From: Sasha Levin Date: Tue, 28 Jul 2026 18:10:44 +0000 (-0400) Subject: Drop a few riscv commits from 6.18 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=ebd37b7354957bb43f833234c1712a0b90454dc4;p=thirdparty%2Fkernel%2Fstable-queue.git Drop a few riscv commits from 6.18 Signed-off-by: Sasha Levin --- diff --git a/queue-6.18/riscv-enable-kernel-access-to-shadow-stack-memory-vi.patch b/queue-6.18/riscv-enable-kernel-access-to-shadow-stack-memory-vi.patch deleted file mode 100644 index 2dba401375..0000000000 --- a/queue-6.18/riscv-enable-kernel-access-to-shadow-stack-memory-vi.patch +++ /dev/null @@ -1,105 +0,0 @@ -From a5ad00dd5f1908fd1a1724c2d45c87edd5326b91 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 25 Jan 2026 21:09:55 -0700 -Subject: riscv: enable kernel access to shadow stack memory via the FWFT SBI - call - -From: Deepak Gupta - -[ Upstream commit 41213bf2ae6c936f51a79986b37f95da9ecbb970 ] - -The kernel has to perform shadow stack operations on the user shadow stack. -During signal delivery and sigreturn, the shadow stack token must be -created and validated respectively. Thus shadow stack access for the kernel -must be enabled. - -In the future, when kernel shadow stacks are enabled, they must be -enabled as early as possible for better coverage and to prevent any -imbalance between the regular stack and the shadow stack. After -'relocate_enable_mmu' has completed, this is the earliest that it can -be enabled. - -Reviewed-by: Zong Li -Signed-off-by: Deepak Gupta -Tested-by: Andreas Korb # QEMU, custom CVA6 -Tested-by: Valentin Haudiquet -Link: https://patch.msgid.link/20251112-v5_user_cfi_series-v23-22-b55691eacf4f@rivosinc.com -[pjw@kernel.org: updated to apply; cleaned up commit message] -Signed-off-by: Paul Walmsley -Stable-dep-of: 3a2694bf6ac8 ("riscv: Gate FUNCTION_ALIGNMENT_4B on DYNAMIC_FTRACE") -Signed-off-by: Sasha Levin ---- - arch/riscv/kernel/asm-offsets.c | 6 ++++++ - arch/riscv/kernel/head.S | 27 +++++++++++++++++++++++++++ - 2 files changed, 33 insertions(+) - -diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c -index 0a5e3e892c0ea0..739f6c6ed15885 100644 ---- a/arch/riscv/kernel/asm-offsets.c -+++ b/arch/riscv/kernel/asm-offsets.c -@@ -529,4 +529,10 @@ void asm_offsets(void) - DEFINE(FREGS_A6, offsetof(struct __arch_ftrace_regs, a6)); - DEFINE(FREGS_A7, offsetof(struct __arch_ftrace_regs, a7)); - #endif -+#ifdef CONFIG_RISCV_SBI -+ DEFINE(SBI_EXT_FWFT, SBI_EXT_FWFT); -+ DEFINE(SBI_EXT_FWFT_SET, SBI_EXT_FWFT_SET); -+ DEFINE(SBI_FWFT_SHADOW_STACK, SBI_FWFT_SHADOW_STACK); -+ DEFINE(SBI_FWFT_SET_FLAG_LOCK, SBI_FWFT_SET_FLAG_LOCK); -+#endif - } -diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S -index bdf3352acf4cb4..9c99c5ad6fe8a3 100644 ---- a/arch/riscv/kernel/head.S -+++ b/arch/riscv/kernel/head.S -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include "efi-header.S" - - __HEAD -@@ -170,6 +171,19 @@ secondary_start_sbi: - call relocate_enable_mmu - #endif - call .Lsetup_trap_vector -+#if defined(CONFIG_RISCV_SBI) && defined(CONFIG_RISCV_USER_CFI) -+ li a7, SBI_EXT_FWFT -+ li a6, SBI_EXT_FWFT_SET -+ li a0, SBI_FWFT_SHADOW_STACK -+ li a1, 1 /* enable supervisor to access shadow stack access */ -+ li a2, SBI_FWFT_SET_FLAG_LOCK -+ ecall -+ beqz a0, 1f -+ la a1, riscv_nousercfi -+ li a0, CMDLINE_DISABLE_RISCV_USERCFI_BCFI -+ REG_S a0, (a1) -+1: -+#endif - scs_load_current - call smp_callin - #endif /* CONFIG_SMP */ -@@ -330,6 +344,19 @@ SYM_CODE_START(_start_kernel) - la tp, init_task - la sp, init_thread_union + THREAD_SIZE - addi sp, sp, -PT_SIZE_ON_STACK -+#if defined(CONFIG_RISCV_SBI) && defined(CONFIG_RISCV_USER_CFI) -+ li a7, SBI_EXT_FWFT -+ li a6, SBI_EXT_FWFT_SET -+ li a0, SBI_FWFT_SHADOW_STACK -+ li a1, 1 /* enable supervisor to access shadow stack access */ -+ li a2, SBI_FWFT_SET_FLAG_LOCK -+ ecall -+ beqz a0, 1f -+ la a1, riscv_nousercfi -+ li a0, CMDLINE_DISABLE_RISCV_USERCFI_BCFI -+ REG_S a0, (a1) -+1: -+#endif - scs_load_current - - #ifdef CONFIG_KASAN --- -2.53.0 - diff --git a/queue-6.18/riscv-export-kaslr-offset-and-satp-in-vmcoreinfo-elf.patch b/queue-6.18/riscv-export-kaslr-offset-and-satp-in-vmcoreinfo-elf.patch deleted file mode 100644 index ff99b227ed..0000000000 --- a/queue-6.18/riscv-export-kaslr-offset-and-satp-in-vmcoreinfo-elf.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 7d1a79d11020d1ec3923d441664f06cf003490a1 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sat, 4 Apr 2026 18:42:40 -0600 -Subject: riscv: export kaslr offset and satp in VMCOREINFO ELF notes - -From: Austin Kim - -[ Upstream commit d8e99133eb4a8d09dcbf71f7277dc948d3413227 ] - -The following options are required by the kdump crash utility for RISC-V -based vmcore file: - -- kaslr: If the vmcore is generated from a KASLR-enabled Linux kernel, - the KASLR offset is required for the crash utility to load - the vmcore. Without the proper kaslr option, the crash utility - fails to load the vmcore file. -- satp: The exact root page table address helps determine the correct base - PGD address. - -With this patch, RISC-V VMCOREINFO ELF notes now include both kaslr -and satp information. - -Signed-off-by: Austin Kim -Link: https://patch.msgid.link/aYwKUE3ZzN7/ZY/A@adminpc-PowerEdge-R7525 -Signed-off-by: Paul Walmsley -Stable-dep-of: 3a2694bf6ac8 ("riscv: Gate FUNCTION_ALIGNMENT_4B on DYNAMIC_FTRACE") -Signed-off-by: Sasha Levin ---- - arch/riscv/kernel/vmcore_info.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/arch/riscv/kernel/vmcore_info.c b/arch/riscv/kernel/vmcore_info.c -index d5e448aa90e746..682ba423cf203d 100644 ---- a/arch/riscv/kernel/vmcore_info.c -+++ b/arch/riscv/kernel/vmcore_info.c -@@ -3,6 +3,11 @@ - #include - #include - -+static inline u64 get_satp_value(void) -+{ -+ return csr_read(CSR_SATP); -+} -+ - void arch_crash_save_vmcoreinfo(void) - { - VMCOREINFO_NUMBER(phys_ram_base); -@@ -27,5 +32,7 @@ void arch_crash_save_vmcoreinfo(void) - #else - vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n", - kernel_map.va_kernel_pa_offset); -+ vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset()); -+ vmcoreinfo_append_str("NUMBER(satp)=0x%llx\n", get_satp_value()); - #endif - } --- -2.53.0 - diff --git a/queue-6.18/riscv-gate-function_alignment_4b-on-dynamic_ftrace.patch b/queue-6.18/riscv-gate-function_alignment_4b-on-dynamic_ftrace.patch deleted file mode 100644 index 75e2b60dc6..0000000000 --- a/queue-6.18/riscv-gate-function_alignment_4b-on-dynamic_ftrace.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 07e53fd655124537b9b12e767a85526c72df4c14 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 6 Jul 2026 21:04:14 +0800 -Subject: riscv: Gate FUNCTION_ALIGNMENT_4B on DYNAMIC_FTRACE - -From: Rui Qi - -[ Upstream commit 3a2694bf6ac8e47b3814293e80343f58fc72937f ] - -The FUNCTION_ALIGNMENT_4B select forces the whole kernel to be built -with -fmin-function-alignment=4. This alignment is only needed so the -patchable-function-entry NOPs, which arch/riscv/Makefile emits under -CONFIG_DYNAMIC_FTRACE, can be patched reliably on RISCV_ISA_C=y builds -where compressed instructions otherwise allow 2-byte function -alignment. - -The select is currently gated on HAVE_DYNAMIC_FTRACE, a capability bit -that is selected whenever the toolchain supports dynamic ftrace, rather -than on whether tracing is actually enabled. As a result every -RISCV_ISA_C=y build gets 4-byte function alignment across the entire -kernel even when function tracing is disabled, needlessly growing the -kernel image and wasting instruction cache for a feature that is not -in use. - -Gate the select on DYNAMIC_FTRACE instead, matching the condition under -which arch/riscv/Makefile emits -fpatchable-function-entry, so the -alignment is only applied when it is actually needed. - -Fixes: c41bf4326c7b ("riscv: ftrace: align patchable functions to 4 Byte boundary") -Signed-off-by: Rui Qi -Link: https://patch.msgid.link/20260706130415.463682-1-qirui.001@bytedance.com -Signed-off-by: Paul Walmsley -Signed-off-by: Sasha Levin ---- - arch/riscv/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig -index c09dbb89461ddb..17b968321b6679 100644 ---- a/arch/riscv/Kconfig -+++ b/arch/riscv/Kconfig -@@ -153,7 +153,7 @@ config RISCV - select HAVE_DEBUG_KMEMLEAK - select HAVE_DMA_CONTIGUOUS if MMU - select HAVE_DYNAMIC_FTRACE if MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE) -- select FUNCTION_ALIGNMENT_4B if HAVE_DYNAMIC_FTRACE && RISCV_ISA_C -+ select FUNCTION_ALIGNMENT_4B if DYNAMIC_FTRACE && RISCV_ISA_C - select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS if HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS - select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS if (DYNAMIC_FTRACE_WITH_ARGS && !CFI) - select HAVE_DYNAMIC_FTRACE_WITH_ARGS if HAVE_DYNAMIC_FTRACE --- -2.53.0 - diff --git a/queue-6.18/riscv-remove-support-for-xip-kernel.patch b/queue-6.18/riscv-remove-support-for-xip-kernel.patch deleted file mode 100644 index 64f6084773..0000000000 --- a/queue-6.18/riscv-remove-support-for-xip-kernel.patch +++ /dev/null @@ -1,979 +0,0 @@ -From 6d2bb998bb0764d49ef86c981e4d356670186611 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 3 Apr 2026 19:28:48 -0600 -Subject: riscv: Remove support for XIP kernel - -From: Nam Cao - -[ Upstream commit 9b3a2be84803cf18c4b4d1efc695991f0daa153c ] - -XIP has a history of being broken for long periods of time. In 2023, it was -broken for 18 months before getting fixed [1]. In 2024 it was 4 months [2]. - -And now it is broken again since commit a44fb5722199 ("riscv: Add runtime -constant support"), 10 months ago. - -These are clear signs that XIP feature is not being used. - -I occasionally looked after XIP, but mostly because I was bored and had -nothing better to do. - -Remove XIP support. Revert is possible if someone shows up complaining. - -Link: https://lore.kernel.org/linux-riscv/20231212-customary-hardcover-e19462bf8e75@wendy/ [1] -Link: https://lore.kernel.org/linux-riscv/20240526110104.470429-1-namcao@linutronix.de/ [2] -Signed-off-by: Nam Cao -Cc: Frederik Haxel -Cc: Vitaly Wool -Reviewed-by: Jisheng Zhang -Acked-by: Conor Dooley -Link: https://patch.msgid.link/20260202115403.2119218-1-namcao@linutronix.de -[pjw@kernel.org: updated to apply] -Signed-off-by: Paul Walmsley -Stable-dep-of: 3a2694bf6ac8 ("riscv: Gate FUNCTION_ALIGNMENT_4B on DYNAMIC_FTRACE") -Signed-off-by: Sasha Levin ---- - arch/riscv/Kconfig | 86 ++++++--------------- - arch/riscv/Kconfig.socs | 8 +- - arch/riscv/Makefile | 3 - - arch/riscv/boot/Makefile | 11 --- - arch/riscv/include/asm/page.h | 29 -------- - arch/riscv/include/asm/pgtable.h | 20 ----- - arch/riscv/include/asm/scs.h | 1 - - arch/riscv/include/asm/set_memory.h | 2 +- - arch/riscv/include/asm/xip_fixup.h | 49 ------------ - arch/riscv/kernel/head.S | 41 ---------- - arch/riscv/kernel/head.h | 3 - - arch/riscv/kernel/setup.c | 6 +- - arch/riscv/kernel/suspend_entry.S | 2 - - arch/riscv/kernel/traps.c | 4 - - arch/riscv/kernel/vmcore_info.c | 7 -- - arch/riscv/kernel/vmlinux.lds.S | 5 -- - arch/riscv/mm/init.c | 111 ++-------------------------- - 17 files changed, 37 insertions(+), 351 deletions(-) - delete mode 100644 arch/riscv/include/asm/xip_fixup.h - -diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig -index fadec20b87a8e3..c09dbb89461ddb 100644 ---- a/arch/riscv/Kconfig -+++ b/arch/riscv/Kconfig -@@ -48,8 +48,8 @@ config RISCV - select ARCH_HAS_PTE_SPECIAL - select ARCH_HAS_SET_DIRECT_MAP if MMU - select ARCH_HAS_SET_MEMORY if MMU -- select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL -- select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL -+ select ARCH_HAS_STRICT_KERNEL_RWX if MMU -+ select ARCH_HAS_STRICT_MODULE_RWX if MMU - select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE - select ARCH_HAS_SYSCALL_WRAPPER - select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST -@@ -85,7 +85,7 @@ config RISCV - select ARCH_WANT_FRAME_POINTERS - select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT - select ARCH_WANT_HUGE_PMD_SHARE if 64BIT -- select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL -+ select ARCH_WANT_LD_ORPHAN_WARN - select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP - select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP - select ARCH_WANTS_NO_INSTR -@@ -130,13 +130,13 @@ config RISCV - select HAVE_ARCH_AUDITSYSCALL - select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP - select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT -- select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL -- select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL -+ select HAVE_ARCH_JUMP_LABEL -+ select HAVE_ARCH_JUMP_LABEL_RELATIVE - select HAVE_ARCH_KASAN if MMU && 64BIT - select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT - select HAVE_ARCH_KFENCE if MMU && 64BIT - select HAVE_ARCH_KSTACK_ERASE -- select HAVE_ARCH_KGDB if !XIP_KERNEL -+ select HAVE_ARCH_KGDB - select HAVE_ARCH_KGDB_QXFER_PKT - select HAVE_ARCH_MMAP_RND_BITS if MMU - select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT -@@ -152,7 +152,7 @@ config RISCV - select HAVE_CONTEXT_TRACKING_USER - select HAVE_DEBUG_KMEMLEAK - select HAVE_DMA_CONTIGUOUS if MMU -- select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE) -+ select HAVE_DYNAMIC_FTRACE if MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE) - select FUNCTION_ALIGNMENT_4B if HAVE_DYNAMIC_FTRACE && RISCV_ISA_C - select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS if HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS - select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS if (DYNAMIC_FTRACE_WITH_ARGS && !CFI) -@@ -160,7 +160,7 @@ config RISCV - select HAVE_FTRACE_GRAPH_FUNC - select HAVE_FUNCTION_GRAPH_TRACER if HAVE_DYNAMIC_FTRACE_WITH_ARGS - select HAVE_FUNCTION_GRAPH_FREGS -- select HAVE_FUNCTION_TRACER if !XIP_KERNEL && HAVE_DYNAMIC_FTRACE -+ select HAVE_FUNCTION_TRACER if HAVE_DYNAMIC_FTRACE - select HAVE_EBPF_JIT if MMU - select HAVE_GENERIC_TIF_BITS - select HAVE_GUP_FAST if MMU -@@ -169,16 +169,16 @@ config RISCV - select HAVE_GCC_PLUGINS - select HAVE_GENERIC_VDSO if MMU - select HAVE_IRQ_TIME_ACCOUNTING -- select HAVE_KERNEL_BZIP2 if !XIP_KERNEL && !EFI_ZBOOT -- select HAVE_KERNEL_GZIP if !XIP_KERNEL && !EFI_ZBOOT -- select HAVE_KERNEL_LZ4 if !XIP_KERNEL && !EFI_ZBOOT -- select HAVE_KERNEL_LZMA if !XIP_KERNEL && !EFI_ZBOOT -- select HAVE_KERNEL_LZO if !XIP_KERNEL && !EFI_ZBOOT -- select HAVE_KERNEL_UNCOMPRESSED if !XIP_KERNEL && !EFI_ZBOOT -- select HAVE_KERNEL_ZSTD if !XIP_KERNEL && !EFI_ZBOOT -- select HAVE_KERNEL_XZ if !XIP_KERNEL && !EFI_ZBOOT -- select HAVE_KPROBES if !XIP_KERNEL -- select HAVE_KRETPROBES if !XIP_KERNEL -+ select HAVE_KERNEL_BZIP2 if !EFI_ZBOOT -+ select HAVE_KERNEL_GZIP if !EFI_ZBOOT -+ select HAVE_KERNEL_LZ4 if !EFI_ZBOOT -+ select HAVE_KERNEL_LZMA if !EFI_ZBOOT -+ select HAVE_KERNEL_LZO if !EFI_ZBOOT -+ select HAVE_KERNEL_UNCOMPRESSED if !EFI_ZBOOT -+ select HAVE_KERNEL_ZSTD if !EFI_ZBOOT -+ select HAVE_KERNEL_XZ if !EFI_ZBOOT -+ select HAVE_KPROBES -+ select HAVE_KRETPROBES - # https://github.com/ClangBuiltLinux/linux/issues/1881 - select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD - select HAVE_MOVE_PMD -@@ -189,9 +189,9 @@ config RISCV - select HAVE_PERF_REGS - select HAVE_PERF_USER_STACK_DUMP - select HAVE_POSIX_CPU_TIMERS_TASK_WORK -- select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL -+ select HAVE_PREEMPT_DYNAMIC_KEY - select HAVE_REGS_AND_STACK_ACCESS_API -- select HAVE_RETHOOK if !XIP_KERNEL -+ select HAVE_RETHOOK - select HAVE_RSEQ - select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG - select HAVE_SAMPLE_FTRACE_DIRECT -@@ -212,7 +212,7 @@ config RISCV - select PCI_ECAM if (ACPI && PCI) - select PCI_MSI if PCI - select RELOCATABLE if !MMU && !PHYS_RAM_BASE_FIXED -- select RISCV_ALTERNATIVE if !XIP_KERNEL -+ select RISCV_ALTERNATIVE - select RISCV_APLIC - select RISCV_IMSIC - select RISCV_INTC -@@ -539,7 +539,6 @@ endchoice - - config RISCV_ALTERNATIVE - bool -- depends on !XIP_KERNEL - help - This Kconfig allows the kernel to automatically patch the - erratum or cpufeature required by the execution platform at run -@@ -1113,7 +1112,6 @@ config PARAVIRT_TIME_ACCOUNTING - - config RELOCATABLE - bool "Build a relocatable kernel" -- depends on !XIP_KERNEL - select MODULE_SECTIONS if MODULES - select ARCH_VMLINUX_NEEDS_RELOCS - help -@@ -1130,7 +1128,7 @@ config RELOCATABLE - config RANDOMIZE_BASE - bool "Randomize the address of the kernel image" - select RELOCATABLE -- depends on MMU && 64BIT && !XIP_KERNEL -+ depends on MMU && 64BIT - help - Randomizes the virtual address at which the kernel image is - loaded, as a security feature that deters exploit attempts -@@ -1198,7 +1196,7 @@ config EFI_STUB - - config EFI - bool "UEFI runtime support" -- depends on OF && !XIP_KERNEL -+ depends on OF - depends on MMU - default y - select ARCH_SUPPORTS_ACPI if 64BIT -@@ -1249,44 +1247,6 @@ config PHYS_RAM_BASE - explicitly specified to run early relocations of read-write data - from flash to RAM. - --config XIP_KERNEL -- bool "Kernel Execute-In-Place from ROM" -- depends on MMU && SPARSEMEM && NONPORTABLE -- # This prevents XIP from being enabled by all{yes,mod}config, which -- # fail to build since XIP doesn't support large kernels. -- depends on !COMPILE_TEST -- select PHYS_RAM_BASE_FIXED -- help -- Execute-In-Place allows the kernel to run from non-volatile storage -- directly addressable by the CPU, such as NOR flash. This saves RAM -- space since the text section of the kernel is not loaded from flash -- to RAM. Read-write sections, such as the data section and stack, -- are still copied to RAM. The XIP kernel is not compressed since -- it has to run directly from flash, so it will take more space to -- store it. The flash address used to link the kernel object files, -- and for storing it, is configuration dependent. Therefore, if you -- say Y here, you must know the proper physical address where to -- store the kernel image depending on your own flash memory usage. -- -- Also note that the make target becomes "make xipImage" rather than -- "make zImage" or "make Image". The final kernel binary to put in -- ROM memory will be arch/riscv/boot/xipImage. -- -- SPARSEMEM is required because the kernel text and rodata that are -- flash resident are not backed by memmap, then any attempt to get -- a struct page on those regions will trigger a fault. -- -- If unsure, say N. -- --config XIP_PHYS_ADDR -- hex "XIP Kernel Physical Location" -- depends on XIP_KERNEL -- default "0x21000000" -- help -- This is the physical address in your flash memory the kernel will -- be linked for and stored to. This address is dependent on your -- own flash usage. -- - config RISCV_ISA_FALLBACK - bool "Permit falling back to parsing riscv,isa for extension support by default" - default y -diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs -index 848e7149e4435a..baed90e6ae4878 100644 ---- a/arch/riscv/Kconfig.socs -+++ b/arch/riscv/Kconfig.socs -@@ -2,7 +2,7 @@ menu "SoC selection" - - config ARCH_ANDES - bool "Andes SoCs" -- depends on MMU && !XIP_KERNEL -+ depends on MMU - select ERRATA_ANDES - help - This enables support for Andes SoC platform hardware. -@@ -28,7 +28,7 @@ config ARCH_RENESAS - - config ARCH_SIFIVE - bool "SiFive SoCs" -- select ERRATA_SIFIVE if !XIP_KERNEL -+ select ERRATA_SIFIVE - help - This enables support for SiFive SoC platform hardware. - -@@ -56,7 +56,7 @@ config SOC_STARFIVE - - config ARCH_SUNXI - bool "Allwinner sun20i SoCs" -- depends on MMU && !XIP_KERNEL -+ depends on MMU - select ERRATA_THEAD - select SUN4I_TIMER - help -@@ -65,7 +65,7 @@ config ARCH_SUNXI - - config ARCH_THEAD - bool "T-HEAD RISC-V SoCs" -- depends on MMU && !XIP_KERNEL -+ depends on MMU - select ERRATA_THEAD - select PM_GENERIC_DOMAINS if PM - help -diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile -index 4c6de57f65ef0e..c7aaa2965a689b 100644 ---- a/arch/riscv/Makefile -+++ b/arch/riscv/Makefile -@@ -147,7 +147,6 @@ ifdef CONFIG_RISCV_M_MODE - boot-image-$(CONFIG_SOC_CANAAN_K210) := loader.bin - endif - boot-image-$(CONFIG_EFI_ZBOOT) := vmlinuz.efi --boot-image-$(CONFIG_XIP_KERNEL) := xipImage - KBUILD_IMAGE := $(boot)/$(boot-image-y) - - libs-y += arch/riscv/lib/ -@@ -212,8 +211,6 @@ define archhelp - echo ' Image.xz - Compressed kernel image (arch/riscv/boot/Image.xz)' - echo ' vmlinuz.efi - Compressed EFI kernel image (arch/riscv/boot/vmlinuz.efi)' - echo ' Default when CONFIG_EFI_ZBOOT=y' -- echo ' xipImage - Execute-in-place kernel image (arch/riscv/boot/xipImage)' -- echo ' Default when CONFIG_XIP_KERNEL=y' - echo ' install - Install kernel using (your) ~/bin/$(INSTALLKERNEL) or' - echo ' (distribution) /sbin/$(INSTALLKERNEL) or install to ' - echo ' $$(INSTALL_PATH)' -diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile -index 5301adf5f3f5d2..fcfbe3f814d664 100644 ---- a/arch/riscv/boot/Makefile -+++ b/arch/riscv/boot/Makefile -@@ -20,17 +20,6 @@ OBJCOPYFLAGS_xipImage :=-O binary -R .note -R .note.gnu.build-id -R .comment -S - - targets := Image Image.* loader loader.o loader.lds loader.bin xipImage - --ifeq ($(CONFIG_XIP_KERNEL),y) -- --quiet_cmd_mkxip = $(quiet_cmd_objcopy) --cmd_mkxip = $(cmd_objcopy) -- --$(obj)/xipImage: vmlinux FORCE -- $(call if_changed,mkxip) -- @$(kecho) ' Physical Address of xipImage: $(CONFIG_XIP_PHYS_ADDR)' -- --endif -- - $(obj)/Image: vmlinux FORCE - $(call if_changed,objcopy) - -diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h -index ffe213ad65a4ee..d0e29b52738567 100644 ---- a/arch/riscv/include/asm/page.h -+++ b/arch/riscv/include/asm/page.h -@@ -29,11 +29,7 @@ - #define PAGE_OFFSET_L5 _AC(0xff60000000000000, UL) - #define PAGE_OFFSET_L4 _AC(0xffffaf8000000000, UL) - #define PAGE_OFFSET_L3 _AC(0xffffffd600000000, UL) --#ifdef CONFIG_XIP_KERNEL --#define PAGE_OFFSET PAGE_OFFSET_L3 --#else - #define PAGE_OFFSET kernel_map.page_offset --#endif /* CONFIG_XIP_KERNEL */ - #else - #define PAGE_OFFSET _AC(0xc0000000, UL) - #endif /* CONFIG_64BIT */ -@@ -106,15 +102,8 @@ struct kernel_mapping { - /* Offset between linear mapping virtual address and kernel load address */ - unsigned long va_pa_offset; - /* Offset between kernel mapping virtual address and kernel load address */ --#ifdef CONFIG_XIP_KERNEL -- unsigned long va_kernel_xip_text_pa_offset; -- unsigned long va_kernel_xip_data_pa_offset; -- uintptr_t xiprom; -- uintptr_t xiprom_sz; --#else - unsigned long page_offset; - unsigned long va_kernel_pa_offset; --#endif - }; - - extern struct kernel_mapping kernel_map; -@@ -133,16 +122,7 @@ extern unsigned long vmemmap_start_pfn; - void *linear_mapping_pa_to_va(unsigned long x); - #endif - --#ifdef CONFIG_XIP_KERNEL --#define kernel_mapping_pa_to_va(y) ({ \ -- unsigned long _y = (unsigned long)(y); \ -- (_y < phys_ram_base) ? \ -- (void *)(_y + kernel_map.va_kernel_xip_text_pa_offset) : \ -- (void *)(_y + kernel_map.va_kernel_xip_data_pa_offset); \ -- }) --#else - #define kernel_mapping_pa_to_va(y) ((void *)((unsigned long)(y) + kernel_map.va_kernel_pa_offset)) --#endif - - #define __pa_to_va_nodebug(x) linear_mapping_pa_to_va(x) - -@@ -152,16 +132,7 @@ void *linear_mapping_pa_to_va(unsigned long x); - phys_addr_t linear_mapping_va_to_pa(unsigned long x); - #endif - --#ifdef CONFIG_XIP_KERNEL --#define kernel_mapping_va_to_pa(y) ({ \ -- unsigned long _y = (unsigned long)(y); \ -- (_y < kernel_map.virt_addr + kernel_map.xiprom_sz) ? \ -- (_y - kernel_map.va_kernel_xip_text_pa_offset) : \ -- (_y - kernel_map.va_kernel_xip_data_pa_offset); \ -- }) --#else - #define kernel_mapping_va_to_pa(y) ((unsigned long)(y) - kernel_map.va_kernel_pa_offset) --#endif - - #define __va_to_pa_nodebug(x) ({ \ - unsigned long _x = x; \ -diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h -index 9b2e967c9fe080..78bde59498836b 100644 ---- a/arch/riscv/include/asm/pgtable.h -+++ b/arch/riscv/include/asm/pgtable.h -@@ -144,21 +144,6 @@ - - #include - --#ifdef CONFIG_XIP_KERNEL --#define XIP_FIXUP(addr) ({ \ -- extern char _sdata[], _start[], _end[]; \ -- uintptr_t __rom_start_data = CONFIG_XIP_PHYS_ADDR \ -- + (uintptr_t)&_sdata - (uintptr_t)&_start; \ -- uintptr_t __rom_end_data = CONFIG_XIP_PHYS_ADDR \ -- + (uintptr_t)&_end - (uintptr_t)&_start; \ -- uintptr_t __a = (uintptr_t)(addr); \ -- (__a >= __rom_start_data && __a < __rom_end_data) ? \ -- __a - __rom_start_data + CONFIG_PHYS_RAM_BASE : __a; \ -- }) --#else --#define XIP_FIXUP(addr) (addr) --#endif /* CONFIG_XIP_KERNEL */ -- - struct pt_alloc_ops { - pte_t *(*get_pte_virt)(phys_addr_t pa); - phys_addr_t (*alloc_pte)(uintptr_t va); -@@ -1106,13 +1091,8 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte) - extern char _start[]; - extern void *_dtb_early_va; - extern uintptr_t _dtb_early_pa; --#if defined(CONFIG_XIP_KERNEL) && defined(CONFIG_MMU) --#define dtb_early_va (*(void **)XIP_FIXUP(&_dtb_early_va)) --#define dtb_early_pa (*(uintptr_t *)XIP_FIXUP(&_dtb_early_pa)) --#else - #define dtb_early_va _dtb_early_va - #define dtb_early_pa _dtb_early_pa --#endif /* CONFIG_XIP_KERNEL */ - extern u64 satp_mode; - - void paging_init(void); -diff --git a/arch/riscv/include/asm/scs.h b/arch/riscv/include/asm/scs.h -index ab7714aa93bdc4..023a412fe38d37 100644 ---- a/arch/riscv/include/asm/scs.h -+++ b/arch/riscv/include/asm/scs.h -@@ -10,7 +10,6 @@ - /* Load init_shadow_call_stack to gp. */ - .macro scs_load_init_stack - la gp, init_shadow_call_stack -- XIP_FIXUP_OFFSET gp - .endm - - /* Load the per-CPU IRQ shadow call stack to gp. */ -diff --git a/arch/riscv/include/asm/set_memory.h b/arch/riscv/include/asm/set_memory.h -index 87389e93325a3b..ef59e1716a2cfd 100644 ---- a/arch/riscv/include/asm/set_memory.h -+++ b/arch/riscv/include/asm/set_memory.h -@@ -47,7 +47,7 @@ bool kernel_page_present(struct page *page); - - #endif /* __ASSEMBLER__ */ - --#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_XIP_KERNEL) -+#if defined(CONFIG_STRICT_KERNEL_RWX) - #ifdef CONFIG_64BIT - #define SECTION_ALIGN (1 << 21) - #else -diff --git a/arch/riscv/include/asm/xip_fixup.h b/arch/riscv/include/asm/xip_fixup.h -deleted file mode 100644 -index f3d56299bc22c5..00000000000000 ---- a/arch/riscv/include/asm/xip_fixup.h -+++ /dev/null -@@ -1,49 +0,0 @@ --/* SPDX-License-Identifier: GPL-2.0-only */ --/* -- * XIP fixup macros, only useful in assembly. -- */ --#ifndef _ASM_RISCV_XIP_FIXUP_H --#define _ASM_RISCV_XIP_FIXUP_H -- --#include -- --#ifdef CONFIG_XIP_KERNEL --.macro XIP_FIXUP_OFFSET reg -- /* Fix-up address in Flash into address in RAM early during boot before -- * MMU is up. Because generated code "thinks" data is in Flash, but it -- * is actually in RAM (actually data is also in Flash, but Flash is -- * read-only, thus we need to use the data residing in RAM). -- * -- * The start of data in Flash is _sdata and the start of data in RAM is -- * CONFIG_PHYS_RAM_BASE. So this fix-up essentially does this: -- * reg += CONFIG_PHYS_RAM_BASE - _start -- */ -- li t0, CONFIG_PHYS_RAM_BASE -- add \reg, \reg, t0 -- la t0, _sdata -- sub \reg, \reg, t0 --.endm --.macro XIP_FIXUP_FLASH_OFFSET reg -- /* In linker script, at the transition from read-only section to -- * writable section, the VMA is increased while LMA remains the same. -- * (See in linker script how _sdata, __data_loc and LOAD_OFFSET is -- * changed) -- * -- * Consequently, early during boot before MMU is up, the generated code -- * reads the "writable" section at wrong addresses, because VMA is used -- * by compiler to generate code, but the data is located in Flash using -- * LMA. -- */ -- la t0, _sdata -- sub \reg, \reg, t0 -- la t0, __data_loc -- add \reg, \reg, t0 --.endm --#else --.macro XIP_FIXUP_OFFSET reg --.endm --.macro XIP_FIXUP_FLASH_OFFSET reg --.endm --#endif /* CONFIG_XIP_KERNEL */ -- --#endif -diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S -index 9c99c5ad6fe8a3..65039904436892 100644 ---- a/arch/riscv/kernel/head.S -+++ b/arch/riscv/kernel/head.S -@@ -14,7 +14,6 @@ - #include - #include - #include --#include - #include - #include "efi-header.S" - -@@ -75,7 +74,6 @@ pe_head_start: - relocate_enable_mmu: - /* Relocate return address */ - la a1, kernel_map -- XIP_FIXUP_OFFSET a1 - REG_L a1, KERNEL_MAP_VIRT_ADDR(a1) - la a2, _start - sub a1, a1, a2 -@@ -89,7 +87,6 @@ relocate_enable_mmu: - /* Compute satp for kernel page tables, but don't load it yet */ - srl a2, a0, PAGE_SHIFT - la a1, satp_mode -- XIP_FIXUP_OFFSET a1 - REG_L a1, 0(a1) - or a2, a2, a1 - -@@ -100,7 +97,6 @@ relocate_enable_mmu: - * to ensure the new translations are in use. - */ - la a0, trampoline_pg_dir -- XIP_FIXUP_OFFSET a0 - srl a0, a0, PAGE_SHIFT - or a0, a0, a1 - sfence.vma -@@ -154,11 +150,9 @@ secondary_start_sbi: - - /* a0 contains the hartid & a1 contains boot data */ - li a2, SBI_HART_BOOT_TASK_PTR_OFFSET -- XIP_FIXUP_OFFSET a2 - add a2, a2, a1 - REG_L tp, (a2) - li a3, SBI_HART_BOOT_STACK_PTR_OFFSET -- XIP_FIXUP_OFFSET a3 - add a3, a3, a1 - REG_L sp, (a3) - -@@ -167,7 +161,6 @@ secondary_start_sbi: - #ifdef CONFIG_MMU - /* Enable virtual memory and relocate to virtual address */ - la a0, swapper_pg_dir -- XIP_FIXUP_OFFSET a0 - call relocate_enable_mmu - #endif - call .Lsetup_trap_vector -@@ -269,40 +262,13 @@ SYM_CODE_START(_start_kernel) - .Lgood_cores: - - /* The lottery system is only required for spinwait booting method */ --#ifndef CONFIG_XIP_KERNEL - /* Pick one hart to run the main boot sequence */ - la a3, hart_lottery - li a2, 1 - amoadd.w a3, a2, (a3) - bnez a3, .Lsecondary_start -- --#else -- /* hart_lottery in flash contains a magic number */ -- la a3, hart_lottery -- mv a2, a3 -- XIP_FIXUP_OFFSET a2 -- XIP_FIXUP_FLASH_OFFSET a3 -- lw t1, (a3) -- amoswap.w t0, t1, (a2) -- /* first time here if hart_lottery in RAM is not set */ -- beq t0, t1, .Lsecondary_start -- --#endif /* CONFIG_XIP */ - #endif /* CONFIG_RISCV_BOOT_SPINWAIT */ - --#ifdef CONFIG_XIP_KERNEL -- la sp, _end + THREAD_SIZE -- XIP_FIXUP_OFFSET sp -- mv s0, a0 -- mv s1, a1 -- call __copy_data -- -- /* Restore a0 & a1 copy */ -- mv a0, s0 -- mv a1, s1 --#endif -- --#ifndef CONFIG_XIP_KERNEL - /* Clear BSS for flat non-ELF images */ - la a3, __bss_start - la a4, __bss_stop -@@ -312,20 +278,16 @@ SYM_CODE_START(_start_kernel) - add a3, a3, RISCV_SZPTR - blt a3, a4, .Lclear_bss - .Lclear_bss_done: --#endif - la a2, boot_cpu_hartid -- XIP_FIXUP_OFFSET a2 - REG_S a0, (a2) - - /* Initialize page tables and relocate to virtual addresses */ - la tp, init_task - la sp, init_thread_union + THREAD_SIZE -- XIP_FIXUP_OFFSET sp - addi sp, sp, -PT_SIZE_ON_STACK - scs_load_init_stack - #ifdef CONFIG_BUILTIN_DTB - la a0, __dtb_start -- XIP_FIXUP_OFFSET a0 - #else - mv a0, a1 - #endif /* CONFIG_BUILTIN_DTB */ -@@ -335,7 +297,6 @@ SYM_CODE_START(_start_kernel) - call setup_vm - #ifdef CONFIG_MMU - la a0, early_pg_dir -- XIP_FIXUP_OFFSET a0 - call relocate_enable_mmu - #endif /* CONFIG_MMU */ - -@@ -374,9 +335,7 @@ SYM_CODE_START(_start_kernel) - - slli a3, a0, LGREG - la a1, __cpu_spinwait_stack_pointer -- XIP_FIXUP_OFFSET a1 - la a2, __cpu_spinwait_task_pointer -- XIP_FIXUP_OFFSET a2 - add a1, a3, a1 - add a2, a3, a2 - -diff --git a/arch/riscv/kernel/head.h b/arch/riscv/kernel/head.h -index a556fdaafed943..05a04bef442b1b 100644 ---- a/arch/riscv/kernel/head.h -+++ b/arch/riscv/kernel/head.h -@@ -11,9 +11,6 @@ - extern atomic_t hart_lottery; - - asmlinkage void __init setup_vm(uintptr_t dtb_pa); --#ifdef CONFIG_XIP_KERNEL --asmlinkage void __init __copy_data(void); --#endif - - #ifdef CONFIG_RISCV_BOOT_SPINWAIT - extern void *__cpu_spinwait_stack_pointer[]; -diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c -index b5bc5fc65cea65..c89cc272440b9f 100644 ---- a/arch/riscv/kernel/setup.c -+++ b/arch/riscv/kernel/setup.c -@@ -46,11 +46,7 @@ - * This is used before the kernel initializes the BSS so it can't be in the - * BSS. - */ --atomic_t hart_lottery __section(".sdata") --#ifdef CONFIG_XIP_KERNEL --= ATOMIC_INIT(0xC001BEEF) --#endif --; -+atomic_t hart_lottery __section(".sdata"); - unsigned long boot_cpu_hartid; - EXPORT_SYMBOL_GPL(boot_cpu_hartid); - -diff --git a/arch/riscv/kernel/suspend_entry.S b/arch/riscv/kernel/suspend_entry.S -index 2d54f309c14059..d71b55fd6259f3 100644 ---- a/arch/riscv/kernel/suspend_entry.S -+++ b/arch/riscv/kernel/suspend_entry.S -@@ -10,7 +10,6 @@ - #include - #include - #include --#include - - .text - .altmacro -@@ -70,7 +69,6 @@ SYM_TYPED_FUNC_START(__cpu_resume_enter) - - /* Enable MMU */ - la a0, swapper_pg_dir -- XIP_FIXUP_OFFSET a0 - call relocate_enable_mmu - - /* Restore A0 and A1 */ -diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c -index 47afea4ff1a8d2..3d24a4697bd915 100644 ---- a/arch/riscv/kernel/traps.c -+++ b/arch/riscv/kernel/traps.c -@@ -142,11 +142,7 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code, - } - } - --#if defined(CONFIG_XIP_KERNEL) && defined(CONFIG_RISCV_ALTERNATIVE) --#define __trap_section __noinstr_section(".xip.traps") --#else - #define __trap_section noinstr --#endif - #define DO_ERROR_INFO(name, signo, code, str) \ - asmlinkage __visible __trap_section void name(struct pt_regs *regs) \ - { \ -diff --git a/arch/riscv/kernel/vmcore_info.c b/arch/riscv/kernel/vmcore_info.c -index 682ba423cf203d..c27efceec3cc3a 100644 ---- a/arch/riscv/kernel/vmcore_info.c -+++ b/arch/riscv/kernel/vmcore_info.c -@@ -24,15 +24,8 @@ void arch_crash_save_vmcoreinfo(void) - #endif - #endif - vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR); --#ifdef CONFIG_XIP_KERNEL -- /* TODO: Communicate with crash-utility developers on the information to -- * export. The XIP case is more complicated, because the virtual-physical -- * address offset depends on whether the address is in ROM or in RAM. -- */ --#else - vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n", - kernel_map.va_kernel_pa_offset); - vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset()); - vmcoreinfo_append_str("NUMBER(satp)=0x%llx\n", get_satp_value()); --#endif - } -diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S -index 997f9eb3b22b13..1f4f8496941aef 100644 ---- a/arch/riscv/kernel/vmlinux.lds.S -+++ b/arch/riscv/kernel/vmlinux.lds.S -@@ -7,10 +7,6 @@ - #define RO_EXCEPTION_TABLE_ALIGN 4 - #define RUNTIME_DISCARD_EXIT - --#ifdef CONFIG_XIP_KERNEL --#include "vmlinux-xip.lds.S" --#else -- - #include - #define LOAD_OFFSET KERNEL_LINK_ADDR - -@@ -176,4 +172,3 @@ SECTIONS - - DISCARDS - } --#endif /* CONFIG_XIP_KERNEL */ -diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c -index ee40ca01ac6636..4994df8dc92618 100644 ---- a/arch/riscv/mm/init.c -+++ b/arch/riscv/mm/init.c -@@ -41,20 +41,17 @@ u64 new_vmalloc[NR_CPUS / sizeof(u64) + 1]; - - struct kernel_mapping kernel_map __ro_after_init; - EXPORT_SYMBOL(kernel_map); --#ifdef CONFIG_XIP_KERNEL --#define kernel_map (*(struct kernel_mapping *)XIP_FIXUP(&kernel_map)) --#endif - - #ifdef CONFIG_64BIT --u64 satp_mode __ro_after_init = !IS_ENABLED(CONFIG_XIP_KERNEL) ? SATP_MODE_57 : SATP_MODE_39; -+u64 satp_mode __ro_after_init = SATP_MODE_57; - #else - u64 satp_mode __ro_after_init = SATP_MODE_32; - #endif - EXPORT_SYMBOL(satp_mode); - - #ifdef CONFIG_64BIT --bool pgtable_l4_enabled __ro_after_init = !IS_ENABLED(CONFIG_XIP_KERNEL); --bool pgtable_l5_enabled __ro_after_init = !IS_ENABLED(CONFIG_XIP_KERNEL); -+bool pgtable_l4_enabled __ro_after_init = true; -+bool pgtable_l5_enabled __ro_after_init = true; - EXPORT_SYMBOL(pgtable_l4_enabled); - EXPORT_SYMBOL(pgtable_l5_enabled); - #endif -@@ -197,9 +194,6 @@ void __init arch_mm_preinit(void) - - /* Limit the memory size via mem. */ - static phys_addr_t memory_limit; --#ifdef CONFIG_XIP_KERNEL --#define memory_limit (*(phys_addr_t *)XIP_FIXUP(&memory_limit)) --#endif /* CONFIG_XIP_KERNEL */ - - static int __init early_mem(char *p) - { -@@ -223,10 +217,7 @@ static void __init setup_bootmem(void) - phys_addr_t max_mapped_addr; - phys_addr_t phys_ram_end, vmlinux_start; - -- if (IS_ENABLED(CONFIG_XIP_KERNEL)) -- vmlinux_start = __pa_symbol(&_sdata); -- else -- vmlinux_start = __pa_symbol(&_start); -+ vmlinux_start = __pa_symbol(&_start); - - memblock_enforce_memory_limit(memory_limit); - -@@ -246,12 +237,10 @@ static void __init setup_bootmem(void) - * Make sure we align the start of the memory on a PMD boundary so that - * at worst, we map the linear mapping with PMD mappings. - */ -- if (!IS_ENABLED(CONFIG_XIP_KERNEL)) { -- phys_ram_base = memblock_start_of_DRAM() & PMD_MASK; -+ phys_ram_base = memblock_start_of_DRAM() & PMD_MASK; - #ifdef CONFIG_SPARSEMEM_VMEMMAP -- vmemmap_start_pfn = round_down(phys_ram_base, VMEMMAP_ADDR_ALIGN) >> PAGE_SHIFT; -+ vmemmap_start_pfn = round_down(phys_ram_base, VMEMMAP_ADDR_ALIGN) >> PAGE_SHIFT; - #endif -- } - - /* - * In 64-bit, any use of __va/__pa before this point is wrong as we -@@ -366,13 +355,6 @@ static pte_t fixmap_pte[PTRS_PER_PTE] __page_aligned_bss; - - pgd_t early_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); - --#ifdef CONFIG_XIP_KERNEL --#define pt_ops (*(struct pt_alloc_ops *)XIP_FIXUP(&pt_ops)) --#define trampoline_pg_dir ((pgd_t *)XIP_FIXUP(trampoline_pg_dir)) --#define fixmap_pte ((pte_t *)XIP_FIXUP(fixmap_pte)) --#define early_pg_dir ((pgd_t *)XIP_FIXUP(early_pg_dir)) --#endif /* CONFIG_XIP_KERNEL */ -- - static const pgprot_t protection_map[16] = { - [VM_NONE] = PAGE_NONE, - [VM_READ] = PAGE_READ, -@@ -469,32 +451,14 @@ static pmd_t trampoline_pmd[PTRS_PER_PMD] __page_aligned_bss; - static pmd_t fixmap_pmd[PTRS_PER_PMD] __page_aligned_bss; - static pmd_t early_pmd[PTRS_PER_PMD] __initdata __aligned(PAGE_SIZE); - --#ifdef CONFIG_XIP_KERNEL --#define trampoline_pmd ((pmd_t *)XIP_FIXUP(trampoline_pmd)) --#define fixmap_pmd ((pmd_t *)XIP_FIXUP(fixmap_pmd)) --#define early_pmd ((pmd_t *)XIP_FIXUP(early_pmd)) --#endif /* CONFIG_XIP_KERNEL */ -- - static p4d_t trampoline_p4d[PTRS_PER_P4D] __page_aligned_bss; - static p4d_t fixmap_p4d[PTRS_PER_P4D] __page_aligned_bss; - static p4d_t early_p4d[PTRS_PER_P4D] __initdata __aligned(PAGE_SIZE); - --#ifdef CONFIG_XIP_KERNEL --#define trampoline_p4d ((p4d_t *)XIP_FIXUP(trampoline_p4d)) --#define fixmap_p4d ((p4d_t *)XIP_FIXUP(fixmap_p4d)) --#define early_p4d ((p4d_t *)XIP_FIXUP(early_p4d)) --#endif /* CONFIG_XIP_KERNEL */ -- - static pud_t trampoline_pud[PTRS_PER_PUD] __page_aligned_bss; - static pud_t fixmap_pud[PTRS_PER_PUD] __page_aligned_bss; - static pud_t early_pud[PTRS_PER_PUD] __initdata __aligned(PAGE_SIZE); - --#ifdef CONFIG_XIP_KERNEL --#define trampoline_pud ((pud_t *)XIP_FIXUP(trampoline_pud)) --#define fixmap_pud ((pud_t *)XIP_FIXUP(fixmap_pud)) --#define early_pud ((pud_t *)XIP_FIXUP(early_pud)) --#endif /* CONFIG_XIP_KERNEL */ -- - static pmd_t *__init get_pmd_virt_early(phys_addr_t pa) - { - /* Before MMU is enabled */ -@@ -765,21 +729,6 @@ static uintptr_t __meminit best_map_size(phys_addr_t pa, uintptr_t va, phys_addr - return PAGE_SIZE; - } - --#ifdef CONFIG_XIP_KERNEL --#define phys_ram_base (*(phys_addr_t *)XIP_FIXUP(&phys_ram_base)) --extern char _xiprom[], _exiprom[], __data_loc; -- --/* called from head.S with MMU off */ --asmlinkage void __init __copy_data(void) --{ -- void *from = (void *)(&__data_loc); -- void *to = (void *)CONFIG_PHYS_RAM_BASE; -- size_t sz = (size_t)((uintptr_t)(&_end) - (uintptr_t)(&_sdata)); -- -- memcpy(to, from, sz); --} --#endif -- - #ifdef CONFIG_STRICT_KERNEL_RWX - static __meminit pgprot_t pgprot_from_va(uintptr_t va) - { -@@ -815,7 +764,7 @@ static __meminit pgprot_t pgprot_from_va(uintptr_t va) - } - #endif /* CONFIG_STRICT_KERNEL_RWX */ - --#if defined(CONFIG_64BIT) && !defined(CONFIG_XIP_KERNEL) -+#if defined(CONFIG_64BIT) - u64 __pi_set_satp_mode_from_cmdline(uintptr_t dtb_pa); - u64 __pi_set_satp_mode_from_fdt(uintptr_t dtb_pa); - -@@ -965,28 +914,6 @@ static __init void set_satp_mode(uintptr_t dtb_pa) - #error "setup_vm() is called from head.S before relocate so it should not use absolute addressing." - #endif - --#ifdef CONFIG_XIP_KERNEL --static void __init create_kernel_page_table(pgd_t *pgdir, -- __always_unused bool early) --{ -- uintptr_t va, start_va, end_va; -- -- /* Map the flash resident part */ -- end_va = kernel_map.virt_addr + kernel_map.xiprom_sz; -- for (va = kernel_map.virt_addr; va < end_va; va += PMD_SIZE) -- create_pgd_mapping(pgdir, va, -- kernel_map.xiprom + (va - kernel_map.virt_addr), -- PMD_SIZE, PAGE_KERNEL_EXEC); -- -- /* Map the data in RAM */ -- start_va = kernel_map.virt_addr + (uintptr_t)&_sdata - (uintptr_t)&_start; -- end_va = kernel_map.virt_addr + kernel_map.size; -- for (va = start_va; va < end_va; va += PMD_SIZE) -- create_pgd_mapping(pgdir, va, -- kernel_map.phys_addr + (va - start_va), -- PMD_SIZE, PAGE_KERNEL); --} --#else - static void __init create_kernel_page_table(pgd_t *pgdir, bool early) - { - uintptr_t va, end_va; -@@ -999,7 +926,6 @@ static void __init create_kernel_page_table(pgd_t *pgdir, bool early) - early ? - PAGE_KERNEL_EXEC : pgprot_from_va(va)); - } --#endif - - /* - * Setup a 4MB mapping that encompasses the device tree: for 64-bit kernel, -@@ -1141,27 +1067,11 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) - - kernel_map.virt_addr = KERNEL_LINK_ADDR + kernel_map.virt_offset; - --#ifdef CONFIG_XIP_KERNEL -- kernel_map.xiprom = (uintptr_t)CONFIG_XIP_PHYS_ADDR; -- kernel_map.xiprom_sz = (uintptr_t)(&_exiprom) - (uintptr_t)(&_xiprom); -- -- phys_ram_base = CONFIG_PHYS_RAM_BASE; --#ifdef CONFIG_SPARSEMEM_VMEMMAP -- vmemmap_start_pfn = round_down(phys_ram_base, VMEMMAP_ADDR_ALIGN) >> PAGE_SHIFT; --#endif -- kernel_map.phys_addr = (uintptr_t)CONFIG_PHYS_RAM_BASE; -- kernel_map.size = (uintptr_t)(&_end) - (uintptr_t)(&_start); -- -- kernel_map.va_kernel_xip_text_pa_offset = kernel_map.virt_addr - kernel_map.xiprom; -- kernel_map.va_kernel_xip_data_pa_offset = kernel_map.virt_addr - kernel_map.phys_addr -- + (uintptr_t)&_sdata - (uintptr_t)&_start; --#else - kernel_map.phys_addr = (uintptr_t)(&_start); - kernel_map.size = (uintptr_t)(&_end) - kernel_map.phys_addr; - kernel_map.va_kernel_pa_offset = kernel_map.virt_addr - kernel_map.phys_addr; --#endif - --#if defined(CONFIG_64BIT) && !defined(CONFIG_XIP_KERNEL) -+#if defined(CONFIG_64BIT) - set_satp_mode(dtb_pa); - set_mmap_rnd_bits_max(); - #endif -@@ -1234,13 +1144,8 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) - if (pgtable_l4_enabled) - create_pud_mapping(trampoline_pud, kernel_map.virt_addr, - (uintptr_t)trampoline_pmd, PUD_SIZE, PAGE_TABLE); --#ifdef CONFIG_XIP_KERNEL -- create_pmd_mapping(trampoline_pmd, kernel_map.virt_addr, -- kernel_map.xiprom, PMD_SIZE, PAGE_KERNEL_EXEC); --#else - create_pmd_mapping(trampoline_pmd, kernel_map.virt_addr, - kernel_map.phys_addr, PMD_SIZE, PAGE_KERNEL_EXEC); --#endif - #else - /* Setup trampoline PGD */ - create_pgd_mapping(trampoline_pg_dir, kernel_map.virt_addr, --- -2.53.0 - diff --git a/queue-6.18/series b/queue-6.18/series index 4b83dd9083..1c29ace5f2 100644 --- a/queue-6.18/series +++ b/queue-6.18/series @@ -113,10 +113,6 @@ bluetooth-mgmt-fix-locking-in-unpair_device-disconne.patch bluetooth-mgmt-hold-reference-for-hci_conn-in-mgmt_p.patch bluetooth-hci_qca-clear-memdump-state-on-invalid-dum.patch smb-client-handle-overlapping-allocated-ranges-in-fa.patch -riscv-enable-kernel-access-to-shadow-stack-memory-vi.patch -riscv-export-kaslr-offset-and-satp-in-vmcoreinfo-elf.patch -riscv-remove-support-for-xip-kernel.patch -riscv-gate-function_alignment_4b-on-dynamic_ftrace.patch drm-i915-gt-use-correct-selftest-config-symbol.patch can-raw-add-locking-for-raw-flags-bitfield.patch powerpc-85xx-add-fsl-ifc-to-common-device-ids.patch