From: Xiongfeng Wang <wangxiongfeng2(a)huawei.com>
commit 21440a9cd9bea4d8d2c41064cc9d9a06e30e4d96 openEuler-1.0.
We need to clear EOI for the secure timer only when we panic from
sdei_handler. If we clear EOI for the secure timer in normal panic
routiue, it has no bad effect on Hi1620, but it may cause undefine
behavior on Hi1616. So add a check for NMI context before we clear EOI
for the secure timer.
Fixes: dd397d5febc4("sdei_watchdog: clear EOI of the secure timer before
kdump")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2(a)huawei.com>
Reviewed-by: Wei Li <liwei391(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
Signed-off-by: Xin Hao <haoxing990(a)gmail.com>
---
arch/arm64/kernel/machine_kexec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
index 3c0e9383d7e0..e3b427446d2b 100644
--- a/arch/arm64/kernel/machine_kexec.c
+++ b/arch/arm64/kernel/machine_kexec.c
@@ -268,7 +268,8 @@ void machine_crash_shutdown(struct pt_regs *regs)
* interrupt failed to trigger in the second kernel. So we clear eoi
* of the secure timer before booting the second kernel.
*/
- sdei_watchdog_clear_eoi();
+ if (in_nmi())
+ sdei_watchdog_clear_eoi();
/* for crashing cpu */
crash_save_cpu(regs, smp_processor_id());
--
2.31.0