1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 #ifndef __ARM_SMMU_V3_MODULE__ 3 #define __ARM_SMMU_V3_MODULE__ 4 5 #if defined(__KVM_NVHE_HYPERVISOR__) && defined(MODULE) 6 7 #include <asm/kvm_pkvm_module.h> 8 9 extern const struct pkvm_module_ops *mod_ops; 10 11 #define CALL_FROM_OPS(fn, ...) mod_ops->fn(__VA_ARGS__) 12 13 #undef memset 14 #undef memcpy 15 #undef kvm_flush_dcache_to_poc 16 #undef kern_hyp_va 17 18 /* Needs alternatives which is not supported at the moment. */ 19 #undef cmpxchg64_relaxed 20 #define cmpxchg64_relaxed __ll_sc__cmpxchg_case_64 21 22 #define hyp_free(x) CALL_FROM_OPS(hyp_free, x) 23 #define hyp_alloc_errno() CALL_FROM_OPS(hyp_alloc_errno) 24 #define hyp_alloc(x) CALL_FROM_OPS(hyp_alloc, x) 25 #define kvm_iommu_donate_pages(x, y) CALL_FROM_OPS(iommu_donate_pages, x, y) 26 #define kvm_iommu_reclaim_pages(x, y) CALL_FROM_OPS(iommu_reclaim_pages, x, y) 27 #define kvm_iommu_request(x) CALL_FROM_OPS(iommu_request, x) 28 #define hyp_virt_to_phys(x) CALL_FROM_OPS(hyp_pa, x) 29 #define hyp_phys_to_virt(x) CALL_FROM_OPS(hyp_va, x) 30 #define memcpy(x, y, z) CALL_FROM_OPS(memcpy, x, y, z) 31 #define kvm_iommu_init_device(x) CALL_FROM_OPS(iommu_init_device, x) 32 #define pkvm_udelay(x) CALL_FROM_OPS(udelay, x) 33 #define kvm_flush_dcache_to_poc(x, y) CALL_FROM_OPS(flush_dcache_to_poc, x, y) 34 #define hyp_alloc_missing_donations() CALL_FROM_OPS(hyp_alloc_missing_donations) 35 #define ___pkvm_host_donate_hyp_prot(x, y, z, w) CALL_FROM_OPS(host_donate_hyp_prot, x, y, z, w) 36 #define ___pkvm_host_donate_hyp(x, y, z) CALL_FROM_OPS(host_donate_hyp, x, y, z) 37 #define kern_hyp_va(x) (void *)CALL_FROM_OPS(kern_hyp_va, (unsigned long)x) 38 #define __pkvm_host_donate_hyp(x, y) CALL_FROM_OPS(host_donate_hyp, x, y, false) 39 #define kvm_iommu_iotlb_gather_add_page(x, y, z, w) \ 40 CALL_FROM_OPS(iommu_iotlb_gather_add_page, x, y, z, w) 41 #define kvm_iommu_donate_pages_atomic(x) CALL_FROM_OPS(iommu_donate_pages_atomic, x) 42 #define kvm_iommu_reclaim_pages_atomic(x, y) CALL_FROM_OPS(iommu_reclaim_pages_atomic, x, y) 43 #define kvm_iommu_snapshot_host_stage2(x) CALL_FROM_OPS(iommu_snapshot_host_stage2, x) 44 #define kvm_iommu_flush_unmap_cache(x) CALL_FROM_OPS(iommu_flush_unmap_cache, x) 45 #endif 46 47 #endif /* __ARM_SMMU_V3_MODULE__ */ 48