On 01/22/2010 04:16 AM, Daniel Veillard wrote: > On Thu, Jan 21, 2010 at 11:33:21AM -0500, Chris Lalancette wrote: >> The patches to add ACS checking to PCI device passthrough >> introduced a bug. With the current code, if you try to >> passthrough a device on the root bus (i.e. bus 0), then >> it denies the passthrough. This is because the code in >> pciDeviceIsBehindSwitchLackingACS() to check for a parent >> device doesn't take into account the possibility of the >> root bus. If we are on the root bus, it means we >> legitimately can't find a parent, and it also means that >> we don't have to worry about whether ACS is enabled. >> Therefore return 0 (indicating we don't lack ACS) from >> pciDeviceIsBehindSwitchLackingACS(). >> >> Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx> >> --- >> src/util/pci.c | 19 ++++++++++++++----- >> 1 files changed, 14 insertions(+), 5 deletions(-) >> >> diff --git a/src/util/pci.c b/src/util/pci.c >> index 086b751..0defbfe 100644 >> --- a/src/util/pci.c >> +++ b/src/util/pci.c >> @@ -1198,11 +1198,20 @@ pciDeviceIsBehindSwitchLackingACS(virConnectPtr conn, >> { >> pciDevice *parent; >> >> - if (!(parent = pciGetParentDevice(conn, dev))) { >> - pciReportError(conn, VIR_ERR_NO_SUPPORT, >> - _("Failed to find parent device for %s"), >> - dev->name); >> - return -1; >> + parent = pciGetParentDevice(conn, dev); >> + if (!parent) { >> + /* if we have no parent, and this is the root bus, ACS doesn't come >> + * into play since devices on the root bus can't P2P without going >> + * through the root IOMMU. >> + */ >> + if (dev->bus == 0) >> + return 0; >> + else { >> + pciReportError(conn, VIR_ERR_NO_SUPPORT, >> + _("Failed to find parent device for %s"), >> + dev->name); >> + return -1; >> + } >> } >> >> /* XXX we should rather fail when we can't find device's parent and > > ACK, Thanks, pushed. -- Chris Lalancette -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list