Repository navigation
PM: phytium: update phytium PM controller driver support to 6.6.0.4 - #2241
Conversation
Reviewer's GuideAdds platform-specific standby suspend support for Phytium PD2408 by selecting custom PSCI SYSTEM_SUSPEND parameters and permitting both standby and memory suspend states, while preserving the existing generic PSCI behavior on other platforms. Sequence diagram for Phytium PD2408 suspend selectionsequenceDiagram
participant Kernel
participant PSCI
participant Firmware
Kernel->>PSCI: psci_init_system_suspend()
PSCI->>PSCI: is_pd2408()
alt Phytium PD2408
PSCI->>Kernel: suspend_set_ops(phytium_psci_suspend_ops)
Kernel->>PSCI: phytium_psci_system_suspend_enter(state)
PSCI->>PSCI: cpu_suspend(state, phytium_psci_system_suspend)
alt PM_SUSPEND_STANDBY
PSCI->>Firmware: SYSTEM_SUSPEND(pa_cpu_resume, 0x544600c2, 0)
else PM_SUSPEND_MEM
PSCI->>Firmware: SYSTEM_SUSPEND(pa_cpu_resume, 0, 0)
end
else Other platform
PSCI->>Kernel: suspend_set_ops(psci_suspend_ops)
Kernel->>Firmware: Generic SYSTEM_SUSPEND
end
Flow diagram for Phytium suspend state validationflowchart TD
A[Requested suspend state] --> B{Phytium platform}
B -->|No| C[Use generic suspend validation]
B -->|Yes| D{State is PM_SUSPEND_STANDBY or PM_SUSPEND_MEM}
D -->|Yes| E[Allow suspend]
D -->|No| F[Reject state]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Hi @wangchenlu2236. Thanks for your PR. I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="drivers/firmware/psci/psci.c" line_range="506" />
<code_context>
+ phys_addr_t pa_cpu_resume = __pa_symbol(cpu_resume);
+
+ if (state == PM_SUSPEND_STANDBY)
+ return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND),
+ pa_cpu_resume, 0x544600c2, 0);
+ else
</code_context>
<issue_to_address>
**Suspend failures report wrong errno**
When PSCI SYSTEM_SUSPEND returns an error for standby or memory suspend, `phytium_psci_system_suspend` returns the raw firmware status through `cpu_suspend()` to the PM core instead of translating it with `psci_to_linux_errno()`; for example, `PSCI_RET_DENIED` reaches callers as `-3` (`-ESRCH`) rather than `-EPERM`, so they see the wrong suspend failure reason.
Translate each `invoke_psci_fn()` result with `psci_to_linux_errno()` before returning it.
Also at `drivers/firmware/psci/psci.c:507-510`.
</issue_to_address>| phys_addr_t pa_cpu_resume = __pa_symbol(cpu_resume); | ||
|
|
||
| if (state == PM_SUSPEND_STANDBY) | ||
| return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND), |
There was a problem hiding this comment.
🟡 Medium · Suspend failures report wrong errno
When PSCI SYSTEM_SUSPEND returns an error for standby or memory suspend, phytium_psci_system_suspend returns the raw firmware status through cpu_suspend() to the PM core instead of translating it with psci_to_linux_errno(); for example, PSCI_RET_DENIED reaches callers as -3 (-ESRCH) rather than -EPERM, so they see the wrong suspend failure reason.
Translate each invoke_psci_fn() result with psci_to_linux_errno() before returning it.
Also at drivers/firmware/psci/psci.c:507-510.
Prompt for AI agents
In `drivers/firmware/psci/psci.c` at line 506:
**Suspend failures report wrong errno**
When PSCI SYSTEM_SUSPEND returns an error for standby or memory suspend, `phytium_psci_system_suspend` returns the raw firmware status through `cpu_suspend()` to the PM core instead of translating it with `psci_to_linux_errno()`; for example, `PSCI_RET_DENIED` reaches callers as `-3` (`-ESRCH`) rather than `-EPERM`, so they see the wrong suspend failure reason.
Translate each `invoke_psci_fn()` result with `psci_to_linux_errno()` before returning it.
Also at `drivers/firmware/psci/psci.c:507-510`.There was a problem hiding this comment.
🟡 Changes recommended
Phytium builds are blocked by an unguarded suspend callback reference when CONFIG_SUSPEND=n and a dangling else treated as an error under CONFIG_WERROR.
3 open issues
What changed in this PR
Introduces PSCI-based standby support for Phytium PD2408 platforms while retaining generic suspend handling elsewhere.
Changes:
- Add a Phytium validator accepting standby and memory suspend states.
- Select PD2408-specific suspend operations and pass a firmware selector for standby.
| File | Description |
|---|---|
kernel/power/suspend.c |
Adds and exports the Phytium suspend-state validator. |
include/linux/suspend.h |
Declares the validator under CONFIG_ARCH_PHYTIUM. |
drivers/firmware/psci/psci.c |
Adds Phytium suspend callbacks and selects them for PD2408. |
Review effort: Max
|
|
||
|
|
||
| static const struct platform_suspend_ops phytium_psci_suspend_ops = { | ||
| .valid = phytium_suspend_valid_mem, |
| if (ret != PSCI_RET_NOT_SUPPORTED) | ||
| #ifdef CONFIG_ARCH_PHYTIUM | ||
| if (is_pd2408()) | ||
| suspend_set_ops(&phytium_psci_suspend_ops); | ||
| else | ||
| suspend_set_ops(&psci_suspend_ops); | ||
| #else | ||
| suspend_set_ops(&psci_suspend_ops); | ||
| #endif |
| phys_addr_t pa_cpu_resume = __pa_symbol(cpu_resume); | ||
|
|
||
| if (state == PM_SUSPEND_STANDBY) | ||
| return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND), | ||
| pa_cpu_resume, 0x544600c2, 0); | ||
| else | ||
| return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND), | ||
| pa_cpu_resume, 0, 0); |
This patch adds a "standby" system state on phytium SoCs, This state has a power consumption level between S2idle and S3, but it provides better system responsiveness. Mainline: NA Signed-off-by: Wang Xu <wangxu@phytium.com.cn> Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn> Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
2c31c3a to
85a804c
Compare


This patches updates the support for phytium PM controller driver.
1.PM: power: Add a standby system state on Phytium platforms
Summary by Sourcery
Support standby and memory suspend states for Phytium power-management controllers.
New Features:
Enhancements: