On 2018-04-16 17:41, Ralf Ramsauer wrote: > On 04/16/2018 05:29 PM, Francois-Frederic Ozog wrote: >> inmates cannot use X86_FEATURE_VMX from regular cpuid >> as vcpu maks the bit explicitely on non-root cells. >> >> use cpuid leaf 0 to detect AuthenticAMD and change to VMMCALL >> >> Signed-off-by: Francois-Frederic Ozog <francois.o...@linaro.org> >> --- >> inmates/lib/x86/hypercall.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/inmates/lib/x86/hypercall.c b/inmates/lib/x86/hypercall.c >> index ac99f0c3..59cbb52f 100644 >> --- a/inmates/lib/x86/hypercall.c >> +++ b/inmates/lib/x86/hypercall.c >> @@ -44,15 +44,15 @@ bool jailhouse_use_vmcall; >> >> void hypercall_init(void) >> { >> - u32 eax = 1, ecx = 0; >> + u32 eax = 0, ebx = 0, ecx = 0, edx = 0; >> >> asm volatile( >> "cpuid" >> : "=c" (ecx) >> - : "a" (eax), "c" (ecx) >> - : "rbx", "rdx", "memory" >> + : "a" (eax), "b" (ebx), "c" (ecx), "d" (edx) >> + : "memory" >> ); >> >> - if (ecx & X86_FEATURE_VMX) >> + if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746E65) > Just a small thing, but maybe it's better to use defines for those > magics to make clear in code what we're checking for. >
Yeah, something like the kernels X86EMUL_CPUID_VENDOR_AuthenticAMD_*, maybe not that long, though. And as we are at it: Patch version goes into the tag ("[PATCH v2] ..."). Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to jailhouse-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.