From nobody Sat Sep 26 20:03:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=tennebo.com Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789829871276412.1045357384885; Sat, 19 Sep 2026 07:57:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7wV4-0007oy-3n; Sat, 19 Sep 2026 10:57:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7wUT-0007lo-Rz for qemu-devel@nongnu.org; Sat, 19 Sep 2026 10:56:33 -0400 Received: from gerbil.apple.relay.mailchannels.net ([23.83.208.67]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7wUS-0004cN-1L for qemu-devel@nongnu.org; Sat, 19 Sep 2026 10:56:33 -0400 Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 66F0E4C0C43; Sat, 19 Sep 2026 14:56:28 +0000 (UTC) Received: from sh-cp12.mia1.servername.online (100-100-66-64.trex-nlb.outbound.svc.cluster.local [100.100.66.64]) (Authenticated sender: hostpapa) by relay.mailchannels.net (Postfix) with ESMTPA id E39B74C0C97; Sat, 19 Sep 2026 14:56:27 +0000 (UTC) Received: from sh-cp12.mia1.servername.online (sh-cp12.mia1.servername.online [199.204.250.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.100.66.64 (trex/8.0.2); Sat, 19 Sep 2026 14:56:28 +0000 Received: from 55a44a6c.bb.online.no ([85.164.74.108]:50478 helo=[127.0.1.1]) by sh-cp12.mia1.servername.online with essmtpa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100) (envelope-from ) id 1x7wUK-0000000BpqJ-39Kd; Sat, 19 Sep 2026 10:56:27 -0400 X-Sender-Id: hostpapa|x-authuser|frode@tennebo.com X-Sender-Id: hostpapa|x-authuser|frode@tennebo.com X-MC-Relay: Good X-MailChannels-SenderId: hostpapa|x-authuser|frode@tennebo.com X-MailChannels-Auth-Id: hostpapa X-Trail-Cure: 51a4a6842dd7fceb_1789829788323_3567877458 X-MC-Loop-Signature: 1789829788323:1660060241 X-MC-Ingress-Time: 1789829788322 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tennebo.com ; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TR9mzCPp7hbE3EDRm2xavNzd6BiYlwbMHC9erJ8BWBI=; b=01o3y7bdM4y2Tr3jU/zugDP9mh 6UMyRZGSoWqoi2JgEnhO1x2GalYMPMrpJCDO2yWQUBf9dd5ByBtPFHUERVTZO0cPpPgKxU3BL8F4w ayabO0Wh4oOgbfTA1Hz2OTd+YTrHTmujmTLyRaV9HvPlEXBQc39iD3tIy9TwIaEbx7Gr3y7h8MCbg scCnXqXqt9S3navezNcE3/41HC5IdRRlt34Q+jh0nYj9oyfrMbbyZ5x+5LWEw44Dx1USPRbPnvxDb z9ydlwFukRDIV00YW0hqaJ2tragF+0SOZlJ8NnaLD81cgOD24u09Lq7lfYdy4rYr5FrMW1fQNds9h 0xURRWCQ==; From: =?utf-8?q?Frode_Tenneb=C3=B8?= Date: Sat, 19 Sep 2026 16:56:02 +0200 Subject: [PATCH 1/3] hw/sparc: add shared sun_hostid helper for hostid/machineid properties MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260919-add_hostid_sub-properties-v1-1-cc1667c0a8ad@tennebo.com> References: <20260919-add_hostid_sub-properties-v1-0-cc1667c0a8ad@tennebo.com> In-Reply-To: <20260919-add_hostid_sub-properties-v1-0-cc1667c0a8ad@tennebo.com> To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Artyom Tarasenko , Pierrick Bouvier , =?utf-8?q?Frode_Tenneb=C3=B8?= X-Mailer: b4 0.13.0 X-AuthUser: frode@tennebo.com Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=23.83.208.67; envelope-from=frode@tennebo.com; helo=gerbil.apple.relay.mailchannels.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 19 Sep 2026 10:57:06 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1789829875190158500 Add a small helper, shared between the sun4m and sun4u/sun4v machine families, implementing "hostid" and "machineid" as -machine sub-properties. Both families report a classic 32-bit Sun "hostid" to the guest (as read by hostid(1), and used by some software for license checks, built from a fixed per-model machine-type byte plus the low 24 bits of the machine's Ethernet MAC address, and written into the emulated NVRAM/IDPROM. Until now neither half was configurable from the command line. Rather than duplicate the property getter/setter logic in each machine family's own file, this introduces a generic SunHostIDProps struct that a machine's instance struct can embed anywhere, plus two functions that locate it via the byte offset of that member: sun_hostid_class_init() - registers the "hostid"/"machineid" QOM properties on a given class sun_hostid_instance_init() - initialises the "is this value set" flags on a given instance This patch only adds the new files; hw/sparc/sun4m.c and hw/sparc64/sun4u.c are wired up to use them in follow-up commits. Signed-off-by: Frode Tenneb=C3=B8 Acked-by: Artyom Tarasenko --- hw/sparc/sun_hostid.c | 88 +++++++++++++++++++++++++++++++++++++++= ++++ include/hw/sparc/sun_hostid.h | 48 +++++++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/hw/sparc/sun_hostid.c b/hw/sparc/sun_hostid.c new file mode 100644 index 0000000000..30501b4539 --- /dev/null +++ b/hw/sparc/sun_hostid.c @@ -0,0 +1,88 @@ +/* + * Shared "hostid"/"machineid" -machine sub-property implementation. + * See include/hw/sparc/sun_hostid.h for the design rationale. + */ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/visitor.h" +#include "hw/sparc/sun_hostid.h" + +static void sun_hostid_get_hostid(Object *obj, Visitor *v, const char *nam= e, + void *opaque, Error **errp) +{ + SunHostIDProps *p =3D sun_hostid_props(obj, (ptrdiff_t)(uintptr_t)opaq= ue); + uint32_t value =3D p->hostid; + + visit_type_uint32(v, name, &value, errp); +} + +static void sun_hostid_set_hostid(Object *obj, Visitor *v, const char *nam= e, + void *opaque, Error **errp) +{ + SunHostIDProps *p =3D sun_hostid_props(obj, (ptrdiff_t)(uintptr_t)opaq= ue); + uint32_t value; + + if (!visit_type_uint32(v, name, &value, errp)) { + return; + } + if (value > 0xffffff) { + error_setg(errp, + "hostid must be a 24-bit value (0x000000-0xffffff)"); + return; + } + p->hostid =3D value; + p->hostid_set =3D true; +} + +static void sun_hostid_get_machineid(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + SunHostIDProps *p =3D sun_hostid_props(obj, (ptrdiff_t)(uintptr_t)opaq= ue); + uint8_t value =3D p->machineid; + + visit_type_uint8(v, name, &value, errp); +} + +static void sun_hostid_set_machineid(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + SunHostIDProps *p =3D sun_hostid_props(obj, (ptrdiff_t)(uintptr_t)opaq= ue); + uint8_t value; + + if (!visit_type_uint8(v, name, &value, errp)) { + return; + } + p->machineid =3D value; + p->machineid_set =3D true; +} + +void sun_hostid_class_init(ObjectClass *oc, ptrdiff_t props_offset) +{ + void *opaque =3D (void *)(uintptr_t)props_offset; + + object_class_property_add(oc, "hostid", "uint32", + sun_hostid_get_hostid, sun_hostid_set_hostid, + NULL, opaque); + object_class_property_set_description(oc, "hostid", + "Override the 24-bit hostid stored in NVRAM/IDPROM " + "(low 3 bytes of the classic Sun hostid; independent of " + "the emulated NIC's MAC address)"); + + object_class_property_add(oc, "machineid", "uint8", + sun_hostid_get_machineid, + sun_hostid_set_machineid, NULL, opaque); + object_class_property_set_description(oc, "machineid", + "Override the machine-type byte stored in NVRAM/IDPROM " + "(top byte of the classic Sun hostid; normally fixed per " + "machine model)"); +} + +void sun_hostid_instance_init(Object *obj, ptrdiff_t props_offset) +{ + SunHostIDProps *p =3D sun_hostid_props(obj, props_offset); + + p->hostid_set =3D false; + p->machineid_set =3D false; +} diff --git a/include/hw/sparc/sun_hostid.h b/include/hw/sparc/sun_hostid.h new file mode 100644 index 0000000000..c0ac0a0b87 --- /dev/null +++ b/include/hw/sparc/sun_hostid.h @@ -0,0 +1,48 @@ +/* + * Shared "hostid"/"machineid" -machine sub-property implementation, + * used by both hw/sparc/sun4m.c (sun4m-common) and hw/sparc64/sun4u.c + * (sun4u-common) to represent the classic Sun "hostid" (as + * reported by hostid(1) and used by some software for license + * checks. + * + * The value is split across the emulated NVRAM/IDPROM into a fixed + * per-model machine-type byte and the low 24 bits of the Ethernet + * MAC address. These values can be changed in the NVRAM. + * For QEMU, each machine family embeds a SunHostIDProps member + * anywhere convenient in its own instance struct and wires it up + * from instance_init/class_init via the two functions below, passing + * the byte offset of that member (offsetof(...)) so the shared + * getter/setters can find it regardless of which struct they're in. + */ +#ifndef HW_SPARC_SUN_HOSTID_H +#define HW_SPARC_SUN_HOSTID_H + +#include "qom/object.h" + +typedef struct SunHostIDProps { + uint32_t hostid; /* low 24 bits valid when hostid_set */ + uint8_t machineid; /* valid when machineid_set */ + bool hostid_set; + bool machineid_set; +} SunHostIDProps; + +/* + * Register the "hostid" and "machineid" properties on class oc. + * props_offset is offsetof(YourMachineState, ). + */ +void sun_hostid_class_init(ObjectClass *oc, ptrdiff_t props_offset); + +/* + * Initialise the *_set flags to false for a freshly created instance. + * Call from your machine's instance_init with the same offset. + */ +void sun_hostid_instance_init(Object *obj, ptrdiff_t props_offset); + +/* Convenience accessor: fetch the SunHostIDProps embedded at offset. */ +static inline SunHostIDProps *sun_hostid_props(Object *obj, + ptrdiff_t props_offset) +{ + return (SunHostIDProps *)((char *)obj + props_offset); +} + +#endif /* HW_SPARC_SUN_HOSTID_H */ --=20 2.43.0 From nobody Sat Sep 26 20:03:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=tennebo.com Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789829871812507.80675903297345; Sat, 19 Sep 2026 07:57:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7wV1-0007ob-Ry; Sat, 19 Sep 2026 10:57:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7wUZ-0007mB-4W for qemu-devel@nongnu.org; Sat, 19 Sep 2026 10:56:39 -0400 Received: from bisque.pear.relay.mailchannels.net ([23.83.216.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7wUW-0004cj-FZ for qemu-devel@nongnu.org; Sat, 19 Sep 2026 10:56:38 -0400 Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 97E3E94083E; Sat, 19 Sep 2026 14:56:34 +0000 (UTC) Received: from sh-cp12.mia1.servername.online (100-99-48-45.trex-nlb.outbound.svc.cluster.local [100.99.48.45]) (Authenticated sender: hostpapa) by relay.mailchannels.net (Postfix) with ESMTPA id 288009415DF; Sat, 19 Sep 2026 14:56:34 +0000 (UTC) Received: from sh-cp12.mia1.servername.online (sh-cp12.mia1.servername.online [199.204.250.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.99.48.45 (trex/8.0.2); Sat, 19 Sep 2026 14:56:34 +0000 Received: from 55a44a6c.bb.online.no ([85.164.74.108]:50478 helo=[127.0.1.1]) by sh-cp12.mia1.servername.online with essmtpa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100) (envelope-from ) id 1x7wUQ-0000000BpqJ-433i; Sat, 19 Sep 2026 10:56:33 -0400 X-Sender-Id: hostpapa|x-authuser|frode@tennebo.com X-Sender-Id: hostpapa|x-authuser|frode@tennebo.com X-MC-Relay: Good X-MailChannels-SenderId: hostpapa|x-authuser|frode@tennebo.com X-MailChannels-Auth-Id: hostpapa X-Well-Made-Belong: 685f15162c8c39a3_1789829794569_1398387228 X-MC-Loop-Signature: 1789829794569:3607864318 X-MC-Ingress-Time: 1789829794569 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tennebo.com ; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=WnkoRUFN8Qb+qmnkOqVdY7PDrUUla+Ddg8rfv9MHVxQ=; b=SZSfuCunPU5FR6wbNkjOmSjBQe bLdG9z2HckqKtRX/bbRugWvJQ1bXoWbLoiu60QF/Dbxm+B9OpOV2tExDHcDCEvw2W/VfVXxpl/8sH vIK5IRA4QhbqroxVHDLcc900gc/44Emk5qt+OliIFkqACLio2RgebBDn6/BdL5b0RH7U53PG9ZB5c lHNldBQatUw20EpIG9iwtxJ0LiVu06xFE2nbrciVbbxleFbvSl3dIqmoGIn/El7mJUZ3+z4+BRuUv /4ItHe9AoP+MEjLNHACxmCS1izuvUrkSK5oHoaxb32bHz3JYnrY12cjZ+kKxReg2J04986buhB8AZ u0/wudHA==; From: =?utf-8?q?Frode_Tenneb=C3=B8?= Date: Sat, 19 Sep 2026 16:56:03 +0200 Subject: [PATCH 2/3] hw/sparc: add hostid= and machineid= -machine sub-properties MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260919-add_hostid_sub-properties-v1-2-cc1667c0a8ad@tennebo.com> References: <20260919-add_hostid_sub-properties-v1-0-cc1667c0a8ad@tennebo.com> In-Reply-To: <20260919-add_hostid_sub-properties-v1-0-cc1667c0a8ad@tennebo.com> To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Artyom Tarasenko , Pierrick Bouvier , =?utf-8?q?Frode_Tenneb=C3=B8?= X-Mailer: b4 0.13.0 X-AuthUser: frode@tennebo.com Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=23.83.216.18; envelope-from=frode@tennebo.com; helo=bisque.pear.relay.mailchannels.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 19 Sep 2026 10:57:06 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1789829875209158500 Sun sun4m hardware reports a 32-bit "hostid" (as read by the guest's hostid(1), and historically used by some software for license checks) built from two independent pieces stored in the NVRAM/IDPROM: * a fixed per-model machine-type byte (bits 31:24), e.g. 0x80 for a SPARCstation-5, 0x72 for a SPARCstation-20 * the low 3 bytes (24 bits) of the machine's Ethernet MAC address (bits 23:0) QEMU already reproduces this in nvram_init()/Sun_init_header(), but until now both halves were fixed: the machine-type byte came from sun4m_hwdef::nvram_machine_id, and the low 24 bits were copied from whatever MAC address ended up on the emulated NIC. Add "hostid" and "machineid" -machine sub-properties, shared across every sun4m board via the sun4m-common abstract class, so both halves can be set explicitly and independently of the emulated NIC's MAC address: qemu-system-sparc -machine SS-20,hostid=3D0x352e09,machineid=3D0x80 Extend Sun_init_header() to take an optional hostid override, falling back to its previous macaddr-derived behaviour if NULL, and use the hw/sparc/sun_hostid.c helper (added in a previous commit) for the property implementation itself. Document the new properties in docs/system/target-sparc.rst. hw/sparc64/sun4u.c is updated to pass NULL for the new hostid parameter at its own Sun_init_header() call site, keeping its existing behaviour unchanged; this is required for sun4u.c to still build against the new prototype, sun4u/sun4v do not yet expose hostid=3D/machineid=3D of their own (will be added in the next commit). Both properties default to the existing behaviour when unset, so this is fully backward compatible. Signed-off-by: Frode Tenneb=C3=B8 Acked-by: Artyom Tarasenko --- docs/system/target-sparc.rst | 23 ++++++++++++++++++ hw/sparc/meson.build | 1 + hw/sparc/sun4m.c | 55 ++++++++++++++++++++++++++++++++++++++--= ---- hw/sparc64/sun4u.c | 3 ++- include/hw/nvram/sun_nvram.h | 11 ++++++--- 5 files changed, 82 insertions(+), 11 deletions(-) diff --git a/docs/system/target-sparc.rst b/docs/system/target-sparc.rst index 4116cac493..82cfe9dd58 100644 --- a/docs/system/target-sparc.rst +++ b/docs/system/target-sparc.rst @@ -55,6 +55,29 @@ The number of peripherals is fixed in the architecture. = Maximum memory size depends on the machine type, for SS-5 it is 256MB and for others 2047MB. =20 +Every sun4[cdm] machine reports a classic Sun "hostid" to the guest OS, +historically used by ``hostid(1)``, that some software use for license +checks. Normally it is built from a fixed per-model machine-type byte +plus the low 3 bytes of the machine's Ethernet MAC address. However, +these values can be overridden in the host's NVRAM. Since the current +emulated NVRAM isn't persistent, both halves can be overridden +independently using the ``hostid`` and ``machineid`` -machine +sub-properties:: + + qemu-system-sparc -machine SS-20,hostid=3D0x352e09,machineid=3D0x80 + +``hostid=3DVALUE`` + Override the low 24 bits of the NVRAM/IDPROM hostid (accepts + 0x000000-0xffffff). Does not affect the emulated Lance NIC's MAC + address, which is still set independently via ``-nic``/``-net``. + +``machineid=3DVALUE`` + Override the machine-type byte (bits 31:24 of the hostid) normally + fixed per machine model, e.g. 0x80 for SS-5, 0x72 for SS-20 (accepts + 0x00-0xff). + +If neither property is given, the behaviour is unchanged. + Since version 0.8.2, QEMU uses OpenBIOS https://www.openbios.org/. OpenBIOS is a free (GPL v2) portable firmware implementation. The goal is to implement a 100% IEEE 1275-1994 (referred to as Open Firmware) diff --git a/hw/sparc/meson.build b/hw/sparc/meson.build index 19c442c90d..bc8f226b4a 100644 --- a/hw/sparc/meson.build +++ b/hw/sparc/meson.build @@ -2,5 +2,6 @@ sparc_ss =3D ss.source_set() sparc_ss.add(when: 'CONFIG_LEON3', if_true: files('leon3.c')) sparc_ss.add(when: 'CONFIG_SUN4M', if_true: files('sun4m.c')) sparc_ss.add(when: 'CONFIG_SUN4M', if_true: files('sun4m_iommu.c')) +sparc_ss.add(when: 'CONFIG_SUN4M', if_true: files('sun_hostid.c')) =20 hw_arch +=3D {'sparc': sparc_ss} diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 550acdff6d..d86fb5c119 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qapi/error.h" +#include "hw/sparc/sun_hostid.h" #include "qemu/datadir.h" #include "target/sparc/cpu.h" #include "exec/target_page.h" @@ -107,6 +108,14 @@ struct sun4m_hwdef { uint8_t nvram_machine_id; }; =20 +/* hostid_props carries the optional "hostid"/"machineid" overrides; + * see include/hw/sparc/sun_hostid.h. */ +struct Sun4mMachineState { + MachineState parent_obj; + SunHostIDProps hostid_props; +}; +typedef struct Sun4mMachineState Sun4mMachineState; + struct Sun4mMachineClass { /*< private >*/ MachineClass parent_obj; @@ -116,7 +125,13 @@ struct Sun4mMachineClass { typedef struct Sun4mMachineClass Sun4mMachineClass; =20 #define TYPE_SUN4M_MACHINE MACHINE_TYPE_NAME("sun4m-common") -DECLARE_CLASS_CHECKERS(Sun4mMachineClass, SUN4M_MACHINE, TYPE_SUN4M_MACHIN= E) +OBJECT_DECLARE_TYPE(Sun4mMachineState, Sun4mMachineClass, SUN4M_MACHINE) + +static void sun4m_machine_instance_init(Object *obj) +{ + sun_hostid_instance_init(obj, offsetof(Sun4mMachineState, + hostid_props)); +} =20 const char *fw_cfg_arch_key_name(uint16_t key) { @@ -147,7 +162,8 @@ static void nvram_init(Nvram *nvram, uint8_t *macaddr, const char *cmdline, const char *boot_devices, ram_addr_t RAM_size, uint32_t kernel_size, int width, int height, int depth, - int nvram_machine_id, const char *arch) + int machine_id, const uint8_t *hostid, + const char *arch) { unsigned int i; int sysp_end; @@ -163,7 +179,7 @@ static void nvram_init(Nvram *nvram, uint8_t *macaddr, chrp_nvram_create_free_partition(&image[sysp_end], 0x1fd0 - sysp_end); =20 Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr, - nvram_machine_id); + machine_id, hostid); =20 for (i =3D 0; i < sizeof(image); i++) { (k->write)(nvram, i, image[i]); @@ -805,6 +821,7 @@ static void dummy_fdc_tc(void *opaque, int irq, int lev= el) static void sun4m_hw_init(MachineState *machine) { const struct sun4m_hwdef *hwdef =3D SUN4M_MACHINE_GET_CLASS(machine)->= hwdef; + Sun4mMachineState *sms =3D SUN4M_MACHINE(machine); DeviceState *slavio_intctl; unsigned int i; Nvram *nvram; @@ -820,7 +837,9 @@ static void sun4m_hw_init(MachineState *machine) unsigned int smp_cpus =3D machine->smp.cpus; unsigned int max_cpus =3D machine->smp.max_cpus; HostMemoryBackend *ram_memdev =3D machine->memdev; - MACAddr hostid; + MACAddr MACid; + uint8_t nvram_machine_id =3D hwdef->nvram_machine_id; + uint8_t nvram_hostid[3]; =20 if (machine->ram_size > hwdef->max_mem) { error_report("Too much memory for this machine: %" PRId64 "," @@ -881,7 +900,24 @@ static void sun4m_hw_init(MachineState *machine) =20 sparc32_dma_init(hwdef->dma_base, hwdef->esp_base, slavio_irq[18], - hwdef->le_base, slavio_irq[16], &hostid); + hwdef->le_base, slavio_irq[16], &MACid); + + /* + * sparc32_dma_init() has already programmed the emulated lance + * NIC's MAC property from `MACid` above (either the user's + * -nic mac=3D, or an auto-generated one). Overriding hostid here, + * *after* that call, only changes what gets written into the + * NVRAM/IDPROM hostid field below - it deliberately does not + * change the NIC's actual MAC address. + */ + if (sms->hostid_props.hostid_set) { + nvram_hostid[0] =3D (sms->hostid_props.hostid >> 16) & 0xff; + nvram_hostid[1] =3D (sms->hostid_props.hostid >> 8) & 0xff; + nvram_hostid[2] =3D sms->hostid_props.hostid & 0xff; + } + if (sms->hostid_props.machineid_set) { + nvram_machine_id =3D sms->hostid_props.machineid; + } =20 if (!graphic_width) { graphic_width =3D 1024; @@ -1042,10 +1078,11 @@ static void sun4m_hw_init(MachineState *machine) machine->initrd_filename, machine->ram_size, &initrd_size); =20 - nvram_init(nvram, hostid.a, machine->kernel_cmdline, + nvram_init(nvram, MACid.a, machine->kernel_cmdline, machine->boot_config.order, machine->ram_size, kernel_size, graphic_width, graphic_height, graphic_depth, - hwdef->nvram_machine_id, "Sun4m"); + nvram_machine_id, + sms->hostid_props.hostid_set ? nvram_hostid : NULL, "Sun4m"= ); =20 if (hwdef->ecc_base) ecc_init(hwdef->ecc_base, slavio_irq[28], @@ -1109,6 +1146,8 @@ static void sun4m_machine_class_init(ObjectClass *oc,= const void *data) mc->default_boot_order =3D "c"; mc->default_display =3D "tcx"; mc->default_ram_id =3D "sun4m.ram"; + + sun_hostid_class_init(oc, offsetof(Sun4mMachineState, hostid_props)); } =20 static void ss5_class_init(ObjectClass *oc, const void *data) @@ -1471,6 +1510,8 @@ static const TypeInfo sun4m_machine_types[] =3D { .parent =3D TYPE_MACHINE, .class_size =3D sizeof(Sun4mMachineClass), .class_init =3D sun4m_machine_class_init, + .instance_size =3D sizeof(Sun4mMachineState), + .instance_init =3D sun4m_machine_instance_init, .abstract =3D true, } }; diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index a348096aee..e677daaf97 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -144,7 +144,8 @@ static int sun4u_NVRAM_set_params(Nvram *nvram, uint16_= t NVRAM_size, /* Free space partition */ chrp_nvram_create_free_partition(&image[sysp_end], 0x1fd0 - sysp_end); =20 - Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr, 0x80); + Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr, + 0x80, NULL); =20 for (i =3D 0; i < sizeof(image); i++) { (k->write)(nvram, i, image[i]); diff --git a/include/hw/nvram/sun_nvram.h b/include/hw/nvram/sun_nvram.h index 68eaa60308..b07359cac4 100644 --- a/include/hw/nvram/sun_nvram.h +++ b/include/hw/nvram/sun_nvram.h @@ -2,7 +2,7 @@ #define SUN_NVRAM_H =20 /* Sun IDPROM structure at the end of NVRAM */ -/* from http://www.squirrel.com/squirrel/sun-nvram-hostid.faq.html */ +/* from https://www.sun3arc.org/FAQ/sun-nvram-hostid.faq.phtml */ struct Sun_nvram { uint8_t type; /* always 01 */ uint8_t machine_id; /* first byte of host id (machine type) */ @@ -13,7 +13,8 @@ struct Sun_nvram { }; =20 static inline void -Sun_init_header(struct Sun_nvram *header, const uint8_t *macaddr, int mach= ine_id) +Sun_init_header(struct Sun_nvram *header, const uint8_t *macaddr, + int machine_id, const uint8_t *hostid) { uint8_t tmp, *tmpptr; unsigned int i; @@ -21,7 +22,11 @@ Sun_init_header(struct Sun_nvram *header, const uint8_t = *macaddr, int machine_id header->type =3D 1; header->machine_id =3D machine_id & 0xff; memcpy(&header->macaddr, macaddr, 6); - memcpy(&header->hostid , &macaddr[3], 3); + if (hostid) { + memcpy(&header->hostid, hostid, sizeof(header->hostid)); + } else { + memcpy(&header->hostid, &macaddr[3], sizeof(header->hostid)); + } =20 /* Calculate checksum */ tmp =3D 0; --=20 2.43.0 From nobody Sat Sep 26 20:03:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=tennebo.com Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789829875793958.6234613173135; Sat, 19 Sep 2026 07:57:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7wV4-0007p3-4p; Sat, 19 Sep 2026 10:57:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7wUf-0007mV-6f for qemu-devel@nongnu.org; Sat, 19 Sep 2026 10:56:47 -0400 Received: from beige.yew.relay.mailchannels.net ([23.83.220.16]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7wUd-0004cv-3P for qemu-devel@nongnu.org; Sat, 19 Sep 2026 10:56:44 -0400 Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id DBEAA160D65; Sat, 19 Sep 2026 14:56:40 +0000 (UTC) Received: from sh-cp12.mia1.servername.online (100-100-63-42.trex-nlb.outbound.svc.cluster.local [100.100.63.42]) (Authenticated sender: hostpapa) by relay.mailchannels.net (Postfix) with ESMTPA id 63D261610F9; Sat, 19 Sep 2026 14:56:40 +0000 (UTC) Received: from sh-cp12.mia1.servername.online (sh-cp12.mia1.servername.online [199.204.250.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.100.63.42 (trex/8.0.2); Sat, 19 Sep 2026 14:56:40 +0000 Received: from 55a44a6c.bb.online.no ([85.164.74.108]:50478 helo=[127.0.1.1]) by sh-cp12.mia1.servername.online with essmtpa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100) (envelope-from ) id 1x7wUX-0000000BpqJ-0q0q; Sat, 19 Sep 2026 10:56:39 -0400 X-Sender-Id: hostpapa|x-authuser|frode@tennebo.com X-Sender-Id: hostpapa|x-authuser|frode@tennebo.com X-MC-Relay: Good X-MailChannels-SenderId: hostpapa|x-authuser|frode@tennebo.com X-MailChannels-Auth-Id: hostpapa X-Cooperative-Cooperative: 4a84ee0345d0bbf4_1789829800810_3452067029 X-MC-Loop-Signature: 1789829800810:1387936756 X-MC-Ingress-Time: 1789829800809 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tennebo.com ; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2jKqGYMQ5lWVfbxi4OAOtc7dYKXEICaqwwtDwDEvsSc=; b=M5mOK74183CMBDC8W4QeThKwEe ffpdK0UXrFJSuLsq/xgjduclnEOFD+uCRG0YYVyCTXc6LdW44HO4vG9/TNYlywNI/CBdSuKm7rxFd APCNfXsacZKnGZT0weE80IlAUd88QcJIvnJGJcH5Dn+sw5lMr5L64rLPxlCkP59GjwNPgG9Uq5W10 RKRVQW8XZvJGHrjHxprdxY1kcNl4ki1THNtMCRiKkMKMrSKPCKXACobXK8CcnE1xWv+NO/ZCUx2w+ 79iwlzUpvCYgQ4SJH17OzRHiWw+GU5qXIz4qaozI6kx/x+ReK7dIDh1yJ+xXM9hgwQfdKGYS/VKI8 ANtDz0XQ==; From: =?utf-8?q?Frode_Tenneb=C3=B8?= Date: Sat, 19 Sep 2026 16:56:04 +0200 Subject: [PATCH 3/3] hw/sparc64: add hostid= and machineid= -machine sub-properties MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260919-add_hostid_sub-properties-v1-3-cc1667c0a8ad@tennebo.com> References: <20260919-add_hostid_sub-properties-v1-0-cc1667c0a8ad@tennebo.com> In-Reply-To: <20260919-add_hostid_sub-properties-v1-0-cc1667c0a8ad@tennebo.com> To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Artyom Tarasenko , Pierrick Bouvier , =?utf-8?q?Frode_Tenneb=C3=B8?= X-Mailer: b4 0.13.0 X-AuthUser: frode@tennebo.com Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=23.83.220.16; envelope-from=frode@tennebo.com; helo=beige.yew.relay.mailchannels.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 19 Sep 2026 10:57:06 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1789829878503158500 This is a continuation of previous commits: Extend the hostid=3D/machineid= =3D -machine sub-properties added for sun4m to the sun4u and sun4v machines: qemu-system-sparc64 -machine sun4u,hostid=3D0x352e09,machineid=3D0x72 Introduce a common sun4u-common abstract machine class (Sun4uMachineState/TYPE_SUN4U_MACHINE) as the parent of both "sun4u" and "sun4v", and register the properties on it once via the shared hw/sparc/sun_hostid.c helper (also used by sun4m.c); both machines pick them up through QOM's class-hierarchy property lookup, with no changes needed in sun4u_class_init()/sun4v_class_init() themselves. Document the new properties in docs/system/target-sparc64.rst. Both properties default to the existing behaviour when unset, so this is fully backward compatible. Note that the "niagara" machine (hw/sparc64/niagara.c) is a separate machine family that does not use the classic Sun NVRAM/IDPROM hostid mechanism, and is unaffected by this commit. Signed-off-by: Frode Tenneb=C3=B8 Acked-by: Artyom Tarasenko --- docs/system/target-sparc64.rst | 22 +++++++++++++ hw/sparc64/meson.build | 1 + hw/sparc64/sun4u.c | 73 ++++++++++++++++++++++++++++++++++++++= ---- 3 files changed, 89 insertions(+), 7 deletions(-) diff --git a/docs/system/target-sparc64.rst b/docs/system/target-sparc64.rst index 97e334b930..545bc3fc65 100644 --- a/docs/system/target-sparc64.rst +++ b/docs/system/target-sparc64.rst @@ -35,3 +35,25 @@ QEMU emulates the following peripherals: - 2 PCI IDE interfaces with hard disk and CD-ROM support =20 - Floppy disk + +Every sun4[uv] machine reports a classic Sun "hostid" to the guest OS, +historically used by ``hostid(1)``, that some software use for license +checks. Normally it is built from a fixed machine id (defaults to 0x80) +byte plus the low 3 bytes of the machine's Ethernet MAC address. However, +these values can be overridden in the host's NVRAM. Since the current +emulated NVRAM isn't persistent, both halves can be overridden +independently using the ``hostid`` and ``machineid`` -machine +sub-properties:: + + qemu-system-sparc64 -machine sun4u,hostid=3D0x352e09,machineid=3D0x72 + +``hostid=3DVALUE`` + Override the low 24 bits of the NVRAM/IDPROM hostid (accepts + 0x000000-0xffffff). Does not affect the emulated Lance NIC's MAC + address, which is still set independently via ``-nic``/``-net``. + +``machineid=3DVALUE`` + Override the machine-type byte (bits 31:24 of the hostid) normally + fixed per machine model, e.g. 0x80 for sun4u (accepts 0x00-0xff). + +If neither property is given, the behaviour is unchanged. diff --git a/hw/sparc64/meson.build b/hw/sparc64/meson.build index 58b5504651..66f7e9a9fb 100644 --- a/hw/sparc64/meson.build +++ b/hw/sparc64/meson.build @@ -2,5 +2,6 @@ sparc64_ss =3D ss.source_set() sparc64_ss.add(files('sparc64.c')) sparc64_ss.add(when: 'CONFIG_NIAGARA', if_true: files('niagara.c')) sparc64_ss.add(when: 'CONFIG_SUN4U', if_true: files('sun4u.c', 'sun4u_iomm= u.c')) +sparc64_ss.add(when: 'CONFIG_SUN4U', if_true: files('../sparc/sun_hostid.c= ')) =20 hw_arch +=3D {'sparc64': sparc64_ss} diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index e677daaf97..a8538ba313 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -26,6 +26,7 @@ #include "qemu/units.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "hw/sparc/sun_hostid.h" #include "qemu/datadir.h" #include "target/sparc/cpu.h" #include "exec/target_page.h" @@ -96,6 +97,39 @@ struct EbusState { #define TYPE_EBUS "ebus" OBJECT_DECLARE_SIMPLE_TYPE(EbusState, EBUS) =20 +/* + * Sun4uMachineState/TYPE_SUN4U_MACHINE: common abstract instance/class + * pair shared by "sun4u" and "sun4v", giving both the hostid=3D/ + * machineid=3D -machine properties via one sun_hostid_class_init() + * (from hw/sparc/sun_hostid.c) call here (property lookup walks up + * the class hierarchy, so sun4u_class_init()/sun4v_class_init() + * don't need to call it too). + */ +struct Sun4uMachineState { + MachineState parent_obj; + SunHostIDProps hostid_props; +}; +typedef struct Sun4uMachineState Sun4uMachineState; + +struct Sun4uMachineClass { + MachineClass parent_obj; +}; +typedef struct Sun4uMachineClass Sun4uMachineClass; + +#define TYPE_SUN4U_MACHINE MACHINE_TYPE_NAME("sun4u-common") +OBJECT_DECLARE_TYPE(Sun4uMachineState, Sun4uMachineClass, SUN4U_MACHINE) + +static void sun4u_machine_instance_init(Object *obj) +{ + sun_hostid_instance_init(obj, offsetof(Sun4uMachineState, + hostid_props)); +} + +static void sun4u_common_class_init(ObjectClass *oc, const void *data) +{ + sun_hostid_class_init(oc, offsetof(Sun4uMachineState, hostid_props)); +} + const char *fw_cfg_arch_key_name(uint16_t key) { static const struct { @@ -129,7 +163,9 @@ static int sun4u_NVRAM_set_params(Nvram *nvram, uint16_= t NVRAM_size, uint32_t initrd_image, uint32_t initrd_s= ize, uint32_t NVRAM_image, int width, int height, int depth, - const uint8_t *macaddr) + const uint8_t *macaddr, + uint8_t machine_id, + const uint8_t *hostid) { unsigned int i; int sysp_end; @@ -145,7 +181,7 @@ static int sun4u_NVRAM_set_params(Nvram *nvram, uint16_= t NVRAM_size, chrp_nvram_create_free_partition(&image[sysp_end], 0x1fd0 - sysp_end); =20 Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr, - 0x80, NULL); + machine_id, hostid); =20 for (i =3D 0; i < sizeof(image); i++) { (k->write)(nvram, i, image[i]); @@ -680,6 +716,19 @@ static void sun4uv_init(MemoryRegion *address_space_me= m, machine->ram_size, &initrd_size, &init= rd_addr, &kernel_addr, &kernel_entry); =20 + Sun4uMachineState *sms =3D SUN4U_MACHINE(machine); + uint8_t nvram_machine_id =3D 0x80; + uint8_t nvram_hostid[3]; + + if (sms->hostid_props.machineid_set) { + nvram_machine_id =3D sms->hostid_props.machineid; + } + if (sms->hostid_props.hostid_set) { + nvram_hostid[0] =3D (sms->hostid_props.hostid >> 16) & 0xff; + nvram_hostid[1] =3D (sms->hostid_props.hostid >> 8) & 0xff; + nvram_hostid[2] =3D sms->hostid_props.hostid & 0xff; + } + sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", machine->ram_size, machine->boot_config.order, kernel_addr, kernel_size, @@ -688,7 +737,9 @@ static void sun4uv_init(MemoryRegion *address_space_mem, /* XXX: need an option to load a NVRAM image */ 0, graphic_width, graphic_height, graphic_depth, - (uint8_t *)&macaddr); + (uint8_t *)&macaddr, + nvram_machine_id, + sms->hostid_props.hostid_set ? nvram_hostid : N= ULL); =20 dev =3D qdev_new(TYPE_FW_CFG_IO); qdev_prop_set_bit(dev, "dma_enabled", false); @@ -824,7 +875,7 @@ static void sun4u_class_init(ObjectClass *oc, const voi= d *data) =20 static const TypeInfo sun4u_type =3D { .name =3D MACHINE_TYPE_NAME("sun4u"), - .parent =3D TYPE_MACHINE, + .parent =3D TYPE_SUN4U_MACHINE, .class_init =3D sun4u_class_init, .interfaces =3D (const InterfaceInfo[]) { { TYPE_FW_PATH_PROVIDER }, @@ -849,17 +900,25 @@ static void sun4v_class_init(ObjectClass *oc, const v= oid *data) =20 static const TypeInfo sun4v_type =3D { .name =3D MACHINE_TYPE_NAME("sun4v"), - .parent =3D TYPE_MACHINE, + .parent =3D TYPE_SUN4U_MACHINE, .class_init =3D sun4v_class_init, }; - +static const TypeInfo sun4u_common_type =3D { + .name =3D TYPE_SUN4U_MACHINE, + .parent =3D TYPE_MACHINE, + .abstract =3D true, + .instance_size =3D sizeof(Sun4uMachineState), + .instance_init =3D sun4u_machine_instance_init, + .class_size =3D sizeof(Sun4uMachineClass), + .class_init =3D sun4u_common_class_init, +}; static void sun4u_register_types(void) { type_register_static(&power_info); type_register_static(&ebus_info); type_register_static(&prom_info); type_register_static(&ram_info); - + type_register_static(&sun4u_common_type); type_register_static(&sun4u_type); type_register_static(&sun4v_type); } --=20 2.43.0