Force GFP_DMA32 allocation for Rockchip IOMMU v2 page tables to fix NPU operation on systems with >4GB RAM. Without this patch, IOMMU allocates page tables above 4GB which the NPU cannot access, causing DMA mapping failures. Tested on ODROID-M1 with 8GB RAM, kernel 6.18.9-current-rockchip64.
38 lines
1.5 KiB
Diff
38 lines
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Vitalij Borissow <250549977+vitalijborissow@users.noreply.github.com>
|
|
Date: Sat, 15 Feb 2026 21:30:00 +0100
|
|
Subject: iommu/rockchip: Force GFP_DMA32 for rk3568-iommu v2
|
|
|
|
On systems with >4GB RAM, the RK3568 IOMMU v2 allocates page tables from
|
|
high memory (above 4GB). While the IOMMU claims 40-bit address support,
|
|
some devices like the NPU cannot properly handle page tables located
|
|
above 4GB, resulting in DMA mapping failures and NPU timeouts.
|
|
|
|
This patch forces GFP_DMA32 allocation for IOMMU v2 page tables,
|
|
ensuring all allocations are within the first 4GB of physical memory.
|
|
|
|
Tested on ODROID-M1 with 8GB RAM running kernel 6.18.9-current-rockchip64.
|
|
Without this patch, NPU inference fails with IOMMU page table access errors.
|
|
With this patch, NPU operates correctly with full IOMMU support enabled.
|
|
|
|
Signed-off-by: Vitalij Borissow <250549977+vitalijborissow@users.noreply.github.com>
|
|
---
|
|
drivers/iommu/rockchip-iommu.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
|
|
index 111111111111..222222222222 100644
|
|
--- a/drivers/iommu/rockchip-iommu.c
|
|
+++ b/drivers/iommu/rockchip-iommu.c
|
|
@@ -1349,7 +1349,7 @@ static struct rk_iommu_ops iommu_data_ops_v2 = {
|
|
.mk_dtentries = &rk_mk_dte_v2,
|
|
.mk_ptentries = &rk_mk_pte_v2,
|
|
.dma_bit_mask = DMA_BIT_MASK(40),
|
|
- .gfp_flags = 0,
|
|
+ .gfp_flags = GFP_DMA32,
|
|
};
|
|
|
|
static const struct of_device_id rk_iommu_dt_ids[] = {
|
|
--
|
|
Armbian
|