diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2018-12-05 16:36:21 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-12-14 17:59:59 +0100 |
commit | 87a8d795b2f1d926b4e831d27144d3e6ab7e33dc (patch) | |
tree | fd40da6eed2fb69e26254a6fb543fa1a01e4071a | |
parent | 08a800ac257a2eeed1fad34b55ed55b2578e9b4e (diff) | |
download | linux-stable-87a8d795b2f1d926b4e831d27144d3e6ab7e33dc.tar.gz linux-stable-87a8d795b2f1d926b4e831d27144d3e6ab7e33dc.tar.bz2 linux-stable-87a8d795b2f1d926b4e831d27144d3e6ab7e33dc.zip |
x86/hyper-v: Stop caring about EOI for direct stimers
Turns out we over-engineered Direct Mode for stimers a bit: unlike
traditional stimers where we may want to try to re-inject the message upon
EOI, Direct Mode stimers just set the irq in APIC and kvm_apic_set_irq()
fails only when APIC is disabled (see APIC_DM_FIXED case in
__apic_accept_irq()). Remove the redundant part.
Suggested-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/hyperv.c | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 209ca485a2c7..c90a5352d158 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -56,21 +56,8 @@ static inline int synic_get_sint_vector(u64 sint_value) static bool synic_has_vector_connected(struct kvm_vcpu_hv_synic *synic, int vector) { - struct kvm_vcpu *vcpu = synic_to_vcpu(synic); - struct kvm_vcpu_hv *hv_vcpu = vcpu_to_hv_vcpu(vcpu); - struct kvm_vcpu_hv_stimer *stimer; int i; - for (i = 0; i < ARRAY_SIZE(hv_vcpu->stimer); i++) { - stimer = &hv_vcpu->stimer[i]; - if (stimer->config.enable && stimer->config.direct_mode && - stimer->config.apic_vector == vector) - return true; - } - - if (vector < HV_SYNIC_FIRST_VALID_VECTOR) - return false; - for (i = 0; i < ARRAY_SIZE(synic->sint); i++) { if (synic_get_sint_vector(synic_read_sint(synic, i)) == vector) return true; @@ -96,14 +83,14 @@ static bool synic_has_vector_auto_eoi(struct kvm_vcpu_hv_synic *synic, static void synic_update_vector(struct kvm_vcpu_hv_synic *synic, int vector) { + if (vector < HV_SYNIC_FIRST_VALID_VECTOR) + return; + if (synic_has_vector_connected(synic, vector)) __set_bit(vector, synic->vec_bitmap); else __clear_bit(vector, synic->vec_bitmap); - if (vector < HV_SYNIC_FIRST_VALID_VECTOR) - return; - if (synic_has_vector_auto_eoi(synic, vector)) __set_bit(vector, synic->auto_eoi_bitmap); else @@ -353,9 +340,7 @@ int kvm_hv_synic_set_irq(struct kvm *kvm, u32 vpidx, u32 sint) void kvm_hv_synic_send_eoi(struct kvm_vcpu *vcpu, int vector) { - struct kvm_vcpu_hv *hv_vcpu = vcpu_to_hv_vcpu(vcpu); struct kvm_vcpu_hv_synic *synic = vcpu_to_synic(vcpu); - struct kvm_vcpu_hv_stimer *stimer; int i; trace_kvm_hv_synic_send_eoi(vcpu->vcpu_id, vector); @@ -363,14 +348,6 @@ void kvm_hv_synic_send_eoi(struct kvm_vcpu *vcpu, int vector) for (i = 0; i < ARRAY_SIZE(synic->sint); i++) if (synic_get_sint_vector(synic_read_sint(synic, i)) == vector) kvm_hv_notify_acked_sint(vcpu, i); - - for (i = 0; i < ARRAY_SIZE(hv_vcpu->stimer); i++) { - stimer = &hv_vcpu->stimer[i]; - if (stimer->msg_pending && stimer->config.enable && - stimer->config.direct_mode && - stimer->config.apic_vector == vector) - stimer_mark_pending(stimer, false); - } } static int kvm_hv_set_sint_gsi(struct kvm *kvm, u32 vpidx, u32 sint, int gsi) @@ -537,8 +514,6 @@ static int stimer_start(struct kvm_vcpu_hv_stimer *stimer) static int stimer_set_config(struct kvm_vcpu_hv_stimer *stimer, u64 config, bool host) { - struct kvm_vcpu *vcpu = stimer_to_vcpu(stimer); - struct kvm_vcpu_hv *hv_vcpu = vcpu_to_hv_vcpu(vcpu); union hv_stimer_config new_config = {.as_uint64 = config}, old_config = {.as_uint64 = stimer->config.as_uint64}; @@ -551,11 +526,6 @@ static int stimer_set_config(struct kvm_vcpu_hv_stimer *stimer, u64 config, new_config.enable = 0; stimer->config.as_uint64 = new_config.as_uint64; - if (old_config.direct_mode) - synic_update_vector(&hv_vcpu->synic, old_config.apic_vector); - if (new_config.direct_mode) - synic_update_vector(&hv_vcpu->synic, new_config.apic_vector); - stimer_mark_pending(stimer, false); return 0; } |