mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 06:29:19 +00:00
hv: vm_event: send event on triple fault handler
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: #8547 Signed-off-by: Wu Zhou <wu.zhou@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
7eb44dbcd3
commit
29b3d03ac7
@ -10,6 +10,7 @@
|
|||||||
#include <logmsg.h>
|
#include <logmsg.h>
|
||||||
#include <asm/per_cpu.h>
|
#include <asm/per_cpu.h>
|
||||||
#include <asm/guest/vm_reset.h>
|
#include <asm/guest/vm_reset.h>
|
||||||
|
#include <vm_event.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pre vm != NULL
|
* @pre vm != NULL
|
||||||
@ -17,6 +18,7 @@
|
|||||||
void triple_fault_shutdown_vm(struct acrn_vcpu *vcpu)
|
void triple_fault_shutdown_vm(struct acrn_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
struct acrn_vm *vm = vcpu->vm;
|
struct acrn_vm *vm = vcpu->vm;
|
||||||
|
struct vm_event trp_event;
|
||||||
|
|
||||||
if (is_postlaunched_vm(vm)) {
|
if (is_postlaunched_vm(vm)) {
|
||||||
struct io_request *io_req = &vcpu->req;
|
struct io_request *io_req = &vcpu->req;
|
||||||
@ -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.size = 2UL;
|
||||||
io_req->reqs.pio_request.value = (VIRTUAL_PM1A_SLP_EN | (5U << 10U));
|
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 */
|
/* Inject pm1a S5 request to Service VM to shut down the guest */
|
||||||
(void)emulate_io(vcpu, io_req);
|
(void)emulate_io(vcpu, io_req);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user