From patchwork Wed Sep 16 11:31:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 7194301 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 58C81BEEC1 for ; Wed, 16 Sep 2015 11:31:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78CEA205E9 for ; Wed, 16 Sep 2015 11:31:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A684C205BE for ; Wed, 16 Sep 2015 11:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752369AbbIPLb0 (ORCPT ); Wed, 16 Sep 2015 07:31:26 -0400 Received: from blu004-omc1s24.hotmail.com ([65.55.116.35]:57288 "EHLO BLU004-OMC1S24.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751648AbbIPLbZ convert rfc822-to-8bit (ORCPT ); Wed, 16 Sep 2015 07:31:25 -0400 Received: from BLU436-SMTP97 ([65.55.116.9]) by BLU004-OMC1S24.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Wed, 16 Sep 2015 04:31:25 -0700 X-TMN: [Z0CJnH8QHUP2rjjcBj0how25NxhUJ4pe] X-Originating-Email: [wanpeng.li@hotmail.com] Message-ID: From: Wanpeng Li To: Paolo Bonzini CC: Jan Kiszka , Bandan Das , Wincy Van , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH] KVM: vmx: fix VPID is 0000H in non-root operation Date: Wed, 16 Sep 2015 19:31:11 +0800 X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-OriginalArrivalTime: 16 Sep 2015 11:31:23.0751 (UTC) FILETIME=[378B0F70:01D0F073] 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,T_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 Reference SDM 28.1: The current VPID is 0000H in the following situations: — Outside VMX operation. (This includes operation in system-management mode under the default treatment of SMIs and SMM with VMX operation; see Section 34.14.) — In VMX root operation. — In VMX non-root operation when the “enable VPID” VM-execution control is 0. The VPID should never be 0000H in non-root operation when "enable VPID" VM-execution control is 1. However, commit (34a1cd60: 'kvm: x86: vmx: move some vmx setting from vmx_init() to hardware_setup()') remove the codes which reserve 0000H for VMX root operation. This patch fix it by reintroducing reserve 0000H for VMX root operation. Reported-by: Wincy Van Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9ff6a3f..a63b9ca 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -6056,6 +6056,8 @@ static __init int hardware_setup(void) memcpy(vmx_msr_bitmap_longmode_x2apic, vmx_msr_bitmap_longmode, PAGE_SIZE); + set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */ + if (enable_apicv) { for (msr = 0x800; msr <= 0x8ff; msr++) vmx_disable_intercept_msr_read_x2apic(msr);