From: Michael Roth <michael.roth@amd.com>
To: qemu-devel@nongnu.org
Cc: zhenwei pi <pizhenwei@bytedance.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Igor Mammedov <imammedo@redhat.com>
Subject: [PATCH] target/i386: Fix cpuid level for AMD
Date: Thu, 8 Jul 2021 12:06:41 -0500 [thread overview]
Message-ID: <20210708170641.49410-1-michael.roth@amd.com> (raw)
In-Reply-To: <20210708003623.18665-1-michael.roth@amd.com>
From: zhenwei pi <pizhenwei@bytedance.com>
A AMD server typically has cpuid level 0x10(test on Rome/Milan), it
should not be changed to 0x1f in multi-dies case.
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: zhenwei pi <pizhenwei@bytedance.com>
Fixes: a94e1428991 (target/i386: Add CPUID.1F generation support for multi-dies PCMachine)
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
* to maintain compatibility with older machine types, only implement
this change when the CPU's "x-vendor-cpuid-only" property is false
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
target/i386/cpu.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 0b6c921e5a..289dd2b1d8 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5950,8 +5950,15 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
}
}
- /* CPU topology with multi-dies support requires CPUID[0x1F] */
- if (env->nr_dies > 1) {
+ /*
+ * Intel CPU topology with multi-dies support requires CPUID[0x1F].
+ * For AMD Rome/Milan, cpuid level is 0x10, and guest OS should detect
+ * extended toplogy by leaf 0xB. Only adjust it for Intel CPU, unless
+ * cpu->vendor_cpuid_only has been unset for compatibility with older
+ * machine types.
+ */
+ if ((env->nr_dies > 1) &&
+ (IS_INTEL_CPU(env) || !cpu->vendor_cpuid_only)) {
x86_cpu_adjust_level(cpu, &env->cpuid_min_level, 0x1F);
}
--
2.25.1
next prev parent reply other threads:[~2021-07-08 17:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-08 0:36 [PATCH] target/i386: suppress CPUID leaves not defined by the CPU vendor Michael Roth
2021-07-08 17:06 ` Michael Roth [this message]
2021-07-08 21:05 ` [PATCH] target/i386: Fix cpuid level for AMD Eduardo Habkost
2021-07-08 21:05 ` [PATCH] target/i386: suppress CPUID leaves not defined by the CPU vendor Eduardo Habkost
-- strict thread matches above, loose matches on Subject: below --
2021-06-28 13:20 [PATCH] target/i386: Fix cpuid level for AMD zhenwei pi
2021-06-29 14:06 ` Dr. David Alan Gilbert
2021-06-29 21:29 ` Babu Moger
2021-06-30 19:18 ` Michael Roth
2021-07-01 8:43 ` Igor Mammedov
2021-07-01 20:35 ` Michael Roth
2021-07-02 6:50 ` David Edmondson
2021-07-02 15:40 ` Michael Roth
2021-07-02 17:32 ` Eduardo Habkost
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=20210708170641.49410-1-michael.roth@amd.com \
--to=michael.roth@amd.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=pizhenwei@bytedance.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).