forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/arch/arm64/kernel/entry.S
....@@ -297,7 +297,7 @@
297297 alternative_else_nop_endif
298298 1:
299299
300
- scs_load tsk, x20
300
+ scs_load_current
301301 .else
302302 add x21, sp, #S_FRAME_SIZE
303303 get_current_task tsk
....@@ -626,18 +626,9 @@
626626 mrs x0, daif
627627 orr x24, x24, x0
628628 alternative_else_nop_endif
629
-
630
- cbz x24, 1f // (need_resched + count) == 0
631
- cbnz w24, 2f // count != 0
632
-
633
- ldr w24, [tsk, #TSK_TI_PREEMPT_LAZY] // get preempt lazy count
634
- cbnz w24, 2f // preempt lazy count != 0
635
-
636
- ldr x0, [tsk, #TSK_TI_FLAGS] // get flags
637
- tbz x0, #TIF_NEED_RESCHED_LAZY, 2f // needs rescheduling?
629
+ cbnz x24, 1f // preempt count != 0 || NMI return path
630
+ bl arm64_preempt_schedule_irq // irq en/disable is done inside
638631 1:
639
- bl arm64_preempt_schedule_irq // irq en/disable is done inside
640
-2:
641632 #endif
642633
643634 mov x0, sp
....@@ -1131,7 +1122,7 @@
11311122 msr sp_el0, x1
11321123 ptrauth_keys_install_kernel x1, x8, x9, x10
11331124 scs_save x0, x8
1134
- scs_load x1, x8
1125
+ scs_load_current
11351126 ret
11361127 SYM_FUNC_END(cpu_switch_to)
11371128 NOKPROBE(cpu_switch_to)
....@@ -1247,9 +1238,13 @@
12471238
12481239 mov x19, x1
12491240
1250
-#if defined(CONFIG_VMAP_STACK) || defined(CONFIG_SHADOW_CALL_STACK)
1241
+ /* Store the registered-event for crash_smp_send_stop() */
12511242 ldrb w4, [x19, #SDEI_EVENT_PRIORITY]
1252
-#endif
1243
+ cbnz w4, 1f
1244
+ adr_this_cpu dst=x5, sym=sdei_active_normal_event, tmp=x6
1245
+ b 2f
1246
+1: adr_this_cpu dst=x5, sym=sdei_active_critical_event, tmp=x6
1247
+2: str x19, [x5]
12531248
12541249 #ifdef CONFIG_VMAP_STACK
12551250 /*
....@@ -1314,6 +1309,14 @@
13141309
13151310 ldr_l x2, sdei_exit_mode
13161311
1312
+ /* Clear the registered-event seen by crash_smp_send_stop() */
1313
+ ldrb w3, [x4, #SDEI_EVENT_PRIORITY]
1314
+ cbnz w3, 1f
1315
+ adr_this_cpu dst=x5, sym=sdei_active_normal_event, tmp=x6
1316
+ b 2f
1317
+1: adr_this_cpu dst=x5, sym=sdei_active_critical_event, tmp=x6
1318
+2: str xzr, [x5]
1319
+
13171320 alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0
13181321 sdei_handler_exit exit_mode=x2
13191322 alternative_else_nop_endif
....@@ -1324,4 +1327,15 @@
13241327 #endif
13251328 SYM_CODE_END(__sdei_asm_handler)
13261329 NOKPROBE(__sdei_asm_handler)
1330
+
1331
+SYM_CODE_START(__sdei_handler_abort)
1332
+ mov_q x0, SDEI_1_0_FN_SDEI_EVENT_COMPLETE_AND_RESUME
1333
+ adr x1, 1f
1334
+ ldr_l x2, sdei_exit_mode
1335
+ sdei_handler_exit exit_mode=x2
1336
+ // exit the handler and jump to the next instruction.
1337
+ // Exit will stomp x0-x17, PSTATE, ELR_ELx, and SPSR_ELx.
1338
+1: ret
1339
+SYM_CODE_END(__sdei_handler_abort)
1340
+NOKPROBE(__sdei_handler_abort)
13271341 #endif /* CONFIG_ARM_SDE_INTERFACE */