Thread (15 messages) 15 messages, 5 authors, 2020-12-18

Re: [PATCH v8 4/9] of/iommu: Support dma-can-stall property

From: Robin Murphy <robin.murphy@arm.com>
Date: 2020-11-26 18:09:33
Also in: linux-acpi, linux-devicetree, linux-iommu, linux-pci

On 2020-11-12 12:55, Jean-Philippe Brucker wrote:
Copy the dma-can-stall property into the fwspec structure.
Can't we just handle this as a regular device property? It's not part of 
the actual IOMMU specifier, it doesn't need to be translated in any way, 
and AFAICS it's used a grand total of once, in a slow path. Simply 
treating it as the per-device property that it is should require zero 
additional code for DT, and a simple device_add_properties() call for IORT.

TBH that appears to be true of pasid-num-bits as well.

Robin.
quoted hunk ↗ jump to hunk
Signed-off-by: Jean-Philippe Brucker <redacted>
---
  include/linux/iommu.h    | 2 ++
  drivers/iommu/of_iommu.c | 5 ++++-
  2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a1c78c4cdeb1..9076fb592c8f 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -572,6 +572,7 @@ struct iommu_group *fsl_mc_device_group(struct device *dev);
   * @iommu_fwnode: firmware handle for this device's IOMMU
   * @iommu_priv: IOMMU driver private data for this device
   * @num_pasid_bits: number of PASID bits supported by this device
+ * @can_stall: the device is allowed to stall
   * @num_ids: number of associated device IDs
   * @ids: IDs which this device may present to the IOMMU
   */
@@ -579,6 +580,7 @@ struct iommu_fwspec {
  	const struct iommu_ops	*ops;
  	struct fwnode_handle	*iommu_fwnode;
  	u32			num_pasid_bits;
+	bool			can_stall;
  	unsigned int		num_ids;
  	u32			ids[];
  };
diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index e505b9130a1c..d6255ca823d8 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -212,9 +212,12 @@ const struct iommu_ops *of_iommu_configure(struct device *dev,
  		err = of_iommu_configure_device(master_np, dev, id);
  
  		fwspec = dev_iommu_fwspec_get(dev);
-		if (!err && fwspec)
+		if (!err && fwspec) {
  			of_property_read_u32(master_np, "pasid-num-bits",
  					     &fwspec->num_pasid_bits);
+			fwspec->can_stall = of_property_read_bool(master_np,
+								  "dma-can-stall");
+		}
  	}
  
  	/*
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help