Skip to content

Commit 2db67aa

Browse files
Pavan Kumar Paluribp3tk0v
authored andcommitted
x86/virt: Provide "nosnp" boot option for sev kernel command line
Provide a "nosnp" kernel command line option to prevent enabling of the RMP and SEV-SNP features in the host/hypervisor. Not initializing the RMP removes system overhead associated with RMP checks. [ bp: Actually make it a HV-only cmdline option. ] Co-developed-by: Eric Van Tassell <[email protected]> Signed-off-by: Eric Van Tassell <[email protected]> Signed-off-by: Pavan Kumar Paluri <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4ae47fa commit 2db67aa

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Documentation/arch/x86/x86_64/boot-options.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,8 @@ The available options are:
305305

306306
debug
307307
Enable debug messages.
308+
309+
nosnp
310+
Do not enable SEV-SNP (applies to host/hypervisor only). Setting
311+
'nosnp' avoids the RMP check overhead in memory accesses when
312+
users do not want to run SEV-SNP guests.

arch/x86/virt/svm/cmdline.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/string.h>
1111
#include <linux/printk.h>
1212
#include <linux/cache.h>
13+
#include <linux/cpufeature.h>
1314

1415
#include <asm/sev-common.h>
1516

@@ -25,6 +26,17 @@ static int __init init_sev_config(char *str)
2526
continue;
2627
}
2728

29+
if (!strcmp(s, "nosnp")) {
30+
if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) {
31+
setup_clear_cpu_cap(X86_FEATURE_SEV_SNP);
32+
cc_platform_clear(CC_ATTR_HOST_SEV_SNP);
33+
continue;
34+
} else {
35+
goto warn;
36+
}
37+
}
38+
39+
warn:
2840
pr_info("SEV command-line option '%s' was not recognized\n", s);
2941
}
3042

0 commit comments

Comments
 (0)