iommu: map reserved memory as cacheable if device is coherent
PATCH v3 1/1 iommu: map reserved memory as cacheable if device is coherent
Check if the device is marked as DMA coherent in the DT and if so, map its reserved memory as cacheable in the IOMMU.
This fixes the recently added IOMMU reserved memory support which uses IOMMU_RESV_DIRECT without properly building the PROT for the mapping.
---
Changes in v3:
- added Acked-by tag (Thierry)
Changes in v2:
- added Reviewed-by tag (Jason)
drivers/iommu/of_iommu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/of_iommu.c +3 -0
@@ -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);
Signature · 1 line
2.17.1
Hello,
Any chance of having this picked up? It is the last missing bit to fix booting vanilla images on some NXP platforms (Layerscape LX2160A, LS2088A, LS1088A) given that the bootloader side of things [1] was accepted. Thank you!
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=375154&state=*
---
Best Regards, Laurentiu
Quoted 34 lines · Laurentiu Tudor
Check if the device is marked as DMA coherent in the DT and if so, map its reserved memory as cacheable in the IOMMU.
This fixes the recently added IOMMU reserved memory support which usesIOMMU_RESV_DIRECTwithout properly building the PROT for the mapping.Fixes a5bf3cfce8cb ("iommu: Implement of_iommu_get_resv_regions()")Signed-off-by Laurentiu Tudor <[email protected]>Reviewed-by Jason Gunthorpe <[email protected]>Acked-by Thierry Reding <[email protected]>---
Changes in v3:
- added Acked-by tag (Thierry)Changes in v2:
- added Reviewed-by tag (Jason)drivers/iommu/of_iommu.c | 3 +++ 1 file changed, 3 insertions(+)drivers/iommu/of_iommu.c +3
-0@@ -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);
Quoted 2 lines · Laurentiu Tudor
drivers/iommu/of_iommu.c | 3 +++ 1 file changed, 3 insertions(+)
Applied, thanks.