Skip to content

Commit 2995674

Browse files
committed
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> Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20240202163510.GDZb0Zvj8qOndvFOiZ@fat_crate.local
1 parent 1bfca8d commit 2995674

File tree

4 files changed

+10
-34
lines changed

4 files changed

+10
-34
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,9 +3320,7 @@
33203320

33213321
mem_encrypt= [X86-64] AMD Secure Memory Encryption (SME) control
33223322
Valid arguments: on, off
3323-
Default (depends on kernel configuration option):
3324-
on (CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT=y)
3325-
off (CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT=n)
3323+
Default: off
33263324
mem_encrypt=on: Activate SME
33273325
mem_encrypt=off: Do not activate SME
33283326

Documentation/arch/x86/amd-memory-encryption.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ The state of SME in the Linux kernel can be documented as follows:
8787
kernel is non-zero).
8888

8989
SME can also be enabled and activated in the BIOS. If SME is enabled and
90-
activated in the BIOS, then all memory accesses will be encrypted and it will
91-
not be necessary to activate the Linux memory encryption support. If the BIOS
92-
merely enables SME (sets bit 23 of the MSR_AMD64_SYSCFG), then Linux can activate
93-
memory encryption by default (CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT=y) or
94-
by supplying mem_encrypt=on on the kernel command line. However, if BIOS does
95-
not enable SME, then Linux will not be able to activate memory encryption, even
96-
if configured to do so by default or the mem_encrypt=on command line parameter
97-
is specified.
90+
activated in the BIOS, then all memory accesses will be encrypted and it
91+
will not be necessary to activate the Linux memory encryption support.
92+
93+
If the BIOS merely enables SME (sets bit 23 of the MSR_AMD64_SYSCFG),
94+
then memory encryption can be enabled by supplying mem_encrypt=on on the
95+
kernel command line. However, if BIOS does not enable SME, then Linux
96+
will not be able to activate memory encryption, even if configured to do
97+
so by default or the mem_encrypt=on command line parameter is specified.
9898

9999
Secure Nested Paging (SNP)
100100
==========================

arch/x86/Kconfig

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,19 +1539,6 @@ config AMD_MEM_ENCRYPT
15391539
This requires an AMD processor that supports Secure Memory
15401540
Encryption (SME).
15411541

1542-
config AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT
1543-
bool "Activate AMD Secure Memory Encryption (SME) by default"
1544-
depends on AMD_MEM_ENCRYPT
1545-
help
1546-
Say yes to have system memory encrypted by default if running on
1547-
an AMD processor that supports Secure Memory Encryption (SME).
1548-
1549-
If set to Y, then the encryption of system memory can be
1550-
deactivated with the mem_encrypt=off command line option.
1551-
1552-
If set to N, then the encryption of system memory can be
1553-
activated with the mem_encrypt=on command line option.
1554-
15551542
# Common NUMA Features
15561543
config NUMA
15571544
bool "NUMA Memory Allocation and Scheduler Support"

arch/x86/mm/mem_encrypt_identity.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ static char sme_workarea[2 * PMD_SIZE] __section(".init.scratch");
9797

9898
static char sme_cmdline_arg[] __initdata = "mem_encrypt";
9999
static char sme_cmdline_on[] __initdata = "on";
100-
static char sme_cmdline_off[] __initdata = "off";
101100

102101
static void __init sme_clear_pgd(struct sme_populate_pgd_data *ppd)
103102
{
@@ -504,7 +503,7 @@ void __init sme_encrypt_kernel(struct boot_params *bp)
504503

505504
void __init sme_enable(struct boot_params *bp)
506505
{
507-
const char *cmdline_ptr, *cmdline_arg, *cmdline_on, *cmdline_off;
506+
const char *cmdline_ptr, *cmdline_arg, *cmdline_on;
508507
unsigned int eax, ebx, ecx, edx;
509508
unsigned long feature_mask;
510509
unsigned long me_mask;
@@ -587,12 +586,6 @@ void __init sme_enable(struct boot_params *bp)
587586
asm ("lea sme_cmdline_on(%%rip), %0"
588587
: "=r" (cmdline_on)
589588
: "p" (sme_cmdline_on));
590-
asm ("lea sme_cmdline_off(%%rip), %0"
591-
: "=r" (cmdline_off)
592-
: "p" (sme_cmdline_off));
593-
594-
if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT))
595-
sme_me_mask = me_mask;
596589

597590
cmdline_ptr = (const char *)((u64)bp->hdr.cmd_line_ptr |
598591
((u64)bp->ext_cmd_line_ptr << 32));
@@ -602,8 +595,6 @@ void __init sme_enable(struct boot_params *bp)
602595

603596
if (!strncmp(buffer, cmdline_on, sizeof(buffer)))
604597
sme_me_mask = me_mask;
605-
else if (!strncmp(buffer, cmdline_off, sizeof(buffer)))
606-
sme_me_mask = 0;
607598

608599
out:
609600
if (sme_me_mask) {

0 commit comments

Comments
 (0)