hv: add GUEST_FLAG_STATELESS flag

GUEST_FLAG_STATELESS indicates guest is running a stateless operating
system and need to be shutdown forcefully without data loss. This flag
is only appalicable to pre-launched VM. For TEE_VM, this flag will be
set implicitly.

Tracked-On: #8671
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Jiaqing Zhao
2024-07-11 07:31:43 +00:00
committed by acrnsi-robot
parent c4ea248bc9
commit 2dc56a8f23
4 changed files with 9 additions and 4 deletions

View File

@@ -177,10 +177,8 @@ bool is_stateful_vm(const struct acrn_vm *vm)
{
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
/* TEE VM doesn't has its own state. The TAs will do the content
* flush by themselves, HV and OS doesn't need to care about the state.
*/
return ((vm_config->guest_flags & GUEST_FLAG_TEE) == 0U);
/* TEE VM has GUEST_FLAG_STATELESS set implicitly */
return ((vm_config->guest_flags & GUEST_FLAG_STATELESS) == 0U);
}
/**

View File

@@ -65,6 +65,7 @@
#define GUEST_FLAG_PMU_PASSTHROUGH (1UL << 11U) /* Whether PMU is passed through */
#define GUEST_FLAG_VHWP (1UL << 12U) /* Whether the VM supports vHWP */
#define GUEST_FLAG_VTM (1UL << 13U) /* Whether the VM supports virtual thermal monitor */
#define GUEST_FLAG_STATELESS (1UL << 14U) /* Whether the VM is stateless (can be forcefully shutdown with no data loss) */
/* TODO: We may need to get this addr from guest ACPI instead of hardcode here */
#define VIRTUAL_SLEEP_CTL_ADDR 0x400U /* Pre-launched VM uses ACPI reduced HW mode and sleep control register */