|
| 1 | +From 10a28336d837029c3f3c714adc5edd4f19ff8ca1 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Josua Mayer <josua@solid-run.com> |
| 3 | +Date: Wed, 1 Jul 2026 16:52:13 +0200 |
| 4 | +Subject: [PATCH 46/47] drivers: net: fsl-mc: mark mc reserved memory no-map |
| 5 | +MIME-Version: 1.0 |
| 6 | +Content-Type: text/plain; charset=UTF-8 |
| 7 | +Content-Transfer-Encoding: 8bit |
| 8 | + |
| 9 | +When booting an operating system via the UEFI pathway (e.g., using |
| 10 | +grub.efi), passing 0 as the flags argument to fdtdec_add_reserved_memory() |
| 11 | +omits the "no-map" property from the generated DTB entries. |
| 12 | + |
| 13 | +Consequently, U-Boot's internal UEFI memory allocator translates these |
| 14 | +regions—including the 256MB 'mc-mem5@0' co-processor block—into standard |
| 15 | +EFI_BOOT_SERVICES_DATA descriptors. The early Linux EFI stub parses this |
| 16 | +table and incorrectly maps absolute physical address 0x0 into system RAM: |
| 17 | + |
| 18 | +[ 0.000000] Early memory node ranges |
| 19 | +[ 0.000000] node 0: [mem 0x0000000000000000-0x000000000fffffff] |
| 20 | + |
| 21 | +Because the kernel now registers the SoC's lower peripheral configuration |
| 22 | +space as cacheable system memory, subsequent ioremap() calls to critical |
| 23 | +hardware blocks fail, preventing the system from initializing and |
| 24 | +triggering a watchdog reset loop: |
| 25 | + |
| 26 | +[ 0.000000] GICv3: [Firmware Bug]: GICD region 0x0000000006000000 has overlapping address |
| 27 | +[ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm64/mm/ioremap.c:28 ioremap_prot+0xb0/0xf0 |
| 28 | +[ 0.000000] Modules linked in: |
| 29 | +[ 0.000000] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.12.86+deb13-arm64 #1 Debian 6.12.86-1 |
| 30 | +[ 0.000000] Hardware name: SolidRun LX2160A SolidWAN Single (DT) |
| 31 | +[ 0.000000] pstate: 800000c5 (Nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) |
| 32 | +[ 0.000000] pc : ioremap_prot+0xb0/0xf0 |
| 33 | +[ 0.000000] lr : ioremap_prot+0x64/0xf0 |
| 34 | +[ 0.000000] sp : ffffb9bd5a833bc0 |
| 35 | +[ 0.000000] x29: ffffb9bd5a833bd0 x28: 000000000000000a x27: ffffb9bd5abc38a0 |
| 36 | +[ 0.000000] x26: dead000000000122 x25: ffff47ff00037d00 x24: dead000000000100 |
| 37 | +[ 0.000000] x23: ffffb9bd5abc34e8 x22: ffffb9bd59dcfe88 x21: 0000000000000000 |
| 38 | +[ 0.000000] x20: 0000000000010000 x19: 0000000006000000 x18: 0000000000000006 |
| 39 | +[ 0.000000] x17: 616c7265766f2073 x16: 6168203030303030 x15: 3036303030303030 |
| 40 | +[ 0.000000] x14: 3030307830206e6f x13: 7373657264646120 x12: ffffb9bd5a8c2b00 |
| 41 | +[ 0.000000] x11: ffffb9bd5a86ab58 x10: ffffb9bd5a89cca9 x9 : ffffb9bd58836d78 |
| 42 | +[ 0.000000] x8 : 0000000010000000 x7 : 0000000000000018 x6 : ffffb9bd5ac3c398 |
| 43 | +[ 0.000000] x5 : ffffb9bd5ac3c398 x4 : 0000000000000001 x3 : 0000000000000001 |
| 44 | +[ 0.000000] x2 : 0000000010000000 x1 : 0000000000000000 x0 : 0000000000000001 |
| 45 | +[ 0.000000] Call trace: |
| 46 | +[ 0.000000] ioremap_prot+0xb0/0xf0 |
| 47 | +[ 0.000000] of_iomap+0x10c/0x128 |
| 48 | +[ 0.000000] gic_of_iomap+0x60/0x88 |
| 49 | +[ 0.000000] gic_of_init+0x70/0x288 |
| 50 | +[ 0.000000] of_irq_init+0x210/0x388 |
| 51 | +[ 0.000000] irqchip_init+0x20/0x50 |
| 52 | +[ 0.000000] init_IRQ+0xa4/0xc8 |
| 53 | +[ 0.000000] start_kernel+0x5d0/0x798 |
| 54 | +[ 0.000000] __primary_switched+0x80/0x90 |
| 55 | +[ 0.000000] ---[ end trace 0000000000000000 ]--- |
| 56 | +[ 0.000000] GICv3: /interrupt-controller@6000000: unable to map gic dist registers |
| 57 | +[ 0.000000] OF: of_irq_init: Failed to init /interrupt-controller@6000000 ((____ptrval____)), parent 0000000000000000 |
| 58 | +[ 0.000000] OF: of_irq_init: children remain, but no parents |
| 59 | +[ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention. |
| 60 | + |
| 61 | +Fix this by explicitly passing the FDTDEC_RESERVED_MEMORY_NO_MAP flag. |
| 62 | +This injects the proper "no-map;" property into the device tree. U-Boot |
| 63 | +UEFI will then correctly treat it as EFI_RESERVED_MEMORY_TYPE, forcing |
| 64 | +the downstream Linux kernel to mark the pool as MEMBLOCK_NOMAP. This keeps |
| 65 | +the linear mapping clear and unblocks early system ioremap operations. |
| 66 | + |
| 67 | +Signed-off-by: Josua Mayer <josua@solid-run.com> |
| 68 | +--- |
| 69 | + drivers/net/fsl-mc/mc.c | 2 +- |
| 70 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 71 | + |
| 72 | +diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c |
| 73 | +index 7d2bae924b0..714acafb7f4 100644 |
| 74 | +--- a/drivers/net/fsl-mc/mc.c |
| 75 | ++++ b/drivers/net/fsl-mc/mc.c |
| 76 | +@@ -994,7 +994,7 @@ void fdt_reserve_mc_mem(void *blob, u32 mc_icid) |
| 77 | + sprintf(mem_name, "mc-mem%d", i); |
| 78 | + ret = fdtdec_add_reserved_memory(blob, mem_name, |
| 79 | + &mc_mem_ranges[i], NULL, 0, |
| 80 | +- &phandle, 0); |
| 81 | ++ &phandle, FDTDEC_RESERVED_MEMORY_NO_MAP); |
| 82 | + if (ret < 0) { |
| 83 | + printf("ERROR: failed to reserve MC memory: %d\n", ret); |
| 84 | + return; |
| 85 | +-- |
| 86 | +2.51.0 |
| 87 | + |
0 commit comments