On 12/9/23 16:05, Paolo Bonzini wrote:
On 9/11/23 23:13, Philippe Mathieu-Daudé wrote:
/*
* Only for builtin_x86_defs models initialized with
x86_register_cpudef_types.
*/
@@ -6163,6 +6195,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t
index, uint32_t count,
}
*edx = env->features[FEAT_7_0_EDX]; /* Feature flags */
+#ifndef CONFIG_USER_ONLY
/*
* SGX cannot be emulated in software. If hardware does
not
* support enabling SGX and/or SGX flexible launch control,
@@ -6181,6 +6214,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t
index, uint32_t count,
CPUID_7_0_ECX_SGX_LC))) {
*ecx &= ~CPUID_7_0_ECX_SGX_LC;
}
+#endif
This can use a variant of x86_cpu_get_supported_cpuid that returns a
single register; or it can be rewritten to use x86_cpu_get_supported_cpuid.
Great suggestion, thanks!
In general, a lot of checks for accel_uses_host_cpuid() are unnecessary,
and the code can be modified to not depend on either KVM or HVF.
OK.