@@ -69,7 +69,7 @@ MODULE_PARM_DESC(disable_bypass,
"Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
struct arm_smmu_s2cr {
- struct iommu_group *group;
+ struct device *dev;
int count;
enum arm_smmu_s2cr_type type;
enum arm_smmu_s2cr_privcfg privcfg;
@@ -1100,7 +1100,7 @@ static int arm_smmu_master_alloc_smes(struct device *dev)
/* It worked! Now, poke the actual hardware */
for_each_cfg_sme(cfg, fwspec, i, idx) {
arm_smmu_write_sme(smmu, idx);
- smmu->s2crs[idx].group = group;
+ smmu->s2crs[idx].dev = dev;
}
mutex_unlock(&smmu->stream_map_mutex);
@@ -1495,11 +1495,15 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
int i, idx;
for_each_cfg_sme(cfg, fwspec, i, idx) {
- if (group && smmu->s2crs[idx].group &&
- group != smmu->s2crs[idx].group)
+ struct iommu_group *idx_grp = NULL;
+
+ if (smmu->s2crs[idx].dev)
+ idx_grp = smmu->s2crs[idx].dev->iommu_group;
+
+ if (group && idx_grp && group != idx_grp)
return ERR_PTR(-EINVAL);
- group = smmu->s2crs[idx].group;
+ group = idx_grp;
}
if (group)