提交 67c9dddc 编写于 作者: P Paolo Bonzini

KVM: x86: make hwapic_isr_update and hwapic_irr_update look the same

Neither APICv nor AVIC actually need the first argument of
hwapic_isr_update, but the vCPU makes more sense than passing the
pointer to the whole virtual machine!  In fact in the APICv case it's
just happening that the vCPU is used implicitly, through the loaded VMCS.

The second argument instead is named differently, make it consistent.
Reviewed-by: NRadim Krčmář <rkrcmar@redhat.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 8221c137
...@@ -922,7 +922,7 @@ struct kvm_x86_ops { ...@@ -922,7 +922,7 @@ struct kvm_x86_ops {
bool (*get_enable_apicv)(void); bool (*get_enable_apicv)(void);
void (*refresh_apicv_exec_ctrl)(struct kvm_vcpu *vcpu); void (*refresh_apicv_exec_ctrl)(struct kvm_vcpu *vcpu);
void (*hwapic_irr_update)(struct kvm_vcpu *vcpu, int max_irr); void (*hwapic_irr_update)(struct kvm_vcpu *vcpu, int max_irr);
void (*hwapic_isr_update)(struct kvm *kvm, int isr); void (*hwapic_isr_update)(struct kvm_vcpu *vcpu, int isr);
void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap); void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set); void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set);
void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa); void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa);
......
...@@ -392,7 +392,7 @@ static inline void apic_set_isr(int vec, struct kvm_lapic *apic) ...@@ -392,7 +392,7 @@ static inline void apic_set_isr(int vec, struct kvm_lapic *apic)
* just set SVI. * just set SVI.
*/ */
if (unlikely(vcpu->arch.apicv_active)) if (unlikely(vcpu->arch.apicv_active))
kvm_x86_ops->hwapic_isr_update(vcpu->kvm, vec); kvm_x86_ops->hwapic_isr_update(vcpu, vec);
else { else {
++apic->isr_count; ++apic->isr_count;
BUG_ON(apic->isr_count > MAX_APIC_VECTOR); BUG_ON(apic->isr_count > MAX_APIC_VECTOR);
...@@ -440,7 +440,7 @@ static inline void apic_clear_isr(int vec, struct kvm_lapic *apic) ...@@ -440,7 +440,7 @@ static inline void apic_clear_isr(int vec, struct kvm_lapic *apic)
* and must be left alone. * and must be left alone.
*/ */
if (unlikely(vcpu->arch.apicv_active)) if (unlikely(vcpu->arch.apicv_active))
kvm_x86_ops->hwapic_isr_update(vcpu->kvm, kvm_x86_ops->hwapic_isr_update(vcpu,
apic_find_highest_isr(apic)); apic_find_highest_isr(apic));
else { else {
--apic->isr_count; --apic->isr_count;
...@@ -1965,7 +1965,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu, ...@@ -1965,7 +1965,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu,
kvm_x86_ops->apicv_post_state_restore(vcpu); kvm_x86_ops->apicv_post_state_restore(vcpu);
kvm_x86_ops->hwapic_irr_update(vcpu, kvm_x86_ops->hwapic_irr_update(vcpu,
apic_find_highest_irr(apic)); apic_find_highest_irr(apic));
kvm_x86_ops->hwapic_isr_update(vcpu->kvm, kvm_x86_ops->hwapic_isr_update(vcpu,
apic_find_highest_isr(apic)); apic_find_highest_isr(apic));
} }
kvm_make_request(KVM_REQ_EVENT, vcpu); kvm_make_request(KVM_REQ_EVENT, vcpu);
......
...@@ -4202,7 +4202,7 @@ static void svm_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr) ...@@ -4202,7 +4202,7 @@ static void svm_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr)
{ {
} }
static void svm_hwapic_isr_update(struct kvm *kvm, int isr) static void svm_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr)
{ {
} }
......
...@@ -8314,19 +8314,19 @@ static void vmx_set_apic_access_page_addr(struct kvm_vcpu *vcpu, hpa_t hpa) ...@@ -8314,19 +8314,19 @@ static void vmx_set_apic_access_page_addr(struct kvm_vcpu *vcpu, hpa_t hpa)
vmcs_write64(APIC_ACCESS_ADDR, hpa); vmcs_write64(APIC_ACCESS_ADDR, hpa);
} }
static void vmx_hwapic_isr_update(struct kvm *kvm, int isr) static void vmx_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr)
{ {
u16 status; u16 status;
u8 old; u8 old;
if (isr == -1) if (max_isr == -1)
isr = 0; max_isr = 0;
status = vmcs_read16(GUEST_INTR_STATUS); status = vmcs_read16(GUEST_INTR_STATUS);
old = status >> 8; old = status >> 8;
if (isr != old) { if (max_isr != old) {
status &= 0xff; status &= 0xff;
status |= isr << 8; status |= max_isr << 8;
vmcs_write16(GUEST_INTR_STATUS, status); vmcs_write16(GUEST_INTR_STATUS, status);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册