arch/riscv: enable XIP
PATCH 1/1 arch/riscv: enable XIP
Introduce XIP (eXecute In Place) support for RISC-V platforms. It allows code to be executed directly from non-volatile storage directly addressable by the CPU, such as QSPI NOR flash which can be found on many RISC-V platforms. This makes way for significant optimization of RAM footprint. The XIP kernel is not compressed since it has to run directly from flash, so it will occupy more space on the non-volatile storage to The physical flash address used to link the kernel object files and for storing it has to be known at compile time and is represented by a Kconfig option.
XIP on RISC-V will currently only work on MMU-enabled kernels.
--- arch/riscv/Kconfig | 40 +++++++- arch/riscv/Makefile | 8 +- arch/riscv/boot/Makefile | 14 ++- arch/riscv/include/asm/pgtable.h | 53 +++++++++-- arch/riscv/kernel/head.S | 35 ++++++- arch/riscv/kernel/head.h | 3 + arch/riscv/kernel/setup.c | 2 +- arch/riscv/kernel/vmlinux-xip.lds.S | 132 +++++++++++++++++++++++++++ arch/riscv/kernel/vmlinux.lds.S | 6 ++ arch/riscv/mm/Makefile | 1 + arch/riscv/mm/init.c | 136 +++++++++++++++++++++++++--- 11 files changed, 408 insertions(+), 22 deletions(-) create mode 100644 arch/riscv/kernel/vmlinux-xip.lds.S
arch/riscv/Kconfig +39 -1
@@ -395,7 +395,7 @@ config EFI_STUB config EFI bool "UEFI runtime support" - depends on OF + depends on OF && !XIP_KERNEL select LIBFDT select UCS2_STRING select EFI_PARAMS_FROM_FDT
@@ -412,6 +412,44 @@ config EFI allow the kernel to be booted as an EFI application. This is only useful on systems that have UEFI firmware. +config XIP_KERNEL + bool "Kernel Execute-In-Place from ROM" + depends on MMU + 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. + + 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 XIP_PHYS_RAM_BASE + hex "Platform Physical RAM address" + depends on XIP_KERNEL + default "0x80000000" + help + This is the physical address of RAM in the system. It has to be + explicitly specified to run early relocations of read-write data + from flash to RAM. endmenu config BUILTIN_DTB
arch/riscv/Makefile +7 -1
@@ -70,7 +70,11 @@ CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS) # Default target when executing plain make boot := arch/riscv/boot +ifeq ($(CONFIG_XIP_KERNEL),y) +KBUILD_IMAGE := $(boot)/xipImage +else KBUILD_IMAGE := $(boot)/Image.gz +endif head-y := arch/riscv/kernel/head.o
@@ -83,12 +87,14 @@ PHONY += vdso_install vdso_install: $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ +ifneq ($(CONFIG_XIP_KERNEL),y) ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_KENDRYTE),yy) KBUILD_IMAGE := $(boot)/loader.bin else KBUILD_IMAGE := $(boot)/Image.gz endif -BOOT_TARGETS := Image Image.gz loader loader.bin +endif +BOOT_TARGETS := Image Image.gz loader loader.bin xipImage all: $(notdir $(KBUILD_IMAGE))
arch/riscv/boot/Makefile +13 -1
@@ -17,8 +17,20 @@ KCOV_INSTRUMENT := n OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S +OBJCOPYFLAGS_xipImage :=-O binary -R .note -R .note.gnu.build-id -R .comment -S -targets := Image loader +targets := Image loader 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)
arch/riscv/include/asm/pgtable.h +47 -6
71 lines not on this page · raw message
arch/riscv/kernel/head.S +34 -1
@@ -9,6 +9,7 @@ #include <linux/linkage.h> #include <asm/thread_info.h> #include <asm/page.h> +#include <asm/pgtable.h> #include <asm/csr.h> #include <asm/hwcap.h> #include <asm/image.h>
@@ -69,7 +70,11 @@ pe_head_start: #ifdef CONFIG_MMU relocate: /* Relocate return address */ +#ifdef CONFIG_XIP_KERNEL + li a1, XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) +#else li a1, PAGE_OFFSET +#endif la a2, _start sub a1, a1, a2 add ra, ra, a1
@@ -90,7 +95,13 @@ relocate: * full fence here because setup_vm() just wrote these PTEs and we need * to ensure the new translations are in use. */ +#ifdef CONFIG_XIP_KERNEL + la a0, _trampoline_pg_dir + lw t0, _xip_fixup + add a0, a0, t0 +#else la a0, trampoline_pg_dir +#endif srl a0, a0, PAGE_SHIFT or a0, a0, a1 sfence.vma
@@ -256,15 +267,33 @@ clear_bss_done: /* Save hart ID and DTB physical address */ mv s0, a0 mv s1, a1 + +#ifdef CONFIG_XIP_KERNEL + call __copy_data +#endif la a2, boot_cpu_hartid - REG_S a0, (a2) +#ifdef CONFIG_XIP_KERNEL + lw t0, _xip_fixup + add a2, a2, t0 +#endif + sw s0, (a2) /* Initialize page tables and relocate to virtual addresses */ la sp, init_thread_union + THREAD_SIZE +#ifdef CONFIG_XIP_KERNEL + lw t0, _xip_fixup + add sp, sp, t0 +#endif mv a0, s1 call setup_vm #ifdef CONFIG_MMU +#ifdef CONFIG_XIP_KERNEL + la a0, _early_pg_dir + lw t0, _xip_fixup + add a0, a0, t0 +#else la a0, early_pg_dir +#endif call relocate #endif /* CONFIG_MMU */
@@ -307,6 +336,10 @@ clear_bss_done: tail secondary_start_common #endif +#ifdef CONFIG_XIP_KERNEL +_xip_fixup: + .dword CONFIG_XIP_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET +#endif END(_start_kernel)
arch/riscv/kernel/head.h +3 -0
@@ -12,6 +12,9 @@ extern atomic_t hart_lottery; asmlinkage void do_page_fault(struct pt_regs *regs); asmlinkage void __init setup_vm(uintptr_t dtb_pa); +#ifdef CONFIG_XIP_KERNEL +asmlinkage void __init __copy_data(void); +#endif extern void *__cpu_up_stack_pointer[];extern void *__cpu_up_task_pointer[];
arch/riscv/kernel/setup.c +1 -1
@@ -84,7 +84,7 @@ void __init setup_arch(char **cmdline_p)#if IS_ENABLED (CONFIG_BUILTIN_DTB )unflatten_and_copy_device_tree ();#else -if (early_init_dt_verify (__va (dtb_early_pa))) +if (early_init_dt_verify (dtb_early_va))unflatten_device_tree ();else pr_err ("No DTB found in kernel mappings\n" );
arch/riscv/kernel/vmlinux-xip.lds.S new file +132 -0
132 lines not on this page · raw message
arch/riscv/kernel/vmlinux.lds.S +6 -0
@@ -4,7 +4,12 @@ * Copyright (C) 2017 SiFive */ +#ifdef CONFIG_XIP_KERNEL +#include "vmlinux-xip.lds.S" +#else + #define LOAD_OFFSET PAGE_OFFSET + #include <asm/vmlinux.lds.h> #include <asm/page.h> #include <asm/cache.h>
@@ -121,3 +126,4 @@ SECTIONS DISCARDS } +#endif /* CONFIG_XIP_KERNEL */
arch/riscv/mm/Makefile +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only CFLAGS_init.o := -mcmodel=medany + ifdef CONFIG_FTRACE CFLAGS_REMOVE_init.o = -pg endif
arch/riscv/mm/init.c +125 -11
240 lines not on this page · raw message
Signature · 7 lines
2.20.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 10 lines · Vitaly Wool
Introduce XIP (eXecute In Place) support for RISC-V platforms. It allows code to be executed directly from non-volatile storage directly addressable by the CPU, such as QSPI NOR flash which can be found on many RISC-V platforms. This makes way for significant optimization of RAM footprint. The XIP kernel is not compressed since it has to run directly from flash, so it will occupy more space on the non-volatile storage to The physical flash address used to link the kernel object files and for storing it has to be known at compile time and is represented by a
Kconfigoption.
Quoted 3 lines
XIP on RISC-V will currently only work on MMU-enabled kernels.
Signed-off-by Vitaly Wool <[email protected]>
That's nice!
Suggestion for a future enhancement:
To save on ROM storage, and given that the .data segment has to be copied to RAM anyway, you could store .data compressed and decompress it to RAM instead. See commit ca8b5d97d6bf for inspiration. In fact, many parts there could be shared.
More comments below.
arch/riscv/include/asm/pgtable.h line 35
Quoted 5 lines
arch/riscv/include/asm/pgtable.h +5
-0+#define __XIP_FIXUP (addr) \ + (((long)(addr) >= CONFIG_XIP_PHYS_ADDR && \ + (long)(addr) <= CONFIG_XIP_PHYS_ADDR + SZ_16M) ? \ + (long)(addr) - CONFIG_XIP_PHYS_ADDR + CONFIG_XIP_PHYS_RAM_BASE - XIP_OFFSET : \ + (long)(addr))
Here you should cast to unsigned long instead.
Quoted 4 lines
arch/riscv/kernel/head.S +4
-0+#ifdef CONFIG_XIP_KERNEL + la a0, _trampoline_pg_dir + lw t0, _xip_fixup + add a0, a0, t0
[...]
arch/riscv/kernel/head.S clear_bss_done: · line 342
Quoted 3 lines
arch/riscv/kernel/head.S +3
-0+_xip_fixup: + .dword CONFIG_XIP_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET +#endif
Here _xip_fixup is a dword but you're loading it as a word. This won't work for both rv32 and rv64.
Quoted 29 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +29
-0+SECTIONS +{ + /* Beginning of code and text segment */ + . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR); + _xiprom = .; + _start = .; + HEAD_TEXT_SECTION + INIT_TEXT_SECTION(PAGE_SIZE) + /* we have to discard exit text and such at runtime, not link time */ + .exit.text : + { + EXIT_TEXT + } + + .text : { + _text = .; + _stext = .; + TEXT_TEXT + SCHED_TEXT + CPUIDLE_TEXT + LOCK_TEXT + KPROBES_TEXT + ENTRY_TEXT + IRQENTRY_TEXT + SOFTIRQENTRY_TEXT + *(.fixup) + _etext = .; + } + RO_DATA(L1_CACHE_BYTES)
arch/riscv/kernel/vmlinux-xip.lds.S line 61
Quoted 10 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +10
-0+ .srodata : { + *(.srodata*) + } + .init.rodata : { + INIT_SETUP(16) + INIT_CALLS + CON_INITCALL + INIT_RAM_FS + } + _exiprom = ALIGN(PAGE_SIZE); /* End of XIP ROM area */
Why do you align this to a page size?
arch/riscv/kernel/vmlinux-xip.lds.S line 67
Quoted 6 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +6
-0+ + +/* + * From this point, stuff is considered writable and will be copied to RAM + */ + __data_loc = ALIGN(PAGE_SIZE); /* location in file */
Same question here?
arch/riscv/kernel/vmlinux-xip.lds.S line 80
Quoted 13 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +13
-0+ . = PAGE_OFFSET; /* location in memory */ + + _sdata = .; /* Start of data section */ + _data = .; + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + _edata = .; + __start_ro_after_init = .; + .data.ro_after_init : AT(ADDR(.data.ro_after_init) - LOAD_OFFSET) { + *(.data..ro_after_init) + } + __end_ro_after_init = .; + + . = ALIGN(PAGE_SIZE);
And again here?
arch/riscv/mm/init.c static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size) · line 482
Quoted 12 lines
arch/riscv/mm/init.c +12
-0+#ifdef CONFIG_XIP_KERNEL +/* called from head.S with MMU off */ +asmlinkage void __init __copy_data(void) +{ +void *from = (void *)(&_sdata); +void *end = (void *)(&_end); +void *to = (void *)CONFIG_XIP_PHYS_RAM_BASE ; +size_t sz = (size_t )(end - from); + +memcpy (to, from, sz); +} +#endif
Where is the stack located when this executes? The stack for the init task is typically found within the .data area. At least on ARM it is. You don't want to overwrite your stack here.
Nicolas
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 17 lines · Nicolas Pitre
Quoted 10 lines · Vitaly Wool
Introduce XIP (eXecute In Place) support for RISC-V platforms. It allows code to be executed directly from non-volatile storage directly addressable by the CPU, such as QSPI NOR flash which can be found on many RISC-V platforms. This makes way for significant optimization of RAM footprint. The XIP kernel is not compressed since it has to run directly from flash, so it will occupy more space on the non-volatile storage to The physical flash address used to link the kernel object files and for storing it has to be known at compile time and is represented by a
Kconfigoption.Quoted 3 lines
XIP on RISC-V will currently only work on MMU-enabled kernels.
Signed-off-by Vitaly Wool <[email protected]>
Quoted 7 lines
That's nice!
Suggestion for a future enhancement:
To save on ROM storage, and given that the .data segment has to be copied to RAM anyway, you could store .data compressed and decompress it to RAM instead. See commitca8b5d97d6bffor inspiration. In fact, many parts there could be shared.
Thanks! That's in my TODO list.
Quoted 9 lines
More comments below.
arch/riscv/include/asm/pgtable.h line 35
Quoted 5 lines
arch/riscv/include/asm/pgtable.h +5
-0+#define __XIP_FIXUP (addr) \ + (((long)(addr) >= CONFIG_XIP_PHYS_ADDR && \ + (long)(addr) <= CONFIG_XIP_PHYS_ADDR + SZ_16M) ? \ + (long)(addr) - CONFIG_XIP_PHYS_ADDR + CONFIG_XIP_PHYS_RAM_BASE - XIP_OFFSET : \ + (long)(addr))Here you should cast to unsigned long instead.
Right, or (just thought of it) uintptr_t for that matter. Does that sound right?
Quoted 11 lines
Quoted 4 lines
arch/riscv/kernel/head.S +4
-0+#ifdef CONFIG_XIP_KERNEL + la a0, _trampoline_pg_dir + lw t0, _xip_fixup + add a0, a0, t0[...]
arch/riscv/kernel/head.S clear_bss_done: · line 342
Quoted 3 lines
arch/riscv/kernel/head.S +3
-0+_xip_fixup: + .dword CONFIG_XIP_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET +#endifHere
_xip_fixupis a dword but you're loading it as a word. This won't work for both rv32 and rv64.
Well, at this point I believe it does, as long as we use little endian. 64-bit version has been verified.
I do not argue though that it isn't nice and should be fixed.
Quoted 33 lines
Quoted 33 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +33
-0+SECTIONS +{ + /* Beginning of code and text segment */ + . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR); + _xiprom = .; + _start = .; + HEAD_TEXT_SECTION + INIT_TEXT_SECTION(PAGE_SIZE) + /* we have to discard exit text and such at runtime, not link time */ + .exit.text : + { + EXIT_TEXT + } + + .text : { + _text = .; + _stext = .; + TEXT_TEXT + SCHED_TEXT + CPUIDLE_TEXT + LOCK_TEXT + KPROBES_TEXT + ENTRY_TEXT + IRQENTRY_TEXT + SOFTIRQENTRY_TEXT + *(.fixup) + _etext = .; + } + RO_DATA(L1_CACHE_BYTES) + .srodata : { + *(.srodata*) + } + .init.rodata : {
Quoted 8 lines
arch/riscv/kernel/vmlinux-xip.lds.S line 61
Quoted 6 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +6
-0+ INIT_SETUP(16) + INIT_CALLS + CON_INITCALL + INIT_RAM_FS + } + _exiprom = ALIGN(PAGE_SIZE); /* End of XIP ROM area */Why do you align this to a page size?
TBH I just cut the corners here and below, did not have to worry about partial pages and such.
Quoted 25 lines
arch/riscv/kernel/vmlinux-xip.lds.S line 67
Quoted 6 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +6
-0+ + +/* + * From this point, stuff is considered writable and will be copied to RAM + */ + __data_loc = ALIGN(PAGE_SIZE); /* location in file */Same question here?
arch/riscv/kernel/vmlinux-xip.lds.S line 80
Quoted 13 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +13
-0+ . = PAGE_OFFSET; /* location in memory */ + + _sdata = .; /* Start of data section */ + _data = .; + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + _edata = .; + __start_ro_after_init = .; + .data.ro_after_init : AT(ADDR(.data.ro_after_init) - LOAD_OFFSET) { + *(.data..ro_after_init) + } + __end_ro_after_init = .; + + . = ALIGN(PAGE_SIZE);And again here?
Quoted 16 lines
arch/riscv/mm/init.c static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size) · line 482
Quoted 12 lines
arch/riscv/mm/init.c +12
-0+#ifdef CONFIG_XIP_KERNEL +/* called from head.S with MMU off */ +asmlinkage void __init __copy_data(void) +{ +void *from = (void *)(&_sdata); +void *end = (void *)(&_end); +void *to = (void *)CONFIG_XIP_PHYS_RAM_BASE ; +size_t sz = (size_t )(end - from); + +memcpy (to, from, sz); +} +#endif Where is the stack located when this executes? The stack for the init task is typically found within the .data area. At least on ARM it is. You don't want to overwrite your stack here.
sp is set to within the .data area later, we rely on the u-boot sp setting which is outside of the destination area for the image parts that are copied. I agree that this makes the implementation fragile and will explicitly set sp in the next path version.
Best regards,
Vitaly
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 36 lines · Vitaly Wool
Quoted 17 lines · Nicolas Pitre
Quoted 10 lines · Vitaly Wool
Introduce XIP (eXecute In Place) support for RISC-V platforms. It allows code to be executed directly from non-volatile storage directly addressable by the CPU, such as QSPI NOR flash which can be found on many RISC-V platforms. This makes way for significant optimization of RAM footprint. The XIP kernel is not compressed since it has to run directly from flash, so it will occupy more space on the non-volatile storage to The physical flash address used to link the kernel object files and for storing it has to be known at compile time and is represented by a
Kconfigoption.Quoted 3 lines
XIP on RISC-V will currently only work on MMU-enabled kernels.
Signed-off-by Vitaly Wool <[email protected]>Quoted 7 lines
That's nice!
Suggestion for a future enhancement:
To save on ROM storage, and given that the .data segment has to be copied to RAM anyway, you could store .data compressed and decompress it to RAM instead. See commitca8b5d97d6bffor inspiration. In fact, many parts there could be shared.Thanks! That's in my TODO list.
Quoted 8 lines
More comments below.
Quoted 5 lines
arch/riscv/include/asm/pgtable.h +5
-0+#define __XIP_FIXUP (addr) \ + (((long)(addr) >= CONFIG_XIP_PHYS_ADDR && \ + (long)(addr) <= CONFIG_XIP_PHYS_ADDR + SZ_16M) ? \ + (long)(addr) - CONFIG_XIP_PHYS_ADDR + CONFIG_XIP_PHYS_RAM_BASE - XIP_OFFSET : \ + (long)(addr))
Quoted 3 lines
Quoted 1 line
Here you should cast to unsigned long instead.
Right, or (just thought of it)
uintptr_tfor that matter. Does that sound right?
Sure.
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
arch/riscv/kernel/head.S +4
-0+#ifdef CONFIG_XIP_KERNEL + la a0, _trampoline_pg_dir + lw t0, _xip_fixup + add a0, a0, t0[...]
arch/riscv/kernel/head.S clear_bss_done: · line 342
Quoted 3 lines
arch/riscv/kernel/head.S +3
-0+_xip_fixup: + .dword CONFIG_XIP_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET +#endifHere
_xip_fixupis a dword but you're loading it as a word. This won't work for both rv32 and rv64.
Quoted 2 lines
Well, at this point I believe it does, as long as we use little endian.
... and the fixup is not larger than 32 bits.
Quoted 1 line
64-bit version has been verified.
Won't work if ROM and RAM are far-enough apart.
Quoted 44 lines
I do not argue though that it isn't nice and should be fixed.
Quoted 33 lines
Quoted 33 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +33
-0+SECTIONS +{ + /* Beginning of code and text segment */ + . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR); + _xiprom = .; + _start = .; + HEAD_TEXT_SECTION + INIT_TEXT_SECTION(PAGE_SIZE) + /* we have to discard exit text and such at runtime, not link time */ + .exit.text : + { + EXIT_TEXT + } + + .text : { + _text = .; + _stext = .; + TEXT_TEXT + SCHED_TEXT + CPUIDLE_TEXT + LOCK_TEXT + KPROBES_TEXT + ENTRY_TEXT + IRQENTRY_TEXT + SOFTIRQENTRY_TEXT + *(.fixup) + _etext = .; + } + RO_DATA(L1_CACHE_BYTES) + .srodata : { + *(.srodata*) + } + .init.rodata : {Quoted 8 lines
arch/riscv/kernel/vmlinux-xip.lds.S line 61
Quoted 6 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +6
-0+ INIT_SETUP(16) + INIT_CALLS + CON_INITCALL + INIT_RAM_FS + } + _exiprom = ALIGN(PAGE_SIZE); /* End of XIP ROM area */Why do you align this to a page size?
Quoted 2 lines
TBH I just cut the corners here and below, did not have to worry about partial pages and such.
You're wasting ROM space though.
Quoted 9 lines
Quoted 9 lines
arch/riscv/kernel/vmlinux-xip.lds.S line 67
Quoted 6 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +6
-0+ + +/* + * From this point, stuff is considered writable and will be copied to RAM + */ + __data_loc = ALIGN(PAGE_SIZE); /* location in file */Same question here?
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +7
-0+ . = PAGE_OFFSET; /* location in memory */ + + _sdata = .; /* Start of data section */ + _data = .; + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + _edata = .; + __start_ro_after_init = .;Quoted 8 lines
arch/riscv/kernel/vmlinux-xip.lds.S line 80
Quoted 6 lines
arch/riscv/kernel/vmlinux-xip.lds.S new file +6
-0+ .data.ro_after_init : AT(ADDR(.data.ro_after_init) - LOAD_OFFSET) { + *(.data..ro_after_init) + } + __end_ro_after_init = .; + + . = ALIGN(PAGE_SIZE);And again here?
Forget this particular one. It is fine.
Nicolas
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv