Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp657645pxj; Tue, 18 May 2021 11:10:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYB72npQN20jU/+dX+y0R/W6PnuryCOdvTFcppLespKx0aWnV1mZlVV4zT6o8WerwfMiZ7 X-Received: by 2002:a05:6e02:190b:: with SMTP id w11mr5963268ilu.197.1621361436746; Tue, 18 May 2021 11:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621361436; cv=none; d=google.com; s=arc-20160816; b=kKuaoXufCjVyOiAyNjU+PK+6agfmWUpJmi1RPnQ4HzLm+hGGWFnZrnjPhdhykcax8p xwlmqAoYAF08Vret5Dye/PXtpuZjyxtdtFjx4E/FLQSB7Wm4Fb9O0xFRkGi6tZ+9IbcA VuqFkwRaQoDx9SilTZcj3Lfr1YMRJEYadIxR1SLHjiyFJJhQvNEkS0kRwWKbbzsx/vQC JslncNKQL0UCRdX1UoD6niEdaFPSh0w0oPr1Y+prViw5ftyeU49t81eYC/6eUVGWPjRj A5RnTF22N0s4Jqu89luFoNqQYWu3PU5VrUkpGdhwmUfIybs9VnW/n02OElnpj3uLg0wc 1+Vg== 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=9nGYGWIGaSAkbTvVSh1x7YCwb3rRhhEHy8lqRnw/pEg=; b=S2NZr9RExdMPGCtqiOcg+yHCbWFXS9JhuNAO+rTJNBtfNekF+hOnpdiXlfBXUSRaf5 WCjAmNDUdlO2ySxCShEbe+HfMbDvt2/ILF1HXwFECt5oWf2LqYqBNsfPqd63nb/0+ILp CuLfPHIxyWJig6P++8S7IPAZZpvTKyKu6RmYiIDkm43zDRRuoIATKEA9Ap5PVRpiX4qX DlkzM32I6mccE/sjSG26cwyI+lK+N3nuh4Tzl0/D4k98oISmAoSO/Y6P5O69tIa0OBXq XPsrh3O4rrCgbF+HsGdFTAIr6q5IumSYkmXtmjQ/hUJRbS1Cgr3KLuoC9xfm+lyZvDeW uX/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EV8+oZE+; 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 s21si19806873jaj.47.2021.05.18.11.10.24; Tue, 18 May 2021 11:10:36 -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=EV8+oZE+; 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 S235596AbhEQQLC (ORCPT + 99 others); Mon, 17 May 2021 12:11:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:36778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244185AbhEQPrn (ORCPT ); Mon, 17 May 2021 11:47:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BFCC561D3B; Mon, 17 May 2021 14:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262681; bh=Wy5n+kKT3DpRwN3gNA16ZtIgW/KSm8eu08jOP/HWRRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EV8+oZE+FacD4Q7AYo66gv8RJyKuaGg6QOB90Sban18eW1o6ufWkFDYTLXEib1dfC 1WopFcZK81z2kmE3H8sL7Mah0Q/7miY+ckuf5jtlXu3OanANclEDPoRpJT6OntMDMO DoIN1RJUvjUq10lALLnT2Pn4VWHt0jhWDqWlVuQ0= 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.10 259/289] KVM: VMX: Do not advertise RDPID if ENABLE_RDTSCP control is unsupported Date: Mon, 17 May 2021 16:03:04 +0200 Message-Id: <20210517140313.868161885@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 @@ -7302,9 +7302,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);