diff --git a/hypervisor/acpi_parser/acpi_ext.c b/hypervisor/acpi_parser/acpi_ext.c index e139101f2..4cda879e4 100644 --- a/hypervisor/acpi_parser/acpi_ext.c +++ b/hypervisor/acpi_parser/acpi_ext.c @@ -34,6 +34,7 @@ #include #include #include +#include #include /* Per ACPI spec: diff --git a/hypervisor/arch/x86/guest/vm_reset.c b/hypervisor/arch/x86/guest/vm_reset.c index ba4929855..936892afd 100644 --- a/hypervisor/arch/x86/guest/vm_reset.c +++ b/hypervisor/arch/x86/guest/vm_reset.c @@ -32,21 +32,13 @@ struct acpi_reset_reg *get_host_reset_reg_data(void) /** * @pre vm != NULL */ -void triple_fault_shutdown_vm(struct acrn_vm *vm) +void triple_fault_shutdown_vm(struct acrn_vcpu *vcpu) { - struct acrn_vcpu *vcpu = vcpu_from_vid(vm, BOOT_CPU_ID); + struct acrn_vm *vm = vcpu->vm; if (is_postlaunched_vm(vm)) { struct io_request *io_req = &vcpu->req; - /* - * Hypervisor sets VM_POWERING_OFF to authenticate that the reboot request is - * actually from the guest itself, not from external entities. (for example acrn-dm) - */ - if (is_rt_vm(vm)) { - vm->state = VM_POWERING_OFF; - } - /* Device model emulates PM1A for post-launched VMs */ io_req->io_type = REQ_PORTIO; io_req->reqs.pio.direction = REQUEST_WRITE; @@ -258,9 +250,6 @@ void register_reset_port_handler(struct acrn_vm *vm) void shutdown_vm_from_idle(uint16_t pcpu_id) { struct acrn_vm *vm = get_vm_from_vmid(per_cpu(shutdown_vm_id, pcpu_id)); - const struct acrn_vcpu *vcpu = vcpu_from_vid(vm, BOOT_CPU_ID); - if (vcpu->pcpu_id == pcpu_id) { - (void)shutdown_vm(vm); - } + (void)shutdown_vm(vm); } diff --git a/hypervisor/arch/x86/guest/vmexit.c b/hypervisor/arch/x86/guest/vmexit.c index a6d209f0c..698430b8b 100644 --- a/hypervisor/arch/x86/guest/vmexit.c +++ b/hypervisor/arch/x86/guest/vmexit.c @@ -255,7 +255,7 @@ static int32_t triple_fault_vmexit_handler(struct acrn_vcpu *vcpu) { pr_fatal("VM%d: triple fault @ guest RIP 0x%016llx, exit qualification: 0x%016llx", vcpu->vm->vm_id, exec_vmread(VMX_GUEST_RIP), exec_vmread(VMX_EXIT_QUALIFICATION)); - triple_fault_shutdown_vm(vcpu->vm); + triple_fault_shutdown_vm(vcpu); return 0; } diff --git a/hypervisor/include/arch/x86/guest/vm_reset.h b/hypervisor/include/arch/x86/guest/vm_reset.h index a10db6668..e0b05a772 100644 --- a/hypervisor/include/arch/x86/guest/vm_reset.h +++ b/hypervisor/include/arch/x86/guest/vm_reset.h @@ -16,7 +16,7 @@ struct acpi_reset_reg { 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); +void triple_fault_shutdown_vm(struct acrn_vcpu *vcpu); struct acpi_reset_reg *get_host_reset_reg_data(void); #endif /* VM_RESET_H_ */