qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/i386: Fix wrong count setting
@ 2022-05-30 13:18 Yang Zhong
  2022-05-31 10:10 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Zhong @ 2022-05-30 13:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, yang.zhong

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>
---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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];
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] target/i386: Fix wrong count setting
  2022-05-30 13:18 [PATCH] target/i386: Fix wrong count setting Yang Zhong
@ 2022-05-31 10:10 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-05-31 10:10 UTC (permalink / raw)
  To: Yang Zhong; +Cc: qemu-devel, pbonzini

Queued, thanks.

Paolo




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-31 10:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-30 13:18 [PATCH] target/i386: Fix wrong count setting Yang Zhong
2022-05-31 10:10 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).