[Concept,02/32] sandbox: bootz: Fix incorrect pointer passed to unmap_sysmem()

Message ID 20260109231151.4056804-3-sjg@u-boot.org
State New
Headers
Series boot: pxe: Refactor into separate load/setup phases |

Commit Message

Simon Glass Jan. 9, 2026, 11:11 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

The bootz_setup() function maps the kernel image address to get a host
pointer, but then incorrectly passes the original physical address to
unmap_sysmem() instead of the mapped pointer. This causes a warning on
sandbox:

  unmap_physmem() Address not mapped: 0000000002000000

Fix this by passing the mapped pointer (zimage) to unmap_sysmem()
instead of the raw physical address cast to a pointer.

Update the PXE tests to remove expectations for this warning message.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 arch/sandbox/lib/bootm.c | 2 +-
 test/boot/pxe.c          | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)
  

Patch

diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
index 8ed923750f4..c1d970d021d 100644
--- a/arch/sandbox/lib/bootm.c
+++ b/arch/sandbox/lib/bootm.c
@@ -45,7 +45,7 @@  int bootz_setup(ulong image, ulong *start, ulong *end)
 		ret = 1;
 	}
 
-	unmap_sysmem((void *)image);
+	unmap_sysmem(zimage);
 
 	return ret;
 }
diff --git a/test/boot/pxe.c b/test/boot/pxe.c
index 9398cf5757f..0da28be8576 100644
--- a/test/boot/pxe.c
+++ b/test/boot/pxe.c
@@ -299,7 +299,6 @@  static int pxe_test_sysboot_norun(struct unit_test_state *uts)
 
 	/* Boot fails on sandbox */
 	ut_assert_nextline("Unrecognized zImage");
-	ut_assert_nextlinen("       unmap_physmem");
 
 	/* Verify files were loaded at the correct addresses */
 	kernel = map_sysmem(PXE_KERNEL_ADDR, 0);
@@ -376,7 +375,6 @@  static int pxe_test_fdtdir_norun(struct unit_test_state *uts)
 
 	/* Boot fails but we verified the path construction */
 	ut_assert_nextline("Unrecognized zImage");
-	ut_assert_nextlinen("       unmap_physmem");
 
 	/* Verify FDT was loaded correctly */
 	fdt = map_sysmem(PXE_FDT_ADDR, 0);
@@ -405,7 +403,6 @@  static int pxe_test_fdtdir_norun(struct unit_test_state *uts)
 
 	/* Boot fails but we verified the path construction */
 	ut_assert_nextline("Unrecognized zImage");
-	ut_assert_nextlinen("       unmap_physmem");
 
 	/* Verify FDT was loaded */
 	fdt = map_sysmem(PXE_FDT_ADDR, 0);
@@ -483,7 +480,6 @@  static int pxe_test_errors_norun(struct unit_test_state *uts)
 	 * that label loading continued despite missing fdtdir FDT
 	 */
 	ut_assert_nextline("Unrecognized zImage");
-	ut_assert_nextlinen("       unmap_physmem");
 
 	/* Clean up env vars */
 	env_set("fdtfile", NULL);