diff mbox series

[1/2] i386/cpuid: Decrease cpuid_i when skipping CPUID leaf 1F

Message ID 20220712021249.3227256-2-xiaoyao.li@intel.com (mailing list archive)
State New, archived
Headers show
Series i386/cpuid: Minor fixes for CPUID leaf 1f setup | expand

Commit Message

Xiaoyao Li July 12, 2022, 2:12 a.m. UTC
Decrease array index cpuid_i when CPUID leaf 1F is skipped, otherwise it
will get an all zero'ed CPUID entry with leaf 0 and subleaf 0. It
conflicts with correct leaf 0.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 target/i386/kvm/kvm.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index b8578882c12b..a0b412a1129f 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -1831,6 +1831,7 @@  int kvm_arch_init_vcpu(CPUState *cs)
         }
         case 0x1f:
             if (env->nr_dies < 2) {
+                cpuid_i--;
                 break;
             }
             /* fallthrough */