-
Notifications
You must be signed in to change notification settings - Fork 86
Update and enhance the LPM documentation #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,37 +7,50 @@ | |||||
| ARM Trusted Firmware changes | ||||||
| **************************** | ||||||
|
|
||||||
| This patch updates the system suspend mode for the AM62L platform. After making the following changes, | ||||||
| re-build the ARM Trusted Firmware and then re-package it in the :file:`tispl.bin` file to ensure | ||||||
| the changes take effect. To learn more about TF-A and how to rebuild it, see :ref:`foundational-components-atf`. | ||||||
| For rebuilding U-Boot and generating the new :file:`tispl.bin` follow :ref:`Build-U-Boot-label`. | ||||||
| The AM62L platform supports multiple low power modes. The TF-A firmware sets the | ||||||
|
Check warning on line 10 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst
|
||||||
| active mode through the ``mode`` variable in the :func:`am62l_pwr_domain_suspend` | ||||||
| function. The following table lists all available modes: | ||||||
|
|
||||||
| +--------------+---------------------------+----------------------------------------------+ | ||||||
| | Mode Value | Low Power Mode | Description | | ||||||
| +==============+===========================+==============================================+ | ||||||
| | 0 | DeepSleep | Default mode. Low latency, higher power | | ||||||
| +--------------+---------------------------+----------------------------------------------+ | ||||||
| | 6 | RTC + I/O + DDR | Lowest power with DDR retention | | ||||||
|
Check warning on line 19 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst
|
||||||
| +--------------+---------------------------+----------------------------------------------+ | ||||||
| | 8 | DSS plus DeepSleep | DeepSleep with Display Subsystem powered | | ||||||
|
Check warning on line 21 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst
|
||||||
| +--------------+---------------------------+----------------------------------------------+ | ||||||
|
|
||||||
| To change the low power mode, modify the ``mode`` value in the TF-A source code as shown below. | ||||||
|
Check warning on line 24 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst
|
||||||
| After making the changes, re-build the ARM Trusted Firmware and then re-package it in the | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| :file:`tispl.bin` file to ensure the changes take effect. To learn more about TF-A and how to | ||||||
| rebuild it, see :ref:`foundational-components-atf`. For rebuilding U-Boot and generating the new | ||||||
| :file:`tispl.bin` follow :ref:`Build-U-Boot-label`. | ||||||
|
|
||||||
| .. code-block:: diff | ||||||
|
|
||||||
| diff --git a/plat/ti/k3/common/am62l_psci.c b/plat/ti/k3/common/am62l_psci.c | ||||||
| index 3df4986e5..945da5908 100644 | ||||||
| --- a/plat/ti/k3/common/am62l_psci.c | ||||||
| +++ b/plat/ti/k3/common/am62l_psci.c | ||||||
| @@ -317,6 +317,7 @@ static void am62l_pwr_domain_suspend(const psci_power_state_t *target_state) | ||||||
| * mode=6 for RTC only + DDR and mode=0 for deepsleep | ||||||
| */ | ||||||
| uint32_t mode = am62l_lpm_state; | ||||||
| + mode = 6; | ||||||
|
|
||||||
| diff --git a/plat/ti/k3low/common/am62l_psci.c b/plat/ti/k3low/common/am62l_psci.c | ||||||
| index 6bb9a4298..d8da7e6a9 100644 | ||||||
| --- a/plat/ti/k3low/common/am62l_psci.c | ||||||
| +++ b/plat/ti/k3low/common/am62l_psci.c | ||||||
| @@ -233,7 +233,7 @@ static int am62l_validate_power_state(unsigned int power_state, | ||||||
| static void am62l_pwr_domain_suspend(const psci_power_state_t *target_state) | ||||||
| { | ||||||
| uint32_t core, proc_id; | ||||||
| - uint32_t mode = 0; | ||||||
| + uint32_t mode = 6; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure that this modification is sufficient to hardcode mode value to 6?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the mode = am62l_lpm_state is only executed for the s2idle path. For the deep, we only need to make the above change |
||||||
| core = plat_my_core_pos(); | ||||||
| proc_id = PLAT_PROC_START_ID + core; | ||||||
| uint64_t context_save_addr = TIFS_LPM_SAVE_CTX; | ||||||
|
|
||||||
| This modifies :file:`plat/ti/k3/common/am62l_psci.c`, which is the new Power | ||||||
| State Coordination Interface (PSCI) driver for AM62L in Arm Trusted Firmware. | ||||||
| The :func:`am62l_pwr_domain_suspend` function will change the default system | ||||||
| suspend mode from Deep Sleep to RTC Only + DDR. | ||||||
| This modifies :file:`plat/ti/k3/common/am62l_psci.c`, the PSCI driver for AM62L in | ||||||
|
Check warning on line 45 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst
|
||||||
| Arm Trusted Firmware. The example above changes the default suspend mode from DeepSleep | ||||||
|
Check warning on line 46 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst
|
||||||
| (mode 0) to RTC + I/O + DDR (mode 6). Replace the ``mode`` value with any value from the | ||||||
| table above to select a different low power mode. | ||||||
|
|
||||||
| The default mode of 0 is the Deep Sleep state. Deep Sleep provides the lowest | ||||||
| latency wake-up but also uses more power. The updated default mode of 6 is | ||||||
| the RTC only + DDR state. In contrast, RTC only + DDR offers a lower power | ||||||
| consumption profile, but at the cost of higher wake-up latency. | ||||||
| .. note:: | ||||||
|
|
||||||
| This change is a temporary solution. A more robust solution is under development to pass a suspend parameter from the kernel | ||||||
| by leveraging the s2idle mechanism. | ||||||
| This is a workaround required for selecting the low power mode when using [deep] in the /sys/power/suspend interface. | ||||||
| A more robust solution to select the suspend mode at runtime from the kernel is via the s2idle mechanism, without requiring | ||||||
| a firmware rebuild. See :ref:`pm_s2idle_psci` for details. | ||||||
|
|
||||||
| Once :file:`tispl.bin` is rebuilt and packaged, continue with entering LPM as described in :ref:`lpm_modes`. | ||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,8 +19,28 @@ | |||||||
| #. RTC Only Plus DDR | ||||||||
| #. Deep Sleep | ||||||||
|
|
||||||||
| These modes fall into two distinct categories based on whether DDR context is retained: | ||||||||
|
|
||||||||
| - **Power Off**: The system enters a complete poweroff state. DDR context is lost and a | ||||||||
| full hardware restart is required on wakeup. | ||||||||
|
Comment on lines
+24
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sort of makes it sound like the user will have to do a full hardware restart upon wakeup. Maybe reword to be something along the lines of "DDR context is lost and upon wakeup, the system executes a full hardware restart" |
||||||||
|
|
||||||||
| - **Suspend to RAM**: The system suspends with DDR RAM context retained. State is | ||||||||
| restored on resume without a full hardware restart, resulting in significantly lower wakeup | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO leave out "without a full hardware restart" |
||||||||
| latency. | ||||||||
|
|
||||||||
| | **Power Off Mode** | ||||||||
| | - RTC Only | ||||||||
|
|
||||||||
| | **Suspend to RAM Mode** | ||||||||
| | - RTC + I/O + DDR | ||||||||
| | - Deep Sleep | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add DSS + DeepSleep also
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||||||||
| | - DSS plus DeepSleep | ||||||||
|
|
||||||||
| Power Off Mode | ||||||||
| ************** | ||||||||
|
|
||||||||
| RTC Only | ||||||||
| ******** | ||||||||
| ======== | ||||||||
|
|
||||||||
| RTC Only mode is the deepest low power mode that allows the system to enter a complete poweroff state | ||||||||
| with ultra-low power consumption while maintaining system time and wakeup capability. | ||||||||
|
|
@@ -80,17 +100,41 @@ | |||||||
| detects that the RTC is already programmed and skips the full initialization, performing only minimal | ||||||||
| cleanup to preserve the system time. | ||||||||
|
|
||||||||
| RTC Only Plus DDR | ||||||||
| ***************** | ||||||||
| Suspend to RAM Mode | ||||||||
| ******************* | ||||||||
|
|
||||||||
| Selecting the Suspend to RAM Entry Mechanism | ||||||||
| ============================================ | ||||||||
|
|
||||||||
| When entering Suspend to RAM via ``echo mem > /sys/power/state``, the kernel selects the | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| low power mode to enter based on the value of ``/sys/power/mem_sleep``: | ||||||||
|
|
||||||||
| - ``deep`` — uses the System Suspend path, and is the default mode. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| Always enters the hardcoded mode selected in the firmware during build time, | ||||||||
|
Check failure on line 113 in source/linux/Foundational_Components/Power_Management/pm_am62lx_low_power_modes.rst
|
||||||||
| which is **DeepSleep** mode by default. | ||||||||
| - ``s2idle`` — uses the Suspend-to-Idle path via PSCI, which allows the platform firmware(TF-A) to select the deepest available mode. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| Allows mode selection in runtime. Mode selected is determined by latency and system configuration. | ||||||||
|
|
||||||||
| To check or change the current default at runtime: | ||||||||
|
|
||||||||
| .. code-block:: console | ||||||||
|
|
||||||||
| root@am62lxx-evm:~# cat /sys/power/mem_sleep | ||||||||
| s2idle [deep] | ||||||||
|
|
||||||||
| root@am62lxx-evm:~# echo s2idle > /sys/power/mem_sleep | ||||||||
|
|
||||||||
|
|
||||||||
| For full details on the s2idle path, PSCI integration, and mode selection at runtime, refer to :ref:`pm_s2idle_psci`. | ||||||||
|
|
||||||||
| .. note:: | ||||||||
|
|
||||||||
| Please go through the s2idle docs to understand how to select between multiple low power modes. | ||||||||
| The steps and overall architecture/ sequence diagrams are documented in :ref:`pm_s2idle_psci`. | ||||||||
| The default mode via s2idle is RTC Only Plus DDR, since it's the deepest. | ||||||||
| If the [deep] path is selected in `/sys/power/mem_sleep`, the low power mode | ||||||||
| selection requires special steps to enter. The steps are documented in :ref:`am62l_suspend_workarounds`. | ||||||||
| The default mode entered would be **DeepSleep** mode. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| If regular [mem] interface is selected in `/sys/power/mem_sleep`, the RTC Only + DDR low power mode | ||||||||
| requires special steps to enter. The steps are documented in :ref:`am62l_suspend_workarounds`. | ||||||||
| RTC + I/O + DDR | ||||||||
| ================= | ||||||||
|
|
||||||||
| RTC Only + DDR mode is the deepest low power mode that allows the system to enter a state of lowest power consumption | ||||||||
| while still retaining the DDR RAM context. | ||||||||
|
|
@@ -108,6 +152,14 @@ | |||||||
| root@am62lxx-evm:~# echo disabled > /sys/devices/platform/bus@f0000/f900000.dwc3-usb/power/wakeup | ||||||||
| root@am62lxx-evm:~# echo disabled > /sys/devices/platform/bus@f0000/f910000.dwc3-usb/power/wakeup | ||||||||
|
|
||||||||
| .. note:: | ||||||||
|
|
||||||||
| Without the disabling USB as a wakeup source, the system will not resume cleanly and result in a usb driver crash on resume, | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| while using the [deep] path. | ||||||||
|
|
||||||||
| For the [s2idle] path, the system will not enter RTC + I/O + DDR mode if USB0 or USB1 is enabled as a wakeup source, and enter | ||||||||
| Deepsleep mode instead. | ||||||||
|
Comment on lines
+160
to
+161
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| Now the SoC can be suspended using the following command. | ||||||||
|
|
||||||||
| .. code-block:: console | ||||||||
|
|
@@ -132,7 +184,7 @@ | |||||||
| [ 222.445468] PM: suspend exit | ||||||||
|
|
||||||||
| DeepSleep | ||||||||
| ********* | ||||||||
| ========= | ||||||||
|
|
||||||||
| DeepSleep AKA Suspend-to-RAM is a low-power mode that allows the SoC | ||||||||
| to retain its state in RAM while the processor is turned off. | ||||||||
|
|
@@ -144,7 +196,14 @@ | |||||||
| power to key modules such as GPIO and others is maintained to allow wakeup events | ||||||||
| to exit out of this mode. | ||||||||
|
|
||||||||
| In order to enter DeepSleep, | ||||||||
| DeepSleep is the default mode entered using the [deep] path in `/sys/power/mem_sleep`. | ||||||||
|
|
||||||||
| | To enter DeepSleep mode using the [s2idle] path, set the cpu latency constraint between that of DeepSleep(350ms) and RTC + I/O + DDR(900ms) mode. | ||||||||
| | Use the following command to set the constraint to 500ms, which will allow the system to enter DeepSleep mode. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a sentence that says to refer to the standby documentation on how setting the constraint works to choose modes. |
||||||||
|
|
||||||||
| .. code-block:: bash | ||||||||
|
|
||||||||
| exec 4<>/dev/cpu_wakeup_latency; echo 0x7a120 >&4 | ||||||||
|
|
||||||||
| .. code-block:: console | ||||||||
|
|
||||||||
|
|
@@ -172,6 +231,8 @@ | |||||||
| [ 88.649913] PM: suspend exit | ||||||||
| root@am62lxx-evm:~# | ||||||||
|
|
||||||||
| Execute the above commands in a subshell to avoid accidentally keeping the file descriptor open indefinitely. | ||||||||
|
|
||||||||
| Memory Usage | ||||||||
| ************ | ||||||||
|
|
||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace TF-A acronym then you can use it later in the docs