From: Igor Mammedov <imammedo@redhat.com>
To: Patrick Venture <venture@google.com>
Cc: ani@anisinha.ca, Titus Rwantare <titusr@google.com>,
Peter Foley <pefoley@google.com>,
qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [PATCH v2] hw/smbios: Add table 4 parameter, "processor-id"
Date: Tue, 25 Jan 2022 14:35:33 +0100 [thread overview]
Message-ID: <20220125143533.5d8e2848@redhat.com> (raw)
In-Reply-To: <20220124201151.833769-1-venture@google.com>
On Mon, 24 Jan 2022 12:11:51 -0800
Patrick Venture <venture@google.com> wrote:
> This parameter is to be used in the processor_id lower 32-bit entry in
> the type 4 table. The upper 32-bits represent the features for the CPU.
> This patch leaves those as 0 when the lower 32-bits are set.
Did you forget to update commit message ^^^^ ?
Other than that patch looks good to me,
so with commit message fixed:
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> 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>
> ---
> v2: Added to SRST options list, upgraded to full 64-bit value.
> ---
> 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 7397e56737..385b69b0c9 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 */ }
> };
> @@ -669,8 +675,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 */
> @@ -1292,6 +1303,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 ec90505d84..6256417935 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2527,6 +2527,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"
> @@ -2552,7 +2553,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]``
next prev parent reply other threads:[~2022-01-25 14:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 20:11 [PATCH v2] hw/smbios: Add table 4 parameter, "processor-id" Patrick Venture
2022-01-25 13:35 ` Igor Mammedov [this message]
2022-01-25 16:26 ` Patrick Venture
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=20220125143533.5d8e2848@redhat.com \
--to=imammedo@redhat.com \
--cc=ani@anisinha.ca \
--cc=mst@redhat.com \
--cc=pefoley@google.com \
--cc=qemu-devel@nongnu.org \
--cc=titusr@google.com \
--cc=venture@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).