Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Tao_W_
Beginner
100 Views

What is the right ways to enable VMX root and load VM.

Hi,

I am working a Linux kernel module to test VMX operations. 

The kernel module defines some Linux filesystem APIs which can be used by user space to start VMX operation. Here is the main sequence.

In Dev_open(), VMXe in CR4 is set to all online CPUs. And call VMXON, VMXPTRCLEAR, VMXPTRLD, VMXwrite to populate VMCS.

In Dev_Ioctl(), VMXON, VMXPTRLD, and VMLaunch or VMReume based on VM's state.

In Dev_release(), VMXOFF is called.

With this design, i always hit an error of 'invalid host state' when VMLaunch is called for the first time. Subsequent calls of VMlaunch or VMResume did NOT hit this issue.

I am suspecting if I missed something of VMX operations. 

In stackoverflow, there was a post to say VMXe bit is not persistent in Linux. https://stackoverflow.com/questions/37380232/linux-kernel-module-setting-cr4-vmxe-does-not-persist.

I hit this issue also, and I am studying it.

Thanks,

-Tao

Tags (1)
0 Kudos
0 Replies
Reply