diff options
author | Xiaoyao Li <xiaoyao.li@intel.com> | 2024-08-14 03:54:27 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-10-17 12:30:21 +0200 |
commit | 5ab639141b6d916a6f4041d4ec46f2f1a1e4a365 (patch) | |
tree | 6b20284c83e36c685c5cdd9cda7e353aa64a6310 | |
parent | 7dddc3bb875e7141ab25931d0f30a1c319bc8457 (diff) | |
download | qemu-5ab639141b6d916a6f4041d4ec46f2f1a1e4a365.zip qemu-5ab639141b6d916a6f4041d4ec46f2f1a1e4a365.tar.gz qemu-5ab639141b6d916a6f4041d4ec46f2f1a1e4a365.tar.bz2 |
target/i386: Construct CPUID 2 as stateful iff times > 1
When times == 1, the CPUID leaf 2 is not stateful.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20240814075431.339209-6-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | target/i386/kvm/kvm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 6f63014..77e8816 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -1838,10 +1838,12 @@ static uint32_t kvm_x86_build_cpuid(CPUX86State *env, int times; c->function = i; - c->flags = KVM_CPUID_FLAG_STATEFUL_FUNC | - KVM_CPUID_FLAG_STATE_READ_NEXT; cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx); times = c->eax & 0xff; + if (times > 1) { + c->flags = KVM_CPUID_FLAG_STATEFUL_FUNC | + KVM_CPUID_FLAG_STATE_READ_NEXT; + } for (j = 1; j < times; ++j) { if (cpuid_i == KVM_MAX_CPUID_ENTRIES) { |