From patchwork Tue Aug 6 08:40:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 2839261 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 120EB9F479 for ; Tue, 6 Aug 2013 08:40:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 583B120181 for ; Tue, 6 Aug 2013 08:40:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93FAD2017B for ; Tue, 6 Aug 2013 08:40:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754875Ab3HFIkX (ORCPT ); Tue, 6 Aug 2013 04:40:23 -0400 Received: from mout.web.de ([212.227.15.3]:57189 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754444Ab3HFIkS (ORCPT ); Tue, 6 Aug 2013 04:40:18 -0400 Received: from localhost.localdomain ([95.157.58.223]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0M4Zlk-1W52Wi3eUG-00yeNZ for ; Tue, 06 Aug 2013 10:40:17 +0200 From: Jan Kiszka To: Gleb Natapov , Paolo Bonzini Cc: kvm , Xiao Guangrong , Jun Nakajima , Yang Zhang , Arthur Chunqi Li Subject: [PATCH v2 8/8] KVM: nVMX: Update mmu.base_role.nxe after EFER loading on VM-entry/exit Date: Tue, 6 Aug 2013 10:40:02 +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:Amz16T3d2yB/51KSeY84Jy09kbuSjKesViwZOaOrglJ8qtcJSFh vGdCiBz1B9SjtnpdTEKbzutwrTIzWU1liMHVSTvnk+kKy3CGXWQpU5a01XEWlPszrwWEZUj Y64tQ5VJeBExmCRJekMJ22d0y9AAHKkc/8jukYJtZCZ6U7jbHgjUeHoeu1AXSAtO5u/5afx YyEuP6UDyj1HvCNzpDEug== 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 This job is normally performed by the architectural EFER set service which we cannot use as it prevents transitions that are valid when switching between L1 and L2. So open-code the update of base_role.nxe after changing EFER on VM-entry and exit. Signed-off-by: Jan Kiszka --- arch/x86/kvm/vmx.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 99a4a70..44494ed 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -7741,6 +7741,8 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) vcpu->arch.efer &= ~(EFER_LMA | EFER_LME); /* Note: modifies VM_ENTRY/EXIT_CONTROLS and GUEST/HOST_IA32_EFER */ vmx_set_efer(vcpu, vcpu->arch.efer); + vcpu->arch.mmu.base_role.nxe = + (vcpu->arch.efer & EFER_NX) && !enable_ept; if (nested_cpu_has_ept(vmcs12)) { kvm_mmu_unload(vcpu); @@ -8185,6 +8187,8 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu, else vcpu->arch.efer &= ~(EFER_LMA | EFER_LME); vmx_set_efer(vcpu, vcpu->arch.efer); + vcpu->arch.mmu.base_role.nxe = + (vcpu->arch.efer & EFER_NX) && !enable_ept; kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp); kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip);