From: sashiko-bot@kernel.org
To: "Sven Peter" <sven@kernel.org>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH RFC 6/6] arm64: dts: apple: t8103: Add PSCI and CPU idle states
Date: Wed, 08 Jul 2026 07:48:29 +0000 [thread overview]
Message-ID: <20260708074830.513321F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708-efi-psci-v1-6-9efb3abf0e4c@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] State leak (preempt_count) and corruption (saved_ttbr0) in `arm64_efi_psci_call` during CPU/System suspend.
Pre-existing issues:
- [High] Missing Context Synchronization Events (ISB) after writes to control-plane system registers in user access helpers.
--
--- Patch [6]: [PATCH RFC 6/6] arm64: dts: apple: t8103: Add PSCI and CPU idle states ---
commit 4618cadb25b8f3f6d74cc463901a493df3b5128c
Author: Sven Peter <sven@kernel.org>
arm64: dts: apple: t8103: Add PSCI and CPU idle states
Switch the base M1 from spin-table to PSCI and also add two basic idle
states that we support for now.
> --- a/arch/arm64/boot/dts/apple/t8103.dtsi
> +++ b/arch/arm64/boot/dts/apple/t8103.dtsi
[ ... ]
> @@ -185,6 +198,28 @@ l2_cache_1: l2-cache-1 {
> cache-unified;
> cache-size = <0xc00000>;
> };
> +
> + idle-states {
> + entry-method = "psci";
> +
> + cpu_retention_wfi: cpu-retention-wfi {
> + compatible = "arm,idle-state";
> + idle-state-name = "wfi";
> + arm,psci-suspend-param = <0x00000000>;
> + entry-latency-us = <1>;
> + exit-latency-us = <1>;
> + min-residency-us = <1>;
> + };
> +
> + cpu_deep_wfi: cpu-deep-wfi {
> + compatible = "arm,idle-state";
> + idle-state-name = "deep-wfi";
> + arm,psci-suspend-param = <0x00000001>;
> + entry-latency-us = <5>;
> + exit-latency-us = <5>;
> + min-residency-us = <10000>;
> + };
[Severity: High]
Does adding this deep suspend state expose a state leak in the EFI PSCI
wrapper?
When the CPU enters deep sleep via CPU_SUSPEND or SYSTEM_SUSPEND, it uses
psci_suspend_finisher which invokes arm64_efi_psci_call() in
arch/arm64/kernel/efi.c. This wrapper calls efi_virtmap_load() (which
disables preemption and swaps ttbr0 to efi_mm) and uaccess_ttbr0_enable().
On success, the firmware powers down the CPU and never returns to the caller
of arm64_efi_psci_call(). Upon waking, the hardware resumes execution at
pa_cpu_resume, restoring the pre-suspend CPU registers and returning directly
to cpu_suspend().
Since the return path of arm64_efi_psci_call() is bypassed,
uaccess_ttbr0_disable() and efi_virtmap_unload() are never executed. Can this
leak the preempt_count increment and leave the saved_ttbr0 page table
reference corrupted, leading to scheduling-while-atomic panics or deadlocks
upon resume?
[Severity: High]
This is a pre-existing issue, but the EFI PSCI path used by this idle state
relies on __uaccess_ttbr0_enable() and __uaccess_ttbr0_disable() in
arch/arm64/include/asm/uaccess.h, which appear to be missing required
synchronization.
In __uaccess_ttbr0_disable(), the code performs sequential writes to control
plane registers without an intervening isb():
write_sysreg(ttbr - RESERVED_SWAPPER_OFFSET, ttbr0_el1);
/* Set reserved ASID */
write_sysreg(ttbr, ttbr1_el1);
isb();
Similarly, __uaccess_ttbr0_enable() writes to ttbr1_el1 and ttbr0_el1
sequentially before the isb().
Architectural rules require an isb() immediately after each write to a
control-plane system register before any subsequent write or read-back. Does
the lack of an intervening isb() here force the pipeline to observe
architecturally undefined state?
> + };
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260708-efi-psci-v1-0-9efb3abf0e4c@kernel.org?part=6
next prev parent reply other threads:[~2026-07-08 7:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 7:15 [PATCH RFC 0/6] PSCI-via-EFI to support firmware and kernel sharing EL2 for Apple Silicon Sven Peter
2026-07-08 7:15 ` [PATCH RFC 1/6] dt-bindings: arm: psci: Add EFI conduit Sven Peter
2026-07-08 7:15 ` [PATCH RFC 2/6] arm64/efi: Add and parse custom PSCI EFI configuration table Sven Peter
2026-07-08 7:39 ` sashiko-bot
2026-07-08 7:15 ` [PATCH RFC 3/6] efi: Add EFI_MEMORY_ISA_{MASK,VALID} Sven Peter
2026-07-08 7:25 ` sashiko-bot
2026-07-08 7:15 ` [PATCH RFC 4/6] arm64/efi: Honor EFI_MEMORY_ISA_MASK for Device-nGnRnE vs -nGnRE Sven Peter
2026-07-08 7:33 ` sashiko-bot
2026-07-08 7:15 ` [PATCH RFC 5/6] firmware/psci: Add EFI runtime conduit Sven Peter
2026-07-08 7:46 ` sashiko-bot
2026-07-08 7:15 ` [PATCH RFC 6/6] arm64: dts: apple: t8103: Add PSCI and CPU idle states Sven Peter
2026-07-08 7:48 ` sashiko-bot [this message]
2026-09-03 11:34 ` [PATCH RFC 0/6] PSCI-via-EFI to support firmware and kernel sharing EL2 for Apple Silicon Ard Biesheuvel
2026-09-03 11:42 ` Mark Rutland
2026-09-03 12:15 ` Will Deacon
2026-09-03 13:25 ` Ard Biesheuvel
2026-09-03 16:26 ` Sven Peter
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=20260708074830.513321F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sven@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.