mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
Fix device assignment with root devices
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@redhat.com>
This commit is contained in:
parent
54c973d52b
commit
654dd2902d
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user