From: Dinh Nguyen <dinguyen@kernel.org>
To: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] firmware: stratix10-svc: add PSCI secondary CPU offline on warm reboot for agilex and stratix10
Date: Fri, 4 Sep 2026 11:55:39 -0500 [thread overview]
Message-ID: <e153dbfc-e1ff-4811-a470-e547b6c5c7be@kernel.org> (raw)
In-Reply-To: <98ce724c07946338bb0a6ffa7d2b204a93a7a6fe.1788452660.git.adrian.ho.yin.ng@altera.com>
On 9/4/26 00:52, Adrian Ng Ho Yin wrote:
> On Agilex7 and Stratix10 SoCs, secondary CPUs must be offlined before
> a warm reboot to ensure a clean PSCI state. Agilex5 warm reset is a
> SDM-owned HPS reset that holds secondaries in the new reset-release until
> ATF releases them, so the secondary cores dont have to be put offline
> first. Register a reboot notifier that calls remove_cpu() on each
> secondary CPU when SYS_RESTART is triggered in REBOOT_WARM mode.
>
> A snapshot of cpu_online_mask is taken before the loop since remove_cpu()
> modifies the mask as CPUs go down. CPU 0 is excluded as it is typically
> not hotpluggable. Failures are logged and the loop continues so the
> reboot is not blocked by a single CPU that refuses to offline.
> The of_device_id table carries a per-compatible pdata flag to enable the
> notifier only on platforms that need it; Agilex5 leaves the flag unset.
>
> The notifier is unregistered at the start of remove(), before async
> channel teardown, to prevent a reboot notification from racing with
> driver shutdown.
>
> Signed-off-by: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>
> ---
> changelog:
> v2 -> v3:
> - Use ctrl in psci_offline_secondary_cpus() via dev_err(ctrl->dev, ...)
> instead of pr_err(). The controller pointer was unused; this both
> consumes it and attributes the failure to the svc device.
> - Keep of_device_id.data / stratix10_svc_pdata rather than dropping it
> because both intel,stratix10-svc and intel,agilex-svc happen to share
> the same notifier path. A separate patch adds intel,agilex5-svc without
> .data so Agilex5 does not run this sequence. Agilex5 warm reset is an
> SDM-owned HPS reset (REBOOT_HPS) that holds secondaries in the
> reset-release / P-channel block until ATF CPURSTRELEASE; Linux must
> not PSCI-offline them first.
>
> v1 -> v2:
> - Drop workqueue fan-out: remove_cpu() serialises on device_hotplug_lock
> internally so concurrent workers provided no parallelism. Replace with
> a single sequential loop over a cpumask snapshot.
> - Fix CPU identity bug: get_cpu()/put_cpu() did not prevent task migration
> and the notifier can run on any CPU before migrate_to_reboot_cpu().
> Exclude CPU 0 (typically not hotpluggable) and offline everything else.
> - Fix pre-count race: the two-loop atomic pre-count had a window where a
> concurrent hotplug event could cause dec_and_test() to fire prematurely.
> Eliminated entirely along with the completion and timeout.
> - Replace of_device_is_compatible() checks with a stratix10_svc_pdata
> struct carried in of_device_id.data, retrieved via of_device_get_match_data().
> - Move psci_cpu_off_teardown() to the top of stratix10_svc_drv_remove(),
> before async channel teardown, to close the race where a warm-reboot
> notification could fire while the driver is being dismantled.
>
> ---
> drivers/firmware/stratix10-svc.c | 88 ++++++++++++++++++++++++++++++--
> 1 file changed, 85 insertions(+), 3 deletions(-)
>
I had some erros apply this patch, but was able to finally do it. Please
double-check the applied patch on my branch: socfpga_firmware_for_v7.4
Dinh
prev parent reply other threads:[~2026-09-04 16:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 16:52 Adrian Ng Ho Yin
2026-09-04 16:55 ` Dinh Nguyen [this message]
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=e153dbfc-e1ff-4811-a470-e547b6c5c7be@kernel.org \
--to=dinguyen@kernel.org \
--cc=adrian.ho.yin.ng@altera.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®