@@ -16,6 +16,7 @@
#include <linux/sizes.h>
struct arm_smmu_device;
+struct arm_vsmmu;
/* MMIO registers */
#define ARM_SMMU_IDR0 0x0
@@ -720,6 +721,10 @@ struct arm_smmu_impl_ops {
int (*init_structures)(struct arm_smmu_device *smmu);
struct arm_smmu_cmdq *(*get_secondary_cmdq)(
struct arm_smmu_device *smmu, struct arm_smmu_cmdq_ent *ent);
+ const size_t vsmmu_size;
+ const enum iommu_viommu_type vsmmu_type;
+ int (*vsmmu_init)(struct arm_vsmmu *vsmmu,
+ const struct iommu_user_data *user_data);
};
/* An SMMUv3 instance */
@@ -415,6 +415,10 @@ size_t arm_smmu_get_viommu_size(struct device *dev,
!(smmu->features & ARM_SMMU_FEAT_S2FWB))
return 0;
+ if (smmu->impl_ops && smmu->impl_ops->vsmmu_size &&
+ viommu_type == smmu->impl_ops->vsmmu_type)
+ return smmu->impl_ops->vsmmu_size;
+
if (viommu_type != IOMMU_VIOMMU_TYPE_ARM_SMMUV3)
return 0;
@@ -438,6 +442,10 @@ int arm_vsmmu_init(struct iommufd_viommu *viommu,
/* FIXME Move VMID allocation from the S2 domain allocation to here */
vsmmu->vmid = s2_parent->s2_cfg.vmid;
+ if (smmu->impl_ops && smmu->impl_ops->vsmmu_init &&
+ viommu->type == smmu->impl_ops->vsmmu_type)
+ return smmu->impl_ops->vsmmu_init(vsmmu, user_data);
+
viommu->ops = &arm_vsmmu_ops;
return 0;
}