On Mon, May 03, 2021 at 09:34:42PM +0200, Vincent Bernat wrote: > ❦ 3 mai 2021 17:05 +02, Igor Mammedov: > > >> + /* > >> + * We only handle the case were the device is attached to > >> + * the PCI root bus. The general case is more complex as > >> + * bridges are enumerated later and the table would need > >> + * to be updated at this moment. > >> + */ > >> + if (!pci_bus_is_root(pci_get_bus(pdev))) { > >> + error_setg(errp, > >> + "Cannot create type 41 entry for PCI device > >> %s: " > >> + "not attached to the root bus", > >> + t41->pcidev); > >> + return; > >> + } > > Is this limitation really necessary? > > > > As far as I see caller of this smbios_get_tables(), is called at > > machine_done time > > when all devices (including bridges) present on CLI are created. > > I wasn't sure how to get the segment group number in this case. It seems > this is not exposed directly. There is a root_bus_path method returning > a string that would need to be parsed to extract the segment group > number. Looking a bit, it seems to be always 0. > -- > Don't stop with your first draft. > - The Elements of Programming Style (Kernighan & Plauger)
and not just that. the code comments explains the motivation even with a single segment. -- MST