From patchwork Sun Aug 4 17:49:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 2838461 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 151BE9F485 for ; Sun, 4 Aug 2013 17:49:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A1EA2012B for ; Sun, 4 Aug 2013 17:49:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 53CA020123 for ; Sun, 4 Aug 2013 17:49:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753757Ab3HDRtl (ORCPT ); Sun, 4 Aug 2013 13:49:41 -0400 Received: from mout.web.de ([212.227.15.14]:58376 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753689Ab3HDRtg (ORCPT ); Sun, 4 Aug 2013 13:49:36 -0400 Received: from localhost.localdomain ([95.157.58.223]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MN87U-1UzQjF27Kq-006eWF for ; Sun, 04 Aug 2013 19:49:35 +0200 From: Jan Kiszka To: Gleb Natapov , Paolo Bonzini Cc: kvm , Xiao Guangrong , Jun Nakajima , Yang Zhang Subject: [PATCH 6/7] KVM: nVMX: Implement support for EFER saving on VM-exit Date: Sun, 4 Aug 2013 19:49:05 +0200 Message-Id: X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: X-Provags-ID: V03:K0:yVuyREfYn89lxxKW+cZa0fplfzFXkpzmO1DO7Q+qbATZK2xPGFv NfRmule9qh3S191TeLemcFZkOpLMCSVVvZpg5Ww2BHGgTpGSmuFuTnWwMAmYYBlIey0TSRP fKqu71ZndK3GiBPm5szW7aauhkMDUX0BHoLDWL/hMV0kQrT0GkroV+bO3kVS3aWjqYeB1kZ /Y5BFDUt9+xHApOxUSlDQ== Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jan Kiszka 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 --- 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); /* entry controls */ rdmsr(MSR_IA32_VMX_ENTRY_CTLS, @@ -8113,6 +8113,8 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) vmcs12->guest_ia32_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL); if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_PAT) vmcs12->guest_ia32_pat = vmcs_read64(GUEST_IA32_PAT); + if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_EFER) + vmcs12->guest_ia32_efer = vcpu->arch.efer; vmcs12->guest_sysenter_cs = vmcs_read32(GUEST_SYSENTER_CS); vmcs12->guest_sysenter_esp = vmcs_readl(GUEST_SYSENTER_ESP); vmcs12->guest_sysenter_eip = vmcs_readl(GUEST_SYSENTER_EIP);