linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/arm-smmu-v3: Restore prints in arm_smmu_attach_dev()
@ 2022-11-09  7:07 Nicolin Chen
  2022-11-09 13:11 ` Jason Gunthorpe
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolin Chen @ 2022-11-09  7:07 UTC (permalink / raw)
  To: will, joro; +Cc: linux-kernel, iommu, linux-arm-kernel, jgg, robin.murphy

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().

Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index ab160198edd6..076d3710b1fe 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -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;
 	}
-- 
2.38.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu/arm-smmu-v3: Restore prints in arm_smmu_attach_dev()
  2022-11-09  7:07 [PATCH] iommu/arm-smmu-v3: Restore prints in arm_smmu_attach_dev() Nicolin Chen
@ 2022-11-09 13:11 ` Jason Gunthorpe
  2022-11-09 18:47   ` Nicolin Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2022-11-09 13:11 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: will, joro, linux-kernel, iommu, linux-arm-kernel, robin.murphy

On Tue, Nov 08, 2022 at 11:07:13PM -0800, Nicolin Chen wrote:
> 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().
> 
> Suggested-by: Will Deacon <will@kernel.org>
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 +++++++
>  1 file changed, 7 insertions(+)

You should probably include a fixes line

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu/arm-smmu-v3: Restore prints in arm_smmu_attach_dev()
  2022-11-09 13:11 ` Jason Gunthorpe
@ 2022-11-09 18:47   ` Nicolin Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolin Chen @ 2022-11-09 18:47 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: will, joro, linux-kernel, iommu, linux-arm-kernel, robin.murphy

On Wed, Nov 09, 2022 at 09:11:53AM -0400, Jason Gunthorpe wrote:
> On Tue, Nov 08, 2022 at 11:07:13PM -0800, Nicolin Chen wrote:
> > 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().
> > 
> > Suggested-by: Will Deacon <will@kernel.org>
> > Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> > ---
> >  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> 
> You should probably include a fixes line
> 
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Just sent a v2 adding "Fixes" and "Reviewed-by". Thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-09 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-09  7:07 [PATCH] iommu/arm-smmu-v3: Restore prints in arm_smmu_attach_dev() Nicolin Chen
2022-11-09 13:11 ` Jason Gunthorpe
2022-11-09 18:47   ` Nicolin Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).