summaryrefslogtreecommitdiffstats
path: root/include/linux/dma-iommu.h
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2016-09-12 17:13:59 +0100
committerWill Deacon <will.deacon@arm.com>2016-09-16 09:34:22 +0100
commit44bb7e243bd4b4e5c79de2452cd9762582f58925 (patch)
treebf0d949ec860769d523d512dc26b20c9ce26e945 /include/linux/dma-iommu.h
parent455eb7d34ad11b09490f70c33973f9f3e31c4df6 (diff)
downloadtalos-obmc-linux-44bb7e243bd4b4e5c79de2452cd9762582f58925.tar.gz
talos-obmc-linux-44bb7e243bd4b4e5c79de2452cd9762582f58925.zip
iommu/dma: Add support for mapping MSIs
When an MSI doorbell is located downstream of an IOMMU, attaching devices to a DMA ops domain and switching on translation leads to a rude shock when their attempt to write to the physical address returned by the irqchip driver faults (or worse, writes into some already-mapped buffer) and no interrupt is forthcoming. Address this by adding a hook for relevant irqchip drivers to call from their compose_msi_msg() callback, to swizzle the physical address with an appropriatly-mapped IOVA for any device attached to one of our DMA ops domains. Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'include/linux/dma-iommu.h')
-rw-r--r--include/linux/dma-iommu.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h
index 81c5c8d167ad..5ee806e41b5c 100644
--- a/include/linux/dma-iommu.h
+++ b/include/linux/dma-iommu.h
@@ -21,6 +21,7 @@
#ifdef CONFIG_IOMMU_DMA
#include <linux/iommu.h>
+#include <linux/msi.h>
int iommu_dma_init(void);
@@ -62,9 +63,13 @@ void iommu_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
int iommu_dma_supported(struct device *dev, u64 mask);
int iommu_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
+/* The DMA API isn't _quite_ the whole story, though... */
+void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg);
+
#else
struct iommu_domain;
+struct msi_msg;
static inline int iommu_dma_init(void)
{
@@ -80,6 +85,10 @@ static inline void iommu_put_dma_cookie(struct iommu_domain *domain)
{
}
+static inline void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg)
+{
+}
+
#endif /* CONFIG_IOMMU_DMA */
#endif /* __KERNEL__ */
#endif /* __DMA_IOMMU_H */
OpenPOWER on IntegriCloud