kvm: x86: use same convention to name kvm_lapic_{set,clear}_vector()

apic_clear_vector() is the counterpart of kvm_lapic_set_vector(),
while they have different naming convention.

Rename it and move together to arch/x86/kvm/lapic.h. Also fix one typo
in comment by hand.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Wei Yang 2019-03-31 19:17:22 -07:00 committed by Paolo Bonzini
parent 7d2296bfa5
commit ee171d2f39
2 changed files with 12 additions and 10 deletions

View File

@ -87,11 +87,6 @@ bool kvm_apic_pending_eoi(struct kvm_vcpu *vcpu, int vector)
apic_test_vector(vector, apic->regs + APIC_IRR); apic_test_vector(vector, apic->regs + APIC_IRR);
} }
static inline void apic_clear_vector(int vec, void *bitmap)
{
clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));
}
static inline int __apic_test_and_set_vector(int vec, void *bitmap) static inline int __apic_test_and_set_vector(int vec, void *bitmap)
{ {
return __test_and_set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); return __test_and_set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));
@ -445,12 +440,12 @@ static inline void apic_clear_irr(int vec, struct kvm_lapic *apic)
if (unlikely(vcpu->arch.apicv_active)) { if (unlikely(vcpu->arch.apicv_active)) {
/* need to update RVI */ /* need to update RVI */
apic_clear_vector(vec, apic->regs + APIC_IRR); kvm_lapic_clear_vector(vec, apic->regs + APIC_IRR);
kvm_x86_ops->hwapic_irr_update(vcpu, kvm_x86_ops->hwapic_irr_update(vcpu,
apic_find_highest_irr(apic)); apic_find_highest_irr(apic));
} else { } else {
apic->irr_pending = false; apic->irr_pending = false;
apic_clear_vector(vec, apic->regs + APIC_IRR); kvm_lapic_clear_vector(vec, apic->regs + APIC_IRR);
if (apic_search_irr(apic) != -1) if (apic_search_irr(apic) != -1)
apic->irr_pending = true; apic->irr_pending = true;
} }
@ -1055,9 +1050,11 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
if (apic_test_vector(vector, apic->regs + APIC_TMR) != !!trig_mode) { if (apic_test_vector(vector, apic->regs + APIC_TMR) != !!trig_mode) {
if (trig_mode) if (trig_mode)
kvm_lapic_set_vector(vector, apic->regs + APIC_TMR); kvm_lapic_set_vector(vector,
apic->regs + APIC_TMR);
else else
apic_clear_vector(vector, apic->regs + APIC_TMR); kvm_lapic_clear_vector(vector,
apic->regs + APIC_TMR);
} }
if (vcpu->arch.apicv_active) if (vcpu->arch.apicv_active)
@ -2333,7 +2330,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns)
/* /*
* APIC is created enabled. This will prevent kvm_lapic_set_base from * APIC is created enabled. This will prevent kvm_lapic_set_base from
* thinking that APIC satet has changed. * thinking that APIC state has changed.
*/ */
vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE; vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE;
static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */ static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */

View File

@ -130,6 +130,11 @@ void kvm_lapic_exit(void);
#define VEC_POS(v) ((v) & (32 - 1)) #define VEC_POS(v) ((v) & (32 - 1))
#define REG_POS(v) (((v) >> 5) << 4) #define REG_POS(v) (((v) >> 5) << 4)
static inline void kvm_lapic_clear_vector(int vec, void *bitmap)
{
clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));
}
static inline void kvm_lapic_set_vector(int vec, void *bitmap) static inline void kvm_lapic_set_vector(int vec, void *bitmap)
{ {
set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));