From 6975812cf3e03b71aaf36fe01cdad4eb9f2cc552 Mon Sep 17 00:00:00 2001 From: Niklas Sheth Date: Sun, 15 Nov 2026 20:40:17 -0500 Subject: [PATCH 1/3] kboot: omit DMA mappings for identity segments For segments where the device address equals the physical address, macOS doesn't actually map them. These seem to be data reservations. Creating the mappings can mess with the firmware heap, so don't. Signed-off-by: Niklas Sheth --- src/kboot.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/kboot.c b/src/kboot.c index 33d0b42d..1cf70d15 100644 --- a/src/kboot.c +++ b/src/kboot.c @@ -1824,9 +1824,12 @@ static int dt_reserve_asc_firmware(const char *adt_path, const char *adt_path_al return ret; uint32_t mem_phandle = fdt_get_phandle(dt, mem_node); - ret = dt_device_set_reserved_mem(mem_node, node_name, dev_phandle, iova, seg_size); - if (ret < 0) - return ret; + /* Identity segments are reserved data, not existing device mappings. */ + if (iova != seg->phys) { + ret = dt_device_set_reserved_mem(mem_node, node_name, dev_phandle, iova, seg_size); + if (ret < 0) + return ret; + } ret = dt_device_add_mem_region(fdt_path, mem_phandle, NULL); if (ret < 0) @@ -2877,11 +2880,9 @@ int kboot_prepare_dt(void *fdt) if (dt_set_isp_fwdata()) return -1; /* - * The MTP coprocessor DMAs to its iBoot-provided segments (__OS_LOG in - * DRAM) before it sends the RTKit HELLO, so its DART must map them from - * the first instruction. Its DVAs are the segments' remap addresses, - * which fall in the DART's vm-base window. Boards without an "mtp" - * alias are skipped. + * Preserve MTP's firmware reservations. Its identity segment entries + * need no DART mappings: on J713, HELLO and input work without them. + * Boards without an "mtp" alias are skipped. */ if (dt_reserve_asc_firmware("/arm-io/mtp", NULL, "mtp", true, 0)) return -1; From e2f37dfdfb1685db33311cf0f81a71dc44df5bd6 Mon Sep 17 00:00:00 2001 From: Niklas Sheth Date: Sun, 15 Nov 2026 20:42:57 -0500 Subject: [PATCH 2/3] kboot: remove redundant MTP firmware reservations This hack is no longer necessary, it doesn't create mappings and nothing uses the reservations. Signed-off-by: Niklas Sheth --- src/kboot.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/kboot.c b/src/kboot.c index 1cf70d15..97b0b9f5 100644 --- a/src/kboot.c +++ b/src/kboot.c @@ -2879,13 +2879,6 @@ int kboot_prepare_dt(void *fdt) return -1; if (dt_set_isp_fwdata()) return -1; - /* - * Preserve MTP's firmware reservations. Its identity segment entries - * need no DART mappings: on J713, HELLO and input work without them. - * Boards without an "mtp" alias are skipped. - */ - if (dt_reserve_asc_firmware("/arm-io/mtp", NULL, "mtp", true, 0)) - return -1; if (dt_set_pmgr()) return -1; #ifndef RELEASE From 513c103550e322f085119c3565fc54ffcdf6d28e Mon Sep 17 00:00:00 2001 From: Niklas Sheth Date: Sun, 15 Nov 2026 20:43:24 -0500 Subject: [PATCH 3/3] kboot: remove the J773g external display disable workaround dcpext no longer crashes randomly, so enable it on the mini Signed-off-by: Niklas Sheth --- src/kboot.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/kboot.c b/src/kboot.c index 97b0b9f5..f6271198 100644 --- a/src/kboot.c +++ b/src/kboot.c @@ -1846,29 +1846,8 @@ static const char dcpext_aliases[][8] = { "dcpext4", "dcpext5", "dcpext6", "dcpext7", }; -/* - * Boards whose external DCPs have no working output under Linux. Their - * firmware is still pre-loaded by iBoot, so its memory stays reserved, but the - * nodes keep the "disabled" status from the board DT. On J773g (M4 Mac mini) - * the USB-C DisplayPort path is unused, and both dcpext firmwares crash on - * ~9% of boots right after shmem setup. - */ -static const char *const dcpext_disabled_boards[] = { - "apple,j773g", -}; - -static bool dt_dcpext_disabled_board(void) -{ - for (size_t i = 0; i < ARRAY_SIZE(dcpext_disabled_boards); i++) - if (!fdt_node_check_compatible(dt, 0, dcpext_disabled_boards[i])) - return true; - return false; -} - static int dt_reserve_dcpext_firmware(void) { - bool keep_disabled = dt_dcpext_disabled_board(); - /* reserve asc for all */ for (size_t n = 0; n < ARRAY_SIZE(dcpext_aliases); n++) { const char *dcpext_alias = dcpext_aliases[n]; @@ -1893,11 +1872,6 @@ static int dt_reserve_dcpext_firmware(void) if (ret) continue; - if (keep_disabled) { - printf("FDT: leaving '%s' disabled on this board\n", dcpext_alias); - continue; - } - // refresh dcpext_node dcpext_node = fdt_path_offset(dt, dcpext_alias); if ((dcpext_node < 0) || (fdt_setprop_string(dt, dcpext_node, "status", "okay") < 0))