hv: emulate ACPI reset register for Service OS guest

Handle the PIO reset register that is defined in host ACPI:

Parse host FADT table to get the host reset register info, and emulate
it for Service OS:

- return all '1' for guest reads because the read behavior is not defined
  in ACPI.
- ignore guest writes with the reset value to stop it from resetting host;
  if guest writes other values, passthru it to hardware in case the reset
  register supports other functionalities.

Tracked-On: #2700
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Zide Chen
2019-05-08 22:43:10 -07:00
committed by wenlingz
parent 26f08680eb
commit 865ee2956e
7 changed files with 93 additions and 1 deletions

View File

@@ -48,4 +48,9 @@
#define S5_PKG_VAL_PM1B 0U
#define S5_PKG_RESERVED 0U
/* reset register */
#define RESET_REGISTER_BIT_WIDTH 0x08U
#define RESET_REGISTER_BIT_OFFSET 0U
#define RESET_REGISTER_ACCESS_SIZE 0x01U
#endif /* DEFAULT_ACPI_INFO_H */

View File

@@ -7,8 +7,16 @@
#ifndef VM_RESET_H_
#define VM_RESET_H_
#include <acrn_common.h>
struct acpi_reset_reg {
struct acpi_generic_address reg;
uint8_t val;
};
void register_reset_port_handler(struct acrn_vm *vm);
void shutdown_vm_from_idle(uint16_t pcpu_id);
void triple_fault_shutdown_vm(struct acrn_vm *vm);
struct acpi_reset_reg *get_host_reset_reg_data(void);
#endif /* VM_RESET_H_ */

View File

@@ -26,7 +26,8 @@
#define VIRTUAL_PM1A_CNT_PIO_IDX (RTC_PIO_IDX + 1U)
#define KB_PIO_IDX (VIRTUAL_PM1A_CNT_PIO_IDX + 1U)
#define CF9_PIO_IDX (KB_PIO_IDX + 1U)
#define EMUL_PIO_IDX_MAX (CF9_PIO_IDX + 1U)
#define PIO_RESET_REG_IDX (CF9_PIO_IDX + 1U)
#define EMUL_PIO_IDX_MAX (PIO_RESET_REG_IDX + 1U)
/**
* @brief The handler of VM exits on I/O instructions