RE: [PATCH v3 2/2] iommu/arm-smmu-v3:Enable ACPI based HiSilicon erratum 161010801

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Will Deacon [mailto:will.deacon@xxxxxxx]
> Sent: Friday, July 14, 2017 8:33 PM
> To: Shameerali Kolothum Thodi
> Cc: lorenzo.pieralisi@xxxxxxx; marc.zyngier@xxxxxxx;
> sudeep.holla@xxxxxxx; robin.murphy@xxxxxxx; hanjun.guo@xxxxxxxxxx;
> Gabriele Paoloni; John Garry; Linuxarm; linux-acpi@xxxxxxxxxxxxxxx;
> iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx; Wangzhou (B); Guohanjun (Hanjun Guo);
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; devel@xxxxxxxxxx
> Subject: Re: [PATCH v3 2/2] iommu/arm-smmu-v3:Enable ACPI based
> HiSilicon erratum 161010801
> 
[...]
> > > > -	list_add_tail(&region->list, head);
> > > > +	if ((smmu->options & ARM_SMMU_OPT_RESV_HW_MSI)) {
> > > > +
> > > > +		if (!is_of_node(smmu->dev->fwnode))
> > > > +			resv = iort_iommu_its_get_resv_regions(dev, head);
> > >
> > > How does this work when we're not using ACPI? Shouldn't of vs ACPI
> > > be abstracted from the driver?
> >
> > At present ARM_SMMU_OPT_RESV_HW_MSI is only set for ACPI and  DT
> > support for this is a low priority for us at the moment. Is the
> > suggestion is to have a common function outside the smmu driver for
> > _iommu_its_get_resv_regions() ? I am not sure what is the best way here.
> 
> Right, something like that. The driver shouldn't need to care whether or not
> it's using ACPI or DT when setting these options.

Below is what I have in mind for the common function for msi reserve.
But just wondering invoking iort_ functions from iommu code 
is acceptable or not . Could you please take a look and let me know.

Many thanks,
Shameer

--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -19,6 +19,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/acpi_iort.h>
 #include <linux/device.h>
 #include <linux/dma-iommu.h>
 #include <linux/gfp.h>
@@ -198,6 +199,24 @@ void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list)
 }
 EXPORT_SYMBOL(iommu_dma_get_resv_regions);
 
+/**
+ * iommu_dma_get_msi_resv_regions - Reserved region driver helper
+ * @dev: Device from iommu_get_resv_regions()
+ * @list: Reserved region list from iommu_get_resv_regions()
+ *
+ * IOMMU drivers can use this to implement their .get_resv_regions
+ * callback for HW MSI specific reservations. For now, this only
+ * covers ITS MSI region reservation using ACPI IORT helper function.
+ */
+int iommu_dma_get_msi_resv_regions(struct device *dev, struct list_head *list)
+{
+	if (!is_of_node(dev->iommu_fwspec->iommu_fwnode))
+		return iort_iommu_its_get_resv_regions(dev, list);
+
+	return -ENODEV;
+}
+EXPORT_SYMBOL(iommu_dma_get_msi_resv_regions);
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux