smbios: add configurable guest DMI identity - #4105
Conversation
OpenVMM previously reported a fixed, hard-coded SMBIOS identity to guests, with no way to customize what appears under /sys/class/dmi/id/. The PCAT path in particular shipped obviously bogus placeholder serial numbers and GUID. This adds the ability to present a chosen vendor, product, UUID, and related identity fields to the guest, exposed both through a new `--smbios` CLI option and through the ttrpc VM service so RPC callers can configure it at CreateVm time. The CLI option follows QEMU's `-smbios type=N,key=value` syntax and key names so it is familiar and scriptable; the proto mirrors the same type=N grouping with an SMBIOSConfig message. Overrides apply across all three boot paths: Linux direct boot, UEFI, and PCAT. On UEFI and PCAT the firmware builds the tables, so only the fields the firmware can honor are accepted and any unsupported override is rejected with an error rather than silently ignored. Unset keys fall back to the loader's built-in default identity, and the system UUID defaults to the all-zero GUID (with `uuid=random` available to request a fresh per-VM GUID). Identity is now sourced from a single VM BIOS GUID, so a guest reports the same product_uuid whether booted via UEFI or direct boot. The shared configuration types live in a new `smbios_defs` crate so that both the OpenVMM configuration and the Guest Emulation Transport reference one representation instead of near-duplicate definitions, and the same overrides flow through OpenHCL's GET/GED path to its direct-boot loader. Guide docs and vmm/ttrpc tests are updated to cover the new option.
There was a problem hiding this comment.
Pull request overview
This PR adds a configurable SMBIOS (DMI) guest identity to OpenVMM so guests can see a chosen vendor/product/UUID (and related fields) under /sys/class/dmi/id/, instead of hard-coded placeholder values. The configuration is exposed via a new repeatable --smbios type=N,key=value CLI option and via the ttrpc VM service at CreateVm time, and is plumbed through Linux direct boot, UEFI, PCAT, and the OpenHCL GET/GED path (with firmware-path validation that rejects unsupported overrides).
Changes:
- Introduces a shared
smbios_defscrate and threadsSmbiosConfigthrough OpenVMM (CLI + ttrpc) and OpenHCL (GET/GED) so all boot paths use one identity representation. - Updates OpenVMM loaders (Linux direct SMBIOS synthesis; UEFI/PCAT firmware config adaptation) to apply overrides and “fail closed” on unsupported fields.
- Adds/extends petri + vmm_tests coverage and updates Guide documentation for the new option and behavior.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vmm_tests/vmm_tests/tests/tests/ttrpc.rs | Adds ttrpc test coverage for smbios_config overrides validated inside the guest. |
| vmm_tests/vmm_tests/tests/tests/multiarch.rs | Adds multi-arch tests covering direct boot, UEFI, and OpenHCL SMBIOS UUID/Type1 propagation. |
| vm/devices/get/guest_emulation_transport/src/client.rs | Adjusts DPS JSON → GET API mapping to use string fields directly for SMBIOS-related data. |
| vm/devices/get/guest_emulation_transport/src/api.rs | Changes GET platform_settings SMBIOS fields from Vec<u8> to String where schema is textual; documents remaining raw-byte fields. |
| vm/devices/get/guest_emulation_device/src/test_utilities.rs | Initializes new smbios field in GuestConfig defaults for tests/utilities. |
| vm/devices/get/guest_emulation_device/src/resolver.rs | Wires GET resource smbios into the resolved guest config. |
| vm/devices/get/guest_emulation_device/src/lib.rs | Adds SMBIOS override support to GED/DPS emission and rejects unsupported fields over GET. |
| vm/devices/get/guest_emulation_device/Cargo.toml | Adds dependency on smbios_defs. |
| vm/devices/get/get_resources/src/lib.rs | Extends GED resource model to carry SMBIOS overrides. |
| vm/devices/get/get_resources/Cargo.toml | Adds dependency on smbios_defs. |
| vm/devices/firmware/smbios_defs/src/lib.rs | New shared crate defining SmbiosConfig + per-type override structs (MeshPayload). |
| vm/devices/firmware/smbios_defs/Cargo.toml | New crate manifest and dependencies (guid with mesh feature, mesh). |
| petri/src/vm/openvmm/modify.rs | Adds with_smbios helper to apply SMBIOS overrides across OpenVMM/OpenHCL VM builders. |
| petri/src/vm/openvmm/construct.rs | Ensures load modes and GED have SMBIOS config defaults and aligns UEFI BIOS GUID with SMBIOS UUID. |
| petri/Cargo.toml | Adds dependency on smbios_defs. |
| openvmm/openvmm_ttrpc_vmservice/src/vmservice.proto | Adds SMBIOSConfig message and VMConfig.smbios_config field. |
| openvmm/openvmm_entry/src/ttrpc/mod.rs | Parses proto SMBIOS config into loader config and injects it into selected load mode. |
| openvmm/openvmm_entry/src/lib.rs | Implements --smbios → loader config, shares UUID source across boot paths, and forwards config to GED. |
| openvmm/openvmm_entry/src/cli_args.rs | Adds --smbios CLI arg parsing (QEMU-like syntax) + unit tests for parsing/merging. |
| openvmm/openvmm_defs/src/config.rs | Re-exports shared SMBIOS config types and adds boxed SMBIOS config to load modes. |
| openvmm/openvmm_defs/Cargo.toml | Adds dependency on smbios_defs. |
| openvmm/openvmm_core/src/worker/vm_loaders/uefi.rs | Emits supported Type 1 SMBIOS overrides as UEFI config blobs; rejects Type 0 overrides. |
| openvmm/openvmm_core/src/worker/vm_loaders/pcat.rs | Adapts shared SMBIOS config to PCAT ROM’s limited SMBIOS query surface; rejects unsupported overrides. |
| openvmm/openvmm_core/src/worker/vm_loaders/linux.rs | Synthesizes SMBIOS tables from shared config for Linux direct boot (x86 + aarch64 ACPI). |
| openvmm/openvmm_core/src/worker/dispatch.rs | Plumbs SMBIOS config into Linux/UEFI/PCAT loaders; replaces PCAT placeholder constants with derived config. |
| openhcl/underhill_core/src/worker.rs | Adjusts SMBIOS constant wiring to account for GET-side type changes (strings → bytes where needed). |
| openhcl/underhill_core/src/loader/mod.rs | Synthesizes SMBIOS tables for OpenHCL direct boot using host-forwarded DPS identity. |
| openhcl/underhill_core/Cargo.toml | Minor dependency section formatting change (no functional behavior). |
| Guide/src/reference/openvmm/management/cli.md | Documents --smbios usage, supported keys, and UEFI limitations. |
| Guide/src/reference/devices/firmware/linux_direct.md | Adds a Linux direct boot section describing SMBIOS/DMI identity exposure and UUID behavior. |
| Cargo.toml | Adds workspace path dependency for smbios_defs. |
| Cargo.lock | Locks new crate dependency edges including smbios_defs. |
Suppressed comments (1)
Guide/src/reference/devices/firmware/linux_direct.md:120
- This paragraph implies
product_uuidwill be visible and just default to all-zero, but (as noted elsewhere in the PR) a nil UUID is treated as “not present” by Linux. The docs should call out that the sysfs file may be absent until a non-zero UUID is configured.
The `product_uuid` is sourced from the same VM BIOS GUID used by the UEFI boot
path, so a guest reports the same UUID whether booted via UEFI or direct boot.
It defaults to the all-zero GUID; pass `--smbios type=1,uuid=<GUID>` (or
`uuid=random`) to override it.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 32 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
openvmm/openvmm_ttrpc_vmservice/src/vmservice.proto:539
- The comment says PCAT boot only honors UUID + serial, but this ttrpc API currently only exposes DirectBoot and UEFI (see
oneof BootConfig), so mentioning PCAT here is misleading for RPC callers. Consider removing the PCAT note or rephrasing it as a generic “boot types may honor only a subset of fields; unsupported overrides error” statement.
// SMBIOS (DMI) identity overrides. Applied to whichever boot type is
// selected; note that PCAT boot honors only the system UUID and serial
// number.
SMBIOSConfig smbios_config = 13;
openvmm/openvmm_entry/src/lib.rs:1288
--smbiosis documented as applying to Linux direct / UEFI / PCAT, but this code parses it unconditionally. If--igvmor--restore-snapshotis selected, the resultingsmbiosis never moved into aLoadModeand the option becomes silently ineffective (other than indirectly affectingbios_guid). It would be better to reject unsupported combinations explicitly.
// Build the SMBIOS config once, up front, so that UEFI and Linux direct
// boot share a single source for the VM's BIOS GUID / system UUID. The TPM
// also keys off this GUID.
let smbios = Box::new(smbios_config_from_cli(&opt.smbios)?);
let bios_guid = smbios.system.uuid;
OpenVMM previously reported a fixed, hard-coded SMBIOS identity to guests, with no way to customize what appears under /sys/class/dmi/id/. The PCAT path in particular shipped obviously bogus placeholder serial numbers and GUID. This adds the ability to present a chosen vendor, product, UUID, and related identity fields to the guest, exposed both through a new
--smbiosCLI option and through the ttrpc VM service so RPC callers can configure it at CreateVm time.The CLI option follows QEMU's
-smbios type=N,key=valuesyntax and key names so it is familiar and scriptable; the proto mirrors the same type=N grouping with an SMBIOSConfig message. Overrides apply across all three boot paths: Linux direct boot, UEFI, and PCAT. On UEFI and PCAT the firmware builds the tables, so only the fields the firmware can honor are accepted and any unsupported override is rejected with an error rather than silently ignored. Unset keys fall back to the loader's built-in default identity, and the system UUID defaults to the all-zero GUID (withuuid=randomavailable to request a fresh per-VM GUID).Identity is now sourced from a single VM BIOS GUID, so a guest reports the same product_uuid whether booted via UEFI or direct boot. The shared configuration types live in a new
smbios_defscrate so that both the OpenVMM configuration and the Guest Emulation Transport reference one representation instead of near-duplicate definitions, and the same overrides flow through OpenHCL's GET/GED path to its direct-boot loader.Guide docs and vmm/ttrpc tests are updated to cover the new option.