Re: [PATCH v2 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

From
Baolu Lu <baolu.lu@linux.intel.com>
Date
2022-06-16 02:10:40
Also in
kvm, linux-arm-msm, linux-iommu, linux-mediatek, linux-s390, linux-tegra, lkml
Reply to
Nicolin Chen, 2022-06-16
On 2022/6/16 08:03, Nicolin Chen wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 44016594831d..0dd13330fe12 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -4323,7 +4323,7 @@ static int prepare_domain_attach_device(struct iommu_domain *domain,
  		return -ENODEV;
  
  	if (dmar_domain->force_snooping && !ecap_sc_support(iommu->ecap))
-		return -EOPNOTSUPP;
+		return -EMEDIUMTYPE;
  
  	/* check if this iommu agaw is sufficient for max mapped address */
  	addr_width = agaw_to_width(iommu->agaw);
@@ -4331,10 +4331,10 @@ static int prepare_domain_attach_device(struct iommu_domain *domain,
  		addr_width = cap_mgaw(iommu->cap);
  
  	if (dmar_domain->max_addr > (1LL << addr_width)) {
-		dev_err(dev, "%s: iommu width (%d) is not "
+		dev_dbg(dev, "%s: iommu width (%d) is not "
  		        "sufficient for the mapped address (%llx)\n",
  		        __func__, addr_width, dmar_domain->max_addr);
-		return -EFAULT;
+		return -EMEDIUMTYPE;
  	}
  	dmar_domain->gaw = addr_width;
Can we simply remove the dev_err()? As the return value has explicitly
explained the failure reason, putting a print statement won't help much.

Best regards,
baolu

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (30 messages) 30 messages, 6 authors, last reply 2022-06-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help