acrn-hypervisor/hypervisor/include/arch/x86
Kaige Fu 83d11bbff8 HV: Register S5 pio handler for dm-launched RTVM
The virtual pm port of RTVM is intercepted by HV. But the HV needs to inform the DM as well.
So we will forward the virtual S5 request to DM too

The handler in HV just set the pm state flag (VM_POWERING_OFF) which indicate that the RTVM is powering
off by itself. Meanwhile, there are data resources in VHM and DM should be released once we handle the PM
of RTVM in HV. So, return to DM to go through the entire VM destroy cycles to release the resources.
During the cycles, the DM will try to pause vm through hypercall. In the hypercall handler in HV, we will
check the pm state flag. If it is set, pause all the vCPUs of the vm. Otherwise, reject the request.

In this way, we can make sure that RTVM can only trigger its s5 by itself. All
other S5 request from external will be rejected.

Here is sequence chart of RTVM s5.

   poweroff
+-----------+              +----------+           +-----------+         +----------+
|    vBSP   |              |    vAPs  |           |    HV     |         |    DM    |
+-----+-----+              +----------+           +-----+-----+         +-----+----+
      |                         |                       |                     |
      |   Stop all other cpus   |                       |                     |
      +----------------------------+                    |                     |
      |                         |  |Disable LAPIC       |                     |
      |                         +<-+                    |                     |
      |                         |                       |                     |
      |                         +--+                    |                     |
      |                         |  |HLT in              |                     |
      | All other cpus stopped  |  |non-root mode       |                     |
      +----------------------------+                    |                     |
      |     Call ACPI method to enter s5                |                     |
      +-------------------------+---------------------> |                     |
      |                         |   Set s5 flag         |                     |
      |                         | <---------------------+                     |
      |                         |   APs paused          | Re-inject IOREQ TO DM
      |                         | +-------------------> +-------------------> +
      |                         |                       |   Pause VM          |
      |                         |   Check S5 flag:      | <-------------------+
      |                         |    - If set, pause vm |  VM paused          |
      |                         |    - If no, reject    | +-----------------> +--+
      |                         |                       |  Destroy VM         |  |Deinit works
      |                         |                       | <--------------------<-+
      |                         |                       |  VM destroyed       |
      |                         |                       | +-----------------> |
      +                         +                       +                     +

Tracked-On: #2865
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
2019-03-29 16:17:44 +08:00
..
boot hv:Move severl variable declaration for boot code 2019-01-25 21:32:21 +08:00
guest HV: Register S5 pio handler for dm-launched RTVM 2019-03-29 16:17:44 +08:00
apicreg.h hv: Use Interrupt Remapping format for programming interrupt sources 2019-02-01 15:54:55 +08:00
board.h hv: remove CONFIG_PARTITION_MODE for pre-launched VM vE820 creation 2019-03-19 14:28:43 +08:00
cat.h HV: CAT: support config CAT from acrn_vm_config 2019-02-28 11:22:29 +08:00
cpu_caps.h hv: vlapic: add combined constraint for APICv 2019-03-12 20:37:06 +08:00
cpu.h hv: disable mpx capability for guest 2019-03-20 13:07:31 +08:00
cpufeatures.h HV: CAT: capability enumaration 2019-02-28 11:22:29 +08:00
cpuid.h hv: disable mpx capability for guest 2019-03-20 13:07:31 +08:00
default_acpi_info.h HV: refine location of platform_acpi_info header 2019-03-08 10:34:14 +08:00
e820.h hv: remove CONFIG_PARTITION_MODE for pre-launched VM vE820 creation 2019-03-19 14:28:43 +08:00
gdt.h hv: coding style: remove no real declaration for external variable 2018-12-20 20:20:08 +08:00
host_pm.h hv:Move pm state structure to pm.h 2019-01-07 11:23:22 +08:00
hv_arch.h HV: Modularize vtd.c to remove acrn_vm usage 2019-02-06 08:53:46 +08:00
idt.h hv:cleanup header files for arch folder 2019-02-22 13:14:36 +08:00
init.h hv: init: minor fix related to header file 2019-01-11 21:53:09 +08:00
io_req.h HV: HV: make io_read_fn_t return true or false 2019-03-29 16:17:44 +08:00
io.h hv:modulization for IO Emulation 2019-01-21 13:49:54 +08:00
ioapic.h hv:cleanup header files for arch folder 2019-02-22 13:14:36 +08:00
irq.h hv:cleanup header file for guest folder 2019-02-21 10:38:30 +08:00
lapic.h hv:cleanup header file for guest folder 2019-02-21 10:38:30 +08:00
mmu.h hv: pae: fix bug when calculate PDPT address 2019-02-21 18:54:22 +08:00
msr.h HV: CAT: add platform specified info for CLOS 2019-02-28 11:22:29 +08:00
multiboot.h HV: Remove hypervisor.h from bsp folder 2019-03-25 11:13:57 +08:00
page.h hv: add support of EPT mapping of high MMIO 2019-02-28 18:33:11 +08:00
per_cpu.h hv:move instr_emul_ctxt instance to struct vcpu 2019-03-13 14:04:20 +08:00
pgtable.h hv:cleanup header file for guest folder 2019-02-21 10:38:30 +08:00
security.h Make ibrs_type as internal variable 2018-12-19 09:07:14 +08:00
seed.h hv: seed: refine header file 2019-03-15 14:09:56 +08:00
timer.h hv:move 'udelay' to timer.c 2019-03-22 08:38:13 +08:00
trampoline.h hv:Move severl variable declaration for boot code 2019-01-25 21:32:21 +08:00
vm_config.h HV: move MAX_CONFIG_NAME_SIZE to acrn_common.h 2019-03-26 21:23:16 +08:00
vmx.h hv: rename MACROs 'VMX_CRx_MASK" 2019-02-01 16:49:39 +08:00
vtd.h hv: Use domain/device specific invalidation for DMAR translation caches 2019-03-20 09:13:07 +08:00
zeropage.h hv: minimize the case of "identifier reuse" 2018-12-07 15:21:39 +08:00