On 2013-08-05 09:21, Arthur Chunqi Li wrote: > On Mon, Aug 5, 2013 at 1:49 AM, Jan Kiszka <jan.kiszka@xxxxxx> wrote: >> From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> >> >> Implement and advertise VM_EXIT_SAVE_IA32_EFER. L0 traps EFER writes >> unconditionally, so we always find the current L2 value in the >> architectural state. >> >> Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> >> --- >> arch/x86/kvm/vmx.c | 4 +++- >> 1 files changed, 3 insertions(+), 1 deletions(-) >> >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >> index 84a05b4..7208d0b 100644 >> --- a/arch/x86/kvm/vmx.c >> +++ b/arch/x86/kvm/vmx.c >> @@ -2203,7 +2203,7 @@ static __init void nested_vmx_setup_ctls_msrs(void) >> nested_vmx_exit_ctls_high = 0; >> #endif >> nested_vmx_exit_ctls_high |= (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR | >> - VM_EXIT_LOAD_IA32_EFER); >> + VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER); > Here you may need to access MSR_IA32_VMX_EXIT_CTLS first to check if > host support these two features. The codes for "entry controls" > following it can achieve goals like this. We are providing this feature independently of the host's support. Every write to EFER is trapped by L0, so we can emulate saving by reading what L0 recorded. Jan
Attachment:
signature.asc
Description: OpenPGP digital signature