Files
acrn-hypervisor/hypervisor/arch/x86/nmi.c
Yifan Liu cf91e66ac0 hv: vcpu: Move vcpu common parts under common/vcpu.h (data structure)
This commit cleans up struct acrn_vcpu. vcpu API cleanup will be in
future patch series.

Create a common vcpu.h hosting struct acrn_vcpu, and move some x86
specific members of struct acrn_vcpu into struct acrn_vcpu_arch. These
members includes:

reg_cached
reg_updated
inst_ctxt

And pending_req is being moved from arch to common.

And the maximum number of events (i.e., VCPU_EVENT_NUM) are being
replaced by MAX_VCPU_EVENT_NUM.

To avoid circular dependency, some in-header helpers are moved into
vcpu.c with only prototypes being declared inside header.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00

25 lines
539 B
C

/*
* Copyright (C) 2018-2022 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <asm/irq.h>
#include <asm/vmx.h>
#include <vcpu.h>
#include <asm/guest/virq.h>
#include <cpu.h>
void handle_nmi(__unused struct intr_excp_ctx *ctx)
{
uint16_t pcpu_id = get_pcpu_id();
struct acrn_vcpu *vcpu = get_running_vcpu(pcpu_id);
/*
* If NMI occurs, inject it into current vcpu. Now just PMI is verified.
* For other kind of NMI, it may need to be checked further.
*/
vcpu_make_request(vcpu, ACRN_REQUEST_NMI);
}