Linux IOMMU Development
 help / color / mirror / Atom feed
* [RFC PATCH] iommu: map reserved memory as cacheable if device is coherent
@ 2023-07-25 14:00 laurentiu.tudor
  2023-07-26 12:22 ` Jason Gunthorpe
  0 siblings, 1 reply; 4+ messages in thread
From: laurentiu.tudor @ 2023-07-25 14:00 UTC (permalink / raw)
  To: thierry.reding, robin.murphy, iommu, linux-arm-kernel; +Cc: Laurentiu Tudor

From: Laurentiu Tudor <laurentiu.tudor@nxp.com>

Check if the device is marked as DMA coherent in the DT and if so,
map its reserved memory as cacheable in the IOMMU.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
---
 drivers/iommu/of_iommu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index 40f57d293a79..ccb912049b88 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -254,6 +254,9 @@ void of_iommu_get_resv_regions(struct device *dev, struct list_head *list)
 				phys_addr_t iova;
 				size_t length;
 
+				if (of_dma_is_coherent(dev->of_node))
+					prot |= IOMMU_CACHE;
+
 				maps = of_translate_dma_region(np, maps, &iova, &length);
 				type = iommu_resv_region_get_type(dev, &phys, iova, length);
 
-- 
2.17.1


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

end of thread, other threads:[~2023-07-26 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-25 14:00 [RFC PATCH] iommu: map reserved memory as cacheable if device is coherent laurentiu.tudor
2023-07-26 12:22 ` Jason Gunthorpe
2023-07-26 12:29   ` Laurentiu Tudor
2023-07-26 12:32     ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox