mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 00:38:28 +00:00
hv: add ops to vlapic structure
This commit adds ops to vlapic structure, and add an *ops parameter to vlapic_reset(). At vlapic reset, the ops is set to the global apicv_ops, and may be assigned to other ops later. Tracked-On: #3227 Signed-off-by: Yan, Like <like.yan@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
#include <timer.h>
|
||||
#include <apicreg.h>
|
||||
|
||||
|
||||
/**
|
||||
* @file vlapic.h
|
||||
*
|
||||
@@ -85,6 +84,8 @@ struct acrn_vlapic {
|
||||
|
||||
uint64_t msr_apicbase;
|
||||
|
||||
const struct acrn_apicv_ops *ops;
|
||||
|
||||
/*
|
||||
* Copies of some registers in the virtual APIC page. We do this for
|
||||
* a couple of different reasons:
|
||||
@@ -95,6 +96,17 @@ struct acrn_vlapic {
|
||||
uint32_t lvt_last[VLAPIC_MAXLVT_INDEX + 1];
|
||||
} __aligned(PAGE_SIZE);
|
||||
|
||||
struct acrn_apicv_ops {
|
||||
void (*accept_intr)(struct acrn_vlapic *vlapic, uint32_t vector, bool level);
|
||||
bool (*inject_intr)(struct acrn_vlapic *vlapic, bool guest_irq_enabled, bool injected);
|
||||
bool (*has_pending_delivery_intr)(struct acrn_vcpu *vcpu);
|
||||
bool (*apic_read_access_may_valid)(uint32_t offset);
|
||||
bool (*apic_write_access_may_valid)(uint32_t offset);
|
||||
bool (*x2apic_read_msr_may_valid)(uint32_t offset);
|
||||
bool (*x2apic_write_msr_may_valid)(uint32_t offset);
|
||||
};
|
||||
|
||||
extern const struct acrn_apicv_ops *apicv_ops;
|
||||
void vlapic_set_apicv_ops(void);
|
||||
|
||||
/**
|
||||
@@ -182,7 +194,7 @@ void vlapic_free(struct acrn_vcpu *vcpu);
|
||||
* @pre vlapic->vcpu->vcpu_id < CONFIG_MAX_VCPUS_PER_VM
|
||||
*/
|
||||
void vlapic_init(struct acrn_vlapic *vlapic);
|
||||
void vlapic_reset(struct acrn_vlapic *vlapic);
|
||||
void vlapic_reset(struct acrn_vlapic *vlapic, const struct acrn_apicv_ops *ops);
|
||||
void vlapic_restore(struct acrn_vlapic *vlapic, const struct lapic_regs *regs);
|
||||
uint64_t vlapic_apicv_get_apic_access_addr(void);
|
||||
uint64_t vlapic_apicv_get_apic_page_addr(struct acrn_vlapic *vlapic);
|
||||
|
Reference in New Issue
Block a user