diff options
author | Bjorn Andersson <bjorn.andersson@linaro.org> | 2020-09-04 15:55:11 +0000 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2020-10-12 17:17:23 +0000 |
commit | c826656b39381e2484061a659d64a40b4c0dadfc (patch) | |
tree | 38b983396d9a74a15fbfee34de0c7d89ccdb5b25 | |
parent | c0b1ee74ea077f08442ccdcaef3789aec0b375c1 (diff) |
iommu/arm-smmu: Add impl hook for inherit boot mappings
Add a new operation to allow platform implementations to inherit any
stream mappings from the boot loader.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-rw-r--r-- | drivers/iommu/arm/arm-smmu/arm-smmu.c | 11 | ||||
-rw-r--r-- | drivers/iommu/arm/arm-smmu/arm-smmu.h | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 95519df106b4..d26d07e7c904 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -85,11 +85,6 @@ static inline void arm_smmu_rpm_put(struct arm_smmu_device *smmu) pm_runtime_put_autosuspend(smmu->dev); } -static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) -{ - return container_of(dom, struct arm_smmu_domain, domain); -} - static struct platform_driver arm_smmu_driver; static struct iommu_ops arm_smmu_ops; @@ -2188,6 +2183,12 @@ static int arm_smmu_device_probe(struct platform_device *pdev) if (err) return err; + if (smmu->impl->inherit_mappings) { + err = smmu->impl->inherit_mappings(smmu); + if (err) + return err; + } + if (smmu->version == ARM_SMMU_V2) { if (smmu->num_context_banks > smmu->num_context_irqs) { dev_err(dev, diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h b/drivers/iommu/arm/arm-smmu/arm-smmu.h index 235d9a3a6ab6..f58164976e74 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.h +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h @@ -378,6 +378,11 @@ struct arm_smmu_domain { struct iommu_domain domain; }; +static inline struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) +{ + return container_of(dom, struct arm_smmu_domain, domain); +} + struct arm_smmu_master_cfg { struct arm_smmu_device *smmu; s16 smendx[]; @@ -442,6 +447,7 @@ struct arm_smmu_impl { int (*alloc_context_bank)(struct arm_smmu_domain *smmu_domain, struct arm_smmu_device *smmu, struct device *dev, int start); + int (*inherit_mappings)(struct arm_smmu_device *smmu); }; #define INVALID_SMENDX -1 |