Bug 271780 - RPi4 PSCI reset doesn't work.
Summary: RPi4 PSCI reset doesn't work.
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-02 05:16 UTC by t_uemura
Modified: 2023-06-02 17:48 UTC (History)
0 users

See Also:


Attachments
patch_sys_arm64_arm64_vm__machdep.c (744 bytes, patch)
2023-06-02 05:17 UTC, t_uemura
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description t_uemura 2023-06-02 05:16:34 UTC
On RPi4B, PSCI reset, precisely, PSCI_FNID_SYSTEM_RESET doesn't work. This causes a reset (a key press) after shutdown -h to halt the board rather than to reboot, and need a powercycle to restart. To workaround, SoC's watchdog must handle the reset, as its 32-bit sibling did so in bcm2835_machdep.c:bcm2835_cpu_reset() .

This happens on 13.2-RELEASE image, 13.2-STABLE and 14-CURRENT with more recent u-boot and firmware.


Long story:

After shutdown -h, the "Please press any key to reboot." message is shown, and by a key press, architecture dependent cpu_reset() is called to try to reset:

on 32-bit RPis,
  arm/platform.c:cpu_reset()
  broadcom/bcm2835/bcm2835_machdep.c:bcm2835_cpu_reset()
  broadcom/bcm2835/bcm2835_wdog.c:bcmwd_watchdog_reset()

on arm64,
  arm64/arm64/vm_machdep.c:cpu_reset()
  dev/psci/psci.c:psci_reset()
  dev/psci/psci.c:psci_shutdown()
  dev/psci/psci.h:psci_call(PSCI_FNID_SYSTEM_RESET)

Since PSCI reset works properly on RPi3B+, I guess this issue is specific to BCM2711 and is due to a bug in this newer generation SoC's PSCI implementation.

To workaround, watchdog is armed to fire immediately instead of psci_call(). I wasn't sure if I could add SoC dependent snippet in this location (arm64/arm64), but I found a quirk for Cavium in GIC v3 code, so I thought it might be OK.


Finally note that about simple reboots, triggered by shutdown -r or reboot(8), are all handled by watchdog on both arm and arm64; broadcom/bcm2835/bcm2835_wdog.c:bcmwd_reboot_system() via shutdown_final event handler.
Comment 1 t_uemura 2023-06-02 05:17:08 UTC
Created attachment 242549 [details]
patch_sys_arm64_arm64_vm__machdep.c
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2023-06-02 17:48:11 UTC
^Triage: avoid [tags] in summary lines. 

<https://wiki.freebsd.org/Bugzilla/DosAndDonts>