summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/arm-smmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu/arm-smmu.c')
-rw-r--r--drivers/iommu/arm-smmu.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 2409e3bd3df2..7c39ac4b9c53 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -826,6 +826,12 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
826 if (smmu_domain->smmu) 826 if (smmu_domain->smmu)
827 goto out_unlock; 827 goto out_unlock;
828 828
829 /* We're bypassing these SIDs, so don't allocate an actual context */
830 if (domain->type == IOMMU_DOMAIN_DMA) {
831 smmu_domain->smmu = smmu;
832 goto out_unlock;
833 }
834
829 /* 835 /*
830 * Mapping the requested stage onto what we support is surprisingly 836 * Mapping the requested stage onto what we support is surprisingly
831 * complicated, mainly because the spec allows S1+S2 SMMUs without 837 * complicated, mainly because the spec allows S1+S2 SMMUs without
@@ -948,7 +954,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain)
948 void __iomem *cb_base; 954 void __iomem *cb_base;
949 int irq; 955 int irq;
950 956
951 if (!smmu) 957 if (!smmu || domain->type == IOMMU_DOMAIN_DMA)
952 return; 958 return;
953 959
954 /* 960 /*
@@ -1089,18 +1095,20 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
1089 struct arm_smmu_device *smmu = smmu_domain->smmu; 1095 struct arm_smmu_device *smmu = smmu_domain->smmu;
1090 void __iomem *gr0_base = ARM_SMMU_GR0(smmu); 1096 void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
1091 1097
1092 /* Devices in an IOMMU group may already be configured */
1093 ret = arm_smmu_master_configure_smrs(smmu, cfg);
1094 if (ret)
1095 return ret == -EEXIST ? 0 : ret;
1096
1097 /* 1098 /*
1098 * FIXME: This won't be needed once we have IOMMU-backed DMA ops 1099 * FIXME: This won't be needed once we have IOMMU-backed DMA ops
1099 * for all devices behind the SMMU. 1100 * for all devices behind the SMMU. Note that we need to take
1101 * care configuring SMRs for devices both a platform_device and
1102 * and a PCI device (i.e. a PCI host controller)
1100 */ 1103 */
1101 if (smmu_domain->domain.type == IOMMU_DOMAIN_DMA) 1104 if (smmu_domain->domain.type == IOMMU_DOMAIN_DMA)
1102 return 0; 1105 return 0;
1103 1106
1107 /* Devices in an IOMMU group may already be configured */
1108 ret = arm_smmu_master_configure_smrs(smmu, cfg);
1109 if (ret)
1110 return ret == -EEXIST ? 0 : ret;
1111
1104 for (i = 0; i < cfg->num_streamids; ++i) { 1112 for (i = 0; i < cfg->num_streamids; ++i) {
1105 u32 idx, s2cr; 1113 u32 idx, s2cr;
1106 1114