[libvirt] [PATCH] Read PCI class from sysfs class file instead of config space.

Laine Stump laine at laine.org
Wed Dec 11 14:34:05 UTC 2013


On 12/11/2013 02:23 PM, Daniel P. Berrange wrote:
> On Tue, Dec 10, 2013 at 07:57:01AM -0200, Thadeu Lima de Souza Cascardo wrote:
>> When determining if a device is behind a PCI bridge, the PCI device
>> class is checked by reading the config space. However, there are some
>> devices which have the wrong class on the config space, but the class is
>> initialized by Linux correctly as a PCI BRIDGE. This class can be read
>> by the sysfs file '/sys/bus/pci/devices/xxxx:xx:xx.x/class'.
> Do you have any idea how long this file has been present in sysfs ? Hopefully
> it is a fairly ancient feature, so we can rely on it existing ? Otherwise
> we'll need to fallback to reading the config space when the sysfs file does
> not exist.
>
>> One example of such bridge is IBM PCI Bridge 1014:03b9, which is
>> identified as a Host Bridge when reading the config space.
>>
>> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at linux.vnet.ibm.com>
>> ---
>>  src/util/virpci.c |   38 +++++++++++++++++++++++++++++++++++---
>>  1 files changed, 35 insertions(+), 3 deletions(-)
> Looks reasonable to me, though prefer Laine to ACK it since he knows
> the PCI code best of anyone

??? It's possible I'm the most recent person to poke it in a major way,
but I still consider myself fairly unschooled on PCI.




More information about the libvir-list mailing list