Commit 5e4417f9 authored by Max Filippov's avatar Max Filippov
Browse files

xtensa: reorganize vectors placement



Allow vectors to be either merged into the kernel .text or put at a
fixed virtual address independently of XIP option. Drop option that
puts vectors at a fixed offset from the kernel text. Add choice to
Kconfig.
Vectors at fixed virtual address may be useful for XIP-aware MTD support
and for noMMU configurations with available IRAM. Configurations without
VECBASE register must put their vectors at specific locations regardless
of the selected option. All other configurations should happily use
merged vectors.

Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent 4f17664a
Loading
Loading
Loading
Loading
+33 −7
Original line number Diff line number Diff line
@@ -572,15 +572,41 @@ config KERNEL_LOAD_ADDRESS

	  If unsure, leave the default value here.

config VECTORS_OFFSET
	hex "Kernel vectors offset"
	default 0x00003000
	depends on !XIP_KERNEL
choice
	prompt "Relocatable vectors location"
	default XTENSA_VECTORS_IN_TEXT
	help
	  This is the offset of the kernel image from the relocatable vectors
	  base.
	  Choose whether relocatable vectors are merged into the kernel .text
	  or placed separately at runtime. This option does not affect
	  configurations without VECBASE register where vectors are always
	  placed at their hardware-defined locations.

	  If unsure, leave the default value here.
config XTENSA_VECTORS_IN_TEXT
	bool "Merge relocatable vectors into kernel text"
	depends on !MTD_XIP
	help
	  This option puts relocatable vectors into the kernel .text section
	  with proper alignment.
	  This is a safe choice for most configurations.

config XTENSA_VECTORS_SEPARATE
	bool "Put relocatable vectors at fixed address"
	help
	  This option puts relocatable vectors at specific virtual address.
	  Vectors are merged with the .init data in the kernel image and
	  are copied into their designated location during kernel startup.
	  Use it to put vectors into IRAM or out of FLASH on kernels with
	  XIP-aware MTD support.

endchoice

config VECTORS_ADDR
	hex "Kernel vectors virtual address"
	default 0x00000000
	depends on XTENSA_VECTORS_SEPARATE
	help
	  This is the virtual address of the (relocatable) vectors base.
	  It must be within KSEG if MMU is used.

config XIP_DATA_ADDR
	hex "XIP kernel data virtual address"
+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ CONFIG_SMP=y
CONFIG_HOTPLUG_CPU=y
# CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set
# CONFIG_PCI is not set
CONFIG_VECTORS_OFFSET=0x00002000
CONFIG_XTENSA_PLATFORM_XTFPGA=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0"
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ CONFIG_KALLSYMS_ALL=y
CONFIG_PERF_EVENTS=y
CONFIG_XTENSA_VARIANT_DC233C=y
CONFIG_XTENSA_UNALIGNED_USER=y
CONFIG_VECTORS_OFFSET=0x00002000
CONFIG_XTENSA_KSEG_512M=y
CONFIG_HIGHMEM=y
CONFIG_CMDLINE_BOOL=y
+2 −2
Original line number Diff line number Diff line
@@ -34,8 +34,8 @@
#endif

#define RESET_VECTOR1_VADDR		(XCHAL_RESET_VECTOR1_VADDR)
#ifdef CONFIG_VECTORS_OFFSET
#define VECBASE_VADDR			(KERNELOFFSET - CONFIG_VECTORS_OFFSET)
#ifdef CONFIG_VECTORS_ADDR
#define VECBASE_VADDR			(CONFIG_VECTORS_ADDR)
#else
#define VECBASE_VADDR			_vecbase
#endif
+2 −2
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ void __init setup_arch(char **cmdline_p)
	mem_reserve(__pa(_xip_start), __pa(_xip_end));
#endif

#ifdef CONFIG_VECTORS_OFFSET
#ifdef CONFIG_VECTORS_ADDR
	mem_reserve(__pa(&_WindowVectors_text_start),
		    __pa(&_WindowVectors_text_end));

@@ -388,7 +388,7 @@ void __init setup_arch(char **cmdline_p)
		    __pa(&_Level6InterruptVector_text_end));
#endif

#endif /* CONFIG_VECTORS_OFFSET */
#endif /* CONFIG_VECTORS_ADDR */

#ifdef CONFIG_SMP
	mem_reserve(__pa(&_SecondaryResetVector_text_start),
Loading