Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shivendra Pratap" <shivendra.pratap@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	lee@kernel.org, mfd@lists.linux.dev
Subject: Re: [PATCH v24 06/12] power: reset: Add psci-reboot-mode driver
Date: Mon, 03 Aug 2026 10:11:17 +0000	[thread overview]
Message-ID: <20260803101117.C91CF1F0155B@smtp.kernel.org> (raw)
In-Reply-To: <20260803-arm-psci-system_reset2-vendor-reboots-v24-6-889281373870@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The `psci-reboot-mode` driver is completely unreachable and non-functional because it is never instantiated.
- [High] Standard 'normal' reboot mode commands are entirely ignored by PSCI due to an incorrect `data` check in the restart handler.
--

--- Patch [6]: [PATCH v24 06/12] power: reset: Add psci-reboot-mode driver ---
commit 90394d93558537c03c13e84cb541a725b02ad7e4
Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Subject: power: reset: Add psci-reboot-mode driver

This commit adds a psci-reboot-mode driver to handle predefined and
vendor-specific PSCI resets. It registers the driver with the reboot-mode
framework to interface these resets to userspace. When userspace initiates a
supported command, the reset arguments are passed to the PSCI driver to
enable a command-based reset.

> diff --git a/drivers/power/reset/psci-reboot-mode.c b/drivers/power/reset/psci-reboot-mode.c
> new file mode 100644
> index 0000000000000..2f960fda8229f
> --- /dev/null
> +++ b/drivers/power/reset/psci-reboot-mode.c
[ ... ]
> +static int psci_reboot_mode_write(struct reboot_mode_driver *reboot,
> +				  const u32 *magic, u32 count)
> +{
> +	(void)reboot;
> +
> +	if (count < 1 || count > 3)
> +		return -EINVAL;
> +
> +	return psci_set_reset_cmd(magic[0], psci_reboot_mode_get_cookie(magic, count));

[Severity: High]
Does this work for standard "normal" reboots?

When a standard reboot is triggered without a specific command string, the
reboot_mode framework translates the NULL command to "normal" mode and calls
this write function to configure the reset command.

However, in drivers/firmware/psci/psci.c, psci_sys_reset() skips applying
the command because it checks for a non-NULL data argument:

drivers/firmware/psci/psci.c:psci_sys_reset() {
	...
	cmd = smp_load_acquire(&reset_cmd);
	if (data && cmd && !panic_in_progress())
		psci_handle_reset_cmd(cmd);

	psci_handle_reboot_mode();
	...
}

Will this cause standard reboots mapped to vendor-specific commands to be
silently ignored?

> +}
[ ... ]
> +static struct platform_driver psci_reboot_mode_driver = {
> +	.probe  = psci_reboot_mode_probe,
> +	.driver = {
> +		.name	= "psci-reboot-mode",
> +	},
> +};

[Severity: High]
Is this driver ever instantiated?

It appears to be missing an .of_match_table in the driver structure.

Additionally, looking at drivers/mfd/psci-mfd.c, psci-reboot-mode is not
included in the psci_cells array:

drivers/mfd/psci-mfd.c:psci_cells[] = {
	{
		.name = "psci-cpuidle-domain",
	},
};

Without an OF match table and being omitted from the MFD cells, how does this
driver get probed to parse the vendor-specific reset modes from the device
tree?

> +module_platform_driver(psci_reboot_mode_driver);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260803-arm-psci-system_reset2-vendor-reboots-v24-0-889281373870@oss.qualcomm.com?part=6

  reply	other threads:[~2026-08-03 10:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  9:43 [PATCH v24 00/12] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-08-03  9:43 ` [PATCH v24 01/12] power: reset: reboot-mode: Support up to 3 magic values per mode Shivendra Pratap
2026-08-03  9:56   ` sashiko-bot
2026-08-03  9:43 ` [PATCH v24 02/12] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
2026-08-03  9:59   ` sashiko-bot
2026-08-04 14:19     ` Shivendra Pratap
2026-08-03  9:43 ` [PATCH v24 03/12] firmware: psci: Introduce command-based resets Shivendra Pratap
2026-08-03 10:01   ` sashiko-bot
2026-08-04 14:38     ` Shivendra Pratap
2026-08-03  9:43 ` [PATCH v24 04/12] mfd: psci-mfd: Add PSCI MFD driver for cpuidle-psci-domain cell Shivendra Pratap
2026-08-03 10:00   ` sashiko-bot
2026-08-03  9:43 ` [PATCH v24 05/12] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2026-08-03 10:09   ` sashiko-bot
2026-08-03 11:44   ` Rob Herring (Arm)
2026-08-03 12:46     ` Shivendra Pratap
2026-08-03 14:02   ` Rob Herring
2026-08-03 14:21     ` Shivendra Pratap
2026-08-03  9:43 ` [PATCH v24 06/12] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2026-08-03 10:11   ` sashiko-bot [this message]
2026-08-03 13:07     ` Shivendra Pratap
2026-08-03  9:43 ` [PATCH v24 07/12] mfd: core: Add firmware-node support to MFD cells Shivendra Pratap
2026-08-03 10:07   ` sashiko-bot
2026-08-03  9:43 ` [PATCH v24 08/12] mfd: psci-mfd: Add psci-reboot-mode child cell Shivendra Pratap
2026-08-03 10:07   ` sashiko-bot
2026-08-03 12:52     ` Shivendra Pratap
2026-08-03  9:43 ` [PATCH v24 09/12] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
2026-08-03 10:13   ` sashiko-bot
2026-08-03  9:43 ` [PATCH v24 10/12] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
2026-08-03 10:15   ` sashiko-bot
2026-08-03  9:43 ` [PATCH v24 11/12] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
2026-08-03 10:13   ` sashiko-bot
2026-08-03  9:43 ` [PATCH v24 12/12] arm64: dts: qcom: Add psci reboot-modes for talos boards Shivendra Pratap
2026-08-03 10:14   ` 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=20260803101117.C91CF1F0155B@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