From 46071773834804fa26251e033a4eb27a632f9b42 Mon Sep 17 00:00:00 2001 From: Jason Chen CJ Date: Fri, 25 May 2018 12:29:00 +0800 Subject: [PATCH] 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 Acked-by: Eddie Dong --- hypervisor/arch/x86/interrupt.c | 24 ++++++++++++------------ hypervisor/common/hv_main.c | 4 ++-- hypervisor/include/arch/x86/guest/vcpu.h | 2 +- hypervisor/include/arch/x86/irq.h | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hypervisor/arch/x86/interrupt.c b/hypervisor/arch/x86/interrupt.c index edbec3f48..9d10de1ee 100644 --- a/hypervisor/arch/x86/interrupt.c +++ b/hypervisor/arch/x86/interrupt.c @@ -111,12 +111,12 @@ static bool vcpu_pending_request(struct vcpu *vcpu) 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) { - 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 * 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)) { /* Do nothing - * acrn_do_intr_process will continue for this vcpu + * acrn_handle_pending_request will continue for this vcpu */ } else { /* No interrupts to inject. @@ -296,18 +296,18 @@ int external_interrupt_vmexit_handler(struct vcpu *vcpu) return 0; } -int acrn_do_intr_process(struct vcpu *vcpu) +int acrn_handle_pending_request(struct vcpu *vcpu) { int ret = 0; int vector; int tmp; 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); - 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); /* 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 */ /* 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 */ exec_vmwrite(VMX_ENTRY_INT_INFO_FIELD, 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)) { /* Inject external interrupt first */ if (bitmap_test_and_clear(ACRN_REQUEST_EXTINT, - pending_intr_bits)) { + pending_req_bits)) { /* has pending external interrupts */ ret = vcpu_do_pending_extint(vcpu); goto INTR_WIN; @@ -378,7 +378,7 @@ int acrn_do_intr_process(struct vcpu *vcpu) /* Inject vLAPIC vectors */ if (bitmap_test_and_clear(ACRN_REQUEST_EVENT, - pending_intr_bits)) { + pending_req_bits)) { /* has pending vLAPIC interrupts */ ret = vcpu_do_pending_event(vcpu); goto INTR_WIN; @@ -386,7 +386,7 @@ int acrn_do_intr_process(struct vcpu *vcpu) } /* 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 */ ret = vcpu_do_pending_gp(vcpu); 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, * 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. */ if (intinfo & VMX_INT_INFO_VALID) { diff --git a/hypervisor/common/hv_main.c b/hypervisor/common/hv_main.c index 5dc1275d1..6793cda8e 100644 --- a/hypervisor/common/hv_main.c +++ b/hypervisor/common/hv_main.c @@ -63,8 +63,8 @@ void vcpu_thread(struct vcpu *vcpu) exec_softirq(); CPU_IRQ_DISABLE(); - /* Check and process interrupts */ - acrn_do_intr_process(vcpu); + /* Check and process pending requests(including interrupt) */ + acrn_handle_pending_request(vcpu); if (need_rescheduled(vcpu->pcpu_id)) { /* diff --git a/hypervisor/include/arch/x86/guest/vcpu.h b/hypervisor/include/arch/x86/guest/vcpu.h index 32fed9772..a3ae03f7a 100644 --- a/hypervisor/include/arch/x86/guest/vcpu.h +++ b/hypervisor/include/arch/x86/guest/vcpu.h @@ -225,7 +225,7 @@ struct vcpu_arch { uint32_t sipi_vector; /* interrupt injection information */ - uint64_t pending_intr; + uint64_t pending_req; bool inject_event_pending; struct event_injection_info inject_info; diff --git a/hypervisor/include/arch/x86/irq.h b/hypervisor/include/arch/x86/irq.h index 5df76e7d6..988a47033 100644 --- a/hypervisor/include/arch/x86/irq.h +++ b/hypervisor/include/arch/x86/irq.h @@ -189,7 +189,7 @@ int vcpu_make_request(struct vcpu *vcpu, int eventid); int exception_vmexit_handler(struct vcpu *vcpu); int interrupt_window_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); void cancel_event_injection(struct vcpu *vcpu);