aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2017-12-09 21:44:11 -0500
committerMax Filippov <jcmvbkbc@gmail.com>2017-12-10 17:48:52 -0500
commit2da03d4114b2587f0e8e45f4862074e34daee64e (patch)
treebb8b7dd122fa8fc036eeaa340264e2af405629cb /arch/xtensa
parentf8f02ca73cd8d1e2ac61ea1e5f0574a8c1f472fa (diff)
xtensa: use call instead of callx in assembly code
Now that xtensa assembly sources are compiled with -mlongcalls let the assembler and linker relax call instructions into l32r + callx where needed. This change makes the code cleaner and potentially a bit faster. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa')
-rw-r--r--arch/xtensa/kernel/coprocessor.S3
-rw-r--r--arch/xtensa/kernel/entry.S56
-rw-r--r--arch/xtensa/kernel/head.S10
-rw-r--r--arch/xtensa/kernel/vectors.S3
4 files changed, 24 insertions, 48 deletions
diff --git a/arch/xtensa/kernel/coprocessor.S b/arch/xtensa/kernel/coprocessor.S
index 3a98503ad11a..4f8b52d575a2 100644
--- a/arch/xtensa/kernel/coprocessor.S
+++ b/arch/xtensa/kernel/coprocessor.S
@@ -212,8 +212,7 @@ ENDPROC(coprocessor_restore)
212ENTRY(fast_coprocessor_double) 212ENTRY(fast_coprocessor_double)
213 213
214 wsr a0, excsave1 214 wsr a0, excsave1
215 movi a0, unrecoverable_exception 215 call0 unrecoverable_exception
216 callx0 a0
217 216
218ENDPROC(fast_coprocessor_double) 217ENDPROC(fast_coprocessor_double)
219 218
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 5d5707831626..5a2110bb5902 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -476,8 +476,7 @@ common_exception_return:
4761: 4761:
477 irq_save a2, a3 477 irq_save a2, a3
478#ifdef CONFIG_TRACE_IRQFLAGS 478#ifdef CONFIG_TRACE_IRQFLAGS
479 movi a4, trace_hardirqs_off 479 call4 trace_hardirqs_off
480 callx4 a4
481#endif 480#endif
482 481
483 /* Jump if we are returning from kernel exceptions. */ 482 /* Jump if we are returning from kernel exceptions. */
@@ -504,24 +503,20 @@ common_exception_return:
504 /* Call do_signal() */ 503 /* Call do_signal() */
505 504
506#ifdef CONFIG_TRACE_IRQFLAGS 505#ifdef CONFIG_TRACE_IRQFLAGS
507 movi a4, trace_hardirqs_on 506 call4 trace_hardirqs_on
508 callx4 a4
509#endif 507#endif
510 rsil a2, 0 508 rsil a2, 0
511 movi a4, do_notify_resume # int do_notify_resume(struct pt_regs*)
512 mov a6, a1 509 mov a6, a1
513 callx4 a4 510 call4 do_notify_resume # int do_notify_resume(struct pt_regs*)
514 j 1b 511 j 1b
515 512
5163: /* Reschedule */ 5133: /* Reschedule */
517 514
518#ifdef CONFIG_TRACE_IRQFLAGS 515#ifdef CONFIG_TRACE_IRQFLAGS
519 movi a4, trace_hardirqs_on 516 call4 trace_hardirqs_on
520 callx4 a4
521#endif 517#endif
522 rsil a2, 0 518 rsil a2, 0
523 movi a4, schedule # void schedule (void) 519 call4 schedule # void schedule (void)
524 callx4 a4
525 j 1b 520 j 1b
526 521
527#ifdef CONFIG_PREEMPT 522#ifdef CONFIG_PREEMPT
@@ -532,8 +527,7 @@ common_exception_return:
532 527
533 l32i a4, a2, TI_PRE_COUNT 528 l32i a4, a2, TI_PRE_COUNT
534 bnez a4, 4f 529 bnez a4, 4f
535 movi a4, preempt_schedule_irq 530 call4 preempt_schedule_irq
536 callx4 a4
537 j 1b 531 j 1b
538#endif 532#endif
539 533
@@ -546,23 +540,20 @@ common_exception_return:
5465: 5405:
547#ifdef CONFIG_HAVE_HW_BREAKPOINT 541#ifdef CONFIG_HAVE_HW_BREAKPOINT
548 _bbci.l a4, TIF_DB_DISABLED, 7f 542 _bbci.l a4, TIF_DB_DISABLED, 7f
549 movi a4, restore_dbreak 543 call4 restore_dbreak
550 callx4 a4
5517: 5447:
552#endif 545#endif
553#ifdef CONFIG_DEBUG_TLB_SANITY 546#ifdef CONFIG_DEBUG_TLB_SANITY
554 l32i a4, a1, PT_DEPC 547 l32i a4, a1, PT_DEPC
555 bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f 548 bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f
556 movi a4, check_tlb_sanity 549 call4 check_tlb_sanity
557 callx4 a4
558#endif 550#endif
5596: 5516:
5604: 5524:
561#ifdef CONFIG_TRACE_IRQFLAGS 553#ifdef CONFIG_TRACE_IRQFLAGS
562 extui a4, a3, PS_INTLEVEL_SHIFT, PS_INTLEVEL_WIDTH 554 extui a4, a3, PS_INTLEVEL_SHIFT, PS_INTLEVEL_WIDTH
563 bgei a4, LOCKLEVEL, 1f 555 bgei a4, LOCKLEVEL, 1f
564 movi a4, trace_hardirqs_on 556 call4 trace_hardirqs_on
565 callx4 a4
5661: 5571:
567#endif 558#endif
568 /* Restore optional registers. */ 559 /* Restore optional registers. */
@@ -938,10 +929,8 @@ ENTRY(unrecoverable_exception)
938 movi a0, 0 929 movi a0, 0
939 addi a1, a1, PT_REGS_OFFSET 930 addi a1, a1, PT_REGS_OFFSET
940 931
941 movi a4, panic
942 movi a6, unrecoverable_text 932 movi a6, unrecoverable_text
943 933 call4 panic
944 callx4 a4
945 934
9461: j 1b 9351: j 1b
947 936
@@ -1078,8 +1067,7 @@ ENTRY(fast_syscall_unrecoverable)
1078 xsr a2, depc # restore a2, depc 1067 xsr a2, depc # restore a2, depc
1079 1068
1080 wsr a0, excsave1 1069 wsr a0, excsave1
1081 movi a0, unrecoverable_exception 1070 call0 unrecoverable_exception
1082 callx0 a0
1083 1071
1084ENDPROC(fast_syscall_unrecoverable) 1072ENDPROC(fast_syscall_unrecoverable)
1085 1073
@@ -1418,14 +1406,12 @@ ENTRY(fast_syscall_spill_registers)
1418 rsync 1406 rsync
1419 1407
1420 movi a6, SIGSEGV 1408 movi a6, SIGSEGV
1421 movi a4, do_exit 1409 call4 do_exit
1422 callx4 a4
1423 1410
1424 /* shouldn't return, so panic */ 1411 /* shouldn't return, so panic */
1425 1412
1426 wsr a0, excsave1 1413 wsr a0, excsave1
1427 movi a0, unrecoverable_exception 1414 call0 unrecoverable_exception # should not return
1428 callx0 a0 # should not return
14291: j 1b 14151: j 1b
1430 1416
1431 1417
@@ -1571,8 +1557,8 @@ ENDPROC(fast_syscall_spill_registers)
1571 1557
1572ENTRY(fast_second_level_miss_double_kernel) 1558ENTRY(fast_second_level_miss_double_kernel)
1573 1559
15741: movi a0, unrecoverable_exception 15601:
1575 callx0 a0 # should not return 1561 call0 unrecoverable_exception # should not return
15761: j 1b 15621: j 1b
1577 1563
1578ENDPROC(fast_second_level_miss_double_kernel) 1564ENDPROC(fast_second_level_miss_double_kernel)
@@ -1904,9 +1890,8 @@ ENTRY(system_call)
1904 1890
1905 l32i a3, a2, PT_AREG2 1891 l32i a3, a2, PT_AREG2
1906 mov a6, a2 1892 mov a6, a2
1907 movi a4, do_syscall_trace_enter
1908 s32i a3, a2, PT_SYSCALL 1893 s32i a3, a2, PT_SYSCALL
1909 callx4 a4 1894 call4 do_syscall_trace_enter
1910 mov a3, a6 1895 mov a3, a6
1911 1896
1912 /* syscall = sys_call_table[syscall_nr] */ 1897 /* syscall = sys_call_table[syscall_nr] */
@@ -1938,9 +1923,8 @@ ENTRY(system_call)
19381: /* regs->areg[2] = return_value */ 19231: /* regs->areg[2] = return_value */
1939 1924
1940 s32i a6, a2, PT_AREG2 1925 s32i a6, a2, PT_AREG2
1941 movi a4, do_syscall_trace_leave
1942 mov a6, a2 1926 mov a6, a2
1943 callx4 a4 1927 call4 do_syscall_trace_leave
1944 retw 1928 retw
1945 1929
1946ENDPROC(system_call) 1930ENDPROC(system_call)
@@ -2056,12 +2040,10 @@ ENTRY(ret_from_fork)
2056 /* void schedule_tail (struct task_struct *prev) 2040 /* void schedule_tail (struct task_struct *prev)
2057 * Note: prev is still in a6 (return value from fake call4 frame) 2041 * Note: prev is still in a6 (return value from fake call4 frame)
2058 */ 2042 */
2059 movi a4, schedule_tail 2043 call4 schedule_tail
2060 callx4 a4
2061 2044
2062 movi a4, do_syscall_trace_leave
2063 mov a6, a1 2045 mov a6, a1
2064 callx4 a4 2046 call4 do_syscall_trace_leave
2065 2047
2066 j common_exception_return 2048 j common_exception_return
2067 2049
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index 23ce62e60435..9c4e9433e536 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -264,11 +264,8 @@ ENTRY(_startup)
264 264
265 /* init_arch kick-starts the linux kernel */ 265 /* init_arch kick-starts the linux kernel */
266 266
267 movi a4, init_arch 267 call4 init_arch
268 callx4 a4 268 call4 start_kernel
269
270 movi a4, start_kernel
271 callx4 a4
272 269
273should_never_return: 270should_never_return:
274 j should_never_return 271 j should_never_return
@@ -294,8 +291,7 @@ should_never_return:
294 movi a6, 0 291 movi a6, 0
295 wsr a6, excsave1 292 wsr a6, excsave1
296 293
297 movi a4, secondary_start_kernel 294 call4 secondary_start_kernel
298 callx4 a4
299 j should_never_return 295 j should_never_return
300 296
301#endif /* CONFIG_SMP */ 297#endif /* CONFIG_SMP */
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S
index 2bc85051c680..841503d3307c 100644
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -305,8 +305,7 @@ _DoubleExceptionVector_WindowUnderflow:
305.Lunrecoverable: 305.Lunrecoverable:
306 rsr a3, excsave1 306 rsr a3, excsave1
307 wsr a0, excsave1 307 wsr a0, excsave1
308 movi a0, unrecoverable_exception 308 call0 unrecoverable_exception
309 callx0 a0
310 309
311.Lfixup:/* Check for a fixup handler or if we were in a critical section. */ 310.Lfixup:/* Check for a fixup handler or if we were in a critical section. */
312 311