From patchwork Sun Mar 3 12:04:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 2208241 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E53F63FCF2 for ; Sun, 3 Mar 2013 12:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753076Ab3CCMEy (ORCPT ); Sun, 3 Mar 2013 07:04:54 -0500 Received: from mout.web.de ([212.227.15.4]:62175 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752946Ab3CCMEx (ORCPT ); Sun, 3 Mar 2013 07:04:53 -0500 Received: from mchn199C.mchp.siemens.de ([95.157.56.37]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0MGABv-1Tz9662mdL-00F73P; Sun, 03 Mar 2013 13:04:35 +0100 Message-ID: <51333C50.1080906@web.de> Date: Sun, 03 Mar 2013 13:04:32 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Gleb Natapov , Marcelo Tosatti CC: kvm , Nadav Har'El , "Nakajima, Jun" Subject: [PATCH] KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS X-Enigmail-Version: 1.5 X-Provags-ID: V02:K0:NyFSbvsihw0/5V06RwEvOw4foLLr07e/evvLiptIO+K jKvtgUCqkI+4B2FXPzpql0RzM4ej4y6ME6+O8Eta0eftDnGDxi W/RfBFRHRviToM/e+uqZ6/NL0iZyBl6drS7us+cYhc60nt9Mty R2QdpegeRukVE2tHYlREaSlLvCB6CI46wBl9/NsR8s1tnKT3O8 GwfS5ryxNSYsGUkfJA6xQ== Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Jan Kiszka Properly set those bits to 1 that the spec demands in case bit 55 of VMX_BASIC is 0 - like in our case. Signed-off-by: Jan Kiszka --- arch/x86/kvm/vmx.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 631cdb3..c204f0d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2050,21 +2050,28 @@ static __init void nested_vmx_setup_ctls_msrs(void) PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING | PIN_BASED_VIRTUAL_NMIS; - /* exit controls */ - nested_vmx_exit_ctls_low = 0; + /* + * Exit controls + * If bit 55 of VMX_BASIC is off, bits 0-8 and 10, 11, 13, 14, 16 and + * 17 must be 1. + */ + nested_vmx_exit_ctls_low = 0x36dff; /* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */ #ifdef CONFIG_X86_64 nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE; #else nested_vmx_exit_ctls_high = 0; #endif + nested_vmx_exit_ctls_high |= 0x36dff; /* entry controls */ rdmsr(MSR_IA32_VMX_ENTRY_CTLS, nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high); - nested_vmx_entry_ctls_low = 0; + /* If bit 55 of VMX_BASIC is off, bits 0-8 and 12 must be 1. */ + nested_vmx_entry_ctls_low = 0x11ff; nested_vmx_entry_ctls_high &= VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_IA32E_MODE; + nested_vmx_entry_ctls_high |= 0x11ff; /* cpu-based controls */ rdmsr(MSR_IA32_VMX_PROCBASED_CTLS,