mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hunter Laux via B4 Relay <devnull+hunterlaux.gmail.com@kernel.org>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Hunter Laux <hunterlaux@gmail.com>
Subject: [PATCH] MIPS: kexec: Fix kexec on 32-bit non-EVA systems with HIGHMEM
Date: Tue, 10 Nov 2026 09:53:47 -0700	[thread overview]
Message-ID: <20261110-mips-kexec-highmem-v1-1-a42c73f840f1@gmail.com> (raw)

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>



                 reply	other threads:[~2026-11-10 16:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261110-mips-kexec-highmem-v1-1-a42c73f840f1@gmail.com \
    --to=devnull+hunterlaux.gmail.com@kernel.org \
    --cc=hunterlaux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®