hw/sparc, hw/sparc64: add hostid=/machineid= -machine properties
Get series with b4
b4 am [email protected] change-id 20260917-add_hostid_sub-properties-473a0d2ea35eVersions newest first
- v1 Latest3 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | hw/sparc: add shared sun_hostid helper for hostid/machineid propertieshw/ include/ | +136 | 0 replies | |
| 2/3 | hw/sparc: add hostid= and machineid= -machine sub-propertiesdocs/ hw/ hw/ +2 more | +82 | 0 replies | |
| 3/3 | hw/sparc64: add hostid= and machineid= -machine sub-propertiesdocs/ hw/ hw/ | +89 | 0 replies |
Reviews trailers per patch
None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Artyom Tarasenko |
|---|---|
| Series | A-b |
| 1/3 | |
| 2/3 | |
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/3] hw/sparc, hw/sparc64: add hostid=/machineid= -machine properties
This series adds "hostid" and "machineid" as -machine sub-properties for the sun4m and sun4u/sun4v machine families:
qemu-system-sparc -machine SS-20,hostid=0x352e09,machineid=0x80
qemu-system-sparc64 -machine sun4u,hostid=0x352e09,machineid=0x72Background: these machines report a classic 32-bit Sun "hostid" to the guest OS (as read by hostid(1), and historically use by some software for license checks), built from two independent pieces stored in the emulated NVRAM/IDPROM - a fixed per-model machine-type byte, and the low 24 bits of the machine's Ethernet MAC address. QEMU already reproduces this scheme, but until now neither half was settable from the command line: the machine-type byte was fixed per hwdef, and the low 24 bits always tracked whatever MAC ended up on the emulated NIC. Both properties default to that existing behaviour when left unset, so this series is fully backward compatible.
Patch 1 adds a small shared helper (hw/sparc/sun_hostid.c) rather than duplicating the property getter/setter logic between the two machine families: a generic SunHostIDProps struct that a machine's own instance struct embeds anywhere, located via byte offset, plus two functions to register the properties on a class and initialise an instance.
Patch 2 wires this into sun4m, via the existing sun4m-common abstract machine class.
Patch 3 wires it into sun4u/sun4v. Since sun4u.c had no shared abstract machine class before this series, patch 3 introduces one (sun4u-common) as the parent of both "sun4u" and "sun4v", and registers the properties on it once - both machines pick them up through QOM's class-hierarchy property lookup. The "niagara" machine (hw/sparc64/niagara.c) is a separate machine family that does not use this NVRAM/IDPROM hostid mechanism and is unaffected.
PS: This is my first patch set for QEMU.
---
Frode Tennebø (3):
hw/sparc: add shared sun_hostid helper for hostid/machineid properties hw/sparc: add hostid= and machineid= -machine sub-properties hw/sparc64: add hostid= and machineid= -machine sub-properties
docs/system/target-sparc.rst | 23 +++++++++++ docs/system/target-sparc64.rst | 22 +++++++++++ hw/sparc/meson.build | 1 + hw/sparc/sun4m.c | 55 ++++++++++++++++++++++---- hw/sparc/sun_hostid.c | 88 ++++++++++++++++++++++++++++++++++++++++++ hw/sparc64/meson.build | 1 + hw/sparc64/sun4u.c | 74 +++++++++++++++++++++++++++++++---- include/hw/nvram/sun_nvram.h | 11 ++++-- include/hw/sparc/sun_hostid.h | 48 +++++++++++++++++++++++ 9 files changed, 306 insertions(+), 17 deletions(-)
---
base-commit: f8296b816fabd370307cd22b0270b610fc0fa279
change-id: 20260917-add_hostid_sub-properties-473a0d2ea35e
Best regards,
Signature · 1 line
Frode Tennebø <[email protected]>