File tree Expand file tree Collapse file tree 5 files changed +112
-0
lines changed Expand file tree Collapse file tree 5 files changed +112
-0
lines changed Original file line number Diff line number Diff line change @@ -1415,6 +1415,31 @@ config X86_DIRECT_GBPAGES
14151415 supports them), so don't confuse the user by printing
14161416 that we have them enabled.
14171417
1418+ config ARCH_HAS_MEM_ENCRYPT
1419+ def_bool y
1420+
1421+ config AMD_MEM_ENCRYPT
1422+ bool "AMD Secure Memory Encryption (SME) support"
1423+ depends on X86_64 && CPU_SUP_AMD
1424+ ---help---
1425+ Say yes to enable support for the encryption of system memory.
1426+ This requires an AMD processor that supports Secure Memory
1427+ Encryption (SME).
1428+
1429+ config AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT
1430+ bool "Activate AMD Secure Memory Encryption (SME) by default"
1431+ default y
1432+ depends on AMD_MEM_ENCRYPT
1433+ ---help---
1434+ Say yes to have system memory encrypted by default if running on
1435+ an AMD processor that supports Secure Memory Encryption (SME).
1436+
1437+ If set to Y, then the encryption of system memory can be
1438+ deactivated with the mem_encrypt=off command line option.
1439+
1440+ If set to N, then the encryption of system memory can be
1441+ activated with the mem_encrypt=on command line option.
1442+
14181443# Common NUMA Features
14191444config NUMA
14201445 bool "Numa Memory Allocation and Scheduler Support"
Original file line number Diff line number Diff line change 1+ /*
2+ * AMD Memory Encryption Support
3+ *
4+ * Copyright (C) 2016 Advanced Micro Devices, Inc.
5+ *
6+ * Author: Tom Lendacky <[email protected] > 7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License version 2 as
10+ * published by the Free Software Foundation.
11+ */
12+
13+ #ifndef __X86_MEM_ENCRYPT_H__
14+ #define __X86_MEM_ENCRYPT_H__
15+
16+ #ifndef __ASSEMBLY__
17+
18+ #ifdef CONFIG_AMD_MEM_ENCRYPT
19+
20+ extern unsigned long sme_me_mask ;
21+
22+ #else /* !CONFIG_AMD_MEM_ENCRYPT */
23+
24+ #define sme_me_mask 0UL
25+
26+ #endif /* CONFIG_AMD_MEM_ENCRYPT */
27+
28+ #endif /* __ASSEMBLY__ */
29+
30+ #endif /* __X86_MEM_ENCRYPT_H__ */
Original file line number Diff line number Diff line change @@ -39,3 +39,4 @@ obj-$(CONFIG_X86_INTEL_MPX) += mpx.o
3939obj-$(CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS) += pkeys.o
4040obj-$(CONFIG_RANDOMIZE_MEMORY) += kaslr.o
4141
42+ obj-$(CONFIG_AMD_MEM_ENCRYPT) += mem_encrypt.o
Original file line number Diff line number Diff line change 1+ /*
2+ * AMD Memory Encryption Support
3+ *
4+ * Copyright (C) 2016 Advanced Micro Devices, Inc.
5+ *
6+ * Author: Tom Lendacky <[email protected] > 7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License version 2 as
10+ * published by the Free Software Foundation.
11+ */
12+
13+ #include <linux/linkage.h>
14+
15+ /*
16+ * Since SME related variables are set early in the boot process they must
17+ * reside in the .data section so as not to be zeroed out when the .bss
18+ * section is later cleared.
19+ */
20+ unsigned long sme_me_mask __section (.data ) = 0 ;
21+ EXPORT_SYMBOL_GPL (sme_me_mask );
Original file line number Diff line number Diff line change 1+ /*
2+ * AMD Memory Encryption Support
3+ *
4+ * Copyright (C) 2016 Advanced Micro Devices, Inc.
5+ *
6+ * Author: Tom Lendacky <[email protected] > 7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License version 2 as
10+ * published by the Free Software Foundation.
11+ */
12+
13+ #ifndef __MEM_ENCRYPT_H__
14+ #define __MEM_ENCRYPT_H__
15+
16+ #ifndef __ASSEMBLY__
17+
18+ #ifdef CONFIG_ARCH_HAS_MEM_ENCRYPT
19+
20+ #include <asm/mem_encrypt.h>
21+
22+ #else /* !CONFIG_ARCH_HAS_MEM_ENCRYPT */
23+
24+ #define sme_me_mask 0UL
25+
26+ #endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */
27+
28+ static inline bool sme_active (void )
29+ {
30+ return !!sme_me_mask ;
31+ }
32+
33+ #endif /* __ASSEMBLY__ */
34+
35+ #endif /* __MEM_ENCRYPT_H__ */
You can’t perform that action at this time.
0 commit comments