KVM: x86: reset RVI upon system reset
A bug was reported as follows: when running Windows 7 32-bit guests on qemu-kvm, sometimes the guests run into blue screen during reboot. The problem was that a guest's RVI was not cleared when it rebooted. This patch has fixed the problem. Signed-off-by: Wei Wang <wei.w.wang@intel.com> Signed-off-by: Yang Zhang <yang.z.zhang@intel.com> Tested-by: Rongrong Liu <rongrongx.liu@intel.com>, Da Chun <ngugc@qq.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a2ae9df7c9
commit
4114c27d45
|
@ -1714,6 +1714,9 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu,
|
||||||
apic->isr_count = kvm_apic_vid_enabled(vcpu->kvm) ?
|
apic->isr_count = kvm_apic_vid_enabled(vcpu->kvm) ?
|
||||||
1 : count_vectors(apic->regs + APIC_ISR);
|
1 : count_vectors(apic->regs + APIC_ISR);
|
||||||
apic->highest_isr_cache = -1;
|
apic->highest_isr_cache = -1;
|
||||||
|
if (kvm_x86_ops->hwapic_irr_update)
|
||||||
|
kvm_x86_ops->hwapic_irr_update(vcpu,
|
||||||
|
apic_find_highest_irr(apic));
|
||||||
kvm_x86_ops->hwapic_isr_update(vcpu->kvm, apic_find_highest_isr(apic));
|
kvm_x86_ops->hwapic_isr_update(vcpu->kvm, apic_find_highest_isr(apic));
|
||||||
kvm_make_request(KVM_REQ_EVENT, vcpu);
|
kvm_make_request(KVM_REQ_EVENT, vcpu);
|
||||||
kvm_rtc_eoi_tracking_restore_one(vcpu);
|
kvm_rtc_eoi_tracking_restore_one(vcpu);
|
||||||
|
|
|
@ -7419,6 +7419,9 @@ static void vmx_set_rvi(int vector)
|
||||||
u16 status;
|
u16 status;
|
||||||
u8 old;
|
u8 old;
|
||||||
|
|
||||||
|
if (vector == -1)
|
||||||
|
vector = 0;
|
||||||
|
|
||||||
status = vmcs_read16(GUEST_INTR_STATUS);
|
status = vmcs_read16(GUEST_INTR_STATUS);
|
||||||
old = (u8)status & 0xff;
|
old = (u8)status & 0xff;
|
||||||
if ((u8)vector != old) {
|
if ((u8)vector != old) {
|
||||||
|
@ -7430,22 +7433,23 @@ static void vmx_set_rvi(int vector)
|
||||||
|
|
||||||
static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr)
|
static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr)
|
||||||
{
|
{
|
||||||
if (max_irr == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If a vmexit is needed, vmx_check_nested_events handles it.
|
|
||||||
*/
|
|
||||||
if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!is_guest_mode(vcpu)) {
|
if (!is_guest_mode(vcpu)) {
|
||||||
vmx_set_rvi(max_irr);
|
vmx_set_rvi(max_irr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (max_irr == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fall back to pre-APICv interrupt injection since L2
|
* In guest mode. If a vmexit is needed, vmx_check_nested_events
|
||||||
|
* handles it.
|
||||||
|
*/
|
||||||
|
if (nested_exit_on_intr(vcpu))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Else, fall back to pre-APICv interrupt injection since L2
|
||||||
* is run without virtual interrupt delivery.
|
* is run without virtual interrupt delivery.
|
||||||
*/
|
*/
|
||||||
if (!kvm_event_needs_reinjection(vcpu) &&
|
if (!kvm_event_needs_reinjection(vcpu) &&
|
||||||
|
|
Loading…
Reference in New Issue