From patchwork Tue Oct 18 22:45:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Dakinevich X-Patchwork-Id: 9383227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8438A607D0 for ; Tue, 18 Oct 2016 22:45:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CABE297F3 for ; Tue, 18 Oct 2016 22:45:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C6A0297FA; Tue, 18 Oct 2016 22:45:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD5BD297F3 for ; Tue, 18 Oct 2016 22:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934620AbcJRWpw (ORCPT ); Tue, 18 Oct 2016 18:45:52 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35733 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756145AbcJRWpu (ORCPT ); Tue, 18 Oct 2016 18:45:50 -0400 Received: by mail-lf0-f68.google.com with SMTP id x79so419873lff.2 for ; Tue, 18 Oct 2016 15:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=5UJNJKgAxT+yF0PB4Qzn2wKYWGNUzrUdOlJCyF5qHKo=; b=wBUxLKRn5uv7TTkkdV93t5/XjembkGBoRw6AKGTMBz4ELOOrtAimuUHZJJnLSr6mv9 Wf4uifiBpDCXMtKXXbCX+dm6wDoHJh1ZAlXheVCsot+IIIIsBs1GKTXTdVggdb7DU85+ JbQgxQS2Y37kh7Kq/OT+hxrVqMhhuTYf6D180f02+YHGSupIXtK1LsrmoOHMM8l90bfP 8WTqGzVl6WRiDe79IQBmSHYiDrWr4zSx8WFRgmBuE/fZ4adQVwSZDXRohGJqgRzfkHP3 bzDH0BahRYkfTwqNAi/5Tk/yi1nJvUgRIcENKzGhJNFObtE2iod22V+Tg19t21x3ixb4 8LLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5UJNJKgAxT+yF0PB4Qzn2wKYWGNUzrUdOlJCyF5qHKo=; b=ZonORb267bb9nPaGdaeqmbVu7Ovd0NCMAa1HF8wWcAoHl9P0mAZ7HD0dOWURkrMATE tdhjmIHgRwAmiASKmTNMXKe2oJWRrH9mrCtmOOMmzUe1abxazRnJkUAk788q7J/rfiLG qRIcIdHuFR/AX4JWOsW3PKharCUN8VglzICv5s3rHauP3Madss8nUPhKFUoYC/7BOuJA epBItMZRMRdA7txkUaa7gWQ2XFC6tBnI3A+A9CippZsRtzsksvyjlWaICR8vUQGc4lt4 6yp7WYmIegCmVeIvE/3FckNaiS/USJj+C/kESiuZFqxXAZtig0+Rdl8kyynAUC0kPgvk 2sOg== X-Gm-Message-State: AA6/9Rks0SvZcJ12ZNBZ/pRnj5Qlv2QL/0/0T/CBQSCd2y42wCG3yGNZhcML18OAhmHPyQ== X-Received: by 10.25.74.9 with SMTP id x9mr2499886lfa.176.1476830748540; Tue, 18 Oct 2016 15:45:48 -0700 (PDT) Received: from localhost.localdomain (194-28-30-174.static-pppoe.itce.ru. [194.28.30.174]) by smtp.gmail.com with ESMTPSA id j4sm4021913lfg.23.2016.10.18.15.45.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 15:45:47 -0700 (PDT) From: Jan Dakinevich To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com, kernellwp@gmail.com, Jan Dakinevich Subject: [PATCH 1/2] KVM: VMX: clean up declaration of VPID/EPT invalidation types Date: Wed, 19 Oct 2016 01:45:04 +0300 Message-Id: <1476830705-19269-1-git-send-email-jan.dakinevich@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - Remove VMX_EPT_EXTENT_INDIVIDUAL_ADDR, since there is no such type of EPT invalidation - Rename VMX_VPID_EXTENT_ALL_CONTEXT to VMX_VPID_EXTENT_GLOBAL_CONTEXT for consitency: all-context VPID invalidation is referenced by "global" keyword in all other places of code - Add missing VPID types names Signed-off-by: Jan Dakinevich --- arch/x86/include/asm/vmx.h | 7 +++++-- arch/x86/kvm/vmx.c | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index a002b07..785390f 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -399,10 +399,11 @@ enum vmcs_field { #define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_USER_MEM_SLOTS + 2) #define VMX_NR_VPIDS (1 << 16) +#define VMX_VPID_EXTENT_INDIVIDUAL_ADDR 0 #define VMX_VPID_EXTENT_SINGLE_CONTEXT 1 -#define VMX_VPID_EXTENT_ALL_CONTEXT 2 +#define VMX_VPID_EXTENT_GLOBAL_CONTEXT 2 +#define VMX_VPID_EXTENT_SINGLE_CONTEXT_RETAINING_GLOBALS 3 -#define VMX_EPT_EXTENT_INDIVIDUAL_ADDR 0 #define VMX_EPT_EXTENT_CONTEXT 1 #define VMX_EPT_EXTENT_GLOBAL 2 #define VMX_EPT_EXTENT_SHIFT 24 @@ -419,8 +420,10 @@ enum vmcs_field { #define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) #define VMX_VPID_INVVPID_BIT (1ull << 0) /* (32 - 32) */ +#define VMX_VPID_EXTENT_INDIVIDUAL_ADDR_BIT (1ull << 8) /* (40 - 32) */ #define VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT (1ull << 9) /* (41 - 32) */ #define VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT (1ull << 10) /* (42 - 32) */ +#define VMX_VPID_EXTENT_SINGLE_CONTEXT_RETAINING_GLOBALS_BIT (1ull << 11) /* (43 - 32) */ #define VMX_EPT_DEFAULT_GAW 3 #define VMX_EPT_MAX_GAW 0x4 diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index af1168e8..b727028 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1521,7 +1521,7 @@ static inline void vpid_sync_vcpu_single(int vpid) static inline void vpid_sync_vcpu_global(void) { if (cpu_has_vmx_invvpid_global()) - __invvpid(VMX_VPID_EXTENT_ALL_CONTEXT, 0, 0); + __invvpid(VMX_VPID_EXTENT_GLOBAL_CONTEXT, 0, 0); } static inline void vpid_sync_context(int vpid) @@ -7747,7 +7747,7 @@ static int handle_invvpid(struct kvm_vcpu *vcpu) * Old versions of KVM use the single-context version so we * have to support it; just treat it the same as all-context. */ - case VMX_VPID_EXTENT_ALL_CONTEXT: + case VMX_VPID_EXTENT_GLOBAL_CONTEXT: __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02); nested_vmx_succeed(vcpu); break;