summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorYang Zhong <yang.zhong@intel.com>2022-05-30 09:18:34 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-06 09:26:53 +0200
commitb0f3184e82817b700ea81bc76ebc8d999de35278 (patch)
tree52fb68b90cbe99c54de707bf290d7a23a55253e0
parentd8f3a60931a700c327aa2ee10d0beaeea2cb97da (diff)
downloadfocaccia-qemu-b0f3184e82817b700ea81bc76ebc8d999de35278.tar.gz
focaccia-qemu-b0f3184e82817b700ea81bc76ebc8d999de35278.zip
target/i386: Fix wrong count setting
The previous patch used wrong count setting with index value, which got wrong
value from CPUID(EAX=12,ECX=0):EAX. So the SGX1 instruction can't be exposed
to VM and the SGX decice can't work in VM.

Fixes: d19d6ffa0710 ("target/i386: introduce helper to access supported CPUID")

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220530131834.1222801-1-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--target/i386/cpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index bb6a5dd498..9fdfec9d8b 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5559,7 +5559,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
          * supports.  Features can be further restricted by userspace, but not
          * made more permissive.
          */
-        x86_cpu_get_supported_cpuid(0x12, index, eax, ebx, ecx, edx);
+        x86_cpu_get_supported_cpuid(0x12, count, eax, ebx, ecx, edx);
 
         if (count == 0) {
             *eax &= env->features[FEAT_SGX_12_0_EAX];