[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251031122122.GKaQSpwhLvkinKKbjG@fat_crate.local>
Date: Fri, 31 Oct 2025 13:21:22 +0100
From: Borislav Petkov <bp@...en8.de>
To: John Allen <john.allen@....com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org, x86@...nel.org,
seanjc@...gle.com, pbonzini@...hat.com, dave.hansen@...el.com,
rick.p.edgecombe@...el.com, mlevitsk@...hat.com,
weijiang.yang@...el.com, chao.gao@...el.com,
dave.hansen@...ux.intel.com, hpa@...or.com, mingo@...hat.com,
tglx@...utronix.de, thomas.lendacky@....com
Subject: [PATCH] x86/coco/sev: Convert has_cpuflag() to use
cpu_feature_enabled()
On Wed, Sep 24, 2025 at 08:08:50PM +0000, John Allen wrote:
> For shadow stack support in SVM when using SEV-ES, the guest kernel
> needs to save XSS to the GHCB in order for the hypervisor to determine
> the XSAVES save area size.
>
> This series can be applied independently of the hypervisor series in
> order to support non-KVM hypervisors.
> ---
> v3:
> - Only CPUID.0xD.1 consumes XSS. Limit including XSS in GHCB for this
> case.
> v2:
> - Update changelog for patch 2/2
>
> John Allen (2):
> x86/boot: Move boot_*msr helpers to asm/shared/msr.h
> x86/sev-es: Include XSS value in GHCB CPUID request
>
> arch/x86/boot/compressed/sev.c | 7 ++++---
> arch/x86/boot/compressed/sev.h | 6 +++---
> arch/x86/boot/cpucheck.c | 16 ++++++++--------
> arch/x86/boot/msr.h | 26 --------------------------
> arch/x86/coco/sev/vc-shared.c | 11 +++++++++++
> arch/x86/include/asm/shared/msr.h | 15 +++++++++++++++
> arch/x86/include/asm/svm.h | 1 +
> 7 files changed, 42 insertions(+), 40 deletions(-)
> delete mode 100644 arch/x86/boot/msr.h
---
Ontop:
From: "Borislav Petkov (AMD)" <bp@...en8.de>
Date: Thu, 30 Oct 2025 17:59:11 +0100
Subject: [PATCH] x86/coco/sev: Convert has_cpuflag() to use cpu_feature_enabled()
Drop one redundant definition, while at it.
There should be no functional changes.
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
---
arch/x86/boot/startup/sev-shared.c | 2 +-
arch/x86/coco/sev/vc-handle.c | 1 -
arch/x86/coco/sev/vc-shared.c | 2 +-
arch/x86/lib/kaslr.c | 2 +-
4 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/x86/boot/startup/sev-shared.c b/arch/x86/boot/startup/sev-shared.c
index 4e22ffd73516..a0fa8bb2b945 100644
--- a/arch/x86/boot/startup/sev-shared.c
+++ b/arch/x86/boot/startup/sev-shared.c
@@ -12,7 +12,7 @@
#include <asm/setup_data.h>
#ifndef __BOOT_COMPRESSED
-#define has_cpuflag(f) boot_cpu_has(f)
+#define has_cpuflag(f) cpu_feature_enabled(f)
#else
#undef WARN
#define WARN(condition, format...) (!!(condition))
diff --git a/arch/x86/coco/sev/vc-handle.c b/arch/x86/coco/sev/vc-handle.c
index 7fc136a35334..f08c7505ed82 100644
--- a/arch/x86/coco/sev/vc-handle.c
+++ b/arch/x86/coco/sev/vc-handle.c
@@ -352,7 +352,6 @@ static enum es_result vc_read_mem(struct es_em_ctxt *ctxt,
#define sev_printk(fmt, ...) printk(fmt, ##__VA_ARGS__)
#define error(v)
-#define has_cpuflag(f) boot_cpu_has(f)
#include "vc-shared.c"
diff --git a/arch/x86/coco/sev/vc-shared.c b/arch/x86/coco/sev/vc-shared.c
index e2ac95de4611..58b2f985d546 100644
--- a/arch/x86/coco/sev/vc-shared.c
+++ b/arch/x86/coco/sev/vc-shared.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#ifndef __BOOT_COMPRESSED
-#define has_cpuflag(f) boot_cpu_has(f)
+#define has_cpuflag(f) cpu_feature_enabled(f)
#endif
static enum es_result vc_check_opcode_bytes(struct es_em_ctxt *ctxt,
diff --git a/arch/x86/lib/kaslr.c b/arch/x86/lib/kaslr.c
index b5893928d55c..8c7cd115b484 100644
--- a/arch/x86/lib/kaslr.c
+++ b/arch/x86/lib/kaslr.c
@@ -22,7 +22,7 @@
#include <asm/setup.h>
#define debug_putstr(v) early_printk("%s", v)
-#define has_cpuflag(f) boot_cpu_has(f)
+#define has_cpuflag(f) cpu_feature_enabled(f)
#define get_boot_seed() kaslr_offset()
#endif
--
2.51.0
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists