Kernel sometimes fails to reboot the system
Hello all,
I am facing a strange issue where the kernel sometimes fails to reboot the system. Here is what I am seeing.
I use busybox reboot -f from the command line so that the reboot request goes directly to the kernel, i.e. no init/systemd involved. This simplifies things.
I am tracing the reboot syscall up to the psci_sys_reset function of the PSCI device driver (drivers/firmware/psci/psci.c). I am toggling a GPIO just before invoking invoke_psci_fn:
static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
void *data)
{
pr_info("reset!\n");
if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
psci_system_reset2_supported) {
/*
* reset_type[31] = 0 (architectural)
* reset_type[30:0] = 0 (SYSTEM_WARM_RESET)
* cookie = 0 (ignored by the implementation)
*/
invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0);
} else {
// TOGGLE GPIO HERE
invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
}
return NOTIFY_DONE;
}The gpio is toggled so I know for sure that this point is being reached.
Then invoke_psci_fn is called; I assume this then calls into sp-min (not using Optee).
Sometimes this results in a proper reboot, as can be seen in the TF-A trace output:
INFO: Reset reason (0x54):
INFO: System reset generated by MPU (MPSYSRST)
But sometimes it doesn't seem to work; the system will then hang for some time, e.g. 20-25 seconds, and then reboot when the watchdog triggers. In these cases, the TF-A trace output shows:
INFO: Reset reason (0x214):
INFO: IWDG2 Reset (rst_iwdg2)
Is someone else experiencing this? Can someone help?
Guillermo
