[libvirt] Questions about function virPCIDeviceIsBehindSwitchLackingACS in virpci.c

Michal Privoznik mprivozn at redhat.com
Wed Sep 20 08:41:07 UTC 2017


On 09/19/2017 03:24 AM, Wuzongyong (Euler Dept) wrote:
> Hi,
> 
> In function virPCIDeviceIsBehindSwitchLackingACS, I noticed that(line 8):
> 
> 1    if (virPCIDeviceGetParent(dev, &parent) < 0)
> 2        return -1;
> 3    if (!parent) {
> 4        /* if we have no parent, and this is the root bus, ACS doesn't come
> 5         * into play since devices on the root bus can't P2P without going
> 6         * through the root IOMMU.
> 7         */
> 8        if (dev->address.bus == 0) {
> 9            return 0;
> 10        } else {
> 11            virReportError(VIR_ERR_INTERNAL_ERROR,
> 12                           _("Failed to find parent device for %s"),
> 13                           dev->name);
> 14            return -1;
> 15        }
> 16    }
> 
> Why we just return 0 only if device's bus is 0?
> In my server, I can see a root bus which bus number is greater than 0, see the
> results(just a part) after I run lspci -t:
> 
> +-[0000:80]-+-02.0-[81-83]--+-00.0
> |           |               \-00.1
> |           +-05.0
> |           +-05.1
> |           +-05.2
> |           \-05.4
> +-[0000:7f]-+-08.0
> |           +-08.2
> |           +-08.3
> |           + . . .
> |           \-1f.2
> \-[0000:00]-+-00.0
>              +-01.0-[01]----00.0
>              +-02.0-[02]--+-00.0
>              |            +-00.1
>              |            +-00.2
>              |            \-00.3
>              +-02.2-[03]--
>              +-03.0-[04-0b]----00.0-[05-0b]--+-08.0-[06-08]----00.0
>              |                               \-10.0-[09-0b]----00.0
>              +-05.0
>              +-05.1
>              +-05.2
>              +-05.4
>              +-11.0
>              +-11.4
>              +-16.0
>              +-16.1
>              +-1a.0
> 
> If I assign the device 0000:81:00.0 to a VM, I get "Failed to find parent device".
> I think I should get no error with return value 0 just like bus number is 0, because
> bus 80 is the root bus as well in my case.
> 
> In the <<Intel C610 Series Chipset and Intel X99 Chipset Platform Controller Hub(PCH)>>
> Datasheet, I found that(Chapter 9.1):
> For some server platforms, it may be desirable to have multiple PCHs in the system
> Which means some PCH's may reside on a bus greater than 0.
> 
> So, is this a bug?

Yes. I mean, sort of. Obviously we haven't encountered platform with
multiple PCHs yet.

Michal




More information about the libvir-list mailing list