* [PATCH 0/2] x86/sev: Fix RMPOPT enablement on non-RMPOPT configs
@ 2026-10-13 15:44 Ashish Kalra
2026-10-13 15:44 ` [PATCH 1/2] x86/sev: Clear RMPOPT when segmented RMP is disabled by firmware Ashish Kalra
2026-10-13 15:44 ` [PATCH 2/2] x86/sev: Only announce RMPOPT optimizations when SNP is enabled Ashish Kalra
0 siblings, 2 replies; 3+ messages in thread
From: Ashish Kalra @ 2026-10-13 15:44 UTC (permalink / raw)
To: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, peterz,
thomas.lendacky, herbert, davem, ardb
Cc: pbonzini, aik, Michael.Roth, KPrateek.Nayak, Tycho.Andersen,
Nathan.Fontenot, ackerleytng, jackyli, pgonda, rientjes, jacobhxu,
xin, pawan.kumar.gupta, babu.moger, dyoung, nikunj, darwi,
linux-kernel, linux-crypto, kvm, linux-coco
From: Ashish Kalra <ashish.kalra@amd.com>
Two fixes for the RMPOPT series, both for configurations where the
RMPOPT CPUID bit is advertised but RMPOPT is not actually usable:
Patch 1 clears X86_FEATURE_RMPOPT when the platform advertises segmented
RMP but the firmware has it disabled (contiguous RMP) - otherwise the
RMPOPT initcall programs RMPOPT_BASE and issues RMPOPT, which #GP.
Patch 2 moves the "RMPOPT optimizations enabled" message out of the
feature-only-gated initcall and into the SNP-gated enable path, so it is
not printed when SNP is disabled in the BIOS.
Both restore the behaviour of the posted series; the issues were
introduced when the series was applied (see the per-patch notes). Each
carries a Fixes: tag.
Ashish Kalra (2):
x86/sev: Clear RMPOPT when segmented RMP is disabled by firmware
x86/sev: Only announce RMPOPT optimizations when SNP is enabled
arch/x86/virt/svm/sev.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
base-commit: 250ee734115bca1c1f7a38d838909aa83cce87ae
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] x86/sev: Clear RMPOPT when segmented RMP is disabled by firmware
2026-10-13 15:44 [PATCH 0/2] x86/sev: Fix RMPOPT enablement on non-RMPOPT configs Ashish Kalra
@ 2026-10-13 15:44 ` Ashish Kalra
2026-10-13 15:44 ` [PATCH 2/2] x86/sev: Only announce RMPOPT optimizations when SNP is enabled Ashish Kalra
1 sibling, 0 replies; 3+ messages in thread
From: Ashish Kalra @ 2026-10-13 15:44 UTC (permalink / raw)
To: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, peterz,
thomas.lendacky, herbert, davem, ardb
Cc: pbonzini, aik, Michael.Roth, KPrateek.Nayak, Tycho.Andersen,
Nathan.Fontenot, ackerleytng, jackyli, pgonda, rientjes, jacobhxu,
xin, pawan.kumar.gupta, babu.moger, dyoung, nikunj, darwi,
linux-kernel, linux-crypto, kvm, linux-coco
From: Ashish Kalra <ashish.kalra@amd.com>
snp_probe_rmptable_info() only clears X86_FEATURE_RMPOPT when the platform
does not advertise X86_FEATURE_SEGMENTED_RMP, or when the segmented RMP
table probe fails. It misses the case where the platform advertises
segmented RMP but the firmware has it disabled (MSR_AMD64_RMP_CFG's
SEG_RMP_ENABLED bit is clear), so the system runs with a contiguous RMP:
that path falls through to the contiguous probe with X86_FEATURE_RMPOPT
still set.
X86_FEATURE_RMPOPT is a CPUID bit advertised independently of whether
segmented RMP is enabled, but RMPOPT requires an enabled segmented RMP.
With the capability left set, the RMPOPT initcall programs RMPOPT_BASE and
issues the RMPOPT instruction, both of which #GP on a contiguous RMP:
unchecked MSR access error: WRMSR to 0xc0010139 ...
general protection fault ... snp_enable_rmpopt
Clear X86_FEATURE_RMPOPT on the common contiguous fall-through so it covers
both "segmented RMP not supported" and "segmented RMP supported but
disabled by firmware". The clear runs at BSP init before alternatives, so
the subsequent cpu_feature_enabled(X86_FEATURE_RMPOPT) checks observe it.
Fixes: 15d974be0a3b ("x86/sev: Initialize RMPOPT configuration MSRs")
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
---
Note: this restores the snp_probe_rmptable_info() structure from the
posted series (v16 3/5), where a single setup_clear_cpu_cap() on the
common contiguous fall-through covered the "SEGMENTED_RMP advertised but
disabled by firmware" case (called out in the v16 cover letter). When
applied, 15d974be0a3b narrowed that clear into an else branch and dropped
that case.
arch/x86/virt/svm/sev.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
index bd70c4d0b774..43e4945e6cdf 100644
--- a/arch/x86/virt/svm/sev.c
+++ b/arch/x86/virt/svm/sev.c
@@ -827,10 +827,16 @@ bool snp_probe_rmptable_info(void)
setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
return false;
}
- } else {
- setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
}
+ /*
+ * Segmented RMP is either not supported on the platform or is
+ * disabled by the firmware. RMPOPT is not supported without
+ * segmented RMP, so drop the capability before it reaches the
+ * initcall and faults programming RMPOPT_BASE / issuing RMPOPT.
+ */
+ setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
+
return probe_contiguous_rmptable_info();
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] x86/sev: Only announce RMPOPT optimizations when SNP is enabled
2026-10-13 15:44 [PATCH 0/2] x86/sev: Fix RMPOPT enablement on non-RMPOPT configs Ashish Kalra
2026-10-13 15:44 ` [PATCH 1/2] x86/sev: Clear RMPOPT when segmented RMP is disabled by firmware Ashish Kalra
@ 2026-10-13 15:44 ` Ashish Kalra
1 sibling, 0 replies; 3+ messages in thread
From: Ashish Kalra @ 2026-10-13 15:44 UTC (permalink / raw)
To: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, peterz,
thomas.lendacky, herbert, davem, ardb
Cc: pbonzini, aik, Michael.Roth, KPrateek.Nayak, Tycho.Andersen,
Nathan.Fontenot, ackerleytng, jackyli, pgonda, rientjes, jacobhxu,
xin, pawan.kumar.gupta, babu.moger, dyoung, nikunj, darwi,
linux-kernel, linux-crypto, kvm, linux-coco
From: Ashish Kalra <ashish.kalra@amd.com>
rmpopt_init() prints "RMPOPT optimizations enabled" gated only on
X86_FEATURE_RMPOPT, which is a CPUID bit advertised independently of
whether SNP is active. On a system where SNP is disabled in the BIOS the
message is still printed at boot even though RMPOPT is never actually used
(snp_enable_rmpopt() bails out on !CC_ATTR_HOST_SEV_SNP), which is
misleading.
rmpopt_init() is only the software setup (workqueue and the delayed work);
the capability that matters for the message - an active SNP host - is
checked in snp_enable_rmpopt(). Move the announcement there, as a
pr_info_once(), so it is emitted only when RMPOPT is actually enabled on an
SNP host.
Fixes: c6c6f156d192 ("x86/sev: Perform RMP optimizations asynchronously")
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
---
Note: in the posted series the pr_info_once() lived in
snp_enable_rmpopt() (SNP-gated); when applied, c6c6f156d192 moved it to
rmpopt_init() (feature-only-gated) as a plain pr_info(). This restores the
original placement.
arch/x86/virt/svm/sev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
index 43e4945e6cdf..6f5f4ee821d0 100644
--- a/arch/x86/virt/svm/sev.c
+++ b/arch/x86/virt/svm/sev.c
@@ -656,8 +656,6 @@ static int __init rmpopt_init(void)
if ((rmpopt_pa_end - rmpopt_pa_start) > SZ_2T)
rmpopt_pa_end = rmpopt_pa_start + SZ_2T;
- pr_info("RMPOPT optimizations enabled\n");
-
rmpopt_soft_init = true;
return 0;
@@ -690,6 +688,8 @@ void snp_enable_rmpopt(void)
mod_delayed_work(rmpopt_wq, &rmpopt_delayed_work,
msecs_to_jiffies(RMPOPT_WORK_TIMEOUT));
+
+ pr_info_once("RMPOPT optimizations enabled\n");
}
EXPORT_SYMBOL_FOR_MODULES(snp_enable_rmpopt, "ccp,kvm-amd");
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-13 15:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 15:44 [PATCH 0/2] x86/sev: Fix RMPOPT enablement on non-RMPOPT configs Ashish Kalra
2026-10-13 15:44 ` [PATCH 1/2] x86/sev: Clear RMPOPT when segmented RMP is disabled by firmware Ashish Kalra
2026-10-13 15:44 ` [PATCH 2/2] x86/sev: Only announce RMPOPT optimizations when SNP is enabled Ashish Kalra
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.