[Bug 271780] [patch][RPi4] PSCI reset doesn't work.

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 02 Jun 2023 05:16:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271780

            Bug ID: 271780
           Summary: [patch][RPi4] PSCI reset doesn't work.
           Product: Base System
           Version: CURRENT
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm@FreeBSD.org
          Reporter: t_uemura@macome.co.jp

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.