From: Ard Biesheuvel <ardb@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>,
Ard Biesheuvel <ardb+git@google.com>,
linux-kernel@vger.kernel.org,
Kevin Loughlin <kevinloughlin@google.com>,
Dionna Glaze <dionnaglaze@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Justin Stitt <justinstitt@google.com>,
Kees Cook <keescook@chromium.org>,
Brian Gerst <brgerst@gmail.com>,
linux-arch@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] x86/Kconfig: Remove CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT
Date: Fri, 2 Feb 2024 17:47:49 +0100 [thread overview]
Message-ID: <CAMj1kXFziPbzQt=eC2kg+7uW9vS_32YHq+37S_zdycNkY04UCg@mail.gmail.com> (raw)
In-Reply-To: <20240202163510.GDZb0Zvj8qOndvFOiZ@fat_crate.local>
On Fri, 2 Feb 2024 at 17:35, Borislav Petkov <bp@alien8.de> wrote:
>
> On Thu, Feb 01, 2024 at 05:15:51PM +0100, Ard Biesheuvel wrote:
> > OK, I'll remove it in the next rev.
>
> Considering how it simplifies sme_enable() even more, I'd like to
> expedite this one.
>
> Thx.
>
> ---
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
> Date: Fri, 2 Feb 2024 17:29:32 +0100
> Subject: [PATCH] x86/Kconfig: Remove CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT
>
> It was meant well at the time but nothing's using it so get rid of it.
>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> ---
> Documentation/admin-guide/kernel-parameters.txt | 4 +---
> Documentation/arch/x86/amd-memory-encryption.rst | 16 ++++++++--------
> arch/x86/Kconfig | 13 -------------
> arch/x86/mm/mem_encrypt_identity.c | 11 +----------
> 4 files changed, 10 insertions(+), 34 deletions(-)
>
Works for me.
Acked-by: Ard Biesheuvel <ardb@kernel.org>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 31b3a25680d0..2cb70a384af8 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -3320,9 +3320,7 @@
>
> mem_encrypt= [X86-64] AMD Secure Memory Encryption (SME) control
> Valid arguments: on, off
> - Default (depends on kernel configuration option):
> - on (CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT=y)
> - off (CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT=n)
> + Default: off
> mem_encrypt=on: Activate SME
> mem_encrypt=off: Do not activate SME
>
> diff --git a/Documentation/arch/x86/amd-memory-encryption.rst b/Documentation/arch/x86/amd-memory-encryption.rst
> index 07caa8fff852..414bc7402ae7 100644
> --- a/Documentation/arch/x86/amd-memory-encryption.rst
> +++ b/Documentation/arch/x86/amd-memory-encryption.rst
> @@ -87,14 +87,14 @@ The state of SME in the Linux kernel can be documented as follows:
> kernel is non-zero).
>
> SME can also be enabled and activated in the BIOS. If SME is enabled and
> -activated in the BIOS, then all memory accesses will be encrypted and it will
> -not be necessary to activate the Linux memory encryption support. If the BIOS
> -merely enables SME (sets bit 23 of the MSR_AMD64_SYSCFG), then Linux can activate
> -memory encryption by default (CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT=y) or
> -by supplying mem_encrypt=on on the kernel command line. However, if BIOS does
> -not enable SME, then Linux will not be able to activate memory encryption, even
> -if configured to do so by default or the mem_encrypt=on command line parameter
> -is specified.
> +activated in the BIOS, then all memory accesses will be encrypted and it
> +will not be necessary to activate the Linux memory encryption support.
> +
> +If the BIOS merely enables SME (sets bit 23 of the MSR_AMD64_SYSCFG),
> +then memory encryption can be enabled by supplying mem_encrypt=on on the
> +kernel command line. However, if BIOS does not enable SME, then Linux
> +will not be able to activate memory encryption, even if configured to do
> +so by default or the mem_encrypt=on command line parameter is specified.
>
> Secure Nested Paging (SNP)
> ==========================
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 5edec175b9bf..58d3593bc4f2 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1539,19 +1539,6 @@ config AMD_MEM_ENCRYPT
> This requires an AMD processor that supports Secure Memory
> Encryption (SME).
>
> -config AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT
> - bool "Activate AMD Secure Memory Encryption (SME) by default"
> - depends on AMD_MEM_ENCRYPT
> - help
> - Say yes to have system memory encrypted by default if running on
> - an AMD processor that supports Secure Memory Encryption (SME).
> -
> - If set to Y, then the encryption of system memory can be
> - deactivated with the mem_encrypt=off command line option.
> -
> - If set to N, then the encryption of system memory can be
> - activated with the mem_encrypt=on command line option.
> -
> # Common NUMA Features
> config NUMA
> bool "NUMA Memory Allocation and Scheduler Support"
> diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c
> index 7f72472a34d6..efe9f217fcf9 100644
> --- a/arch/x86/mm/mem_encrypt_identity.c
> +++ b/arch/x86/mm/mem_encrypt_identity.c
> @@ -97,7 +97,6 @@ static char sme_workarea[2 * PMD_SIZE] __section(".init.scratch");
>
> static char sme_cmdline_arg[] __initdata = "mem_encrypt";
> static char sme_cmdline_on[] __initdata = "on";
> -static char sme_cmdline_off[] __initdata = "off";
>
> static void __init sme_clear_pgd(struct sme_populate_pgd_data *ppd)
> {
> @@ -504,7 +503,7 @@ void __init sme_encrypt_kernel(struct boot_params *bp)
>
> void __init sme_enable(struct boot_params *bp)
> {
> - const char *cmdline_ptr, *cmdline_arg, *cmdline_on, *cmdline_off;
> + const char *cmdline_ptr, *cmdline_arg, *cmdline_on;
> unsigned int eax, ebx, ecx, edx;
> unsigned long feature_mask;
> unsigned long me_mask;
> @@ -587,12 +586,6 @@ void __init sme_enable(struct boot_params *bp)
> asm ("lea sme_cmdline_on(%%rip), %0"
> : "=r" (cmdline_on)
> : "p" (sme_cmdline_on));
> - asm ("lea sme_cmdline_off(%%rip), %0"
> - : "=r" (cmdline_off)
> - : "p" (sme_cmdline_off));
> -
> - if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT))
> - sme_me_mask = me_mask;
>
> cmdline_ptr = (const char *)((u64)bp->hdr.cmd_line_ptr |
> ((u64)bp->ext_cmd_line_ptr << 32));
> @@ -602,8 +595,6 @@ void __init sme_enable(struct boot_params *bp)
>
> if (!strncmp(buffer, cmdline_on, sizeof(buffer)))
> sme_me_mask = me_mask;
> - else if (!strncmp(buffer, cmdline_off, sizeof(buffer)))
> - sme_me_mask = 0;
>
> out:
> if (sme_me_mask) {
> --
> 2.43.0
>
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2024-02-02 16:48 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 18:05 [PATCH v3 00/19] x86: Confine early 1:1 mapped startup code Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 01/19] efi/libstub: Add generic support for parsing mem_encrypt= Ard Biesheuvel
2024-01-31 7:31 ` Borislav Petkov
2024-02-01 16:23 ` Kevin Loughlin
2024-02-01 16:28 ` Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 02/19] x86/boot: Move mem_encrypt= parsing to the decompressor Ard Biesheuvel
2024-01-31 8:35 ` Borislav Petkov
2024-01-31 9:12 ` Ard Biesheuvel
2024-01-31 9:29 ` Borislav Petkov
2024-01-31 9:59 ` Ard Biesheuvel
2024-02-01 14:17 ` Tom Lendacky
2024-02-01 16:15 ` Ard Biesheuvel
2024-02-02 16:35 ` [PATCH] x86/Kconfig: Remove CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT Borislav Petkov
2024-02-02 16:47 ` Ard Biesheuvel [this message]
2024-02-03 10:50 ` [tip: x86/sev] " tip-bot2 for Borislav Petkov (AMD)
2024-01-29 18:05 ` [PATCH v3 03/19] x86/startup_64: Drop long return to initial_code pointer Ard Biesheuvel
2024-01-31 13:44 ` Borislav Petkov
2024-01-31 13:57 ` Ard Biesheuvel
2024-01-31 14:07 ` Ard Biesheuvel
2024-01-31 16:29 ` Borislav Petkov
2024-01-31 18:14 ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 04/19] x86/startup_64: Simplify calculation of initial page table address Ard Biesheuvel
2024-02-05 10:40 ` Borislav Petkov
2024-01-29 18:05 ` [PATCH v3 05/19] x86/startup_64: Simplify CR4 handling in startup code Ard Biesheuvel
2024-02-06 18:21 ` Borislav Petkov
2024-02-07 10:38 ` Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 06/19] x86/startup_64: Drop global variables keeping track of LA57 state Ard Biesheuvel
2024-02-07 13:29 ` Borislav Petkov
2024-02-09 13:55 ` Ard Biesheuvel
2024-02-10 10:40 ` Borislav Petkov
2024-02-11 22:36 ` Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 07/19] x86/startup_64: Simplify virtual switch on primary boot Ard Biesheuvel
2024-02-07 14:50 ` Borislav Petkov
2024-01-29 18:05 ` [PATCH v3 08/19] x86/head64: Replace pointer fixups with PIE codegen Ard Biesheuvel
2024-02-12 10:29 ` Borislav Petkov
2024-02-12 11:52 ` Ard Biesheuvel
2024-02-12 14:18 ` Borislav Petkov
2024-01-29 18:05 ` [PATCH v3 09/19] x86/head64: Simplify GDT/IDT initialization code Ard Biesheuvel
2024-02-12 14:37 ` Borislav Petkov
2024-02-12 15:23 ` Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 10/19] asm-generic: Add special .pi.text section for position independent code Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 11/19] x86: Move return_thunk to __pitext section Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 12/19] x86/head64: Move early startup code into __pitext Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 13/19] modpost: Warn about calls from __pitext into other text sections Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 14/19] x86/coco: Make cc_set_mask() static inline Ard Biesheuvel
2024-01-30 23:16 ` Kevin Loughlin
2024-01-30 23:36 ` Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 15/19] x86/sev: Make all code reachable from 1:1 mapping __pitext Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 16/19] x86/sev: Avoid WARN() in early code Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 17/19] x86/sev: Use PIC codegen for early SEV startup code Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 18/19] x86/sev: Drop inline asm LEA instructions for RIP-relative references Ard Biesheuvel
2024-01-29 18:05 ` [PATCH v3 19/19] x86/startup_64: Don't bother setting up GS before the kernel is mapped Ard Biesheuvel
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='CAMj1kXFziPbzQt=eC2kg+7uW9vS_32YHq+37S_zdycNkY04UCg@mail.gmail.com' \
--to=ardb@kernel.org \
--cc=ardb+git@google.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=dionnaglaze@google.com \
--cc=justinstitt@google.com \
--cc=keescook@chromium.org \
--cc=kevinloughlin@google.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--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).