mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-12 17:26:47 -04:00
Use the memory encryption APIs to trigger a RSI call to request a transition between protected memory and shared memory (or vice versa) and updating the kernel's linear map of modified pages to flip the top bit of the IPA. This requires that block mappings are not used in the direct map for realm guests. Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Co-developed-by: Steven Price <steven.price@arm.com> Signed-off-by: Steven Price <steven.price@arm.com> Link: https://lore.kernel.org/r/20241017131434.40935-10-steven.price@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
25 lines
620 B
C
25 lines
620 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef __ASM_MEM_ENCRYPT_H
|
|
#define __ASM_MEM_ENCRYPT_H
|
|
|
|
#include <asm/rsi.h>
|
|
|
|
struct arm64_mem_crypt_ops {
|
|
int (*encrypt)(unsigned long addr, int numpages);
|
|
int (*decrypt)(unsigned long addr, int numpages);
|
|
};
|
|
|
|
int arm64_mem_crypt_ops_register(const struct arm64_mem_crypt_ops *ops);
|
|
|
|
int set_memory_encrypted(unsigned long addr, int numpages);
|
|
int set_memory_decrypted(unsigned long addr, int numpages);
|
|
|
|
int realm_register_memory_enc_ops(void);
|
|
|
|
static inline bool force_dma_unencrypted(struct device *dev)
|
|
{
|
|
return is_realm_world();
|
|
}
|
|
|
|
#endif /* __ASM_MEM_ENCRYPT_H */
|