Hi All, I am Mohit Dhingra, planning to work in GSoC project "Improve nested virtualization support for x86". I got in touch with Jan (jan.kiszka@xxxxxx) few days back. As suggested by him, I am trying to write a simple unit test which tests the "vmx" functions. To start with, I have written a small code which checks whether "vmx" functionality is available on the current processor or not[1]. I have used "cpuid" to check the VMX functionality. Before executing cpuid, eax is set to 1. cpuid then puts the feature flags in ecx and edx registers. Bit5 in ecx register tells whether VMX feature is present or not. I am attaching the patch along with this mail. But there is a problem that I am facing. CPUID behaves differently when I run it using qemu-kvm, and when I run it directly in user mode. Please check the below output. It would be great if someone can please help me out. ---------------------------------------------------------------------------------------------------- Using qemu-kvm Command : qemu-kvm -device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out -serial stdio -kernel ./x86/vmx_test.flat Output : Warning: default mac address being used, creating potential for address conflict enabling apic Feauture Flag returned in ecx : 0x80802001 VMX capabilities not present ! Vendor ID (returned by CPUID) : GenuineIntel --------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- Executing directly Compile : gcc -o gcc_output x86/vmx_test.c Executing : ./gcc_output Output : Feauture Flag returned in ecx : 0x98e3bd VMX capabilities present ! Vendor ID (returned by CPUID) : GenuineIntel ---------------------------------------------------------------------------------------------------------- [1] Intel Processor Identification and the CPUID Instruction ---------------------------- Thanks & Regards Mohit Dhingra +919611190435
Attachment:
check_vmx_capabilities.patch
Description: Binary data