]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iommu/exynos: add support for reserved regions
authorKaustabh Chakraborty <kauschluss@disroot.org>
Sat, 12 Jul 2025 11:49:30 +0000 (17:19 +0530)
committerWill Deacon <will@kernel.org>
Mon, 14 Jul 2025 11:32:47 +0000 (12:32 +0100)
The bootloader configures a reserved memory region for framebuffer,
which is protected by the IOMMU. The kernel-side driver is oblivious as
of which memory region is set up by the bootloader. In such case, the
IOMMU tries to reference the reserved region - which is not reserved in
the kernel anymore - and it results in an unrecoverable page fault. More
information about it is provided in [1].

Add support for reserved regions using iommu_dma_get_resv_regions().
For OF supported boards, this requires defining the region in the
iommu-addresses property of the IOMMU owner's node.

Link: https://lore.kernel.org/r/544ad69cba52a9b87447e3ac1c7fa8c3@disroot.org
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
Link: https://lore.kernel.org/r/20250712-exynos-sysmmu-resv-regions-v1-1-e79681fcab1a@disroot.org
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/exynos-iommu.c

index fcb6a0f7c08275083065e5e311f190a85dd1f5f4..f499861da1b166db8d3227df68138dd92bf6cb50 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
 
+#include "dma-iommu.h"
 #include "iommu-pages.h"
 
 typedef u32 sysmmu_iova_t;
@@ -1478,6 +1479,7 @@ static const struct iommu_ops exynos_iommu_ops = {
        .probe_device = exynos_iommu_probe_device,
        .release_device = exynos_iommu_release_device,
        .pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE,
+       .get_resv_regions = iommu_dma_get_resv_regions,
        .of_xlate = exynos_iommu_of_xlate,
        .default_domain_ops = &(const struct iommu_domain_ops) {
                .attach_dev     = exynos_iommu_attach_device,