On Sun, Mar 28, 2021 at 10:57:26PM +0200, Vincent Bernat wrote: > Type 41 defines the attributes of devices that are onboard. The > original intent was to imply the BIOS had some level of control over > the enablement of the associated devices. > > If network devices are present in this table, by default, udev will > name the corresponding interfaces enoX, X being the instance number. > Without such information, udev will fallback to using the PCI ID and > this usually gives ens3 or ens4. This can be a bit annoying as the > name of the network card may depend on the order of options and may > change if a new PCI device is added earlier on the commande line. > Being able to provide SMBIOS type 41 entry ensure the name of the > interface won't change and helps the user guess the right name without > booting a first time. > > This can be invoked with: > > $QEMU -netdev user,id=internet > -device virtio-net-pci,mac=50:54:00:00:00:42,netdev=internet \ > -smbios type=41,designation=Onboard > LAN,instance=1,kind=ethernet,pci=0000:00:09.0 > > Which results in the guest seeing dmidecode data and the interface > exposed as "eno1": > > $ dmidecode -t 41 > # dmidecode 3.3 > Getting SMBIOS data from sysfs. > SMBIOS 2.8 present.Handle 0x2900, DMI type 41, 11 bytes > Onboard Device > Reference Designation: Onboard LAN > Type: Ethernet > Status: Enabled > Type Instance: 1 > Bus Address: 0000:00:09.0 > $ udevadm info -p /sys/class/net/eno1 | grep ONBOARD > E: ID_NET_NAME_ONBOARD=eno1 > E: ID_NET_LABEL_ONBOARD=Onboard LAN > > The original plan was to directly provide a device and populate "kind" > and "pci" from the device. However, since the SMIBIOS tables are built > during argument evaluation, the information is not yet available. > I would welcome some guidance on how to implement this.
I'm not sure I see the problem you're describing here, could you elaborate ? I see SMBIOS tables are built by smbios_get_tables() method. This is called from qemu_init(), after all arguents have been processed and devices have been created. It seems like this should allow SMBIOS tables to be auto-populated from the NICs listed in -device args previously. Note, if we're going to auto-populate the SMBIOS type 41 tabes from -device args, then we'll need to make this behaviour configurable via a property, so that we can ensure this only applies to new machine types. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|