dm: pm: add s3 support for an ovmf-booted User VM

For ovmf-booted User VM, we should set CMOS shutdown status register
(index 0xF) as S3_resume(0xFE). So ovmf will read it and start S3 resume
at POST entry.

And ovmf will read waking vector from FACS table and transfer control to
guest.

Tracked-On: #8624
Signed-off-by: Haiwei Li <haiwei.li@intel.com>
This commit is contained in:
Haiwei Li
2024-06-21 09:31:53 +08:00
committed by acrnsi-robot
parent c42b45e9a3
commit 374ad1c9ed
5 changed files with 18 additions and 1 deletions

View File

@@ -102,6 +102,7 @@ bool vtpm2;
bool is_winvm;
bool skip_pci_mem64bar_workaround = false;
bool gfx_ui = false;
bool ovmf_loaded = false;
static int guest_ncpus;
static int virtio_msix = 1;
@@ -752,6 +753,8 @@ vm_suspend_resume(struct vmctx *ctx)
* 6. hypercall restart vm
*/
vm_pause(ctx);
if (ovmf_loaded)
vrtc_suspend(ctx);
vm_clear_ioreq(ctx);
vm_stop_watchdog(ctx);
@@ -1016,6 +1019,7 @@ main(int argc, char *argv[])
case CMD_OPT_OVMF:
if (!vsbl_file_name && acrn_parse_ovmf(optarg) != 0)
errx(EX_USAGE, "invalid ovmf param %s", optarg);
ovmf_loaded = true;
skip_pci_mem64bar_workaround = true;
break;
case CMD_OPT_IASL:

View File

@@ -297,7 +297,7 @@ acrn_sw_load(struct vmctx *ctx)
{
if (vsbl_file_name)
return acrn_sw_load_vsbl(ctx);
else if ((ovmf_file_name != NULL) ^ (ovmf_code_file_name && ovmf_vars_file_name))
else if (ovmf_loaded)
return acrn_sw_load_ovmf(ctx);
else if (kernel_file_name)
return acrn_sw_load_bzimage(ctx);