2019-11-04 17:53:09 +08:00
|
|
|
.. _enable-s5:
|
|
|
|
|
|
|
|
Enable S5
|
2022-09-23 03:13:44 +08:00
|
|
|
#########
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
About System S5 Support
|
|
|
|
***********************
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
S5 refers to the ACPI “soft off” system state. ACRN system S5 support enables
|
|
|
|
you to gracefully shut down or reset the whole system when multiple VMs are
|
|
|
|
running. This is done by requesting and waiting for all pre-launched and
|
|
|
|
post-launched VMs to gracefully shut themselves down before the Service VM
|
|
|
|
triggers a system-wide shutdown or reset.
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
We recommend using ACRN system S5 support to shut down or reset a system unless
|
|
|
|
you have other mechanisms in place to protect external storage from being
|
|
|
|
corrupted by a mechanical off.
|
2021-11-10 10:39:33 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
Dependencies and Constraints
|
|
|
|
****************************
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
Consider the following dependencies and constraints:
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
* ACRN system S5 support is hardware neutral but requires the deployment of a
|
|
|
|
daemon (named Lifecycle Manager) in all VMs. The Lifecycle Manager manages
|
|
|
|
power state transitions.
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
* The COM2 port is reserved for the Lifecycle Manager to communicate requests
|
|
|
|
and responses. Console vUARTs and inter-VM UART connections should avoid using
|
|
|
|
COM2 as an interface.
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
* The S5 feature needs a communication vUART to control a User VM. However, you
|
|
|
|
don't need to configure a vUART connection for S5 via the ACRN Configurator,
|
|
|
|
because ACRN code already has a vUART connection between the Service VM and
|
|
|
|
User VMs by default.
|
2021-11-10 10:39:33 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
Example Configuration
|
|
|
|
*********************
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
The following steps show how to enable S5 by extending the information provided
|
|
|
|
in the :ref:`gsg`. The scenario has a Service VM and one Ubuntu post-launched
|
|
|
|
User VM.
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
#. On the development computer, build the Lifecycle Manager daemon::
|
2021-11-10 10:39:33 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
cd acrn-hypervisor
|
|
|
|
make life_mngr
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
The build generates files in the ``build/misc/services/life_mngr`` directory.
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
#. Copy ``life_mngr.conf``, ``s5_trigger_linux.py``, ``life_mngr``, and
|
|
|
|
``life_mngr.service`` into the Service VM and User VM.
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
These commands assume you have a network connection between the development
|
|
|
|
computer and target system. You can also use a USB stick to transfer files.
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
.. code-block:: bash
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
scp build/misc/services/s5_trigger_linux.py acrn@<target board address>:~/
|
|
|
|
scp build/misc/services/life_mngr acrn@<target board address>:~/
|
|
|
|
scp build/misc/services/life_mngr.service acrn@<target board address>:~/
|
|
|
|
scp build/misc/services/life_mngr.conf acrn@<target board address>:~/
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
Log in to the target system and run the following commands::
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
sudo mkdir /etc/life_mngr
|
|
|
|
sudo mv ~/life_mngr.conf /etc/life_mngr/
|
|
|
|
sudo mv ~/life_mngr.service /lib/systemd/system/
|
|
|
|
sudo mv ~/life_mngr /usr/bin/
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
#. Copy ``user_vm_shutdown.py`` from the development computer into the Service
|
|
|
|
VM::
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
scp misc/services/life_mngr/user_vm_shutdown.py acrn@<target board address>:~/
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
#. ACRN code sets the COM2 (``/dev/ttyS1``) as the default communication port of
|
|
|
|
the User VM, so we need only check the S5 vUART of the Service VM. Use the
|
|
|
|
following steps to get the Service VM S5 connection information.
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
Log in to the Service VM and run the command ``cat /etc/serial.conf`` to get
|
|
|
|
the connection information between the Service VM and User VM. Output
|
|
|
|
example:
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
.. code-block:: console
|
2022-01-08 03:31:49 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
# User_VM_id: 1
|
|
|
|
/dev/ttyS8 port 0X9008 irq 0 uart 16550A baud_base 115200
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
This example means the Service VM uses the ``/dev/ttyS8`` connection to the
|
|
|
|
User VM's ``/dev/ttyS1``.
|
2019-11-11 23:27:13 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
#. Configure the S5 feature:
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
a. In the Service VM, edit the following options in
|
|
|
|
``/etc/life_mngr/life_mngr.conf``. Make sure ``VM_NAME`` is the Service VM
|
|
|
|
name specified in the ACRN Configurator. Replace ``/dev/ttyS8`` with your
|
|
|
|
Service VM's S5 vUART, if it was different from the example in the
|
|
|
|
previous step.
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
.. code-block:: bash
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
VM_TYPE=service_vm
|
|
|
|
VM_NAME= ACRN_Service_VM
|
|
|
|
DEV_NAME=tty:/dev/ttyS8
|
|
|
|
ALLOW_TRIGGER_S5=/dev/ttySn
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
#. In the User VM, edit the following options in
|
|
|
|
``/etc/life_mngr/life_mngr.conf``. Replace ``<User VM name>`` with the
|
|
|
|
VM name specified in the ACRN Configurator.
|
2021-11-10 10:39:33 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
.. code-block:: bash
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
VM_TYPE=user_vm
|
|
|
|
VM_NAME=<User VM name>
|
|
|
|
DEV_NAME=tty:/dev/ttyS1
|
|
|
|
ALLOW_TRIGGER_S5=/dev/ttySn
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
#. Enable ``life_mngr.service`` and restart the Service VM and User VM::
|
2019-11-04 17:53:09 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
sudo chmod +x /usr/bin/life_mngr
|
|
|
|
sudo systemctl enable life_mngr.service
|
|
|
|
sudo reboot
|
2022-01-08 03:31:49 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
#. To trigger a system S5, run ``s5_trigger_linux.py`` in the Service VM.
|
|
|
|
The Service VM shuts down (transitioning to the S5 state) and sends a
|
|
|
|
poweroff request to shut down the User VM.
|
2022-01-08 03:31:49 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
.. note::
|
2022-01-08 03:31:49 +08:00
|
|
|
|
2022-09-23 03:13:44 +08:00
|
|
|
The S5 state is not automatically triggered by a Service VM shutdown; you
|
|
|
|
need to run ``s5_trigger_linux.py`` in the Service VM.
|