From patchwork Fri Feb 12 00:34:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12084529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2123C433DB for ; Fri, 12 Feb 2021 00:35:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AFB5264E55 for ; Fri, 12 Feb 2021 00:35:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbhBLAfI (ORCPT ); Thu, 11 Feb 2021 19:35:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230238AbhBLAe5 (ORCPT ); Thu, 11 Feb 2021 19:34:57 -0500 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3093BC061786 for ; Thu, 11 Feb 2021 16:34:17 -0800 (PST) Received: by mail-qk1-x74a.google.com with SMTP id u66so5993685qkd.13 for ; Thu, 11 Feb 2021 16:34:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=XKAXpkAK94m0RVh5MFfko19Er9G2ZY3kVKxPG6EQzGU=; b=vjd6+zoLspGHBkN7ol8n4f+FjOIp8P2A/+YjMZg6o1//7bbDDw3LDFDWuQI/immX0s wXQdgoclJ2QdYDRqMi3zEeojvNCPe92KwX7KJ5fZ9UbzTqofpAt533+Jq84tbqxA4Y8B 7cAx8qPdmBol9OoS8mgP6KYje4BE3GyGH87kFGokeMMb9OMtHyitSynWP52CX/MfFPg0 5FeR/97QZf5daWhIOf+ZGCcWY5AoRPBzosRmBzWMEybSvVapSutS5FPHl8Y5y4Ve2klP dbrBNWf9g/wX4XGBcPOyHaVcSghSWi0fzrrKW2AtWRpDtzQ2zmMphIE52u6VDOM/+spw QT0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=XKAXpkAK94m0RVh5MFfko19Er9G2ZY3kVKxPG6EQzGU=; b=Ko+/7yCOZ7H1pF4p26D7dVGG07E7EW/4G/zqgiCnt+DsiPQ4O/+r9obZoCG27Mpmz8 jgcGpLKa/JZqJvYx+iA9WOG30MVrzskkiIGDKz3UT5HQASXn1niRCW28kJCozXrNeChG FKPU2kpYtbCFgnALvY6FOk8P66Ql6/NQ1Qx1Dc6NvSQMM1UppyAR8/67aygRrI1wDNP/ tWabNcf4/PrC15GwlkojezYiHpZUMcAclqYUf84Fxmo8wAji1QoKMzD8MMB41TXilrdR JDyyecKcWgHLlaJ/6F8Tr31suumDrbLqJ73iV5LBzF3fhar+eYMHRAc0Y48OM6OGbZte ENSQ== X-Gm-Message-State: AOAM533Wo6vI9VJg+mMhmXpG9jo9nZEZRj2VUwx/GUTsgPn1EFQB1RL2 1Bzw0K9LQpn2xa479T8zX8hp4h91GlE= X-Google-Smtp-Source: ABdhPJzam5xHM6CKpgswhd+0Z76z2ZKGfRhz/IAvdhuId1g4omPd3547ZhuvaFerJAKBULuhxD/8NzglLrk= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:f588:a708:f347:3ebb]) (user=seanjc job=sendgmr) by 2002:a0c:f589:: with SMTP id k9mr552818qvm.0.1613090056322; Thu, 11 Feb 2021 16:34:16 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 11 Feb 2021 16:34:09 -0800 In-Reply-To: <20210212003411.1102677-1-seanjc@google.com> Message-Id: <20210212003411.1102677-2-seanjc@google.com> Mime-Version: 1.0 References: <20210212003411.1102677-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 1/3] KVM: SVM: Intercept INVPCID when it's disabled to inject #UD From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Babu Moger Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Intercept INVPCID if it's disabled in the guest, even when using NPT, as KVM needs to inject #UD in this case. Fixes: 4407a797e941 ("KVM: SVM: Enable INVPCID feature on AMD") Cc: Babu Moger Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson --- arch/x86/kvm/svm/svm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 42d4710074a6..ca9706c2f99b 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -1103,12 +1103,12 @@ static u64 svm_write_l1_tsc_offset(struct kvm_vcpu *vcpu, u64 offset) static void svm_check_invpcid(struct vcpu_svm *svm) { /* - * Intercept INVPCID instruction only if shadow page table is - * enabled. Interception is not required with nested page table - * enabled. + * Intercept INVPCID if shadow paging is enabled to sync/free shadow + * roots, or if INVPCID is disabled in the guest to inject #UD. */ if (kvm_cpu_cap_has(X86_FEATURE_INVPCID)) { - if (!npt_enabled) + if (!npt_enabled || + !guest_cpuid_has(&svm->vcpu, X86_FEATURE_INVPCID)) svm_set_intercept(svm, INTERCEPT_INVPCID); else svm_clr_intercept(svm, INTERCEPT_INVPCID); From patchwork Fri Feb 12 00:34:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12084531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2E7DC433E6 for ; Fri, 12 Feb 2021 00:35:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7C3B64E56 for ; Fri, 12 Feb 2021 00:35:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbhBLAfM (ORCPT ); Thu, 11 Feb 2021 19:35:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbhBLAfA (ORCPT ); Thu, 11 Feb 2021 19:35:00 -0500 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B6E8C061788 for ; Thu, 11 Feb 2021 16:34:20 -0800 (PST) Received: by mail-qv1-xf49.google.com with SMTP id bc13so5196886qvb.9 for ; Thu, 11 Feb 2021 16:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=M+eyZ12tarq6UkDTGfT0OACpGX3Sqrl84N/PdHAw1yU=; b=noaYGPU2lYBspzZciBFmGhYBxjzuQ7nsmNTnWE7bK+VXu1VfCXybGuUI3vhsNy0Vkw m4sEnBsWWYJPdfib4mqj77emep6BvLkp66x6M3B2dC4bFuaYLcJ9I6blaCgrgMwyzeER n9vW4Ya5T967d1I+JLEJ8J1m4ifdoqOEBxbKcBtmgv6oTFBIGGF3lanJrary0UbAZc+N fv9kgzA/qPiarqOAkcyFYTTAUOdOhI+uBHmIW3AgJNukRZEifAcJZQPaSFddjjYWGhEB zxDXK6DlOqRKWSb/e2ccRbj31QToEOqObrRgGoK51y+eP6O7zkK2E+w9eSJDv5XKhqGi T3aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=M+eyZ12tarq6UkDTGfT0OACpGX3Sqrl84N/PdHAw1yU=; b=uPSJd1+t6pa2zHFTxd+G27XNiWuGIUTNjUpRWCx3hpuSpTDjk7VXJrQXlJxmhW2Glq zd5QeWkY21aZgZ7Zx7IQC4Pn75yKjVkd/TwgFzlcZ6ME4WIYMsA8VNH5cq0FyxtUc/hk jUMRn4XRTDww1lycdkyeeTnVOLLYNpRStHWIfeWqfwCF2d+ZxFuH1xAhB9m4N03Il+Lk +wHSS8TZGHulR58kIl11d2c9oEXWRR5Q/MHbPmYGVlFhWtiJodFpon6MIo3lqd4Rx/Qg +OWRNOILaQcXpUoi3R1uX9V7X9l6yKR0uxb8yZn1CWEyDke0l4ZIucqbfn2HFzdZZ2eU WlMA== X-Gm-Message-State: AOAM532bzyq1QgKu6KhT5KPlUvWY8HDdXOZYdgrjgcfYDnTk8NPEDa+v f5c4FmI0m1NLzxa0YP1vsK7c+0vP+1A= X-Google-Smtp-Source: ABdhPJxEkdaoRqPqf5oFS/oyQj2EMhabB41ggzQAHTxQMUh2tIPzigyF9exo98vwfWsvOTuVsIo8wFsMAVw= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:f588:a708:f347:3ebb]) (user=seanjc job=sendgmr) by 2002:ad4:4b30:: with SMTP id s16mr520658qvw.62.1613090059665; Thu, 11 Feb 2021 16:34:19 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 11 Feb 2021 16:34:10 -0800 In-Reply-To: <20210212003411.1102677-1-seanjc@google.com> Message-Id: <20210212003411.1102677-3-seanjc@google.com> Mime-Version: 1.0 References: <20210212003411.1102677-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 2/3] KVM: x86: Advertise INVPCID by default From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Babu Moger Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Advertise INVPCID by default (if supported by the host kernel) instead of having both SVM and VMX opt in. INVPCID was opt in when it was a VMX only feature so that KVM wouldn't prematurely advertise support if/when it showed up in the kernel on AMD hardware. Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson --- arch/x86/kvm/cpuid.c | 2 +- arch/x86/kvm/svm/svm.c | 3 --- arch/x86/kvm/vmx/vmx.c | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index c8f2592ccc99..6bd2f8b830e4 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -408,7 +408,7 @@ void kvm_set_cpu_caps(void) kvm_cpu_cap_mask(CPUID_7_0_EBX, F(FSGSBASE) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) | - F(BMI2) | F(ERMS) | 0 /*INVPCID*/ | F(RTM) | 0 /*MPX*/ | F(RDSEED) | + F(BMI2) | F(ERMS) | F(INVPCID) | F(RTM) | 0 /*MPX*/ | F(RDSEED) | F(ADX) | F(SMAP) | F(AVX512IFMA) | F(AVX512F) | F(AVX512PF) | F(AVX512ER) | F(AVX512CD) | F(CLFLUSHOPT) | F(CLWB) | F(AVX512DQ) | F(SHA_NI) | F(AVX512BW) | F(AVX512VL) | 0 /*INTEL_PT*/ diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index ca9706c2f99b..f4eca77f65c6 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -926,9 +926,6 @@ static __init void svm_set_cpu_caps(void) if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) || boot_cpu_has(X86_FEATURE_AMD_SSBD)) kvm_cpu_cap_set(X86_FEATURE_VIRT_SSBD); - - /* Enable INVPCID feature */ - kvm_cpu_cap_check_and_set(X86_FEATURE_INVPCID); } static __init int svm_hardware_setup(void) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index e0a3a9be654b..6d265b2523f8 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7330,8 +7330,8 @@ static __init void vmx_set_cpu_caps(void) /* CPUID 0x7 */ if (kvm_mpx_supported()) kvm_cpu_cap_check_and_set(X86_FEATURE_MPX); - if (cpu_has_vmx_invpcid()) - kvm_cpu_cap_check_and_set(X86_FEATURE_INVPCID); + if (!cpu_has_vmx_invpcid()) + kvm_cpu_cap_clear(X86_FEATURE_INVPCID); if (vmx_pt_mode_is_host_guest()) kvm_cpu_cap_check_and_set(X86_FEATURE_INTEL_PT); From patchwork Fri Feb 12 00:34:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12084533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20328C433DB for ; Fri, 12 Feb 2021 00:36:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE01D61493 for ; Fri, 12 Feb 2021 00:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230427AbhBLAf6 (ORCPT ); Thu, 11 Feb 2021 19:35:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230344AbhBLAfl (ORCPT ); Thu, 11 Feb 2021 19:35:41 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C08CFC06178B for ; Thu, 11 Feb 2021 16:34:22 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id f127so7871835ybf.12 for ; Thu, 11 Feb 2021 16:34:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=HiLuaEqgR2Zld6XmaaPoO5KvEAReZ5PkM63iqGTwhYE=; b=ZsKNp492o99jcgPOmAK9In2KwTkldmofXtwhobMCDR54LWHgw43V6No73zBR1S5ALi fx0ZOcy7c+r+wQrPsBDFdugM41Dh5lpn+VNZBgLOrMleScPRqb/tNiwzoQEGm1TjJOJn l6ddgrgyUwK+TTDdcv4E7MbMabLrG7drll821snERsbcjmnYKhU0aUH43h6RtpGdwqnB knsdzOM7TU1C3dnTEYqN5h2jgfqnz2XsBEKmg6ilFTnpFXqd3G9rgQgf67CBWpiFuBoi j7NOGRDhbQvawgpRsBEZv+khpTk17mhPdzoAxXC/hwRTaRNDZQ5x7qNQfCPvan7I61nq TeDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=HiLuaEqgR2Zld6XmaaPoO5KvEAReZ5PkM63iqGTwhYE=; b=RDO2sfrOVHThQwzpOGt18Qo5i0Xd54s/F0BUr2q8K9apA8kUBXqEiclgEGRBZ59YcV qMKvuvXgVVAjiD4kgX9KL5BMyiZm0a4meAGiqk0LVW/kWx8tgx/Uvs/txm44Ox7aOsna ruR8fuTv/omw/z0LWovXx2B856DmhZEzlkm3vWq2QuajWIt8ZT4GwMWprOuxZyEOKyE8 lvf84AuPHDoexGzfQIEx/uIObTcAAdtpdakPvqhPHfQG4a2jjmuI5L0zTo/12cimrV2k XGi8xqBBqhHl7MvfuCZzL8pNvkSCiC/1QzFsMaS0nb4Mw+9LlWnbW5GP6tEXVIaFs85L yqZw== X-Gm-Message-State: AOAM530AcXsPoQwJQViL2t2BVKqVXoVhyX/YM88Em5gDiPJxECk59So+ gCUy3T7qXwTC7BXFqcETXswD+8QszJ4= X-Google-Smtp-Source: ABdhPJwK5b+suKRPnqy0zqTg7zGY3SLR+Mwuz3838RchlSecSDLe7wNZ+yk5VjjAgFs7GvC5s5tPDbKjUGM= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:f588:a708:f347:3ebb]) (user=seanjc job=sendgmr) by 2002:a25:2b04:: with SMTP id r4mr699264ybr.219.1613090062011; Thu, 11 Feb 2021 16:34:22 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 11 Feb 2021 16:34:11 -0800 In-Reply-To: <20210212003411.1102677-1-seanjc@google.com> Message-Id: <20210212003411.1102677-4-seanjc@google.com> Mime-Version: 1.0 References: <20210212003411.1102677-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 3/3] KVM: VMX: Allow INVPCID in guest without PCID From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Babu Moger Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Remove the restriction that prevents VMX from exposing INVPCID to the guest without PCID also being exposed to the guest. The justification of the restriction is that INVPCID will #UD if it's disabled in the VMCS. While that is a true statement, it's also true that RDTSCP will #UD if it's disabled in the VMCS. Neither of those things has any dependency whatsoever on the guest being able to set CR4.PCIDE=1, which is what is effectively allowed by exposing PCID to the guest. Removing the bogus restriction aligns VMX with SVM, and also allows for an interesting configuration. INVPCID is that fastest way to do a global TLB flush, e.g. see native_flush_tlb_global(). Allowing INVPCID without PCID would let a guest use the expedited flush while also limiting the number of ASIDs consumed by the guest. Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson --- arch/x86/kvm/vmx/vmx.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 6d265b2523f8..e1b84008a05d 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4295,18 +4295,8 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx) } vmx_adjust_sec_exec_feature(vmx, &exec_control, rdtscp, RDTSCP); - - /* - * Expose INVPCID if and only if PCID is also exposed to the guest. - * INVPCID takes a #UD when it's disabled in the VMCS, but a #GP or #PF - * if CR4.PCIDE=0. Enumerating CPUID.INVPCID=1 would lead to incorrect - * behavior from the guest perspective (it would expect #GP or #PF). - */ - if (!guest_cpuid_has(vcpu, X86_FEATURE_PCID)) - guest_cpuid_clear(vcpu, X86_FEATURE_INVPCID); vmx_adjust_sec_exec_feature(vmx, &exec_control, invpcid, INVPCID); - vmx_adjust_sec_exec_exiting(vmx, &exec_control, rdrand, RDRAND); vmx_adjust_sec_exec_exiting(vmx, &exec_control, rdseed, RDSEED);