mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-05 03:26:29 +00:00
replace pending_intr with pending_req
the pending_intr is not only serving for interrupt but also for different request including TLB & TMR updating, so change the function & variants name accordingly. Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
7003e50e4e
commit
4607177383
@ -111,12 +111,12 @@ static bool vcpu_pending_request(struct vcpu *vcpu)
|
|||||||
vcpu_make_request(vcpu, ACRN_REQUEST_EVENT);
|
vcpu_make_request(vcpu, ACRN_REQUEST_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return vcpu->arch_vcpu.pending_intr != 0;
|
return vcpu->arch_vcpu.pending_req != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vcpu_make_request(struct vcpu *vcpu, int eventid)
|
int vcpu_make_request(struct vcpu *vcpu, int eventid)
|
||||||
{
|
{
|
||||||
bitmap_set(eventid, &vcpu->arch_vcpu.pending_intr);
|
bitmap_set(eventid, &vcpu->arch_vcpu.pending_req);
|
||||||
/*
|
/*
|
||||||
* if current hostcpu is not the target vcpu's hostcpu, we need
|
* if current hostcpu is not the target vcpu's hostcpu, we need
|
||||||
* to invoke IPI to wake up target vcpu
|
* to invoke IPI to wake up target vcpu
|
||||||
@ -255,7 +255,7 @@ int interrupt_window_vmexit_handler(struct vcpu *vcpu)
|
|||||||
|
|
||||||
if (vcpu_pending_request(vcpu)) {
|
if (vcpu_pending_request(vcpu)) {
|
||||||
/* Do nothing
|
/* Do nothing
|
||||||
* acrn_do_intr_process will continue for this vcpu
|
* acrn_handle_pending_request will continue for this vcpu
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
/* No interrupts to inject.
|
/* No interrupts to inject.
|
||||||
@ -296,18 +296,18 @@ int external_interrupt_vmexit_handler(struct vcpu *vcpu)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int acrn_do_intr_process(struct vcpu *vcpu)
|
int acrn_handle_pending_request(struct vcpu *vcpu)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int vector;
|
int vector;
|
||||||
int tmp;
|
int tmp;
|
||||||
bool intr_pending = false;
|
bool intr_pending = false;
|
||||||
uint64_t *pending_intr_bits = &vcpu->arch_vcpu.pending_intr;
|
uint64_t *pending_req_bits = &vcpu->arch_vcpu.pending_req;
|
||||||
|
|
||||||
if (bitmap_test_and_clear(ACRN_REQUEST_TLB_FLUSH, pending_intr_bits))
|
if (bitmap_test_and_clear(ACRN_REQUEST_TLB_FLUSH, pending_req_bits))
|
||||||
invept(vcpu);
|
invept(vcpu);
|
||||||
|
|
||||||
if (bitmap_test_and_clear(ACRN_REQUEST_TMR_UPDATE, pending_intr_bits))
|
if (bitmap_test_and_clear(ACRN_REQUEST_TMR_UPDATE, pending_req_bits))
|
||||||
vioapic_update_tmr(vcpu);
|
vioapic_update_tmr(vcpu);
|
||||||
|
|
||||||
/* handling cancelled event injection when vcpu is switched out */
|
/* handling cancelled event injection when vcpu is switched out */
|
||||||
@ -353,7 +353,7 @@ int acrn_do_intr_process(struct vcpu *vcpu)
|
|||||||
|
|
||||||
/* Do pending interrupts process */
|
/* Do pending interrupts process */
|
||||||
/* TODO: checkin NMI intr windows before inject */
|
/* TODO: checkin NMI intr windows before inject */
|
||||||
if (bitmap_test_and_clear(ACRN_REQUEST_NMI, pending_intr_bits)) {
|
if (bitmap_test_and_clear(ACRN_REQUEST_NMI, pending_req_bits)) {
|
||||||
/* Inject NMI vector = 2 */
|
/* Inject NMI vector = 2 */
|
||||||
exec_vmwrite(VMX_ENTRY_INT_INFO_FIELD,
|
exec_vmwrite(VMX_ENTRY_INT_INFO_FIELD,
|
||||||
VMX_INT_INFO_VALID | (VMX_INT_TYPE_NMI << 8) | IDT_NMI);
|
VMX_INT_INFO_VALID | (VMX_INT_TYPE_NMI << 8) | IDT_NMI);
|
||||||
@ -370,7 +370,7 @@ int acrn_do_intr_process(struct vcpu *vcpu)
|
|||||||
if (is_guest_irq_enabled(vcpu)) {
|
if (is_guest_irq_enabled(vcpu)) {
|
||||||
/* Inject external interrupt first */
|
/* Inject external interrupt first */
|
||||||
if (bitmap_test_and_clear(ACRN_REQUEST_EXTINT,
|
if (bitmap_test_and_clear(ACRN_REQUEST_EXTINT,
|
||||||
pending_intr_bits)) {
|
pending_req_bits)) {
|
||||||
/* has pending external interrupts */
|
/* has pending external interrupts */
|
||||||
ret = vcpu_do_pending_extint(vcpu);
|
ret = vcpu_do_pending_extint(vcpu);
|
||||||
goto INTR_WIN;
|
goto INTR_WIN;
|
||||||
@ -378,7 +378,7 @@ int acrn_do_intr_process(struct vcpu *vcpu)
|
|||||||
|
|
||||||
/* Inject vLAPIC vectors */
|
/* Inject vLAPIC vectors */
|
||||||
if (bitmap_test_and_clear(ACRN_REQUEST_EVENT,
|
if (bitmap_test_and_clear(ACRN_REQUEST_EVENT,
|
||||||
pending_intr_bits)) {
|
pending_req_bits)) {
|
||||||
/* has pending vLAPIC interrupts */
|
/* has pending vLAPIC interrupts */
|
||||||
ret = vcpu_do_pending_event(vcpu);
|
ret = vcpu_do_pending_event(vcpu);
|
||||||
goto INTR_WIN;
|
goto INTR_WIN;
|
||||||
@ -386,7 +386,7 @@ int acrn_do_intr_process(struct vcpu *vcpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Inject GP event */
|
/* Inject GP event */
|
||||||
if (bitmap_test_and_clear(ACRN_REQUEST_GP, pending_intr_bits)) {
|
if (bitmap_test_and_clear(ACRN_REQUEST_GP, pending_req_bits)) {
|
||||||
/* has pending GP interrupts */
|
/* has pending GP interrupts */
|
||||||
ret = vcpu_do_pending_gp(vcpu);
|
ret = vcpu_do_pending_gp(vcpu);
|
||||||
goto INTR_WIN;
|
goto INTR_WIN;
|
||||||
@ -416,7 +416,7 @@ void cancel_event_injection(struct vcpu *vcpu)
|
|||||||
/*
|
/*
|
||||||
* If event is injected, we clear VMX_ENTRY_INT_INFO_FIELD,
|
* If event is injected, we clear VMX_ENTRY_INT_INFO_FIELD,
|
||||||
* save injection info, and mark inject event pending.
|
* save injection info, and mark inject event pending.
|
||||||
* The event will be re-injected in next acrn_do_intr_process
|
* The event will be re-injected in next acrn_handle_pending_request
|
||||||
* call.
|
* call.
|
||||||
*/
|
*/
|
||||||
if (intinfo & VMX_INT_INFO_VALID) {
|
if (intinfo & VMX_INT_INFO_VALID) {
|
||||||
|
@ -63,8 +63,8 @@ void vcpu_thread(struct vcpu *vcpu)
|
|||||||
exec_softirq();
|
exec_softirq();
|
||||||
CPU_IRQ_DISABLE();
|
CPU_IRQ_DISABLE();
|
||||||
|
|
||||||
/* Check and process interrupts */
|
/* Check and process pending requests(including interrupt) */
|
||||||
acrn_do_intr_process(vcpu);
|
acrn_handle_pending_request(vcpu);
|
||||||
|
|
||||||
if (need_rescheduled(vcpu->pcpu_id)) {
|
if (need_rescheduled(vcpu->pcpu_id)) {
|
||||||
/*
|
/*
|
||||||
|
@ -225,7 +225,7 @@ struct vcpu_arch {
|
|||||||
uint32_t sipi_vector;
|
uint32_t sipi_vector;
|
||||||
|
|
||||||
/* interrupt injection information */
|
/* interrupt injection information */
|
||||||
uint64_t pending_intr;
|
uint64_t pending_req;
|
||||||
bool inject_event_pending;
|
bool inject_event_pending;
|
||||||
struct event_injection_info inject_info;
|
struct event_injection_info inject_info;
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ int vcpu_make_request(struct vcpu *vcpu, int eventid);
|
|||||||
int exception_vmexit_handler(struct vcpu *vcpu);
|
int exception_vmexit_handler(struct vcpu *vcpu);
|
||||||
int interrupt_window_vmexit_handler(struct vcpu *vcpu);
|
int interrupt_window_vmexit_handler(struct vcpu *vcpu);
|
||||||
int external_interrupt_vmexit_handler(struct vcpu *vcpu);
|
int external_interrupt_vmexit_handler(struct vcpu *vcpu);
|
||||||
int acrn_do_intr_process(struct vcpu *vcpu);
|
int acrn_handle_pending_request(struct vcpu *vcpu);
|
||||||
int interrupt_init(uint32_t logical_id);
|
int interrupt_init(uint32_t logical_id);
|
||||||
|
|
||||||
void cancel_event_injection(struct vcpu *vcpu);
|
void cancel_event_injection(struct vcpu *vcpu);
|
||||||
|
Loading…
Reference in New Issue
Block a user