Skip to contentSkip to conversation

i386/cpuid: Minor fixes for CPUID leaf 1f setup

PATCH Superseded Xiaoyao Li 1 participant 5 messages Jul 12, 2022 – Jun 7, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Xiaoyao Li

author
#0 lore raw

cover i386/cpuid: Minor fixes for CPUID leaf 1f setup

The issue that fixed by Patch 1 looks fatal though it doesn't appear on KVM because KVM always searches with assending order and hit with the correct cpuid leaf 0.

Patch 2 removes the wrong constraint on CPUID leaf 1f

Xiaoyao Li (2):
i386/cpuid: Decrease cpuid_i when skipping CPUID leaf 1F i386/cpuid: Remove subleaf constraint on CPUID leaf 1F

 target/i386/kvm/kvm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Signature · 1 line
2.27.0
author
#1 lore raw

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

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.

---
 target/i386/kvm/kvm.c | 1 +
 1 file changed, 1 insertion(+)
target/i386/kvm/kvm.c +1 -0
index b8578882c12b..a0b412a1129f 100644
@@ -1831,6 +1831,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
         }
         case 0x1f:
             if (env->nr_dies < 2) {
+                cpuid_i--;
                 break;
             }
             /* fallthrough */
Signature · 1 line
2.27.0
author
#2 lore raw

PATCH 2/2 i386/cpuid: Remove subleaf constraint on CPUID leaf 1F

In reply to Xiaoyao Li

No such constraint that subleaf index needs to be less than 64.

---
 target/i386/kvm/kvm.c | 4 ----
 1 file changed, 4 deletions(-)
target/i386/kvm/kvm.c +0 -4
index a0b412a1129f..3efa524b4b93 100644
@@ -1843,10 +1843,6 @@ int kvm_arch_init_vcpu(CPUState *cs)
                     break;
                 }
 
-                if (i == 0x1f && j == 64) {
-                    break;
-                }
-
                 c->function = i;
                 c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
                 c->index = j;
Signature · 1 line
2.27.0
author
#3 lore raw
In reply to Xiaoyao Li
Quoted 5 lines · Xiaoyao Li

The issue that fixed by Patch 1 looks fatal though it doesn't appear on KVM because KVM always searches with assending order and hit with the correct cpuid leaf 0.

Patch 2 removes the wrong constraint on CPUID leaf 1f

Kindly ping.

Quoted 7 lines

Xiaoyao Li (2):
i386/cpuid: Decrease cpuid_i when skipping CPUID leaf 1F i386/cpuid: Remove subleaf constraint on CPUID leaf 1F

  target/i386/kvm/kvm.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
author
#4 lore raw
Quoted 8 lines · Xiaoyao Li
Quoted 5 lines · Xiaoyao Li

The issue that fixed by Patch 1 looks fatal though it doesn't appear on KVM because KVM always searches with assending order and hit with the correct cpuid leaf 0.

Patch 2 removes the wrong constraint on CPUID leaf 1f

Kindly ping.

ping it one more time.

Does it need a rebase and resend?

Quoted 9 lines
Quoted 7 lines

Xiaoyao Li (2):
   i386/cpuid: Decrease cpuid_i when skipping CPUID leaf 1F i386/cpuid: Remove subleaf constraint on CPUID leaf 1F

  target/i386/kvm/kvm.c | 5 +----

  1 file changed, 1 insertion(+), 4 deletions(-)