• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __KVM_ARM_SMMU_V3_H
3 #define __KVM_ARM_SMMU_V3_H
4 
5 #include <asm/arm-smmu-v3-common.h>
6 #include <asm/kvm_asm.h>
7 #include <kvm/iommu.h>
8 
9 /*
10  * Parameters from the trusted host:
11  * @mmio_addr		base address of the SMMU registers
12  * @mmio_size		size of the registers resource
13  *
14  * Other members are filled and used at runtime by the SMMU driver.
15  */
16 struct hyp_arm_smmu_v3_device {
17 	struct kvm_hyp_iommu	iommu;
18 	phys_addr_t		mmio_addr;
19 	size_t			mmio_size;
20 	unsigned long		features;
21 
22 	void __iomem		*base;
23 	u32			cmdq_prod;
24 	u64			*cmdq_base;
25 	size_t			cmdq_log2size;
26 	/* strtab_cfg.l2.l2ptrs is not used, instead computed from L1 */
27 	struct arm_smmu_strtab_cfg strtab_cfg;
28 	size_t			oas;
29 	size_t			ias;
30 	size_t			pgsize_bitmap;
31 	size_t			ssid_bits;
32 };
33 
34 extern size_t kvm_nvhe_sym(kvm_hyp_arm_smmu_v3_count);
35 #define kvm_hyp_arm_smmu_v3_count kvm_nvhe_sym(kvm_hyp_arm_smmu_v3_count)
36 
37 extern struct hyp_arm_smmu_v3_device *kvm_nvhe_sym(kvm_hyp_arm_smmu_v3_smmus);
38 #define kvm_hyp_arm_smmu_v3_smmus kvm_nvhe_sym(kvm_hyp_arm_smmu_v3_smmus)
39 
40 enum kvm_arm_smmu_domain_type {
41 	KVM_ARM_SMMU_DOMAIN_BYPASS = KVM_IOMMU_DOMAIN_IDMAP_TYPE,
42 	KVM_ARM_SMMU_DOMAIN_ANY = KVM_IOMMU_DOMAIN_ANY_TYPE,
43 	KVM_ARM_SMMU_DOMAIN_S1,
44 	KVM_ARM_SMMU_DOMAIN_S2,
45 	KVM_ARM_SMMU_DOMAIN_MAX,
46 };
47 
48 #endif /* __KVM_ARM_SMMU_V3_H */
49