From: Alexander Gryanko <xpahos@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Ani Sinha" <anisinha@redhat.com>,
"Alexander Gryanko" <xpahos@gmail.com>
Subject: [PATCH 2/3] hw/smbios: Add dedicated handle range for Type 8 tables
Date: Sat, 23 May 2026 06:41:57 +0300 [thread overview]
Message-ID: <20260523034158.57487-3-xpahos@gmail.com> (raw)
In-Reply-To: <20260523034158.57487-1-xpahos@gmail.com>
SMBIOS Type 8 (Port Connector) tables currently use T0_BASE (0x0) for
handle allocation. This can lead to handle collisions with other table
types that also start at T0_BASE. Types 2, 3, 4, 9, and 11 already
have dedicated handle ranges (T2_BASE=0x200, T3_BASE=0x300, T4_BASE=0x400,
T9_BASE=0x900, T11_BASE=0xe00), but Type 8 was missed.
Add T8_BASE (0x800) to fill the gap in the handle range allocation.
Introduce a static flag and smbios_set_type8_handle_t8_base() setter
to allow machine types to opt in to the new range. When the flag is
false (the default), the old T0_BASE behavior is preserved.
Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
---
hw/i386/fw_cfg.c | 1 +
hw/smbios/smbios.c | 10 +++++++++-
include/hw/firmware/smbios.h | 1 +
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
index 2876490f06..0b3a14cdb1 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -77,6 +77,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg,
/* These values are guest ABI, do not change */
smbios_set_defaults("QEMU", mc->desc, mc->name);
}
+ smbios_set_type8_handle_t8_base(pcmc->smbios_type8_handle_t8_base);
/* tell smbios about cpuid version and features */
smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]);
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 7d7141851b..0e0200600e 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -49,6 +49,7 @@ static SmbiosEntryPoint ep;
static int smbios_type4_count = 0;
static bool smbios_have_defaults;
static uint32_t smbios_cpuid_version, smbios_cpuid_features;
+static bool smbios_type8_t8_base;
DECLARE_BITMAP(smbios_have_binfile_bitmap, SMBIOS_MAX_TYPE + 1);
DECLARE_BITMAP(smbios_have_fields_bitmap, SMBIOS_MAX_TYPE + 1);
@@ -553,6 +554,7 @@ bool smbios_skip_table(uint8_t type, bool required_table)
#define T2_BASE 0x200
#define T3_BASE 0x300
#define T4_BASE 0x400
+#define T8_BASE 0x800
#define T9_BASE 0x900
#define T11_BASE 0xe00
@@ -742,13 +744,19 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance,
smbios_type4_count++;
}
+void smbios_set_type8_handle_t8_base(bool t8_base)
+{
+ smbios_type8_t8_base = t8_base;
+}
+
static void smbios_build_type_8_table(void)
{
unsigned instance = 0;
struct type8_instance *t8;
+ uint16_t base = smbios_type8_t8_base ? T8_BASE : T0_BASE;
QTAILQ_FOREACH(t8, &type8, next) {
- SMBIOS_BUILD_TABLE_PRE(8, T0_BASE + instance, true);
+ SMBIOS_BUILD_TABLE_PRE(8, base + instance, true);
SMBIOS_TABLE_SET_STR(8, internal_reference_str, t8->internal_reference);
SMBIOS_TABLE_SET_STR(8, external_reference_str, t8->external_reference);
diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
index 3ea732f4e6..62e728b69c 100644
--- a/include/hw/firmware/smbios.h
+++ b/include/hw/firmware/smbios.h
@@ -333,6 +333,7 @@ void smbios_set_cpuid(uint32_t version, uint32_t features);
void smbios_set_defaults(const char *manufacturer, const char *product,
const char *version);
void smbios_set_default_processor_family(uint16_t processor_family);
+void smbios_set_type8_handle_t8_base(bool t8_base);
uint8_t *smbios_get_table_legacy(size_t *length, Error **errp);
void smbios_get_tables(MachineState *ms,
SmbiosEntryPointType ep_type,
--
2.39.5 (Apple Git-154)
next prev parent reply other threads:[~2026-05-23 12:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 3:41 [PATCH 0/3] hw/smbios: Add dedicated handle range for Type 8 tables Alexander Gryanko
2026-05-23 3:41 ` [PATCH 1/3] hw/i386/pc: Introduce 11.2 machine type for SMBIOS type 8 base migration Alexander Gryanko
2026-05-23 3:41 ` Alexander Gryanko [this message]
2026-05-23 3:41 ` [PATCH 3/3] tests/qtest: Add SMBIOS Type 8 handle base tests Alexander Gryanko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260523034158.57487-3-xpahos@gmail.com \
--to=xpahos@gmail.com \
--cc=anisinha@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.