arch/arm64/include/asm/mem_encrypt.h

Source file repositories/reference/linux-study-clean/arch/arm64/include/asm/mem_encrypt.h

File Facts

System
Linux kernel
Corpus path
arch/arm64/include/asm/mem_encrypt.h
Extension
.h
Size
1015 bytes
Lines
38
Domain
Architecture Layer
Bucket
arch/arm64
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

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();
}

/*
 * For Arm CCA guests, canonical addresses are "encrypted", so no changes
 * required for dma_addr_encrypted().
 * The unencrypted DMA buffers must be accessed via the unprotected IPA,
 * "top IPA bit" set.
 */
#define dma_addr_unencrypted(x)		((x) | PROT_NS_SHARED)

/* Clear the "top" IPA bit while converting back */
#define dma_addr_canonical(x)		((x) & ~PROT_NS_SHARED)

#endif	/* __ASM_MEM_ENCRYPT_H */

Annotation

Implementation Notes