x86: Add support for changing memory encryption attribute in early boot
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 14/17 x86: Add support for changing memory encryption attribute in early boot
Some KVM-specific custom MSRs share the guest physical address with the hypervisor in early boot. When SEV is active, the shared physical address must be mapped with memory encryption attribute cleared so that both hypervisor and guest can access the data.
Add APIs to change the memory encryption attribute in early boot code.
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Tom Lendacky <[email protected]>
Signed-off-by Brijesh Singh <[email protected]>
Reviewed-by Borislav Petkov <[email protected]>
---
Changes since 6.1:
* update early_set_memory_decrypted() to use virtual address instead of physical
arch/x86/include/asm/mem_encrypt.h | 8 +++ arch/x86/mm/mem_encrypt.c | 130 +++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+)
arch/x86/include/asm/mem_encrypt.h +8 -0
@@ -42,6 +42,9 @@ void __init sme_early_init(void);void __init sme_encrypt_kernel (void );void __init sme_enable (struct boot_params *bp); +int __init early_set_memory_decrypted (unsigned long vaddr,unsigned long size); +int __init early_set_memory_encrypted (unsigned long vaddr,unsigned long size); +/* Architecture __weak replacement functions */ void __init mem_encrypt_init (void );
@@ -70,6 +73,11 @@ static inline void __init sme_enable(struct boot_params *bp) { }static inline bool sme_active (void ) {return false; }static inline bool sev_active (void ) {return false; } +static inline int __init +early_set_memory_decrypted (unsigned long vaddr,unsigned long size) {return 0 ; } +static inline int __init +early_set_memory_encrypted (unsigned long vaddr,unsigned long size) {return 0 ; } +#endif /* CONFIG_AMD_MEM_ENCRYPT */ /*
arch/x86/mm/mem_encrypt.c +130 -0
142 lines not on this page · raw message
Signature · 1 line
2.9.5