* [PATCH v1] riscv: disable runtime constant support for XIP kernels
@ 2026-03-20 15:58 Charles Mirabile
0 siblings, 0 replies; only message in thread
From: Charles Mirabile @ 2026-03-20 15:58 UTC (permalink / raw)
To: linux-kernel
Cc: Charles Mirabile, linux-riscv, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Charlie Jenkins, stable
Runtime constant support is predicated on patching the kernel binary at
runtime, which is fundamentally impossible for an XIP kernel whose text
section is backed not by RAM but by memory mapped read-only storage.
If CONFIG_XIP_KERNEL is enabled, do not define riscv implementations of
the relevant runtime constant macros so that the fallbacks which do not
perform runtime constant optimization are used.
Fixes: a44fb5722199 ("riscv: Add runtime constant support")
Cc: stable@vger.kernel.org
Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
---
arch/riscv/include/asm/runtime-const.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/asm/runtime-const.h
index d766e2b9e6df1..05110bb7554e9 100644
--- a/arch/riscv/include/asm/runtime-const.h
+++ b/arch/riscv/include/asm/runtime-const.h
@@ -11,6 +11,9 @@
#include <linux/uaccess.h>
+/* patching of the kernel text is fundamentally impossible on XIP kernels */
+#ifndef CONFIG_XIP_KERNEL
+
#ifdef CONFIG_32BIT
#define runtime_const_ptr(sym) \
({ \
@@ -265,4 +268,5 @@ static inline void runtime_const_fixup(void (*fn)(void *, unsigned long),
}
}
+#endif /* !CONFIG_XIP_KERNEL */
#endif /* _ASM_RISCV_RUNTIME_CONST_H */
base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-20 15:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-20 15:58 [PATCH v1] riscv: disable runtime constant support for XIP kernels Charles Mirabile
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®