xen/arm: Suspend to RAM Support in Xen for ARM
RFC 1/1 xen/arm: Suspend to RAM Support in Xen for ARM
This document contains our draft proposal for implementing "suspend to RAM" support for ARM in Xen, as discussed during the last Xen ARM community call. It covers the basic suspend to RAM mechanism based on ARM PSCI standard, that would allow individual guests and Xen itself to suspend.
We would appreciate your feedback.
--- docs/misc/arm/suspend-to-ram.txt | 210 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 docs/misc/arm/suspend-to-ram.txt
docs/misc/arm/suspend-to-ram.txt new file +210 -0
@@ -0,0 +1,210 @@ +% Suspend to RAM Support in Xen for ARM +% Revision 1.0 + +======== +Overview +======== + +Suspend to RAM (in the following text 'suspend') for ARM in Xen should be +coordinated using ARM PSCI standard [1]. + +EL1/2 should suspend in the following order: +1) Unprivileged guests (DomUs) suspend +2) Privileged guest (Dom0) suspends +3) Xen suspends + +Since this proposal is focused on implementing PSCI-based suspend mechanisms in +Xen, communication with or among the guests is not covered by this document. +The order of suspending the guests is assumed to be guaranteed by the software +running in EL1. + +----------------- +Suspending Guests +----------------- + +Suspend procedure for a guest consists of the following: +1) Suspending devices +2) Suspending non-boot CPUs +3) System suspend, performed by the boot CPU + +Each guest should suspend the devices it owns. Suspending of devices is not +covered by this document. The document covers only mechanisms for suspending +non-boot CPUs, as well as the system suspend. + +Guests should suspend their non-boot vCPUs using the hotplug mechanism. +Virtual CPUs should be put offline using the already implemented PSCI vCPU_OFF +call (prefix 'v' is added to distinguish PSCI calls made by guests to Xen, which +affect virtual machines; as opposed to PSCI calls made by Xen to the EL3, which +can affect power state of the physical machine). + +After suspending its non-boot vCPUs a guest should finalize the suspend by +making the vSYSTEM_SUSPEND PSCI call. The resume address is specified by the +guest via the vSYSTEM_SUSPEND entry_point_address argument. The vSYSTEM_SUSPEND +call is currently not implemented in Xen. + +It is expected that a guest leaves enabled all interrupts that should wake it +up. Other interrupts should be disabled by the guest prior to calling +vSYSTEM_SUSPEND. + +After an unprivileged guest suspends, Xen will not suspend. Xen would suspend +only after the Dom0 completes the system suspend. + +-------------- +Suspending Xen +-------------- + +Xen should start suspending itself upon receiving the vSYSTEM_SUSPEND call +from the last running guest (Dom0). At that moment all physical CPUs are still +online (taking offline a vCPU or suspending a VM does not affect physical CPUs). +Xen shall now put offline the non-boot pCPUs by making the CPU_OFF PSCI call +to EL3. The CPU_OFF PSCI function is currently not implemented in Xen. + +After putting offline the non-boot cores Xen must save the context and finalize +suspend by invoking SYSTEM_SUSPEND PSCI call, which is passed to EL3. +The resume point of Xen is specified by the entry_point_address argument of the +SYSTEM_SUSPEND call. The SYSTEM_SUSPEND function and context saving is not +implemented in Xen for ARM today. + +------------ +Resuming Xen +------------ + +Xen must be resumed prior to any software running in EL1. Starting from the +resume point, Xen should restore the context and resume Dom0. Dom0 shall always +be resumed whenever Xen resumes. +The whole Xen resume flow for the ARM architecture has to be implemented. + +--------------- +Resuming Guests +--------------- + +Resume of the privileged guest (Dom0) is always following the Xen resume. + +An unprivileged guest shall resume once a device it owns triggers a wake-up +interrupt, regardless of whether Xen was suspended when the wake-up interrupt +was triggered. If Xen was suspended, it is assumed that Dom0 will be running +before the DomU guest starts to resume. The synchronization mechanism to +enforce the assumed condition is TBD. + +If the ARM's GIC was powered down after the ARM subsystem suspended, it is +assumed that Xen needs to restore the GIC interface for a VM prior to handing +over control to the guest. However, the guest should restore its own context +upon entering the resume point (out of scope of this document). + +======================= +Implementation Proposal +======================= + +-------- +Overview +-------- + +In order to enable the suspend/resume of VMs and Xen itself, the following PSCI +calls have to be implemented and integrated in Xen: +1) vSYSTEM_SUSPEND +2) CPU_OFF +3) SYSTEM_SUSPEND + +In addition, the following have to be implemented: +* Save/restore of EL2 context +* Save/restore of GIC configuration for each VM + +Implementation details are provided in the sections below. Function names and +paths used below are consistent within the document but may not always match the +names used in future implementation. Existing functions and paths are named as +in Xen source tree. + +Note: The proposal is still incomplete and shall be refined in future revisions. +Specific issues that are not addressed are marked as "TBD". + +------------------------------------- +Suspend/Resume Implementation Details +------------------------------------- + +PSCI Implementation and Integration +----------------------------------- +vSYSTEM_SUSPEND +--------------- +vSYSTEM_SUSPEND shall be implemented in +* do_psci_system_suspend() in arch/arm/vpsci.c + +The implementation shall include the following steps: +* Block the current vCPU +* If the hardware domain made the call trigger Xen suspend, i.e. + call machine_suspend() which will be implemented in arch/arm/suspend.c + (similar as the machine_restart() is implemented in arch/arm/shutdown.c) + +The function do_psci_system_suspend() shall be called from +* do_trap_psci() in arch/arm/traps.c + +CPU_OFF (physical CPUs) +----------------------- +The CPU_OFF function shall be implemented in +* call_psci_cpu_off() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. + +This function needs to be called when Xen generic code disables non-boot CPUs, +which is done by +* disable_nonboot_cpus() in common/cpu.c +This function calls architecture specific +* __cpu_die() implemented in arch/arm/smpboot.c +The call_psci_cpu_off() shall be invoked when the respective CPU dies. To make +that happen, the +* arch_cpu_die() would be implemented in arch/arm/arm64/smpboot.c +and called from __cpu_die(). +Finally the call_psci_cpu_off() shall be invoked from arch_cpu_die(). + +Such a control flow would be similar to the already existing flow for enabling +non-boot CPUs, which looks like this: +enable_nonboot_cpus() -> cpu_up() -> __cpu_up() -> arch_cpu_up() -> +call_psci_cpu_on() + +SYSTEM_SUSPEND (physical) +------------------------- +The SYSTEM_SUSPEND function shall be implemented in +* call_psci_system_suspend() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. The +entry_point_address argument of the SMC call needs to be an ARM architecture +resume address. The call_psci_system_suspend() function does not return. + +The function needs to be called from machine_suspend() to finalize the suspend +procedure. + +------------------ +Additional Changes +------------------ + +Suspend Flow +------------ +The suspend procedure shall be implemented in +* machine_suspend() in arch/arm/suspend.c + +The implementation shall include the following steps: +* Set the system_state variable to SYS_STATE_suspend +* Freeze domains by calling domain_pause() for each domain (we assume this needs + to be done) +* Disable non-boot CPUs by calling disable_nonboot_cpus() +* Save ARM specific context + +Resume Flow +------------ +The resume procedure shall be implemented in +* machine_resume() in arch/arm/suspend.c + +The machine_resume() implementation shall include the following steps: +* Restore ARM specific context +* Enable non-boot CPUs by calling enable_nonboot_cpus() +* Thaw domains by calling domain_unpause() for each domain (we assume this needs + to be done) +* Set the system_state variable to SYS_STATE_resume +* TBD: how to resume Dom0, i.e. how to hand over control to Dom0? + +========== +References +========== + +[1] Power State Coordination Interface (ARM): +http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf +
Signature · 7 lines
2.13.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Dear Mirela,
Please see my comments below:
Quoted 23 lines · Mirela Simonovic
This document contains our draft proposal for implementing "suspend to RAM" support for ARM in Xen, as discussed during the last Xen ARM community call. It covers the basic suspend to RAM mechanism based on ARM PSCI standard, that would allow individual guests and Xen itself to suspend.
We would appreciate your feedback.
Signed-off-by Mirela Simonovic <[email protected]>--- docs/misc/arm/suspend-to-ram.txt | 210 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+)create mode 100644
docs/misc/arm/suspend-to-ram.txtdocs/misc/arm/suspend-to-ram.txt new file +4
-0@@ -0,0 +1,210 @@ +% Suspend to RAM Support in Xen for ARM +% Revision 1.0 + +========
docs/misc/arm/suspend-to-ram.txt line 14
Quoted 10 lines
docs/misc/arm/suspend-to-ram.txt new file +10
-0+Overview +======== + +Suspend to RAM (in the following text 'suspend') for ARM in Xen should be +coordinated using ARM PSCI standard [1]. + +EL1/2 should suspend in the following order: +1) Unprivileged guests (DomUs) suspend +2) Privileged guest (Dom0) suspends +3) Xen suspends
This order description makes an impression that unprivileged guest suspend triggers the system suspend, what is not true as per following text. Instead I would describe separately two scenarios: suspend of an unprivileged domain and suspend of a privileged domain. E.g:
Suspend of an unprivileged domain will:
- suspend this domain only
Suspend of a privileged domain will consequently:
- trigger suspend of unprivileged domains
- suspend privileged domain itself
- trigger suspend of Xen hypervisor
Quoted 61 lines
docs/misc/arm/suspend-to-ram.txt new file +61
-0+ +Since this proposal is focused on implementing PSCI-based suspend mechanisms in +Xen, communication with or among the guests is not covered by this document. +The order of suspending the guests is assumed to be guaranteed by the software +running in EL1. + +----------------- +Suspending Guests +----------------- + +Suspend procedure for a guest consists of the following: +1) Suspending devices +2) Suspending non-boot CPUs +3) System suspend, performed by the boot CPU + +Each guest should suspend the devices it owns. Suspending of devices is not +covered by this document. The document covers only mechanisms for suspending +non-boot CPUs, as well as the system suspend. + +Guests should suspend their non-boot vCPUs using the hotplug mechanism. +Virtual CPUs should be put offline using the already implemented PSCI vCPU_OFF +call (prefix 'v' is added to distinguish PSCI calls made by guests to Xen, which +affect virtual machines; as opposed to PSCI calls made by Xen to the EL3, which +can affect power state of the physical machine). + +After suspending its non-boot vCPUs a guest should finalize the suspend by +making the vSYSTEM_SUSPEND PSCI call. The resume address is specified by the +guest via the vSYSTEM_SUSPEND entry_point_address argument. The vSYSTEM_SUSPEND +call is currently not implemented in Xen. + +It is expected that a guest leaves enabled all interrupts that should wake it +up. Other interrupts should be disabled by the guest prior to calling +vSYSTEM_SUSPEND. + +After an unprivileged guest suspends, Xen will not suspend. Xen would suspend +only after the Dom0 completes the system suspend. + +-------------- +Suspending Xen +-------------- + +Xen should start suspending itself upon receiving the vSYSTEM_SUSPEND call +from the last running guest (Dom0). At that moment all physical CPUs are still +online (taking offline a vCPU or suspending a VM does not affect physical CPUs). +Xen shall now put offline the non-boot pCPUs by making the CPU_OFF PSCI call +to EL3. The CPU_OFF PSCI function is currently not implemented in Xen. + +After putting offline the non-boot cores Xen must save the context and finalize +suspend by invoking SYSTEM_SUSPEND PSCI call, which is passed to EL3. +The resume point of Xen is specified by the entry_point_address argument of the +SYSTEM_SUSPEND call. The SYSTEM_SUSPEND function and context saving is not +implemented in Xen for ARM today. + +------------ +Resuming Xen +------------ + +Xen must be resumed prior to any software running in EL1. Starting from the +resume point, Xen should restore the context and resume Dom0. Dom0 shall always +be resumed whenever Xen resumes. +The whole Xen resume flow for the ARM architecture has to be implemented.
docs/misc/arm/suspend-to-ram.txt
Quoted 10 lines
docs/misc/arm/suspend-to-ram.txt new file +10
-0+ +--------------- +Resuming Guests +--------------- + +Resume of the privileged guest (Dom0) is always following the Xen resume. + +An unprivileged guest shall resume once a device it owns triggers a wake-up +interrupt, regardless of whether Xen was suspended when the wake-up interrupt +was triggered.
Will an event channel interrupt wake an unprivileged domain from suspend?
Quoted 93 lines
docs/misc/arm/suspend-to-ram.txt new file +92
-0If Xen was suspended, it is assumed that Dom0 will be running +before the DomU guest starts to resume. The synchronization mechanism to +enforce the assumed condition is TBD. + +If the ARM's GIC was powered down after the ARM subsystem suspended, it is +assumed that Xen needs to restore the GIC interface for a VM prior to handing +over control to the guest. However, the guest should restore its own context +upon entering the resume point (out of scope of this document). + +======================= +Implementation Proposal +======================= + +-------- +Overview +-------- + +In order to enable the suspend/resume of VMs and Xen itself, the following PSCI +calls have to be implemented and integrated in Xen: +1) vSYSTEM_SUSPEND +2) CPU_OFF +3) SYSTEM_SUSPEND + +In addition, the following have to be implemented: +* Save/restore of EL2 context +* Save/restore of GIC configuration for each VM + +Implementation details are provided in the sections below. Function names and +paths used below are consistent within the document but may not always match the +names used in future implementation. Existing functions and paths are named as +in Xen source tree. + +Note: The proposal is still incomplete and shall be refined in future revisions. +Specific issues that are not addressed are marked as "TBD". + +------------------------------------- +Suspend/Resume Implementation Details +------------------------------------- + +PSCI Implementation and Integration +----------------------------------- +vSYSTEM_SUSPEND +--------------- +vSYSTEM_SUSPEND shall be implemented in +* do_psci_system_suspend() in arch/arm/vpsci.c + +The implementation shall include the following steps: +* Block the current vCPU +* If the hardware domain made the call trigger Xen suspend, i.e. + call machine_suspend() which will be implemented in arch/arm/suspend.c + (similar as the machine_restart() is implemented in arch/arm/shutdown.c) + +The function do_psci_system_suspend() shall be called from +* do_trap_psci() in arch/arm/traps.c + +CPU_OFF (physical CPUs) +----------------------- +The CPU_OFF function shall be implemented in +* call_psci_cpu_off() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. + +This function needs to be called when Xen generic code disables non-boot CPUs, +which is done by +* disable_nonboot_cpus() in common/cpu.c +This function calls architecture specific +* __cpu_die() implemented in arch/arm/smpboot.c +The call_psci_cpu_off() shall be invoked when the respective CPU dies. To make +that happen, the +* arch_cpu_die() would be implemented in arch/arm/arm64/smpboot.c +and called from __cpu_die(). +Finally the call_psci_cpu_off() shall be invoked from arch_cpu_die(). + +Such a control flow would be similar to the already existing flow for enabling +non-boot CPUs, which looks like this: +enable_nonboot_cpus() -> cpu_up() -> __cpu_up() -> arch_cpu_up() -> +call_psci_cpu_on() + +SYSTEM_SUSPEND (physical) +------------------------- +The SYSTEM_SUSPEND function shall be implemented in +* call_psci_system_suspend() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. The +entry_point_address argument of the SMC call needs to be an ARM architecture +resume address. The call_psci_system_suspend() function does not return. + +The function needs to be called from machine_suspend() to finalize the suspend +procedure. + +------------------ +Additional Changes +------------------
docs/misc/arm/suspend-to-ram.txt line 187
Quoted 10 lines
docs/misc/arm/suspend-to-ram.txt new file +10
-0+ +Suspend Flow +------------ +The suspend procedure shall be implemented in +* machine_suspend() in arch/arm/suspend.c + +The implementation shall include the following steps: +* Set the system_state variable to SYS_STATE_suspend +* Freeze domains by calling domain_pause() for each domain (we assume this needs + to be done)
Why not triggering suspend on the guests?
Quoted 23 lines
docs/misc/arm/suspend-to-ram.txt new file +23
-0+* Disable non-boot CPUs by calling disable_nonboot_cpus() +* Save ARM specific context + +Resume Flow +------------ +The resume procedure shall be implemented in +* machine_resume() in arch/arm/suspend.c + +The machine_resume() implementation shall include the following steps: +* Restore ARM specific context +* Enable non-boot CPUs by calling enable_nonboot_cpus() +* Thaw domains by calling domain_unpause() for each domain (we assume this needs + to be done) +* Set the system_state variable to SYS_STATE_resume +* TBD: how to resume Dom0, i.e. how to hand over control to Dom0? + +========== +References +========== + +[1] Power State Coordination Interface (ARM): +http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf +
Signature · 8 lines
*Andrii Anisov* _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hi Andrii,
Thank you very much for your feedback, please see my answers below.
Quoted 40 lines · Andrii Anisov
Dear Mirela,
Please see my comments below:
Quoted 32 lines · Mirela Simonovic
This document contains our draft proposal for implementing "suspend to RAM"
support for ARM in Xen, as discussed during the last Xen ARM community call.
It covers the basic suspend to RAM mechanism based on ARM PSCI standard, that would allow individual guests and Xen itself to suspend.We would appreciate your feedback.
Signed-off-by Mirela Simonovic <[email protected]>--- docs/misc/arm/suspend-to-ram.txt | 210 ++++++++++++++++++++++++++++++ +++++++++ 1 file changed, 210 insertions(+)create mode 100644
docs/misc/arm/suspend-to-ram.txtdocs/misc/arm/suspend-to-ram.txt new file +9
-0@@ -0,0 +1,210 @@ +% Suspend to RAM Support in Xen for ARM +% Revision 1.0 + +======== +Overview +======== + +Suspend to RAM (in the following text 'suspend') for ARM in Xen should be +coordinated using ARM PSCI standard [1].
Quoted 8 lines
docs/misc/arm/suspend-to-ram.txt line 14
Quoted 6 lines
docs/misc/arm/suspend-to-ram.txt new file +5
-0+ +EL1/2 should suspend in the following order: +1) Unprivileged guests (DomUs) suspend +2) Privileged guest (Dom0) suspends +3) Xen suspendsThis order description makes an impression that unprivileged guest suspend triggers the system suspend, what is not true as per following text.
Instead I would describe separately two scenarios: suspend of an
Quoted 7 lines
unprivileged domain and suspend of a privileged domain. E.g:
Suspend of an unprivileged domain will:
- suspend this domain onlySuspend of a privileged domain will consequently:
- trigger suspend of unprivileged domains
By this proposal triggering suspend of unprivileged guests will not be done. However, I agree the scenario should work as you described and we plan to support that as well.
In this proposal we focused only on PSCI-based mechanisms that will enable top-down suspend to RAM flow. Once we have the mechanisms, we'll send a proposal for supporting the coordination with domains, which will include triggering suspend of unprivileged guests. Coordination will build on top of what we propose here.
Quoted 93 lines
- suspend privileged domain itself
- trigger suspend of Xen hypervisor+
Quoted 88 lines
docs/misc/arm/suspend-to-ram.txt new file +1
-0+Since this proposal is focused on implementing PSCI-based suspendmechanisms in
+Xen, communication with or among the guests is not covered by this document.
+The order of suspending the guests is assumed to be guaranteed by the softwaredocs/misc/arm/suspend-to-ram.txt new file +12
-0+running in EL1. + +----------------- +Suspending Guests +----------------- + +Suspend procedure for a guest consists of the following: +1) Suspending devices +2) Suspending non-boot CPUs +3) System suspend, performed by the boot CPU + +Each guest should suspend the devices it owns. Suspending of devices isnot
+covered by this document. The document covers only mechanisms for suspendingdocs/misc/arm/suspend-to-ram.txt new file +4
-0+non-boot CPUs, as well as the system suspend. + +Guests should suspend their non-boot vCPUs using the hotplug mechanism. +Virtual CPUs should be put offline using the already implemented PSCI
vCPU_OFF
+call (prefix 'v' is added to distinguish PSCI calls made by guests to Xen, which
+affect virtual machines; as opposed to PSCI calls made by Xen to the EL3, whichdocs/misc/arm/suspend-to-ram.txt new file +3
-0+can affect power state of the physical machine). + +After suspending its non-boot vCPUs a guest should finalize the suspendby
+making thevSYSTEM_SUSPENDPSCI call. The resume address is specified by the
+guest via thevSYSTEM_SUSPENDentry_point_addressargument. ThevSYSTEM_SUSPENDdocs/misc/arm/suspend-to-ram.txt new file +3
-0+call is currently not implemented in Xen. + +It is expected that a guest leaves enabled all interrupts that shouldwake it
docs/misc/arm/suspend-to-ram.txt new file +4
-0+up. Other interrupts should be disabled by the guest prior to calling +vSYSTEM_SUSPEND. + +After an unprivileged guest suspends, Xen will not suspend. Xen wouldsuspend
docs/misc/arm/suspend-to-ram.txt new file +7
-0+only after the Dom0 completes the system suspend. + +-------------- +Suspending Xen +-------------- + +Xen should start suspending itself upon receiving the vSYSTEM_SUSPENDcall
+from the last running guest (Dom0). At that moment all physical CPUs are still
+online (taking offline a vCPU or suspending a VM does not affect physical CPUs).
+Xen shall now put offline the non-boot pCPUs by making theCPU_OFFPSCI calldocs/misc/arm/suspend-to-ram.txt new file +3
-0+to EL3. The CPU_OFF PSCI function is currently not implemented in Xen. + +After putting offline the non-boot cores Xen must save the context andfinalize
docs/misc/arm/suspend-to-ram.txt new file +2
-0+suspend by invoking SYSTEM_SUSPEND PSCI call, which is passed to EL3. +The resume point of Xen is specified by the entry_point_address argumentof the
+SYSTEM_SUSPEND call. TheSYSTEM_SUSPENDfunction and context saving is notdocs/misc/arm/suspend-to-ram.txt new file +7
-0+implemented in Xen for ARM today. + +------------ +Resuming Xen +------------ + +Xen must be resumed prior to any software running in EL1. Starting fromthe
+resume point, Xen should restore the context and resume Dom0. Dom0 shall alwaysdocs/misc/arm/suspend-to-ram.txt new file +8
-0+be resumed whenever Xen resumes. +The whole Xen resume flow for the ARM architecture has to be implemented. + +--------------- +Resuming Guests +--------------- + +Resume of the privileged guest (Dom0) is always following the Xen resume.
Quoted 10 lines
Quoted 7 lines
docs/misc/arm/suspend-to-ram.txt new file +2
-0+ +An unprivileged guest shall resume once a device it owns triggers awake-up
+interrupt, regardless of whether Xen was suspended when the wake-up interrupt
+was triggered.Will an event channel interrupt wake an unprivileged domain from suspend?
Yes
Quoted 112 lines
If Xen was suspended, it is assumed that Dom0 will be running
Quoted 110 lines
docs/misc/arm/suspend-to-ram.txt new file +4
-0+before the DomU guest starts to resume. The synchronization mechanism to +enforce the assumed condition is TBD. + +If the ARM's GIC was powered down after the ARM subsystem suspended, itis
+assumed that Xen needs to restore the GIC interface for a VM prior to handing
+over control to the guest. However, the guest should restore its own contextdocs/misc/arm/suspend-to-ram.txt new file +11
-0+upon entering the resume point (out of scope of this document). + +======================= +Implementation Proposal +======================= + +-------- +Overview +-------- + +In order to enable the suspend/resume of VMs and Xen itself, thefollowing PSCI
docs/misc/arm/suspend-to-ram.txt new file +10
-0+calls have to be implemented and integrated in Xen: +1) vSYSTEM_SUSPEND +2) CPU_OFF +3) SYSTEM_SUSPEND + +In addition, the following have to be implemented: +* Save/restore of EL2 context +* Save/restore of GIC configuration for each VM + +Implementation details are provided in the sections below. Functionnames and
+paths used below are consistent within the document but may not always match the
+names used in future implementation. Existing functions and paths are named asdocs/misc/arm/suspend-to-ram.txt new file +3
-0+in Xen source tree. + +Note: The proposal is still incomplete and shall be refined in futurerevisions.
docs/misc/arm/suspend-to-ram.txt new file +30
-0+Specific issues that are not addressed are marked as "TBD". + +------------------------------------- +Suspend/Resume Implementation Details +------------------------------------- + +PSCI Implementation and Integration +----------------------------------- +vSYSTEM_SUSPEND +--------------- +vSYSTEM_SUSPEND shall be implemented in +* do_psci_system_suspend() in arch/arm/vpsci.c + +The implementation shall include the following steps: +* Block the current vCPU +* If the hardware domain made the call trigger Xen suspend, i.e. + call machine_suspend() which will be implemented in arch/arm/suspend.c + (similar as the machine_restart() is implemented in arch/arm/shutdown.c) + +The function do_psci_system_suspend() shall be called from +* do_trap_psci() in arch/arm/traps.c + +CPU_OFF (physical CPUs) +----------------------- +The CPU_OFF function shall be implemented in +* call_psci_cpu_off() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. + +This function needs to be called when Xen generic code disables non-bootCPUs,
docs/misc/arm/suspend-to-ram.txt new file +5
-0+which is done by +* disable_nonboot_cpus() in common/cpu.c +This function calls architecture specific +* __cpu_die() implemented in arch/arm/smpboot.c +The call_psci_cpu_off() shall be invoked when the respective CPU dies.To make
docs/misc/arm/suspend-to-ram.txt new file +6
-0+that happen, the +* arch_cpu_die() would be implemented in arch/arm/arm64/smpboot.c +and called from __cpu_die(). +Finally the call_psci_cpu_off() shall be invoked from arch_cpu_die(). + +Such a control flow would be similar to the already existing flow forenabling
docs/misc/arm/suspend-to-ram.txt new file +11
-0+non-boot CPUs, which looks like this: +enable_nonboot_cpus() -> cpu_up() -> __cpu_up() -> arch_cpu_up() -> +call_psci_cpu_on() + +SYSTEM_SUSPEND (physical) +------------------------- +The SYSTEM_SUSPEND function shall be implemented in +* call_psci_system_suspend() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. The +entry_point_address argument of the SMC call needs to be an ARMarchitecture
docs/misc/arm/suspend-to-ram.txt new file +3
-0+resume address. The call_psci_system_suspend() function does not return. + +The function needs to be called from machine_suspend() to finalize thesuspend
docs/misc/arm/suspend-to-ram.txt new file +10
-0+procedure. + +------------------ +Additional Changes +------------------ + +Suspend Flow +------------ +The suspend procedure shall be implemented in +* machine_suspend() in arch/arm/suspend.c
Quoted 10 lines
Quoted 7 lines
docs/misc/arm/suspend-to-ram.txt new file +4
-0+ +The implementation shall include the following steps: +* Set the system_state variable to SYS_STATE_suspend +* Freeze domains by calling domain_pause() for each domain (we assumethis needs
+ to be done)Why not triggering suspend on the guests?
This executes when the privileged guest calls vSYSTEM_SUSPEND. At that point the privileged guest has already completed its suspend procedure (vSYSTEM_SUSPEND is called to finalize the suspend). It is too late to trigger suspend of unprivileged guests when the privileged guest is already suspended.
Triggering suspend of unprivileged guests has to happen before the privileged guest suspends. However, this is not covered by PSCI and is out of scope (will be covered in the following proposals).
I hope this answers you questions, otherwise please let me know.
Thanks,
Mirela
Quoted 30 lines
+* Disable non-boot CPUs by calling
disable_nonboot_cpus()Quoted 22 lines
docs/misc/arm/suspend-to-ram.txt new file +11
-0+* Save ARM specific context + +Resume Flow +------------ +The resume procedure shall be implemented in +* machine_resume() in arch/arm/suspend.c + +The machine_resume() implementation shall include the following steps: +* Restore ARM specific context +* Enable non-boot CPUs by calling enable_nonboot_cpus() +* Thaw domains by calling domain_unpause() for each domain (we assumethis needs
docs/misc/arm/suspend-to-ram.txt new file +10
-0+ to be done) +* Set the system_state variable to SYS_STATE_resume +* TBD: how to resume Dom0, i.e. how to hand over control to Dom0? + +========== +References +========== + +[1] Power State Coordination Interface (ARM): +http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Quoted 3 lines
Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf +
--
Quoted 4 lines
*Andrii Anisov*
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 8 lines · Mirela Simonovic
This document contains our draft proposal for implementing "suspend to RAM" support for ARM in Xen, as discussed during the last Xen ARM community call. It covers the basic suspend to RAM mechanism based on ARM PSCI standard, that would allow individual guests and Xen itself to suspend.
We would appreciate your feedback.
Signed-off-by Mirela Simonovic <[email protected]>
I am really sorry, for the very late reply. This email fell through the cracks. In general, if I forget about an email, please send a follow up to help me remember :-) Do you have an more up-to-date proposal or is this still the latest?
From an high level, it looks good, only one minor comment: don't call it "hotplug" because usually in the Xen community hotplug means adding more vcpus or removing vcpus at runtime (removing entirely, not suspending).
But the approach looks good to me.
Quoted 230 lines
--- docs/misc/arm/suspend-to-ram.txt | 210 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 docs/misc/arm/suspend-to-ram.txtdocs/misc/arm/suspend-to-ram.txt new file +210
-0@@ -0,0 +1,210 @@ +% Suspend to RAM Support in Xen for ARM +% Revision 1.0 + +======== +Overview +======== + +Suspend to RAM (in the following text 'suspend') for ARM in Xen should be +coordinated using ARM PSCI standard [1]. + +EL1/2 should suspend in the following order: +1) Unprivileged guests (DomUs) suspend +2) Privileged guest (Dom0) suspends +3) Xen suspends + +Since this proposal is focused on implementing PSCI-based suspend mechanisms in +Xen, communication with or among the guests is not covered by this document. +The order of suspending the guests is assumed to be guaranteed by the software +running in EL1. + +----------------- +Suspending Guests +----------------- + +Suspend procedure for a guest consists of the following: +1) Suspending devices +2) Suspending non-boot CPUs +3) System suspend, performed by the boot CPU + +Each guest should suspend the devices it owns. Suspending of devices is not +covered by this document. The document covers only mechanisms for suspending +non-boot CPUs, as well as the system suspend. + +Guests should suspend their non-boot vCPUs using the hotplug mechanism. +Virtual CPUs should be put offline using the already implemented PSCI vCPU_OFF +call (prefix 'v' is added to distinguish PSCI calls made by guests to Xen, which +affect virtual machines; as opposed to PSCI calls made by Xen to the EL3, which +can affect power state of the physical machine). + +After suspending its non-boot vCPUs a guest should finalize the suspend by +making the vSYSTEM_SUSPEND PSCI call. The resume address is specified by the +guest via the vSYSTEM_SUSPEND entry_point_address argument. The vSYSTEM_SUSPEND +call is currently not implemented in Xen. + +It is expected that a guest leaves enabled all interrupts that should wake it +up. Other interrupts should be disabled by the guest prior to calling +vSYSTEM_SUSPEND. + +After an unprivileged guest suspends, Xen will not suspend. Xen would suspend +only after the Dom0 completes the system suspend. + +-------------- +Suspending Xen +-------------- + +Xen should start suspending itself upon receiving the vSYSTEM_SUSPEND call +from the last running guest (Dom0). At that moment all physical CPUs are still +online (taking offline a vCPU or suspending a VM does not affect physical CPUs). +Xen shall now put offline the non-boot pCPUs by making the CPU_OFF PSCI call +to EL3. The CPU_OFF PSCI function is currently not implemented in Xen. + +After putting offline the non-boot cores Xen must save the context and finalize +suspend by invoking SYSTEM_SUSPEND PSCI call, which is passed to EL3. +The resume point of Xen is specified by the entry_point_address argument of the +SYSTEM_SUSPEND call. The SYSTEM_SUSPEND function and context saving is not +implemented in Xen for ARM today. + +------------ +Resuming Xen +------------ + +Xen must be resumed prior to any software running in EL1. Starting from the +resume point, Xen should restore the context and resume Dom0. Dom0 shall always +be resumed whenever Xen resumes. +The whole Xen resume flow for the ARM architecture has to be implemented. + +--------------- +Resuming Guests +--------------- + +Resume of the privileged guest (Dom0) is always following the Xen resume. + +An unprivileged guest shall resume once a device it owns triggers a wake-up +interrupt, regardless of whether Xen was suspended when the wake-up interrupt +was triggered. If Xen was suspended, it is assumed that Dom0 will be running +before the DomU guest starts to resume. The synchronization mechanism to +enforce the assumed condition is TBD. + +If the ARM's GIC was powered down after the ARM subsystem suspended, it is +assumed that Xen needs to restore the GIC interface for a VM prior to handing +over control to the guest. However, the guest should restore its own context +upon entering the resume point (out of scope of this document). + +======================= +Implementation Proposal +======================= + +-------- +Overview +-------- + +In order to enable the suspend/resume of VMs and Xen itself, the following PSCI +calls have to be implemented and integrated in Xen: +1) vSYSTEM_SUSPEND +2) CPU_OFF +3) SYSTEM_SUSPEND + +In addition, the following have to be implemented: +* Save/restore of EL2 context +* Save/restore of GIC configuration for each VM + +Implementation details are provided in the sections below. Function names and +paths used below are consistent within the document but may not always match the +names used in future implementation. Existing functions and paths are named as +in Xen source tree. + +Note: The proposal is still incomplete and shall be refined in future revisions. +Specific issues that are not addressed are marked as "TBD". + +------------------------------------- +Suspend/Resume Implementation Details +------------------------------------- + +PSCI Implementation and Integration +----------------------------------- +vSYSTEM_SUSPEND +--------------- +vSYSTEM_SUSPEND shall be implemented in +* do_psci_system_suspend() in arch/arm/vpsci.c + +The implementation shall include the following steps: +* Block the current vCPU +* If the hardware domain made the call trigger Xen suspend, i.e. + call machine_suspend() which will be implemented in arch/arm/suspend.c + (similar as the machine_restart() is implemented in arch/arm/shutdown.c) + +The function do_psci_system_suspend() shall be called from +* do_trap_psci() in arch/arm/traps.c + +CPU_OFF (physical CPUs) +----------------------- +The CPU_OFF function shall be implemented in +* call_psci_cpu_off() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. + +This function needs to be called when Xen generic code disables non-boot CPUs, +which is done by +* disable_nonboot_cpus() in common/cpu.c +This function calls architecture specific +* __cpu_die() implemented in arch/arm/smpboot.c +The call_psci_cpu_off() shall be invoked when the respective CPU dies. To make +that happen, the +* arch_cpu_die() would be implemented in arch/arm/arm64/smpboot.c +and called from __cpu_die(). +Finally the call_psci_cpu_off() shall be invoked from arch_cpu_die(). + +Such a control flow would be similar to the already existing flow for enabling +non-boot CPUs, which looks like this: +enable_nonboot_cpus() -> cpu_up() -> __cpu_up() -> arch_cpu_up() -> +call_psci_cpu_on() + +SYSTEM_SUSPEND (physical) +------------------------- +The SYSTEM_SUSPEND function shall be implemented in +* call_psci_system_suspend() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. The +entry_point_address argument of the SMC call needs to be an ARM architecture +resume address. The call_psci_system_suspend() function does not return. + +The function needs to be called from machine_suspend() to finalize the suspend +procedure. + +------------------ +Additional Changes +------------------ + +Suspend Flow +------------ +The suspend procedure shall be implemented in +* machine_suspend() in arch/arm/suspend.c + +The implementation shall include the following steps: +* Set the system_state variable to SYS_STATE_suspend +* Freeze domains by calling domain_pause() for each domain (we assume this needs + to be done) +* Disable non-boot CPUs by calling disable_nonboot_cpus() +* Save ARM specific context + +Resume Flow +------------ +The resume procedure shall be implemented in +* machine_resume() in arch/arm/suspend.c + +The machine_resume() implementation shall include the following steps: +* Restore ARM specific context +* Enable non-boot CPUs by calling enable_nonboot_cpus() +* Thaw domains by calling domain_unpause() for each domain (we assume this needs + to be done) +* Set the system_state variable to SYS_STATE_resume +* TBD: how to resume Dom0, i.e. how to hand over control to Dom0? + +========== +References +========== + +[1] Power State Coordination Interface (ARM): +http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf +Signature · 7 lines
2.13.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Stefano,
Thanks for review.
On Tue, Dec 12, 2017 at 12:10 AM, Stefano Stabellini <[email protected]
Quoted 10 lines
wrote:
Quoted 1 line · Mirela Simonovic
This document contains our draft proposal for implementing "suspend to
RAM"
Quoted 1 line
support for ARM in Xen, as discussed during the last Xen ARM community
call.
Quoted 3 lines
It covers the basic suspend to RAM mechanism based on ARM PSCI standard, that would allow individual guests and Xen itself to suspend.
Quoted 9 lines
Quoted 3 lines
We would appreciate your feedback.
Signed-off-by Mirela Simonovic <[email protected]>I am really sorry, for the very late reply. This email fell through the cracks. In general, if I forget about an email, please send a follow up to help me remember :-) Do you have an more up-to-date proposal or is this still the latest?
I've just sent new version, you're cc-ed.
Quoted 6 lines
From an high level, it looks good, only one minor comment: don't call it "hotplug" because usually in the Xen community hotplug means adding more vcpus or removing vcpus at runtime (removing entirely, not suspending).
PSCI-based suspend relies on hotplug mechanism for suspending/resuming non-boot CPUs. I believe we are aligned with the terminology, but if I missed something please let me know.
I have updated the design spec, hope it's better now.
Thanks,
Mirela
Quoted 259 lines
But the approach looks good to me.
Quoted 2 lines
--- docs/misc/arm/suspend-to-ram.txt | 210 +++++++++++++++++++++++++++++++++++++++
Review
Quoted 4 lines
1 file changed, 210 insertions(+) create mode 100644 docs/misc/arm/suspend-to-ram.txt(quoted diff) +0
-0
b/docs/misc/arm/suspend-to-ram.txtdocs/misc/arm/suspend-to-ram.txt line 8
Quoted 13 lines
new file mode 100644
index 0000000000..ec8080fc64docs/misc/arm/suspend-to-ram.txt new file +8
-0@@ -0,0 +1,210 @@ +% Suspend to RAM Support in Xen for ARM +% Revision 1.0 + +======== +Overview +======== + +Suspend to RAM (in the following text 'suspend') for ARM in Xen shouldbe
docs/misc/arm/suspend-to-ram.txt
Quoted 8 lines
docs/misc/arm/suspend-to-ram.txt new file +8
-0+coordinated using ARM PSCI standard [1]. + +EL1/2 should suspend in the following order: +1) Unprivileged guests (DomUs) suspend +2) Privileged guest (Dom0) suspends +3) Xen suspends + +Since this proposal is focused on implementing PSCI-based suspendmechanisms in
docs/misc/arm/suspend-to-ram.txt line 17
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+Xen, communication with or among the guests is not covered by thisdocument.
docs/misc/arm/suspend-to-ram.txt line 18
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+The order of suspending the guests is assumed to be guaranteed by thesoftware
docs/misc/arm/suspend-to-ram.txt
Quoted 12 lines
docs/misc/arm/suspend-to-ram.txt new file +12
-0+running in EL1. + +----------------- +Suspending Guests +----------------- + +Suspend procedure for a guest consists of the following: +1) Suspending devices +2) Suspending non-boot CPUs +3) System suspend, performed by the boot CPU + +Each guest should suspend the devices it owns. Suspending of devices isnot
docs/misc/arm/suspend-to-ram.txt line 31
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+covered by this document. The document covers only mechanisms forsuspending
docs/misc/arm/suspend-to-ram.txt
Quoted 4 lines
docs/misc/arm/suspend-to-ram.txt new file +4
-0+non-boot CPUs, as well as the system suspend. + +Guests should suspend their non-boot vCPUs using the hotplug mechanism. +Virtual CPUs should be put offline using the already implemented PSCI
vCPU_OFFdocs/misc/arm/suspend-to-ram.txt line 36
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+call (prefix 'v' is added to distinguish PSCI calls made by guests toXen, which
docs/misc/arm/suspend-to-ram.txt line 37
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+affect virtual machines; as opposed to PSCI calls made by Xen to theEL3, which
docs/misc/arm/suspend-to-ram.txt
Quoted 3 lines
docs/misc/arm/suspend-to-ram.txt new file +3
-0+can affect power state of the physical machine). + +After suspending its non-boot vCPUs a guest should finalize the suspendby
docs/misc/arm/suspend-to-ram.txt line 41
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+making the vSYSTEM_SUSPEND PSCI call. The resume address is specifiedby the
docs/misc/arm/suspend-to-ram.txt line 42
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+guest via the vSYSTEM_SUSPEND entry_point_address argument. The
vSYSTEM_SUSPENDdocs/misc/arm/suspend-to-ram.txt
Quoted 3 lines
docs/misc/arm/suspend-to-ram.txt new file +3
-0+call is currently not implemented in Xen. + +It is expected that a guest leaves enabled all interrupts that shouldwake it
docs/misc/arm/suspend-to-ram.txt
Quoted 4 lines
docs/misc/arm/suspend-to-ram.txt new file +4
-0+up. Other interrupts should be disabled by the guest prior to calling +vSYSTEM_SUSPEND. + +After an unprivileged guest suspends, Xen will not suspend. Xen wouldsuspend
docs/misc/arm/suspend-to-ram.txt
Quoted 7 lines
docs/misc/arm/suspend-to-ram.txt new file +7
-0+only after the Dom0 completes the system suspend. + +-------------- +Suspending Xen +-------------- + +Xen should start suspending itself upon receiving the vSYSTEM_SUSPENDcall
docs/misc/arm/suspend-to-ram.txt line 57
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+from the last running guest (Dom0). At that moment all physical CPUsare still
docs/misc/arm/suspend-to-ram.txt line 58
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+online (taking offline a vCPU or suspending a VM does not affectphysical CPUs).
docs/misc/arm/suspend-to-ram.txt line 59
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+Xen shall now put offline the non-boot pCPUs by making the CPU_OFF PSCIcall
docs/misc/arm/suspend-to-ram.txt
Quoted 3 lines
docs/misc/arm/suspend-to-ram.txt new file +3
-0+to EL3. The CPU_OFF PSCI function is currently not implemented in Xen. + +After putting offline the non-boot cores Xen must save the context andfinalize
docs/misc/arm/suspend-to-ram.txt line 64
Quoted 2 lines
docs/misc/arm/suspend-to-ram.txt new file +2
-0+suspend by invoking SYSTEM_SUSPEND PSCI call, which is passed to EL3. +The resume point of Xen is specified by the entry_point_addressargument of the
docs/misc/arm/suspend-to-ram.txt line 65
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+SYSTEM_SUSPEND call. The SYSTEM_SUSPEND function and context saving isnot
docs/misc/arm/suspend-to-ram.txt
Quoted 7 lines
docs/misc/arm/suspend-to-ram.txt new file +7
-0+implemented in Xen for ARM today. + +------------ +Resuming Xen +------------ + +Xen must be resumed prior to any software running in EL1. Starting fromthe
docs/misc/arm/suspend-to-ram.txt line 73
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+resume point, Xen should restore the context and resume Dom0. Dom0shall always
docs/misc/arm/suspend-to-ram.txt line 75
Quoted 2 lines
docs/misc/arm/suspend-to-ram.txt new file +2
-0+be resumed whenever Xen resumes. +The whole Xen resume flow for the ARM architecture has to beimplemented.
docs/misc/arm/suspend-to-ram.txt
Quoted 6 lines
docs/misc/arm/suspend-to-ram.txt new file +6
-0+ +--------------- +Resuming Guests +--------------- + +Resume of the privileged guest (Dom0) is always following the Xenresume.
docs/misc/arm/suspend-to-ram.txt line 83
Quoted 2 lines
docs/misc/arm/suspend-to-ram.txt new file +2
-0+ +An unprivileged guest shall resume once a device it owns triggers awake-up
docs/misc/arm/suspend-to-ram.txt line 84
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+interrupt, regardless of whether Xen was suspended when the wake-upinterrupt
docs/misc/arm/suspend-to-ram.txt line 85
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+was triggered. If Xen was suspended, it is assumed that Dom0 will berunning
docs/misc/arm/suspend-to-ram.txt
Quoted 4 lines
docs/misc/arm/suspend-to-ram.txt new file +4
-0+before the DomU guest starts to resume. The synchronization mechanism to +enforce the assumed condition is TBD. + +If the ARM's GIC was powered down after the ARM subsystem suspended, itis
docs/misc/arm/suspend-to-ram.txt line 90
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+assumed that Xen needs to restore the GIC interface for a VM prior tohanding
docs/misc/arm/suspend-to-ram.txt line 91
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+over control to the guest. However, the guest should restore its owncontext
docs/misc/arm/suspend-to-ram.txt
Quoted 11 lines
docs/misc/arm/suspend-to-ram.txt new file +11
-0+upon entering the resume point (out of scope of this document). + +======================= +Implementation Proposal +======================= + +-------- +Overview +-------- + +In order to enable the suspend/resume of VMs and Xen itself, thefollowing PSCI
docs/misc/arm/suspend-to-ram.txt
Quoted 10 lines
docs/misc/arm/suspend-to-ram.txt new file +10
-0+calls have to be implemented and integrated in Xen: +1) vSYSTEM_SUSPEND +2) CPU_OFF +3) SYSTEM_SUSPEND + +In addition, the following have to be implemented: +* Save/restore of EL2 context +* Save/restore of GIC configuration for each VM + +Implementation details are provided in the sections below. Functionnames and
docs/misc/arm/suspend-to-ram.txt line 113
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+paths used below are consistent within the document but may not alwaysmatch the
docs/misc/arm/suspend-to-ram.txt line 114
Quoted 1 line
docs/misc/arm/suspend-to-ram.txt new file +1
-0+names used in future implementation. Existing functions and paths arenamed as
docs/misc/arm/suspend-to-ram.txt
Quoted 3 lines
docs/misc/arm/suspend-to-ram.txt new file +3
-0+in Xen source tree. + +Note: The proposal is still incomplete and shall be refined in futurerevisions.
Quoted 8 lines
docs/misc/arm/suspend-to-ram.txt new file +8
-0+Specific issues that are not addressed are marked as "TBD". + +------------------------------------- +Suspend/Resume Implementation Details +------------------------------------- + +PSCI Implementation and Integration +-----------------------------------docs/misc/arm/suspend-to-ram.txt
Quoted 10 lines
docs/misc/arm/suspend-to-ram.txt new file +10
-0+vSYSTEM_SUSPEND +--------------- +vSYSTEM_SUSPEND shall be implemented in +* do_psci_system_suspend() in arch/arm/vpsci.c + +The implementation shall include the following steps: +* Block the current vCPU +* If the hardware domain made the call trigger Xen suspend, i.e. + call machine_suspend() which will be implemented in arch/arm/suspend.c + (similar as the machine_restart() is implemented in
arch/arm/shutdown.c)docs/misc/arm/suspend-to-ram.txt
Quoted 12 lines
docs/misc/arm/suspend-to-ram.txt new file +12
-0+ +The function do_psci_system_suspend() shall be called from +* do_trap_psci() in arch/arm/traps.c + +CPU_OFF (physical CPUs) +----------------------- +The CPU_OFF function shall be implemented in +* call_psci_cpu_off() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. + +This function needs to be called when Xen generic code disablesnon-boot CPUs,
docs/misc/arm/suspend-to-ram.txt
Quoted 5 lines
docs/misc/arm/suspend-to-ram.txt new file +5
-0+which is done by +* disable_nonboot_cpus() in common/cpu.c +This function calls architecture specific +* __cpu_die() implemented in arch/arm/smpboot.c +The call_psci_cpu_off() shall be invoked when the respective CPU dies.To make
docs/misc/arm/suspend-to-ram.txt
Quoted 6 lines
docs/misc/arm/suspend-to-ram.txt new file +6
-0+that happen, the +* arch_cpu_die() would be implemented in arch/arm/arm64/smpboot.c +and called from __cpu_die(). +Finally the call_psci_cpu_off() shall be invoked from arch_cpu_die(). + +Such a control flow would be similar to the already existing flow forenabling
docs/misc/arm/suspend-to-ram.txt
Quoted 11 lines
docs/misc/arm/suspend-to-ram.txt new file +11
-0+non-boot CPUs, which looks like this: +enable_nonboot_cpus() -> cpu_up() -> __cpu_up() -> arch_cpu_up() -> +call_psci_cpu_on() + +SYSTEM_SUSPEND (physical) +------------------------- +The SYSTEM_SUSPEND function shall be implemented in +* call_psci_system_suspend() in arch/arm/psci.c + +The implementation shall consist just of making the SMC call to EL3. The +entry_point_address argument of the SMC call needs to be an ARMarchitecture
docs/misc/arm/suspend-to-ram.txt
Quoted 3 lines
docs/misc/arm/suspend-to-ram.txt new file +3
-0+resume address. The call_psci_system_suspend() function does not return. + +The function needs to be called from machine_suspend() to finalize thesuspend
Quoted 4 lines
docs/misc/arm/suspend-to-ram.txt new file +4
-0+procedure. + +------------------ +Additional Changesdocs/misc/arm/suspend-to-ram.txt
Quoted 10 lines
docs/misc/arm/suspend-to-ram.txt new file +10
-0+------------------ + +Suspend Flow +------------ +The suspend procedure shall be implemented in +* machine_suspend() in arch/arm/suspend.c + +The implementation shall include the following steps: +* Set the system_state variable to SYS_STATE_suspend +* Freeze domains by calling domain_pause() for each domain (we assumethis needs
docs/misc/arm/suspend-to-ram.txt
Quoted 13 lines
docs/misc/arm/suspend-to-ram.txt new file +13
-0+ to be done) +* Disable non-boot CPUs by calling disable_nonboot_cpus() +* Save ARM specific context + +Resume Flow +------------ +The resume procedure shall be implemented in +* machine_resume() in arch/arm/suspend.c + +The machine_resume() implementation shall include the following steps: +* Restore ARM specific context +* Enable non-boot CPUs by calling enable_nonboot_cpus() +* Thaw domains by calling domain_unpause() for each domain (we assumethis needs
Quoted 22 lines
docs/misc/arm/suspend-to-ram.txt
Quoted 10 lines
docs/misc/arm/suspend-to-ram.txt new file +10
-0+ to be done) +* Set the system_state variable to SYS_STATE_resume +* TBD: how to resume Dom0, i.e. how to hand over control to Dom0? + +========== +References +========== + +[1] Power State Coordination Interface (ARM): +http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf
Quoted 10 lines
docs/misc/arm/suspend-to-ram.txt new file +1
-1+ --2.13.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel