Commit 9612bbba authored by panhengchang's avatar panhengchang Committed by yangxiangkai
Browse files

virtcca feature: enable unmap swiotlb buffer to save iotlb cvm memory

virtcca inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/#IB4D2Y



--------------------------------

VirtCCA Feature:
enable unmap swiotlb buffer to save iotlb cvm memory

Signed-off-by: default avatarpanhengchang <panhengchang@huawei.com>
---
parent 9d0af12b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ extern void __init swiotlb_cvm_update_mem_attributes(void);

extern void virtcca_cvm_tsi_init(void);

extern void swiotlb_unmap_notify(unsigned long paddr, unsigned long size);

#else

static inline int set_cvm_memory_encrypted(unsigned long addr, int numpages)
@@ -39,5 +41,6 @@ static inline void __init swiotlb_cvm_update_mem_attributes(void) {}

static inline void virtcca_cvm_tsi_init(void) {}

static inline void swiotlb_unmap_notify(unsigned long paddr, unsigned long size) {}
#endif /* CONFIG_HISI_VIRTCCA_GUEST */
#endif /* __VIRTCCA_CVM_GUEST_H */
+7 −0
Original line number Diff line number Diff line
@@ -68,6 +68,13 @@
 */
#define SMC_TSI_DEVICE_CERT                 SMC_TSI_FID(0x19A)

/*
 * arg0: Paddr of rd
 * arg1: Paddr of memory to unmap
 * arg2: Size of memory to unmap
 */
 #define SMC_TSI_SEC_MEM_UNMAP              SMC_TSI_FID(0x19C)

static inline unsigned long tsi_get_version(void)
{
	struct arm_smccc_res res;
+7 −0
Original line number Diff line number Diff line
@@ -119,3 +119,10 @@ int set_cvm_memory_decrypted(unsigned long addr, int numpages)
{
	return __set_memory_encrypted(addr, numpages, false);
}

void swiotlb_unmap_notify(unsigned long paddr, unsigned long size)
{
	struct arm_smccc_res res;

	arm_smccc_1_1_smc(SMC_TSI_SEC_MEM_UNMAP, paddr, size, &res);
}