mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] MIPS: kexec: Fix kexec on 32-bit non-EVA systems with HIGHMEM
@ 2026-11-10 16:53 Hunter Laux via B4 Relay
  0 siblings, 0 replies; only message in thread
From: Hunter Laux via B4 Relay @ 2026-11-10 16:53 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Hunter Laux

From: Hunter Laux <hunterlaux@gmail.com>

Commit a6da4d6fdf8b ("MIPS: kexec: Relax memory restriction") lifted
the 512 MiB limit on the pages kexec copies the new image from and to.
relocate_kernel.S reaches those pages through phys_to_virt(), which
only covers lowmem. On a 32-bit kernel with HIGHMEM, the source pages
are allocated with GFP_HIGHUSER, and one in highmem becomes an address
that isn't that page: physical 0x30060000 becomes 0xb0060000, the
uncached alias of 0x10060000. The new image is copied from there and
the jump to it fails with a Reserved Instruction exception.

Limit the source and destination pages to HIGHMEM_START - 1: the old
512 MiB on most 32-bit platforms, and no limit on 64-bit kernels, where
HIGHMEM_START is beyond any memory.

Platforms with more than 512 MiB of lowmem, such as 32-bit EVA
systems, raise HIGHMEM_START and keep the larger limit.

kimage_alloc_page() keeps the highmem pages it rejects until the image
is unloaded or executed, so loading an image on a HIGHMEM system now
holds most of the free highmem in the meantime. kexec -p is not
affected.

Fixes: a6da4d6fdf8b ("MIPS: kexec: Relax memory restriction")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hunter Laux <hunterlaux@gmail.com>
---
 arch/mips/include/asm/kexec.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/kexec.h b/arch/mips/include/asm/kexec.h
index 69e579e41e..5f57bbc8c3 100644
--- a/arch/mips/include/asm/kexec.h
+++ b/arch/mips/include/asm/kexec.h
@@ -7,12 +7,13 @@
 #ifndef _MIPS_KEXEC
 # define _MIPS_KEXEC
 
+#include <asm/page.h>
 #include <asm/stacktrace.h>
 
 /* Maximum physical address we can use pages from */
-#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
-/* Maximum address we can reach in physical address mode */
-#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
+#define KEXEC_SOURCE_MEMORY_LIMIT (HIGHMEM_START - 1)
+/* Maximum physical address we can copy the image to */
+#define KEXEC_DESTINATION_MEMORY_LIMIT (HIGHMEM_START - 1)
  /* Maximum address we can use for the control code buffer */
 #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
 /* Reserve 3*4096 bytes for board-specific info */

---
base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
change-id: 20261110-mips-kexec-highmem-4c47bdd57a0f

Best regards,
-- 
Hunter Laux <hunterlaux@gmail.com>



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-10 16:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 16:53 [PATCH] MIPS: kexec: Fix kexec on 32-bit non-EVA systems with HIGHMEM Hunter Laux via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®