From 4998af9cd1d7c8787ae79b77fa5289502dc56e3f Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 11 Jun 2026 23:20:51 +0300 Subject: [PATCH] spoof: SMBIOS type 8 (ports) + type 9 (slots) defaults (patch 0025) Phase 1. Real boards expose port connectors and expansion slots; QEMU emits none, so a guest dmidecode looks conspicuously empty. Inject a plausible desktop default set (USB/LAN/audio ports + PCIe/M.2 slots) via the existing type8/type9 build path when none were configured. Inert without a seed. Co-Authored-By: Claude Opus 4.8 (1M context) --- patches/0025-smbios-ports-slots.patch | 63 +++++++++++++++++++++++++++ patches/README.md | 1 + 2 files changed, 64 insertions(+) create mode 100644 patches/0025-smbios-ports-slots.patch diff --git a/patches/0025-smbios-ports-slots.patch b/patches/0025-smbios-ports-slots.patch new file mode 100644 index 0000000..8204a0f --- /dev/null +++ b/patches/0025-smbios-ports-slots.patch @@ -0,0 +1,63 @@ +qemu-spoof: SMBIOS type 8 (ports) + type 9 (slots) defaults + +Real boards expose port connectors (type 8: USB/LAN/audio jacks) and expansion slots +(type 9: PCIe/M.2). QEMU emits none, so a guest dmidecode shows a conspicuously empty +machine. Inject a plausible desktop default set (via the existing type8/type9 build +path) when the operator configured none. Inert without a seed. (spoof.h include added +by 0015-smbios-vm-bit.) +diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c +index 7d71418..140b42a 100644 +--- a/hw/smbios/smbios.c ++++ b/hw/smbios/smbios.c +@@ -1040,6 +1040,51 @@ void smbios_set_defaults(const char *manufacturer, const char *product, + SMBIOS_SET_DEFAULT(type4.version, version); + SMBIOS_SET_DEFAULT(type17.loc_pfx, "DIMM"); + SMBIOS_SET_DEFAULT(type17.manufacturer, manufacturer); ++ ++ /* qemu-spoof: real boards expose port connectors (type 8) and expansion slots ++ * (type 9); QEMU emits none, so dmidecode is conspicuously empty. Inject a ++ * plausible desktop default set when none were configured. Inert without a seed. */ ++ if (spoof_on() && QTAILQ_EMPTY(&type8)) { ++ static const struct { const char *intr, *extr; uint8_t ct, pt; } sp_ports[] = { ++ { "JUSB1", "USB1", 0x12, 0x10 }, /* Access Bus (USB) / USB */ ++ { "JUSB2", "USB2", 0x12, 0x10 }, ++ { "JUSB3", "USB3", 0x12, 0x10 }, ++ { "JRJ45", "LAN", 0x0B, 0x1F }, /* RJ-45 / Network */ ++ { "JAUD1", "Line Out", 0x1D, 0x1C }, /* Mini Jack / Audio */ ++ { "JAUD2", "Mic In", 0x1D, 0x1C }, ++ }; ++ size_t i; ++ for (i = 0; i < ARRAY_SIZE(sp_ports); i++) { ++ struct type8_instance *t8 = g_new0(struct type8_instance, 1); ++ t8->internal_reference = g_strdup(sp_ports[i].intr); ++ t8->external_reference = g_strdup(sp_ports[i].extr); ++ t8->connector_type = sp_ports[i].ct; ++ t8->port_type = sp_ports[i].pt; ++ QTAILQ_INSERT_TAIL(&type8, t8, next); ++ } ++ } ++ if (spoof_on() && QTAILQ_EMPTY(&type9)) { ++ static const struct { ++ const char *desig; uint8_t type, width, usage, length; uint16_t id; ++ } sp_slots[] = { ++ { "PCIEX16", 0xB6, 0x0D, 0x03, 0x04, 0x01 }, /* PCIe gen3 x16, available */ ++ { "PCIEX1_1", 0xB5, 0x0A, 0x03, 0x03, 0x02 }, /* PCIe gen3 x1 */ ++ { "M2_1", 0xB6, 0x0D, 0x04, 0x03, 0x03 }, /* M.2, in use */ ++ }; ++ size_t i; ++ for (i = 0; i < ARRAY_SIZE(sp_slots); i++) { ++ struct type9_instance *t9 = g_new0(struct type9_instance, 1); ++ t9->slot_designation = g_strdup(sp_slots[i].desig); ++ t9->slot_type = sp_slots[i].type; ++ t9->slot_data_bus_width = sp_slots[i].width; ++ t9->current_usage = sp_slots[i].usage; ++ t9->slot_length = sp_slots[i].length; ++ t9->slot_id = sp_slots[i].id; ++ t9->slot_characteristics1 = 0x04; /* PME# supported */ ++ t9->slot_characteristics2 = 0x01; ++ QTAILQ_INSERT_TAIL(&type9, t9, next); ++ } ++ } + } + + static void smbios_entry_point_setup(SmbiosEntryPointType ep_type) diff --git a/patches/README.md b/patches/README.md index dc8ea03..c4377f8 100644 --- a/patches/README.md +++ b/patches/README.md @@ -26,6 +26,7 @@ match exactly. Naming: `0002` = infra, `0010+` = one aspect each. | 0022-storage-extra | IDE WWN + rotation rate; NVMe EUI-64 + NGUID | | 0023-cpu-microcode | CPU microcode revision (IA32_UCODE_REV), vendor-positioned | | 0024-smbios-bios-type0 | SMBIOS type0 BIOS vendor/version/date + type1 system manufacturer/product (real-OEM or Hyper-V persona) | +| 0025-smbios-ports-slots | SMBIOS type 8 (port connectors) + type 9 (expansion slots) default set | ## The PCI-id problem (why 0018 is careful)