[libvirt] [PATCH] Read PCI class from sysfs class file instead of config space.
Thadeu Lima de Souza Cascardo
cascardo at linux.vnet.ibm.com
Wed Dec 11 14:03:48 UTC 2013
On Wed, Dec 11, 2013 at 12:23:59PM +0000, 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.
>
At least 10 years, and before the config file was available (also more
than 10 years). :-)
> > 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
>
Thanks for your review.
Cascardo.
> Daniel
> --
> |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org -o- http://virt-manager.org :|
> |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
>
More information about the libvir-list
mailing list