Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shivendra Pratap" <shivendra.pratap@oss.qualcomm.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, lee@kernel.org,
	robh@kernel.org, mfd@lists.linux.dev
Subject: Re: [PATCH v25 03/10] firmware: psci: Introduce command-based resets
Date: Mon, 14 Sep 2026 15:14:00 +0000	[thread overview]
Message-ID: <20260914151400.D99051F0089A@smtp.kernel.org> (raw)
In-Reply-To: <20260914-arm-psci-system_reset2-vendor-reboots-v25-3-4aaf5c09b5c2@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The restart handler `psci_sys_reset()` unintentionally skips configured reset commands for standard reboots due to checking if `data` is non-NULL.
--

commit 15791809d0deec27e24e64483b3317dacb5842a5
Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>

firmware: psci: Introduce command-based resets

This commit introduces a command-based reset mechanism allowing reboot-mode
drivers to specify custom PSCI reset commands like vendor-specific
SYSTEM_RESET2. It defaults to the existing reboot_mode flow unless a valid
reset command is configured.

> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
> index e73bae6cb23a3..d489ba5d147ce 100644
> --- a/drivers/firmware/psci/psci.c
> +++ b/drivers/firmware/psci/psci.c

[ ... ]

> @@ -320,6 +409,30 @@ static int psci_sys_reset(struct notifier_block *nb, unsigned long action,

[ ... ]

> +static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
> +			  void *data)
> +{
> +	const struct psci_system_reset_cmd *cmd;
> +
> +	/* The function psci_handle_reboot_mode follows reboot_mode based
> +	 * reset flow and psci_handle_reset_cmd uses reset_cmd based reset flow.
> +	 *
> +	 * The reset_cmd is configured at the reboot_notifier phase.
> +	 * If panic() or emergency_restart() occurs between the reboot_notifier
> +	 * and this final reset, skip command-based reset and let reboot_mode drive
> +	 * the reset flow.
> +	 *
> +	 * The function psci_handle_reset_cmd invokes non-returning PSCI SYSTEM_RESET
> +	 * calls to reset the device. If it returns, either the reset failed, or the
> +	 * command was unsupported. Fallback to reboot_mode based reset flow.
> +	 */
> +	cmd = smp_load_acquire(&reset_cmd);
> +	if (data && cmd && !panic_in_progress())
> +		psci_handle_reset_cmd(cmd);

[Severity: High]
Will this check unintentionally skip custom reset commands during a standard
reboot?

When a standard userspace reboot is triggered via the reboot syscall with
LINUX_REBOOT_CMD_RESTART, the reboot sequence ultimately calls
kernel_restart(NULL). 

This propagates down to the atomic restart notifier chain in
do_kernel_restart(NULL), which passes a NULL command pointer to the notifier
handlers.

In psci_sys_reset(), the data parameter receives this NULL pointer. Because
of the check for a non-NULL data variable, the condition evaluates to false,
causing the handler to skip psci_handle_reset_cmd(). It then incorrectly
falls back to psci_handle_reboot_mode(), even if a valid command was
successfully configured by a reboot-mode driver.

Is the data check acting contrary to the commit message's goal of ignoring
reset commands during panic and emergency_restart?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=3

  reply	other threads:[~2026-09-14 15:14 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode Shivendra Pratap
2026-09-14 15:09   ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 02/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
2026-09-14 15:12   ` sashiko-bot
2026-09-15 13:54     ` Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 03/10] firmware: psci: Introduce command-based resets Shivendra Pratap
2026-09-14 15:14   ` sashiko-bot [this message]
2026-09-15 14:02     ` Shivendra Pratap
2026-09-15 14:05       ` Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 04/10] firmware: psci: Add support for PSCI auxiliary devices Shivendra Pratap
2026-09-14 15:21   ` sashiko-bot
2026-09-16  9:29   ` Bartosz Golaszewski
2026-09-17 12:18     ` Shivendra Pratap
2026-09-21 15:06   ` Ulf Hansson
2026-09-23 11:25     ` Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2026-09-14 15:19   ` sashiko-bot
2026-09-18 22:06   ` Rob Herring
2026-09-21 10:29     ` Shivendra Pratap
2026-09-21 18:41       ` Rob Herring
2026-09-14 14:59 ` [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2026-09-14 15:21   ` sashiko-bot
2026-09-16  9:23   ` Bartosz Golaszewski
2026-09-17 12:30     ` Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 07/10] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
2026-09-14 15:24   ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 08/10] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
2026-09-14 15:28   ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 09/10] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
2026-09-14 15:25   ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 10/10] arm64: dts: qcom: Add psci reboot-modes for talos boards Shivendra Pratap
2026-09-14 15:27   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260914151400.D99051F0089A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shivendra.pratap@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox