]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/x86/include/asm/mem_encrypt.h
8baa35ba2316cf53da3416932e4669d947a97d61
2 * AMD Memory Encryption Support
4 * Copyright (C) 2016 Advanced Micro Devices, Inc.
6 * Author: Tom Lendacky <thomas.lendacky@amd.com>
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.
13 #ifndef __X86_MEM_ENCRYPT_H__
14 #define __X86_MEM_ENCRYPT_H__
18 #include <linux/init.h>
20 #ifdef CONFIG_AMD_MEM_ENCRYPT
22 extern unsigned long sme_me_mask
;
24 void __init
sme_early_encrypt(resource_size_t paddr
,
26 void __init
sme_early_decrypt(resource_size_t paddr
,
29 void __init
sme_early_init(void);
31 void __init
sme_encrypt_kernel(void);
32 void __init
sme_enable(void);
34 #else /* !CONFIG_AMD_MEM_ENCRYPT */
36 #define sme_me_mask 0UL
38 static inline void __init
sme_early_encrypt(resource_size_t paddr
,
39 unsigned long size
) { }
40 static inline void __init
sme_early_decrypt(resource_size_t paddr
,
41 unsigned long size
) { }
43 static inline void __init
sme_early_init(void) { }
45 static inline void __init
sme_encrypt_kernel(void) { }
46 static inline void __init
sme_enable(void) { }
48 #endif /* CONFIG_AMD_MEM_ENCRYPT */
51 * The __sme_pa() and __sme_pa_nodebug() macros are meant for use when
52 * writing to or comparing values from the cr3 register. Having the
53 * encryption mask set in cr3 enables the PGD entry to be encrypted and
54 * avoid special case handling of PGD allocations.
56 #define __sme_pa(x) (__pa(x) | sme_me_mask)
57 #define __sme_pa_nodebug(x) (__pa_nodebug(x) | sme_me_mask)
59 #endif /* __ASSEMBLY__ */
61 #endif /* __X86_MEM_ENCRYPT_H__ */