* [PATCH] arm64: versal-net: Add retention state for cpu idle
@ 2026-07-27 12:18 Jay Buddhabhatti
2026-07-27 12:29 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Jay Buddhabhatti @ 2026-07-27 12:18 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, michal.simek
Cc: devicetree, linux-arm-kernel, linux-kernel, git, Jay Buddhabhatti
Remove the sleep state and replace it with a retention state for CPU idle.
The sleep state powers down the CPU core, and the wake-up time cannot be
guaranteed because the firmware may be busy handling other tasks at the time
of the wake-up request. This leads to unpredictable and potentially high
wake-up latency during CPU idle.
Replace the sleep state with a retention state to avoid this dependency on
firmware. The retention state uses a PSCI suspend parameter of 0: the
core simply executes WFI and retains its context without being powered off.
Since wake-up from WFI is handled entirely in hardware, it is effectively
immediate (a few cycles) and does not depend on firmware availability.
As the core is not powered down, the local timer is retained and
"local-timer-stop" is dropped. The entry/exit latency and min-residency
are set to the nominal minimum (1 us), allowing the cpuidle governor to
select the state even for very short idle windows.
Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
---
arch/arm64/boot/dts/xilinx/versal-net.dtsi | 43 +++++++++++-----------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/arch/arm64/boot/dts/xilinx/versal-net.dtsi b/arch/arm64/boot/dts/xilinx/versal-net.dtsi
index 15f767608e67..792bed588ae1 100644
--- a/arch/arm64/boot/dts/xilinx/versal-net.dtsi
+++ b/arch/arm64/boot/dts/xilinx/versal-net.dtsi
@@ -103,7 +103,7 @@ cpu0: cpu@0 {
enable-method = "psci";
reg = <0>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -133,7 +133,7 @@ cpu100: cpu@100 {
enable-method = "psci";
reg = <0x100>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -163,7 +163,7 @@ cpu200: cpu@200 {
enable-method = "psci";
reg = <0x200>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -193,7 +193,7 @@ cpu300: cpu@300 {
enable-method = "psci";
reg = <0x300>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -223,7 +223,7 @@ cpu10000: cpu@10000 {
enable-method = "psci";
reg = <0x10000>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -253,7 +253,7 @@ cpu10100: cpu@10100 {
enable-method = "psci";
reg = <0x10100>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -283,7 +283,7 @@ cpu10200: cpu@10200 {
enable-method = "psci";
reg = <0x10200>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -313,7 +313,7 @@ cpu10300: cpu@10300 {
enable-method = "psci";
reg = <0x10300>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -343,7 +343,7 @@ cpu20000: cpu@20000 {
enable-method = "psci";
reg = <0x20000>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -373,7 +373,7 @@ cpu20100: cpu@20100 {
enable-method = "psci";
reg = <0x20100>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -403,7 +403,7 @@ cpu20200: cpu@20200 {
enable-method = "psci";
reg = <0x20200>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -433,7 +433,7 @@ cpu20300: cpu@20300 {
enable-method = "psci";
reg = <0x20300>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -463,7 +463,7 @@ cpu30000: cpu@30000 {
enable-method = "psci";
reg = <0x30000>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -493,7 +493,7 @@ cpu30100: cpu@30100 {
enable-method = "psci";
reg = <0x30100>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -523,7 +523,7 @@ cpu30200: cpu@30200 {
enable-method = "psci";
reg = <0x30200>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -553,7 +553,7 @@ cpu30300: cpu@30300 {
enable-method = "psci";
reg = <0x30300>;
operating-points-v2 = <&cpu_opp_table>;
- cpu-idle-states = <&CPU_SLEEP_0>;
+ cpu-idle-states = <&CPU_RETENTION_0>;
d-cache-size = <0x10000>; /* 64kB */
d-cache-line-size = <64>;
/* 4 ways set associativity */
@@ -636,13 +636,12 @@ llc: l4-cache { /* LLC inside CMN */
idle-states {
entry-method = "psci";
- CPU_SLEEP_0: cpu-sleep-0 {
+ CPU_RETENTION_0: cpu-retention-0 {
compatible = "arm,idle-state";
- arm,psci-suspend-param = <0x40000000>;
- local-timer-stop;
- entry-latency-us = <300>;
- exit-latency-us = <600>;
- min-residency-us = <10000>;
+ arm,psci-suspend-param = <0>;
+ entry-latency-us = <1>;
+ exit-latency-us = <1>;
+ min-residency-us = <1>;
};
};
};
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] arm64: versal-net: Add retention state for cpu idle
2026-07-27 12:18 [PATCH] arm64: versal-net: Add retention state for cpu idle Jay Buddhabhatti
@ 2026-07-27 12:29 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-27 12:29 UTC (permalink / raw)
To: Jay Buddhabhatti; +Cc: conor+dt, robh, devicetree
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The CPU_RETENTION_0 state duplicates the built-in WFI state and fails to avoid firmware dependency, contradicting the patch's stated goal.
--
--- Patch [1]: [PATCH] arm64: versal-net: Add retention state for cpu idle ---
commit 945569ec7efab4f9ca915d207005b24c2747571f
Author: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
arm64: versal-net: Add retention state for cpu idle
This commit replaces the sleep state with a retention state for CPU idle in
the versal-net device tree. The stated goal is to avoid firmware dependencies
by using a PSCI suspend parameter of 0, intending for the core to simply
execute WFI without powering off.
> diff --git a/arch/arm64/boot/dts/xilinx/versal-net.dtsi b/arch/arm64/boot/dts/xilinx/versal-net.dtsi
> --- a/arch/arm64/boot/dts/xilinx/versal-net.dtsi
> +++ b/arch/arm64/boot/dts/xilinx/versal-net.dtsi
[ ... ]
> @@ -636,13 +636,12 @@ llc: l4-cache { /* LLC inside CMN */
> idle-states {
> entry-method = "psci";
>
> - CPU_SLEEP_0: cpu-sleep-0 {
> + CPU_RETENTION_0: cpu-retention-0 {
> compatible = "arm,idle-state";
> - arm,psci-suspend-param = <0x40000000>;
> - local-timer-stop;
> - entry-latency-us = <300>;
> - exit-latency-us = <600>;
> - min-residency-us = <10000>;
> + arm,psci-suspend-param = <0>;
> + entry-latency-us = <1>;
> + exit-latency-us = <1>;
> + min-residency-us = <1>;
> };
[Severity: Medium]
The commit message states that this state avoids dependencies on firmware
because the core simply executes WFI. However, does defining this PSCI idle
state still trigger an SMC call to EL3?
Looking at the cpuidle-psci driver, any registered PSCI idle state invokes
psci_cpu_suspend_enter(), which issues a CPU_SUSPEND SMC call. This implies
the firmware would still be involved on every idle entry, conflicting with
the stated goal.
Additionally, the cpuidle-psci driver already unconditionally creates a
default WFI state at index 0. Does adding CPU_RETENTION_0 with
arm,psci-suspend-param = <0> create a duplicate, functionally identical
idle state in the cpuidle governor?
If the genuine goal is to execute a native hardware WFI without trapping
to firmware, should the cpu-idle-states property be omitted from the CPU
nodes entirely? This would cause the cpuidle-psci driver to fail to probe,
allowing the kernel to natively fall back to arch_cpu_idle() which invokes
the wfi instruction directly from EL1.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260727121842.3410495-1-jay.buddhabhatti@amd.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-27 12:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27 12:18 [PATCH] arm64: versal-net: Add retention state for cpu idle Jay Buddhabhatti
2026-07-27 12:29 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox