Skip to content

Commit

Permalink
hv: vm_event: send event on triple fault handler
Browse files Browse the repository at this point in the history
In the triple fault handler, post-launched VMs are instantly turned
off. Now a vm event is generated simultaneously. So that
developers can capture the event and decide what to do with it. (e.g.,
logging and populating diagnostics, or poweroff VM)

Tracked-On: projectacrn#8547
Signed-off-by: Wu Zhou <wu.zhou@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
  • Loading branch information
izhouwu committed Jan 19, 2024
1 parent f879d10 commit 8040858
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hypervisor/arch/x86/guest/vm_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
#include <logmsg.h>
#include <asm/per_cpu.h>
#include <asm/guest/vm_reset.h>
#include <vm_event.h>

/**
* @pre vm != NULL
*/
void triple_fault_shutdown_vm(struct acrn_vcpu *vcpu)
{
struct acrn_vm *vm = vcpu->vm;
struct vm_event trp_event;

if (is_postlaunched_vm(vm)) {
struct io_request *io_req = &vcpu->req;
Expand All @@ -28,6 +30,10 @@ void triple_fault_shutdown_vm(struct acrn_vcpu *vcpu)
io_req->reqs.pio_request.size = 2UL;
io_req->reqs.pio_request.value = (VIRTUAL_PM1A_SLP_EN | (5U << 10U));

/* Send the tripple fault event to DM. */
trp_event.type = VM_EVENT_TRIPLE_FAULT;
(void)send_vm_event(vcpu->vm, &trp_event);

/* Inject pm1a S5 request to Service VM to shut down the guest */
(void)emulate_io(vcpu, io_req);
} else {
Expand Down

0 comments on commit 8040858

Please sign in to comment.