[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/16] target/i386: do not include undefined bits in the AMD topoe
From: |
Paolo Bonzini |
Subject: |
[PULL 10/16] target/i386: do not include undefined bits in the AMD topoext leaf |
Date: |
Thu, 4 Jul 2024 11:58:00 +0200 |
Commit d7c72735f61 ("target/i386: Add new EPYC CPU versions with updated
cache_info", 2023-05-08) ensured that AMD-defined CPU models did not
have the 'complex_indexing' bit set, but left it set in "-cpu host"
which uses the default ("legacy") cache information.
Reimplement that commit using a CPU feature, so that it can be applied
to all guests using a new machine type, independent of the CPU model.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.h | 3 +++
hw/i386/pc.c | 1 +
target/i386/cpu.c | 4 ++++
3 files changed, 8 insertions(+)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 9bea7142bf4..0d5624355e4 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -2104,6 +2104,9 @@ struct ArchCPU {
/* Only advertise CPUID leaves defined by the vendor */
bool vendor_cpuid_only;
+ /* Only advertise TOPOEXT features that AMD defines */
+ bool amd_topoext_features_only;
+
/* Enable auto level-increase for Intel Processor Trace leave */
bool intel_pt_auto_level;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 77415064c62..5dff91422ff 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -80,6 +80,7 @@
{ "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },
GlobalProperty pc_compat_9_0[] = {
+ { TYPE_X86_CPU, "x-amd-topoext-features-only", "false" },
{ TYPE_X86_CPU, "x-l1-cache-per-thread", "false" },
{ TYPE_X86_CPU, "guest-phys-bits", "0" },
{ "sev-guest", "legacy-vm-type", "true" },
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 5e5bf71702c..c40551d9bfb 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6982,6 +6982,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
*eax = *ebx = *ecx = *edx = 0;
break;
}
+ if (cpu->amd_topoext_features_only) {
+ *edx &= CACHE_NO_INVD_SHARING | CACHE_INCLUSIVE;
+ }
break;
case 0x8000001E:
if (cpu->core_id <= 255) {
@@ -8293,6 +8296,7 @@ static Property x86_cpu_properties[] = {
DEFINE_PROP_STRING("hv-vendor-id", X86CPU, hyperv_vendor),
DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true),
DEFINE_PROP_BOOL("x-vendor-cpuid-only", X86CPU, vendor_cpuid_only, true),
+ DEFINE_PROP_BOOL("x-amd-topoext-features-only", X86CPU,
amd_topoext_features_only, true),
DEFINE_PROP_BOOL("lmce", X86CPU, enable_lmce, false),
DEFINE_PROP_BOOL("l3-cache", X86CPU, enable_l3_cache, true),
DEFINE_PROP_BOOL("kvm-pv-enforce-cpuid", X86CPU, kvm_pv_enforce_cpuid,
--
2.45.2
- [PULL 00/16] meson, i386 changes for 2024-07-04, Paolo Bonzini, 2024/07/04
- [PULL 01/16] meson: move shared_module() calls where modules are already walked, Paolo Bonzini, 2024/07/04
- [PULL 02/16] meson: move block.syms dependency out of libblock, Paolo Bonzini, 2024/07/04
- [PULL 03/16] meson: merge plugin_ldflags into emulator_link_args, Paolo Bonzini, 2024/07/04
- [PULL 04/16] meson: Pass objects and dependencies to declare_dependency(), Paolo Bonzini, 2024/07/04
- [PULL 05/16] Revert "meson: Propagate gnutls dependency", Paolo Bonzini, 2024/07/04
- [PULL 06/16] meson: Drop the .fa library suffix, Paolo Bonzini, 2024/07/04
- [PULL 07/16] target/i386: pass X86CPU to x86_cpu_get_supported_feature_word, Paolo Bonzini, 2024/07/04
- [PULL 08/16] target/i386: drop AMD machine check bits from Intel CPUID, Paolo Bonzini, 2024/07/04
- [PULL 11/16] i386/sev: Fix error message in sev_get_capabilities(), Paolo Bonzini, 2024/07/04
- [PULL 10/16] target/i386: do not include undefined bits in the AMD topoext leaf,
Paolo Bonzini <=
- [PULL 13/16] target/i386: add avx-vnni-int16 feature, Paolo Bonzini, 2024/07/04
- [PULL 09/16] target/i386: SEV: fix formatting of CPUID mismatch message, Paolo Bonzini, 2024/07/04
- [PULL 14/16] char-stdio: Restore blocking mode of stdout on exit, Paolo Bonzini, 2024/07/04
- [PULL 12/16] i386/sev: Fallback to the default SEV device if none provided in sev_get_capabilities(), Paolo Bonzini, 2024/07/04
- [PULL 15/16] target/i386: add support for masking CPUID features in confidential guests, Paolo Bonzini, 2024/07/04
- [PULL 16/16] target/i386/SEV: implement mask_cpuid_features, Paolo Bonzini, 2024/07/04
- Re: [PULL 00/16] meson, i386 changes for 2024-07-04, Richard Henderson, 2024/07/04