lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241014130948.1476946-3-papaluri@amd.com>
Date: Mon, 14 Oct 2024 08:09:48 -0500
From: Pavan Kumar Paluri <papaluri@....com>
To: <linux-kernel@...r.kernel.org>
CC: <linux-doc@...r.kernel.org>, <linux-coco@...ts.linux.dev>, Borislav Petkov
	<bp@...en8.de>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar
	<mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>, "Eric Van
 Tassell" <Eric.VanTassell@....com>, Tom Lendacky <thomas.lendacky@....com>,
	Ashish Kalra <ashish.kalra@....com>, Michael Roth <michael.roth@....com>, "H
 . Peter Anvin" <hpa@...or.com>, Peter Zijlstra <peterz@...radead.org>, "Pavan
 Kumar Paluri" <papaluri@....com>, Dhaval Giani <dhaval.giani@....com>
Subject: [PATCH v7 2/2] x86 KVM:SVM: 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.

Co-developed-by: Eric Van Tassell <Eric.VanTassell@....com>
Signed-off-by: Eric Van Tassell <Eric.VanTassell@....com>
Signed-off-by: Pavan Kumar Paluri <papaluri@....com>
Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
---
 Documentation/arch/x86/x86_64/boot-options.rst | 5 +++++
 arch/x86/virt/svm/cmdline.c                    | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/Documentation/arch/x86/x86_64/boot-options.rst b/Documentation/arch/x86/x86_64/boot-options.rst
index 98d4805f0823..d69e3cfbdba5 100644
--- a/Documentation/arch/x86/x86_64/boot-options.rst
+++ b/Documentation/arch/x86/x86_64/boot-options.rst
@@ -305,3 +305,8 @@ The available options are:
 
    debug
      Enable debug messages.
+
+   nosnp
+     Do not enable SEV-SNP (applies to host/hypervisor only). Setting
+     'nosnp' avoids the RMP check overhead in memory accesses when
+     users do not want to run SEV-SNP guests.
diff --git a/arch/x86/virt/svm/cmdline.c b/arch/x86/virt/svm/cmdline.c
index add4bae3ebef..13e04547f4df 100644
--- a/arch/x86/virt/svm/cmdline.c
+++ b/arch/x86/virt/svm/cmdline.c
@@ -10,6 +10,7 @@
 #include <linux/string.h>
 #include <linux/printk.h>
 #include <linux/cache.h>
+#include <linux/cpufeature.h>
 
 #include <asm/sev-common.h>
 
@@ -25,6 +26,12 @@ static int __init init_sev_config(char *str)
 			continue;
 		}
 
+		if (!strcmp(s, "nosnp")) {
+			setup_clear_cpu_cap(X86_FEATURE_SEV_SNP);
+			cc_platform_clear(CC_ATTR_HOST_SEV_SNP);
+			continue;
+		}
+
 		pr_info("SEV command-line option '%s' was not recognized\n", s);
 	}
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ