@@ -2346,6 +2346,7 @@ static struct iommu_device *arm_smmu_probe_device(struct device *dev)
INIT_LIST_HEAD(&master->bonds);
dev_iommu_priv_set(dev, master);
+ mutex_lock(&smmu->streams_mutex);
/* Check the SIDs are in range of the SMMU and our stream table */
for (i = 0; i < master->num_sids; i++) {
u32 sid = master->sids[i];
@@ -2362,6 +2363,7 @@ static struct iommu_device *arm_smmu_probe_device(struct device *dev)
goto err_free_master;
}
}
+ mutex_unlock(&smmu->streams_mutex);
master->ssid_bits = min(smmu->ssid_bits, fwspec->num_pasid_bits);
@@ -2818,6 +2820,8 @@ static int arm_smmu_init_structures(struct arm_smmu_device *smmu)
{
int ret;
+ mutex_init(&smmu->streams_mutex);
+
ret = arm_smmu_init_queues(smmu);
if (ret)
return ret;
@@ -636,6 +636,8 @@ struct arm_smmu_device {
/* IOMMU core code handle */
struct iommu_device iommu;
+
+ struct mutex streams_mutex;
};
/* SMMU private data for each master */