xtensa: make secondary reset vector support conditional
authorMax Filippov <jcmvbkbc@gmail.com>
Tue, 28 Dec 2021 09:28:53 +0000 (01:28 -0800)
committerMax Filippov <jcmvbkbc@gmail.com>
Thu, 10 Mar 2022 00:59:18 +0000 (16:59 -0800)
Whether xtensa cores start from primary or secondary reset vector is
configurable and may be chosen by board designer or controlled at
runtime. When secondary reset vector is unused its location in memory
may not be writable.
Make secondary reset vector support conditional and don't build and load
secondary reset vector code when it is disabled.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
arch/xtensa/Kconfig
arch/xtensa/kernel/Makefile
arch/xtensa/kernel/setup.c
arch/xtensa/kernel/vmlinux.lds.S

index cf03ed54c8f0b431e08f28d0e3c8053bba187bd7..a02c3388f52105d84c69c8d2ccf21c34bb13968a 100644 (file)
@@ -227,6 +227,15 @@ config HOTPLUG_CPU
 
          Say N if you want to disable CPU hotplug.
 
+config SECONDARY_RESET_VECTOR
+       bool "Secondary cores use alternative reset vector"
+       default y
+       depends on HAVE_SMP
+       help
+         Secondary cores may be configured to use alternative reset vector,
+         or all cores may use primary reset vector.
+         Say Y here to supply handler for the alternative reset location.
+
 config FAST_SYSCALL_XTENSA
        bool "Enable fast atomic syscalls"
        default n
index d4082c6a121b76553b1d48a497b723cdfc89cf1b..5fd6cd15e0fb191c212b9027f4bd2d9cc16ed371 100644 (file)
@@ -13,7 +13,8 @@ obj-$(CONFIG_MMU) += pci-dma.o
 obj-$(CONFIG_PCI) += pci.o
 obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o
 obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
-obj-$(CONFIG_SMP) += smp.o mxhead.o
+obj-$(CONFIG_SMP) += smp.o
+obj-$(CONFIG_SECONDARY_RESET_VECTOR) += mxhead.o
 obj-$(CONFIG_XTENSA_VARIANT_HAVE_PERF_EVENTS) += perf_event.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
 obj-$(CONFIG_S32C1I_SELFTEST) += s32c1i_selftest.o
index 3f18428914821ba85936fab143e774bdf6ae5331..9191738f99413ab3943be889e79f1bc75a1be732 100644 (file)
@@ -349,7 +349,7 @@ void __init setup_arch(char **cmdline_p)
 
 #endif /* CONFIG_VECTORS_ADDR */
 
-#ifdef CONFIG_SMP
+#ifdef CONFIG_SECONDARY_RESET_VECTOR
        mem_reserve(__pa(_SecondaryResetVector_text_start),
                    __pa(_SecondaryResetVector_text_end));
 #endif
index eee270a039a46043c9750fd5f2ec8997a41e2fa0..965a3952c47b8994ed08c4be199e24299a777102 100644 (file)
@@ -207,7 +207,7 @@ SECTIONS
     RELOCATE_ENTRY(_xip_data, .data);
     RELOCATE_ENTRY(_xip_init_data, .init.data);
 #endif
-#if defined(CONFIG_SMP)
+#if defined(CONFIG_SECONDARY_RESET_VECTOR)
     RELOCATE_ENTRY(_SecondaryResetVector_text,
                   .SecondaryResetVector.text);
 #endif
@@ -303,7 +303,7 @@ SECTIONS
 #define LAST .DoubleExceptionVector.text
 
 #endif
-#if defined(CONFIG_SMP)
+#if defined(CONFIG_SECONDARY_RESET_VECTOR)
 
   SECTION_VECTOR4 (_SecondaryResetVector_text,
                  .SecondaryResetVector.text,