Skip to content

Commit 625a6aa

Browse files
fyin1wenlingz
authored andcommitted
Doc: Update system power management doc
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
1 parent 383d53b commit 625a6aa

File tree

3 files changed

+75
-61
lines changed

3 files changed

+75
-61
lines changed

doc/developer-guides/hld/hld-power-management.rst

Lines changed: 75 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ CPU P-state/C-state are controlled by the guest OS. The ACPI
1313
P/C-state driver relies on some P/C-state-related ACPI data in the guest
1414
ACPI table.
1515

16-
SOS could run ACPI driver with no problem because it can access native
17-
the ACPI table. For UOS though, we need to prepare the corresponding ACPI data
16+
Service VM could run ACPI driver with no problem because it can access native
17+
the ACPI table. For User VM though, we need to prepare the corresponding ACPI data
1818
for Device Model to build virtual ACPI table.
1919

2020
The Px/Cx data includes four
@@ -59,7 +59,7 @@ Virtual ACPI table build flow
5959
=============================
6060

6161
:numref:`vACPItable` shows how to build virtual ACPI table with
62-
Px/Cx data for UOS P/C-state management:
62+
Px/Cx data for User VM P/C-state management:
6363

6464
.. figure:: images/hld-pm-image28.png
6565
:align: center
@@ -68,16 +68,16 @@ Px/Cx data for UOS P/C-state management:
6868
System block for building vACPI table with Px/Cx data
6969

7070
Some ioctl APIs are defined for Device model to query Px/Cx data from
71-
SOS VHM. The Hypervisor needs to provide hypercall APIs to transit Px/Cx
72-
data from CPU state table to SOS VHM.
71+
Service VM VHM. The Hypervisor needs to provide hypercall APIs to transit
72+
Px/Cx data from CPU state table to Service VM VHM.
7373

7474
The build flow is:
7575

7676
1) Use offline tool (e.g. **iasl**) to parse the Px/Cx data and hard-code to
7777
CPU state table in Hypervisor. Hypervisor loads the data after
7878
system boot up.
79-
2) Before UOS launching, Device mode queries the Px/Cx data from SOS VHM
80-
via ioctl interface.
79+
2) Before User VM launching, Device mode queries the Px/Cx data from Service
80+
VM VHM via ioctl interface.
8181
3) VHM transmits the query request to Hypervisor by hypercall.
8282
4) Hypervisor returns the Px/Cx data.
8383
5) Device model builds the virtual ACPI table with these Px/Cx data
@@ -103,77 +103,91 @@ impact both power and performance.
103103

104104
S3/S5
105105
*****
106+
ACRN is designed to support the system level S3/S5 with following
107+
assumptions:
108+
109+
1) Guest has complete S3/S5 power state management.
110+
2) Guest follows the ACPI standard to implement S3/S5.
111+
3) Guest is responsible for saving its contents before entering S3/S5.
112+
4) Highest severity guest's power state is promoted to system power state.
113+
5) Guest has lifecycle manager running to handle power state transaction
114+
requirement and initialize guest power state transaction.
115+
6) S3 is only available on configurations which has no DM launched RTVM.
116+
7) S3 is only supported at platform level - not VM level.
117+
118+
ACRN has a common implementation for notification between lifecycle manager
119+
in different guest. Which is vUART based cross-vm notification. But user
120+
could customize it according to their hardware/software requirements.
121+
122+
:numref:`systempmdiag` shows the basic system level S3/S5 diagram
123+
124+
.. figure:: images/hld-pm-image62.png
125+
:align: center
126+
:name: systempmdiag
127+
128+
ACRN System S3/S5 diagram
106129

107-
ACRN assumes guest has complete S3/S5 power state management and follows
108-
the ACPI standard exactly. System S3/S5 needs to follow well-defined
109-
enter/exit paths and cooperate among different components.
110130

111131
System low power state enter process
112132
====================================
113133

114-
Each time, when OSPM of UOS starts power state transition, it will
115-
finally write the ACPI register per ACPI spec requirement.
116-
With help of ACRN I/O emulation framework, the UOS ACPI
117-
register writing will be dispatched to Device Model and Device Model
118-
will emulate the UOS power state (pause UOS VM for S3 and power off UOS
119-
VM for S5)
120-
121-
The VM Manager monitors all UOS. If all active UOSes are in required power
122-
state, VM Manager will notify OSPM of SOS to start SOS power state
123-
transition. OSPM of SOS follows a very similar process as UOS for power
124-
state transition. The difference is SOS ACPI register writing is trapped
125-
to ACRN HV. And ACRN HV will emulate SOS power state (pause SOS VM for
126-
S3 and no special action for S5)
127-
128-
Once SOS low power state is done, ACRN HV will go through its own low
134+
Each time, when lifecycle manager of User VM starts power state transition,
135+
it will finally write the ACPI register per ACPI spec requirement. With
136+
help of ACRN I/O emulation framework, the User VM ACPI register writing
137+
will be dispatched to Device Model and Device Model will emulate the User VM
138+
power state (pause User VM for S3 and power off User VM for S5)
139+
140+
The VM Manager monitors all User VMs. If all active User VMs are in required
141+
power state, VM Manager will notify lifecyle manager of Service VM to start
142+
Service VM power state transition. lifecycle manager of Service VM follows
143+
a very similar process as User VM for power state transition. The difference
144+
is Service VM ACPI register writing is trapped to ACRN HV. And ACRN HV will
145+
emulate Service VM power state (pause Service VM for S3 and no special
146+
action for S5)
147+
148+
Once Service VM low power state is done, ACRN HV will go through its own low
129149
power state enter path.
130150

131151
The whole system is finally put into low power state.
132152

133-
System low power state exit process
134-
===================================
153+
:numref:`pmworkflow` shows the flow of low power S5 enter process
154+
with typical ISD configuration(S3 follows very similar process)
135155

136-
The low power state exit process is in reverse order. The ACRN
137-
hypervisor is woken up at first. It will go through its own low power
138-
state exit path. Then ACRN hypervisor will resume the SOS to let SOS go
139-
through SOS low power state exit path. After that, the DM is resumed and
140-
let UOS go through UOS low power state exit path. The system is resumed
141-
to running state after at least one UOS is resumed to running state.
142-
143-
:numref:`pmworkflow` shows the flow of low power S3 enter/exit process (S5 follows
144-
very similar process)
145-
146-
.. figure:: images/hld-pm-image62.png
156+
.. figure:: images/hld-pm-image63.png
147157
:align: center
148158
:name: pmworkflow
149159

150-
ACRN system power management workflow
160+
ACRN system S5 enter workflow
151161

152162
For system power state entry:
153163

154-
1. UOS OSPM start UOS S3 entry
155-
2. The UOS S3 entering request is trapped ACPI PM Device of DM
156-
3. DM pauses UOS VM to emulate UOS S3 and notifies VM Manager that the UOS
157-
dedicated to it is in S3
158-
4. If all UOSes are in S3, VM Manager will notify OSPM of SOS
159-
5. SOS OSPM starts SOS S3 enter
160-
6. SOS S3 entering request is trapped to Sx Agency in ACRN HV
161-
7. ACRN HV pauses SOS VM to emulate SOS S3 and starts ACRN HV S3 entry.
162-
163-
For system power state exit:
164-
165-
1. When system is resumed from S3, native bootloader will jump to wake
166-
up vector of HV
167-
2. HV resumes S3 and jumps to wake up vector to emulate SOS resume from S3
168-
3. OSPM of SOS is running
169-
4. OSPM of SOS notifies VM Manager that it's ready to wake up UOS
170-
5. VM Manager will notify DM to resume the UOS
171-
6. DM resets the UOS VM to emulate UOS resume from S3
164+
1. Service VM received S5 request.
165+
2. Lifecycle manager in Service VM notify User VM1 and RTVM through
166+
vUART for S5 request.
167+
3. Guest lifecycle manager initliaze S5 action. And guest enter S5.
168+
4. RTOS cleanup rt task, send response of S5 request back to Service
169+
VM and RTVM enter S5.
170+
5. After get response from RTVM and all User VM are shutdown, Sevice VM
171+
enter S5.
172+
6. OSPM in ACRN hypervisor check all guest in S5 state and shutdown
173+
whole system.
174+
175+
System low power state exit process
176+
===================================
177+
178+
The low power state exit process is in reverse order. The ACRN
179+
hypervisor is woken up at first. It will go through its own low power
180+
state exit path. Then ACRN hypervisor will resume the Service VM to let
181+
Service VM go through Service VM low power state exit path. After that,
182+
the DM is resumed and let User VM go through User VM low power state exit
183+
path. The system is resumed to running state after at least one User VM
184+
is resumed to running state.
185+
172186

173187
According to ACPI standard, S3 is mapped to suspend to RAM and S5 is
174188
mapped to shutdown. So the S5 process is a little different:
175189

176-
- UOS enters S3 -> UOS powers off
177-
- System enters S3 -> System powers off
178-
- System resumes From S3 -> System fresh start
179-
- UOS resumes from S3 -> UOS fresh startup
190+
- User VM enters S5 -> User VM powers off
191+
- System enters S5 -> System powers off
192+
- System resumes From S5 -> System fresh start
193+
- User VM resumes from S5 -> User VM fresh startup
52.4 KB
Loading
64 KB
Loading

0 commit comments

Comments
 (0)