Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp176852pxj; Tue, 18 May 2021 00:22:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3+SXRwQ0+Lzd1JcG5/0kW6fuwri7mZzJA7ryrerBsYRGwazI9Yje+0GznQ7XkcrH11KNW X-Received: by 2002:a17:906:5855:: with SMTP id h21mr4632399ejs.522.1621322553724; Tue, 18 May 2021 00:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621322553; cv=none; d=google.com; s=arc-20160816; b=PL0lGFOQxUmJPtQXlswClkPGdCqpUcBN5Vg1RXil0gl60TUggVjDmI5MD66aVA7xvL nGPuNIRDYybvM6TVq/wSXBFqwjIcZAbiJH5IHfrFjsws8WKgpjpe4TlJ0Zte8nEqOQbk LBBX2VF5Ta94GnLfQYS5yrP20MK/Y+x4A92TZm5yV++3CQ2OJuDWgXOrFHkBnzH9rDW+ qaNKrtzOGE1725vCK+d1LifQQ97pYJ7KenCMiNqaclmOaX4oitrALFY0oBXrEslMheLh Bop6djqOvFWLcyrGa6UhqoTQgQRx/77663jY6DjM6ujh/Z9KTtqPOwChs+iUy3SKqgy0 SWVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rTx6Y/2+lSDpElurRGO+pTz6xnu+Pv/86f26tJJMpDw=; b=SCRNX8vNnCeWAg3CmqTe0gHKN4TJFGL5i5Jec6Qd2W7dtxf5RodJC+by1zp6BKm72b X0c2TkMhISs8/Z4ySpmdwdYT5aihYH73heN2nUHA92p+6fY6bcT9f/Lt4e/q3U1XCEgS SS0aeo3WFdrK16bb4dsJB3E9J5cru+EbrY73SIB2lfWm+Jx/S9sx82A2KR6pY+t9sIyt 787gaUC8+HZRIOtJuop8jXRqYHiFQDKYydr90Nt5KXbW6k0x5hG+6VX/zSe5NO5EF1sl eKRtHQHWdN2RwFjClNXlD2pxja5LrA3hfYR5RsquTAzLDf39mnn/9Ixa7va4m8Bj8my7 8xlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UyTMQ4i+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv15si4406188ejc.501.2021.05.18.00.22.10; Tue, 18 May 2021 00:22:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UyTMQ4i+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242410AbhEQOzR (ORCPT + 99 others); Mon, 17 May 2021 10:55:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:40572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241120AbhEQOq7 (ORCPT ); Mon, 17 May 2021 10:46:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 04B9B613CB; Mon, 17 May 2021 14:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261316; bh=A006AgdxBXRnoTPPBJocUkBUCbHkMSo6a8novqhFVXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UyTMQ4i+oLfrUhcRWmJAr1TFDIhwYgLpBCgVMCwMDOnUxAAYSVBxTBI1Bl7sSOydR iF+5ll1I6DWaOT5uuDBWxhhdWlMEyj8Q2c+hglHWU3Ofo/ft349hLADTID4dKrMMu1 DsBb8fUEORoFddKFuaPB6aNjvxh2i0R51gYg7/sU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Jim Mattson , Reiji Watanabe , Paolo Bonzini Subject: [PATCH 5.12 333/363] KVM: VMX: Do not advertise RDPID if ENABLE_RDTSCP control is unsupported Date: Mon, 17 May 2021 16:03:19 +0200 Message-Id: <20210517140313.865730287@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson commit 8aec21c04caa2000f91cf8822ae0811e4b0c3971 upstream. Clear KVM's RDPID capability if the ENABLE_RDTSCP secondary exec control is unsupported. Despite being enumerated in a separate CPUID flag, RDPID is bundled under the same VMCS control as RDTSCP and will #UD in VMX non-root if ENABLE_RDTSCP is not enabled. Fixes: 41cd02c6f7f6 ("kvm: x86: Expose RDPID in KVM_GET_SUPPORTED_CPUID") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20210504171734.1434054-2-seanjc@google.com> Reviewed-by: Jim Mattson Reviewed-by: Reiji Watanabe Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/vmx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7352,9 +7352,11 @@ static __init void vmx_set_cpu_caps(void if (!cpu_has_vmx_xsaves()) kvm_cpu_cap_clear(X86_FEATURE_XSAVES); - /* CPUID 0x80000001 */ - if (!cpu_has_vmx_rdtscp()) + /* CPUID 0x80000001 and 0x7 (RDPID) */ + if (!cpu_has_vmx_rdtscp()) { kvm_cpu_cap_clear(X86_FEATURE_RDTSCP); + kvm_cpu_cap_clear(X86_FEATURE_RDPID); + } if (cpu_has_vmx_waitpkg()) kvm_cpu_cap_check_and_set(X86_FEATURE_WAITPKG);