mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Borislav Petkov <bp@alien8.de>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>
Cc: Kees Cook <keescook@chromium.org>,
	Thomas Lendacky <Thomas.Lendacky@amd.com>, <hughsient@gmail.com>,
	Martin Fernandez <martin.fernandez@eclypsium.com>,
	<linux-kernel@vger.kernel.org>,
	"Brijesh Singh" <brijesh.singh@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v2 2/4] KVM: SVM: Use cc_platform_has instead of CPU feature flags
Date: Fri, 11 Feb 2022 15:02:53 -0600	[thread overview]
Message-ID: <20220211210255.9820-3-mario.limonciello@amd.com> (raw)
In-Reply-To: <20220211210255.9820-1-mario.limonciello@amd.com>

The CPU feature flags may have been cleared earlier by the kernel
if the BIOS didn't activate features.  Instead use `cc_platform_has`
to determine that SEV was enabled.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 arch/x86/kvm/svm/sev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 17b53457d866..d3d1ec78d927 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -2105,7 +2105,7 @@ void __init sev_hardware_setup(void)
 	 * CPU supports decode assists, which is mandatory for SEV guests to
 	 * support instruction emulation.
 	 */
-	if (!boot_cpu_has(X86_FEATURE_SEV) ||
+	if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT) ||
 	    WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_DECODEASSISTS)))
 		goto out;
 
@@ -2153,7 +2153,7 @@ void __init sev_hardware_setup(void)
 		goto out;
 
 	/* Does the CPU support SEV-ES? */
-	if (!boot_cpu_has(X86_FEATURE_SEV_ES))
+	if (!cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT))
 		goto out;
 
 	/* Has the system been allocated ASIDs for SEV-ES? */
-- 
2.34.1


  parent reply	other threads:[~2022-02-11 21:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 21:02 [PATCH v2 0/4] Only export SME/SEV/SEV_ES features when activated Mario Limonciello
2022-02-11 21:02 ` [PATCH v2 1/4] crypto: ccp: Use cc_platform_has to determine SEV presence Mario Limonciello
2022-02-11 21:02 ` Mario Limonciello [this message]
2022-02-11 21:02 ` [PATCH v2 3/4] x86/cpu: clear SME features when not in use Mario Limonciello
2022-02-11 21:17   ` Tom Lendacky
2022-02-11 21:02 ` [PATCH v2 4/4] x86/cpu: clear SEV/SEV_ES " Mario Limonciello
2022-02-11 21:13 ` [PATCH v2 0/4] Only export SME/SEV/SEV_ES features when activated Tom Lendacky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220211210255.9820-3-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=hughsient@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.fernandez@eclypsium.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®