Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xtensa: separate SMP and XIP support

There's no real dependency between SMP and XIP, allow them to be
selected together. Always define 2- and 4-argument SECTION_VECTOR
macros, always use 4-argument macro for the secondary reset vector and
always define relocation entry for it.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

+34 -34
+34 -34
arch/xtensa/kernel/vmlinux.lds.S
··· 54 54 * to description recorded in the corresponding RELOCATE_ENTRY. 55 55 */ 56 56 57 - #ifdef CONFIG_VECTORS_OFFSET 58 - #define SECTION_VECTOR(sym, section, addr, prevsec) \ 57 + #define SECTION_VECTOR4(sym, section, addr, prevsec) \ 59 58 section addr : AT(((LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \ 60 59 { \ 61 60 . = ALIGN(4); \ ··· 62 63 *(section) \ 63 64 sym ## _end = ABSOLUTE(.); \ 64 65 } 65 - #else 66 - #define SECTION_VECTOR(section, addr) \ 66 + 67 + #define SECTION_VECTOR2(section, addr) \ 67 68 . = addr; \ 68 69 *(section) 69 - #endif 70 70 71 71 /* 72 72 * Mapping of input sections to output sections when linking. ··· 85 87 HEAD_TEXT 86 88 87 89 #ifndef CONFIG_VECTORS_OFFSET 88 - . = ALIGN(PAGE_SIZE); 89 - _vecbase = .; 90 + . = ALIGN(PAGE_SIZE); 91 + _vecbase = .; 90 92 91 - SECTION_VECTOR (.WindowVectors.text, WINDOW_VECTORS_VADDR) 93 + SECTION_VECTOR2 (.WindowVectors.text, WINDOW_VECTORS_VADDR) 92 94 #if XCHAL_EXCM_LEVEL >= 2 93 - SECTION_VECTOR (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR) 95 + SECTION_VECTOR2 (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR) 94 96 #endif 95 97 #if XCHAL_EXCM_LEVEL >= 3 96 - SECTION_VECTOR (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR) 98 + SECTION_VECTOR2 (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR) 97 99 #endif 98 100 #if XCHAL_EXCM_LEVEL >= 4 99 - SECTION_VECTOR (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR) 101 + SECTION_VECTOR2 (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR) 100 102 #endif 101 103 #if XCHAL_EXCM_LEVEL >= 5 102 - SECTION_VECTOR (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR) 104 + SECTION_VECTOR2 (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR) 103 105 #endif 104 106 #if XCHAL_EXCM_LEVEL >= 6 105 - SECTION_VECTOR (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR) 107 + SECTION_VECTOR2 (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR) 106 108 #endif 107 - SECTION_VECTOR (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR) 108 - SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR) 109 - SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR) 110 - SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR) 109 + SECTION_VECTOR2 (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR) 110 + SECTION_VECTOR2 (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR) 111 + SECTION_VECTOR2 (.UserExceptionVector.text, USER_VECTOR_VADDR) 112 + SECTION_VECTOR2 (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR) 111 113 112 - *(.exception.text) 114 + *(.exception.text) 113 115 #endif 114 116 115 117 IRQENTRY_TEXT ··· 196 198 #ifdef CONFIG_XIP_KERNEL 197 199 RELOCATE_ENTRY(_xip_data, .data); 198 200 RELOCATE_ENTRY(_xip_init_data, .init.data); 199 - #else 201 + #endif 200 202 #if defined(CONFIG_SMP) 201 203 RELOCATE_ENTRY(_SecondaryResetVector_text, 202 204 .SecondaryResetVector.text); 203 - #endif 204 205 #endif 205 206 206 207 __boot_reloc_table_end = ABSOLUTE(.) ; ··· 217 220 . = ALIGN(4); 218 221 .dummy : { LONG(0) } 219 222 223 + #undef LAST 224 + #define LAST .dummy 225 + 220 226 #ifdef CONFIG_VECTORS_OFFSET 221 227 /* The vectors are relocated to the real position at startup time */ 222 228 223 - SECTION_VECTOR (_WindowVectors_text, 229 + SECTION_VECTOR4 (_WindowVectors_text, 224 230 .WindowVectors.text, 225 231 WINDOW_VECTORS_VADDR, 226 232 .dummy) 227 - SECTION_VECTOR (_DebugInterruptVector_text, 233 + SECTION_VECTOR4 (_DebugInterruptVector_text, 228 234 .DebugInterruptVector.text, 229 235 DEBUG_VECTOR_VADDR, 230 236 .WindowVectors.text) 231 237 #undef LAST 232 238 #define LAST .DebugInterruptVector.text 233 239 #if XCHAL_EXCM_LEVEL >= 2 234 - SECTION_VECTOR (_Level2InterruptVector_text, 240 + SECTION_VECTOR4 (_Level2InterruptVector_text, 235 241 .Level2InterruptVector.text, 236 242 INTLEVEL2_VECTOR_VADDR, 237 243 LAST) ··· 242 242 # define LAST .Level2InterruptVector.text 243 243 #endif 244 244 #if XCHAL_EXCM_LEVEL >= 3 245 - SECTION_VECTOR (_Level3InterruptVector_text, 245 + SECTION_VECTOR4 (_Level3InterruptVector_text, 246 246 .Level3InterruptVector.text, 247 247 INTLEVEL3_VECTOR_VADDR, 248 248 LAST) ··· 250 250 # define LAST .Level3InterruptVector.text 251 251 #endif 252 252 #if XCHAL_EXCM_LEVEL >= 4 253 - SECTION_VECTOR (_Level4InterruptVector_text, 253 + SECTION_VECTOR4 (_Level4InterruptVector_text, 254 254 .Level4InterruptVector.text, 255 255 INTLEVEL4_VECTOR_VADDR, 256 256 LAST) ··· 258 258 # define LAST .Level4InterruptVector.text 259 259 #endif 260 260 #if XCHAL_EXCM_LEVEL >= 5 261 - SECTION_VECTOR (_Level5InterruptVector_text, 261 + SECTION_VECTOR4 (_Level5InterruptVector_text, 262 262 .Level5InterruptVector.text, 263 263 INTLEVEL5_VECTOR_VADDR, 264 264 LAST) ··· 266 266 # define LAST .Level5InterruptVector.text 267 267 #endif 268 268 #if XCHAL_EXCM_LEVEL >= 6 269 - SECTION_VECTOR (_Level6InterruptVector_text, 269 + SECTION_VECTOR4 (_Level6InterruptVector_text, 270 270 .Level6InterruptVector.text, 271 271 INTLEVEL6_VECTOR_VADDR, 272 272 LAST) 273 273 # undef LAST 274 274 # define LAST .Level6InterruptVector.text 275 275 #endif 276 - SECTION_VECTOR (_KernelExceptionVector_text, 276 + SECTION_VECTOR4 (_KernelExceptionVector_text, 277 277 .KernelExceptionVector.text, 278 278 KERNEL_VECTOR_VADDR, 279 279 LAST) 280 280 #undef LAST 281 - SECTION_VECTOR (_UserExceptionVector_text, 281 + SECTION_VECTOR4 (_UserExceptionVector_text, 282 282 .UserExceptionVector.text, 283 283 USER_VECTOR_VADDR, 284 284 .KernelExceptionVector.text) 285 - SECTION_VECTOR (_DoubleExceptionVector_text, 285 + SECTION_VECTOR4 (_DoubleExceptionVector_text, 286 286 .DoubleExceptionVector.text, 287 287 DOUBLEEXC_VECTOR_VADDR, 288 288 .UserExceptionVector.text) 289 289 #define LAST .DoubleExceptionVector.text 290 290 291 291 #endif 292 - #if !defined(CONFIG_XIP_KERNEL) && defined(CONFIG_SMP) 292 + #if defined(CONFIG_SMP) 293 293 294 - SECTION_VECTOR (_SecondaryResetVector_text, 294 + SECTION_VECTOR4 (_SecondaryResetVector_text, 295 295 .SecondaryResetVector.text, 296 296 RESET_VECTOR1_VADDR, 297 - .DoubleExceptionVector.text) 297 + LAST) 298 298 #undef LAST 299 299 #define LAST .SecondaryResetVector.text 300 300 301 301 #endif 302 302 #ifdef CONFIG_VECTORS_OFFSET 303 - SECTION_VECTOR (_exception_text, 303 + SECTION_VECTOR4 (_exception_text, 304 304 .exception.text, 305 305 , 306 306 LAST)