iommu: Map reserved memory as cacheable if device is coherent
authorLaurentiu Tudor <laurentiu.tudor@nxp.com>
Tue, 26 Sep 2023 15:26:00 +0000 (18:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:51 +0000 (15:35 -0800)
commit28d8fe6641e760db02af2312c14d9c4f6463b087
tree7d01d2e8c0860d3bd6b7550bcac16fde77c4e813
parent887a558d0298d36297daea039954c39940228d9b
iommu: Map reserved memory as cacheable if device is coherent

[ Upstream commit f1aad9df93f39267e890836a28d22511f23474e1 ]

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.

Fixes: a5bf3cfce8cb ("iommu: Implement of_iommu_get_resv_regions()")
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20230926152600.8749-1-laurentiu.tudor@nxp.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/of_iommu.c