[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/9] i386/cpu: Don't construct a all-zero entry for CPUID[0xD 0x3
From: |
Xiaoyao Li |
Subject: |
[PATCH 1/9] i386/cpu: Don't construct a all-zero entry for CPUID[0xD 0x3f] |
Date: |
Wed, 14 Aug 2024 03:54:23 -0400 |
Currently, QEMU always constructs a all-zero CPUID entry for
CPUID[0xD 0x3f].
It's meaningless to construct such a leaf as the end of leaf 0xD. Rework
the logic of how subleaves of 0xD are constructed to get rid of such
all-zero value of subleaf 0x3f.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
target/i386/kvm/kvm.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 31f149c9902c..c168ff5691df 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -1844,10 +1844,6 @@ static uint32_t kvm_x86_build_cpuid(CPUX86State *env,
case 0xb:
case 0xd:
for (j = 0; ; j++) {
- if (i == 0xd && j == 64) {
- break;
- }
-
c->function = i;
c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
c->index = j;
@@ -1863,7 +1859,12 @@ static uint32_t kvm_x86_build_cpuid(CPUX86State *env,
break;
}
if (i == 0xd && c->eax == 0) {
- continue;
+ if (j < 63) {
+ continue;
+ } else {
+ cpuid_i--;
+ break;
+ }
}
if (cpuid_i == KVM_MAX_CPUID_ENTRIES) {
goto full;
--
2.34.1
- [PATCH 0/9] Misc patches for x86 CPUID, Xiaoyao Li, 2024/08/14
- [PATCH 1/9] i386/cpu: Don't construct a all-zero entry for CPUID[0xD 0x3f],
Xiaoyao Li <=
- [PATCH 2/9] i386/cpu: Enable fdp-excptn-only and zero-fcs-fds, Xiaoyao Li, 2024/08/14
- [PATCH 3/9] i386/cpu: Add support for bits in CPUID.7_2.EDX, Xiaoyao Li, 2024/08/14
- [PATCH 7/9] i386/cpu: Suppress CPUID values not defined by Intel, Xiaoyao Li, 2024/08/14
- [PATCH 5/9] i386/cpu: Construct CPUID 2 as stateful iff times > 1, Xiaoyao Li, 2024/08/14
- [PATCH 9/9] i386/cpu: Make invtsc migratable when user sets tsc-khz explicitly, Xiaoyao Li, 2024/08/14
- [PATCH 4/9] i386/cpu: Construct valid CPUID leaf 5 iff CPUID_EXT_MONITOR, Xiaoyao Li, 2024/08/14
- [PATCH 6/9] i386/cpu: Set topology info in 0x80000008.ECX only for AMD CPUs, Xiaoyao Li, 2024/08/14
- [PATCH 8/9] i386/cpu: Drop AMD alias bits in FEAT_8000_0001_EDX for non-AMD guests, Xiaoyao Li, 2024/08/14