Skip to contentSkip to conversation

iommu/arm-smmu-v3: Restore prints in arm_smmu_attach_dev()

PATCH In review Nicolin Chen 2 participants 2 messages Nov 9, 2022 – Nov 14, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iommu/arm-smmu-v3: Restore prints in arm_smmu_attach_dev()

The prints for incompatible failures in arm_smmu_attach_dev() might be still useful for error diagnosis. As VFIO and IOMMUFD would do testing attach() call, having previous dev_err() isn't ideal either.

Add the prints back using dev_dbg().

Fixes f4a147735793 ("iommu: Use EINVAL for incompatible device/domain in ->attach_dev")

---
Changelog
v1->v2:
* Add "Fixes" line and Reviewed-by from Jason

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +7 -0
index ab160198edd6..076d3710b1fe 100644
@@ -2433,14 +2433,21 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 			goto out_unlock;
 		}
 	} else if (smmu_domain->smmu != smmu) {
+		dev_dbg(dev, "cannot attach to SMMU %s (upstream of %s)\n",
+			dev_name(smmu_domain->smmu->dev), dev_name(smmu->dev));
 		ret = -EINVAL;
 		goto out_unlock;
 	} else if (smmu_domain->stage == ARM_SMMU_DOMAIN_S1 &&
 		   master->ssid_bits != smmu_domain->s1_cfg.s1cdmax) {
+		dev_dbg(dev,
+			"cannot attach to incompatible domain (%u SSID bits != %u)\n",
+			smmu_domain->s1_cfg.s1cdmax, master->ssid_bits);
 		ret = -EINVAL;
 		goto out_unlock;
 	} else if (smmu_domain->stage == ARM_SMMU_DOMAIN_S1 &&
 		   smmu_domain->stall_enabled != master->stall_enabled) {
+		dev_dbg(dev, "cannot attach to stall-%s domain\n",
+			smmu_domain->stall_enabled ? "enabled" : "disabled");
 		ret = -EINVAL;
 		goto out_unlock;
 	}
Signature · 1 line
2.38.1
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 33 lines · Nicolin Chen

The prints for incompatible failures in arm_smmu_attach_dev() might be still useful for error diagnosis. As VFIO and IOMMUFD would do testing attach() call, having previous dev_err() isn't ideal either.

Add the prints back using dev_dbg().

Fixes f4a147735793 ("iommu: Use EINVAL for incompatible device/domain in ->attach_dev")

---
Changelog
v1->v2:
* Add "Fixes" line and Reviewed-by from Jason

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +3 -0
index ab160198edd6..076d3710b1fe 100644
@@ -2433,14 +2433,21 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 			goto out_unlock;
 		}
 	} else if (smmu_domain->smmu != smmu) {
+		dev_dbg(dev, "cannot attach to SMMU %s (upstream of %s)\n",
+			dev_name(smmu_domain->smmu->dev), dev_name(smmu->dev));
 		ret = -EINVAL;
 		goto out_unlock;
 	} else if (smmu_domain->stage == ARM_SMMU_DOMAIN_S1 &&
 		   master->ssid_bits != smmu_domain->s1_cfg.s1cdmax) {
+		dev_dbg(dev,

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) · line 2452

Quoted 10 lines
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +4 -0
+			"cannot attach to incompatible domain (%u SSID bits != %u)\n",
+			smmu_domain->s1_cfg.s1cdmax, master->ssid_bits);
 		ret = -EINVAL;
 		goto out_unlock;
 	} else if (smmu_domain->stage == ARM_SMMU_DOMAIN_S1 &&
 		   smmu_domain->stall_enabled != master->stall_enabled) {
+		dev_dbg(dev, "cannot attach to stall-%s domain\n",
+			smmu_domain->stall_enabled ? "enabled" : "disabled");
 		ret = -EINVAL;
 		goto out_unlock;

Thanks!

Will