Skip to content

Commit 185f797

Browse files
vitalijborissowigorpecovnik
authored andcommitted
Add IOMMU GFP_DMA32 patch for RK3568 8GB systems
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.
1 parent b62e9fa commit 185f797

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Vitalij Borissow <250549977+vitalijborissow@users.noreply.github.com>
3+
Date: Sat, 15 Feb 2026 21:30:00 +0100
4+
Subject: iommu/rockchip: Force GFP_DMA32 for rk3568-iommu v2
5+
6+
On systems with >4GB RAM, the RK3568 IOMMU v2 allocates page tables from
7+
high memory (above 4GB). While the IOMMU claims 40-bit address support,
8+
some devices like the NPU cannot properly handle page tables located
9+
above 4GB, resulting in DMA mapping failures and NPU timeouts.
10+
11+
This patch forces GFP_DMA32 allocation for IOMMU v2 page tables,
12+
ensuring all allocations are within the first 4GB of physical memory.
13+
14+
Tested on ODROID-M1 with 8GB RAM running kernel 6.18.9-current-rockchip64.
15+
Without this patch, NPU inference fails with IOMMU page table access errors.
16+
With this patch, NPU operates correctly with full IOMMU support enabled.
17+
18+
Signed-off-by: Vitalij Borissow <250549977+vitalijborissow@users.noreply.github.com>
19+
---
20+
drivers/iommu/rockchip-iommu.c | 2 +-
21+
1 file changed, 1 insertion(+), 1 deletion(-)
22+
23+
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
24+
index 111111111111..222222222222 100644
25+
--- a/drivers/iommu/rockchip-iommu.c
26+
+++ b/drivers/iommu/rockchip-iommu.c
27+
@@ -1349,7 +1349,7 @@ static struct rk_iommu_ops iommu_data_ops_v2 = {
28+
.mk_dtentries = &rk_mk_dte_v2,
29+
.mk_ptentries = &rk_mk_pte_v2,
30+
.dma_bit_mask = DMA_BIT_MASK(40),
31+
- .gfp_flags = 0,
32+
+ .gfp_flags = GFP_DMA32,
33+
};
34+
35+
static const struct of_device_id rk_iommu_dt_ids[] = {
36+
--
37+
Armbian

0 commit comments

Comments
 (0)