[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v4 38/47] hw/smbios: Add table 4 parameter, "processor-id"
From: |
Michael S. Tsirkin |
Subject: |
[PULL v4 38/47] hw/smbios: Add table 4 parameter, "processor-id" |
Date: |
Mon, 7 Mar 2022 17:46:31 -0500 |
From: Patrick Venture <venture@google.com>
This parameter is to be used in the processor_id entry in the type 4
table.
This parameter is set as optional and if left will use the values from
the CPU model.
This enables hiding the host information from the guest and allowing AMD
VMs to run pretending to be Intel for some userspace software concerns.
Reviewed-by: Peter Foley <pefoley@google.com>
Reviewed-by: Titus Rwantare <titusr@google.com>
Signed-off-by: Patrick Venture <venture@google.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220125163118.1011809-1-venture@google.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/smbios/smbios.c | 19 ++++++++++++++++---
qemu-options.hx | 3 ++-
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 1f8d5c252f..60349ee402 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -104,9 +104,11 @@ static struct {
const char *sock_pfx, *manufacturer, *version, *serial, *asset, *part;
uint64_t max_speed;
uint64_t current_speed;
+ uint64_t processor_id;
} type4 = {
.max_speed = DEFAULT_CPU_SPEED,
- .current_speed = DEFAULT_CPU_SPEED
+ .current_speed = DEFAULT_CPU_SPEED,
+ .processor_id = 0,
};
static struct {
@@ -327,6 +329,10 @@ static const QemuOptDesc qemu_smbios_type4_opts[] = {
.name = "part",
.type = QEMU_OPT_STRING,
.help = "part number",
+ }, {
+ .name = "processor-id",
+ .type = QEMU_OPT_NUMBER,
+ .help = "processor id",
},
{ /* end of list */ }
};
@@ -683,8 +689,13 @@ static void smbios_build_type_4_table(MachineState *ms,
unsigned instance)
t->processor_type = 0x03; /* CPU */
t->processor_family = 0x01; /* Other */
SMBIOS_TABLE_SET_STR(4, processor_manufacturer_str, type4.manufacturer);
- t->processor_id[0] = cpu_to_le32(smbios_cpuid_version);
- t->processor_id[1] = cpu_to_le32(smbios_cpuid_features);
+ if (type4.processor_id == 0) {
+ t->processor_id[0] = cpu_to_le32(smbios_cpuid_version);
+ t->processor_id[1] = cpu_to_le32(smbios_cpuid_features);
+ } else {
+ t->processor_id[0] = cpu_to_le32((uint32_t)type4.processor_id);
+ t->processor_id[1] = cpu_to_le32(type4.processor_id >> 32);
+ }
SMBIOS_TABLE_SET_STR(4, processor_version_str, type4.version);
t->voltage = 0;
t->external_clock = cpu_to_le16(0); /* Unknown */
@@ -1323,6 +1334,8 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
save_opt(&type4.serial, opts, "serial");
save_opt(&type4.asset, opts, "asset");
save_opt(&type4.part, opts, "part");
+ /* If the value is 0, it will take the value from the CPU model. */
+ type4.processor_id = qemu_opt_get_number(opts, "processor-id", 0);
type4.max_speed = qemu_opt_get_number(opts, "max-speed",
DEFAULT_CPU_SPEED);
type4.current_speed = qemu_opt_get_number(opts, "current-speed",
diff --git a/qemu-options.hx b/qemu-options.hx
index 094a6c1d7c..5ce0ada75e 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2537,6 +2537,7 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
" specify SMBIOS type 3 fields\n"
"-smbios
type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n"
" [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]\n"
+ " [,processor-id=%d]\n"
" specify SMBIOS type 4 fields\n"
"-smbios type=11[,value=str][,path=filename]\n"
" specify SMBIOS type 11 fields\n"
@@ -2562,7 +2563,7 @@ SRST
``-smbios
type=3[,manufacturer=str][,version=str][,serial=str][,asset=str][,sku=str]``
Specify SMBIOS type 3 fields
-``-smbios
type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str]``
+``-smbios
type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str][,processor-id=%d]``
Specify SMBIOS type 4 fields
``-smbios type=11[,value=str][,path=filename]``
--
MST
- [PULL v4 28/47] pci-bridge/xio3130_upstream: Fix error handling, (continued)
- [PULL v4 28/47] pci-bridge/xio3130_upstream: Fix error handling, Michael S. Tsirkin, 2022/03/07
- [PULL v4 29/47] pci-bridge/xio3130_downstream: Fix error handling, Michael S. Tsirkin, 2022/03/07
- [PULL v4 30/47] headers: Add pvpanic.h, Michael S. Tsirkin, 2022/03/07
- [PULL v4 31/47] hw/misc/pvpanic: Use standard headers instead, Michael S. Tsirkin, 2022/03/07
- [PULL v4 33/47] pci: expose TYPE_XIO3130_DOWNSTREAM name, Michael S. Tsirkin, 2022/03/07
- [PULL v4 35/47] pc: add option to disable PS/2 mouse/keyboard, Michael S. Tsirkin, 2022/03/07
- [PULL v4 34/47] acpi: pcihp: pcie: set power on cap on parent slot, Michael S. Tsirkin, 2022/03/07
- [PULL v4 32/47] pci: show id info when pci BDF conflict, Michael S. Tsirkin, 2022/03/07
- [PULL v4 36/47] vhost-vsock: detach the virqueue element in case of error, Michael S. Tsirkin, 2022/03/07
- [PULL v4 37/47] x86: cleanup unused compat_apic_id_mode, Michael S. Tsirkin, 2022/03/07
- [PULL v4 38/47] hw/smbios: Add table 4 parameter, "processor-id",
Michael S. Tsirkin <=
- [PULL v4 39/47] pci: drop COMPAT_PROP_PCP for 2.0 machine types, Michael S. Tsirkin, 2022/03/07
- [PULL v4 40/47] event_notifier: add event_notifier_get_wfd(), Michael S. Tsirkin, 2022/03/07
- [PULL v4 41/47] vhost: use wfd on functions setting vring call fd, Michael S. Tsirkin, 2022/03/07
- [PULL v4 42/47] configure, meson: allow enabling vhost-user on all POSIX systems, Michael S. Tsirkin, 2022/03/07
- [PULL v4 43/47] docs: vhost-user: add subsection for non-Linux platforms, Michael S. Tsirkin, 2022/03/07
- [PULL v4 44/47] tests/acpi: i386: allow FACP acpi table changes, Michael S. Tsirkin, 2022/03/07
- [PULL v4 45/47] hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table, Michael S. Tsirkin, 2022/03/07
- [PULL v4 46/47] tests/acpi: i386: update FACP table differences, Michael S. Tsirkin, 2022/03/07
- [PULL v4 47/47] hw/acpi/microvm: turn on 8042 bit in FADT boot architecture flags if present, Michael S. Tsirkin, 2022/03/07
- Re: [PULL v4 00/47] virtio,pc,pci: features, cleanups, fixes, Peter Maydell, 2022/03/09