From: Pavan Kumar Paluri <papaluri@amd.com>
To: <linux-kernel@vger.kernel.org>
Cc: <linux-doc@vger.kernel.org>, <linux-coco@lists.linux.dev>,
Borislav Petkov <bp@alien8.de>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
"Eric Van Tassell" <Eric.VanTassell@amd.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Ashish Kalra <ashish.kalra@amd.com>,
Michael Roth <michael.roth@amd.com>,
"H . Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
"Pavan Kumar Paluri" <papaluri@amd.com>,
Dhaval Giani <dhaval.giani@amd.com>
Subject: [PATCH v6 2/2] x86 KVM:SVM: Provide "nosnp" boot option for sev kernel command line
Date: Thu, 10 Oct 2024 07:14:55 -0500 [thread overview]
Message-ID: <20241010121455.15795-3-papaluri@amd.com> (raw)
In-Reply-To: <20241010121455.15795-1-papaluri@amd.com>
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@amd.com>
Signed-off-by: Eric Van Tassell <Eric.VanTassell@amd.com>
Signed-off-by: Pavan Kumar Paluri <papaluri@amd.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.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 9640507342e0..313415d6f53f 100644
--- a/arch/x86/virt/svm/cmdline.c
+++ b/arch/x86/virt/svm/cmdline.c
@@ -11,6 +11,7 @@
#include <linux/printk.h>
#include <asm/sev-common.h>
+#include <asm/cpufeature.h>
struct sev_config sev_cfg __read_mostly;
@@ -24,6 +25,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
prev parent reply other threads:[~2024-10-10 12:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 12:14 [PATCH v6 0/2] nosnp sev command line support Pavan Kumar Paluri
2024-10-10 12:14 ` [PATCH v6 1/2] x86, KVM:SVM: Move sev specific parsing into arch/x86/virt/svm Pavan Kumar Paluri
2024-10-11 16:21 ` Borislav Petkov
2024-10-11 16:35 ` Tom Lendacky
2024-10-11 16:48 ` Borislav Petkov
2024-10-11 16:55 ` Tom Lendacky
2024-10-11 16:59 ` Borislav Petkov
2024-10-11 17:08 ` Paluri, PavanKumar
2024-10-11 22:16 ` Borislav Petkov
2024-10-10 12:14 ` Pavan Kumar Paluri [this message]
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=20241010121455.15795-3-papaluri@amd.com \
--to=papaluri@amd.com \
--cc=Eric.VanTassell@amd.com \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dhaval.giani@amd.com \
--cc=hpa@zytor.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
/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;
as well as URLs for NNTP newsgroup(s).