mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-25 11:19:32 +00:00
hv:move 'fire_vhm_interrupt' to io_emul.c
-- this api is related with arch_x86, then move to x86 folder -- rename 'set_vhm_vector' to 'set_vhm_notification_vector' -- rename 'acrn_vhm_vector' to 'acrn_vhm_notification_vector' -- add an API 'get_vhm_notification_vector' Tracked-On: #1842 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
e7605fad7d
commit
35c8437bbc
@ -22,6 +22,21 @@
|
|||||||
#define MMIO_DEFAULT_VALUE_SIZE_4 (0xFFFFFFFFUL)
|
#define MMIO_DEFAULT_VALUE_SIZE_4 (0xFFFFFFFFUL)
|
||||||
#define MMIO_DEFAULT_VALUE_SIZE_8 (0xFFFFFFFFFFFFFFFFUL)
|
#define MMIO_DEFAULT_VALUE_SIZE_8 (0xFFFFFFFFFFFFFFFFUL)
|
||||||
|
|
||||||
|
void arch_fire_vhm_interrupt(void)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* use vLAPIC to inject vector to SOS vcpu 0 if vlapic is enabled
|
||||||
|
* otherwise, send IPI hardcoded to BOOT_CPU_ID
|
||||||
|
*/
|
||||||
|
struct acrn_vm *sos_vm;
|
||||||
|
struct acrn_vcpu *vcpu;
|
||||||
|
|
||||||
|
sos_vm = get_sos_vm();
|
||||||
|
vcpu = vcpu_from_vid(sos_vm, BOOT_CPU_ID);
|
||||||
|
|
||||||
|
vlapic_set_intr(vcpu, get_vhm_notification_vector(), LAPIC_TRIG_EDGE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief General complete-work for port I/O emulation
|
* @brief General complete-work for port I/O emulation
|
||||||
*
|
*
|
||||||
|
@ -1215,7 +1215,7 @@ int32_t hcall_set_callback_vector(const struct acrn_vm *vm, uint64_t param)
|
|||||||
pr_err("%s: Invalid passed vector\n");
|
pr_err("%s: Invalid passed vector\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
set_vhm_vector((uint32_t)param);
|
set_vhm_notification_vector((uint32_t)param);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,22 +11,7 @@
|
|||||||
|
|
||||||
#define ACRN_DBG_IOREQUEST 6U
|
#define ACRN_DBG_IOREQUEST 6U
|
||||||
|
|
||||||
static uint32_t acrn_vhm_vector = VECTOR_HYPERVISOR_CALLBACK_VHM;
|
static uint32_t acrn_vhm_notification_vector = VECTOR_HYPERVISOR_CALLBACK_VHM;
|
||||||
|
|
||||||
static void fire_vhm_interrupt(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* use vLAPIC to inject vector to SOS vcpu 0 if vlapic is enabled
|
|
||||||
* otherwise, send IPI hardcoded to BOOT_CPU_ID
|
|
||||||
*/
|
|
||||||
struct acrn_vm *sos_vm;
|
|
||||||
struct acrn_vcpu *vcpu;
|
|
||||||
|
|
||||||
sos_vm = get_sos_vm();
|
|
||||||
vcpu = vcpu_from_vid(sos_vm, BOOT_CPU_ID);
|
|
||||||
|
|
||||||
vlapic_set_intr(vcpu, acrn_vhm_vector, LAPIC_TRIG_EDGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HV_DEBUG)
|
#if defined(HV_DEBUG)
|
||||||
static void acrn_print_request(uint16_t vcpu_id, const struct vhm_request *req)
|
static void acrn_print_request(uint16_t vcpu_id, const struct vhm_request *req)
|
||||||
@ -137,7 +122,7 @@ int32_t acrn_insert_request(struct acrn_vcpu *vcpu, const struct io_request *io_
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* signal VHM */
|
/* signal VHM */
|
||||||
fire_vhm_interrupt();
|
arch_fire_vhm_interrupt();
|
||||||
|
|
||||||
/* Polling completion of the request in polling mode */
|
/* Polling completion of the request in polling mode */
|
||||||
if (is_polling) {
|
if (is_polling) {
|
||||||
@ -199,7 +184,12 @@ void set_vhm_req_state(struct acrn_vm *vm, uint16_t vhm_req_id, uint32_t state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_vhm_vector(uint32_t vector)
|
void set_vhm_notification_vector(uint32_t vector)
|
||||||
{
|
{
|
||||||
acrn_vhm_vector = vector;
|
acrn_vhm_notification_vector = vector;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t get_vhm_notification_vector(void)
|
||||||
|
{
|
||||||
|
return acrn_vhm_notification_vector;
|
||||||
}
|
}
|
||||||
|
@ -97,4 +97,12 @@ void register_pio_default_emulation_handler(struct acrn_vm *vm);
|
|||||||
* @param vm The VM to which the MMIO handler is registered
|
* @param vm The VM to which the MMIO handler is registered
|
||||||
*/
|
*/
|
||||||
void register_mmio_default_emulation_handler(struct acrn_vm *vm);
|
void register_mmio_default_emulation_handler(struct acrn_vm *vm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fire VHM interrupt to SOS
|
||||||
|
*
|
||||||
|
* @return None
|
||||||
|
*/
|
||||||
|
void arch_fire_vhm_interrupt(void);
|
||||||
|
|
||||||
#endif /* IO_EMUL_H */
|
#endif /* IO_EMUL_H */
|
||||||
|
@ -211,8 +211,14 @@ void set_vhm_req_state(struct acrn_vm *vm, uint16_t vhm_req_id, uint32_t state);
|
|||||||
* @param vector vector for HV callback VHM
|
* @param vector vector for HV callback VHM
|
||||||
* @return None
|
* @return None
|
||||||
*/
|
*/
|
||||||
void set_vhm_vector(uint32_t vector);
|
void set_vhm_notification_vector(uint32_t vector);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the vector for HV callback VHM
|
||||||
|
*
|
||||||
|
* @return vector for HV callbakc VH
|
||||||
|
*/
|
||||||
|
uint32_t get_vhm_notification_vector(void);
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user