If a PCI device is disabled, e.g. a secondary GPU, we may not see its config space anymore while it is still listed. With config all 0xff, we will then enter an infinite loop while trying to make sense of the capability list. Prevent this, issuing a warning that we will skip this device.
Reported-by: Thomas Pettinger <[email protected]> Signed-off-by: Jan Kiszka <[email protected]> --- tools/jailhouse-config-create | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/jailhouse-config-create b/tools/jailhouse-config-create index 49a002e..f0d65ed 100755 --- a/tools/jailhouse-config-create +++ b/tools/jailhouse-config-create @@ -340,6 +340,10 @@ class PCIDevice: def parse_pcidevice_sysfsdir(basedir, dir): dpath = os.path.join(basedir, dir) f = input_open(os.path.join(dpath, 'config'), 'rb') + (vendor_device,) = struct.unpack('<I', f.read(4)) + if vendor_device == 0xffffffff: + print('WARNING: Ignoring apparently disabled PCI device %s' % dir) + return None f.seek(0x0A) (classcode,) = struct.unpack('<H', f.read(2)) f.close() -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
