Commit d31d498d authored by Kunkun Jiang's avatar Kunkun Jiang Committed by Dongxu Sun
Browse files

KVM: arm64: vgic-v3: Clearing pending status of vtimer on guest reset

virt inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8K89F


CVE: NA

------------------------------------------------------------------

On reset, userspace clears pending status for all PPIs and SGIs by
writing all 0's to GICR_ISPENDR0. The pending state of vtimer
interrupt is somehow staying in redistributor and we have to
explicitly clear it...

Signed-off-by: default avatarZenghui Yu <yuzenghui@huawei.com>
Signed-off-by: default avatarKunkun Jiang <jiangkunkun@huawei.com>
Signed-off-by: default avatarDongxu Sun <sundongxu3@huawei.com>
parent fd291462
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -365,6 +365,19 @@ static int vgic_v3_uaccess_write_pending(struct kvm_vcpu *vcpu,
			irq->pending_latch = true;
			vgic_queue_irq_unlock(vcpu->kvm, irq, flags);
		} else {
			/**
			 * workaround: On reset, userspace clears pending status
			 * for all PPIs and SGIs by writing all 0's to
			 * GICR_ISPENDR0. The pending state of vtimer interrupt
			 * is somehow staying in redistributor and we have to
			 * explicitly clear it...
			 *
			 * P.S., irq->vtimer_info is NULL on restore.
			 */
			if (irq->vtimer_info)
				WARN_ON_ONCE(irq_set_irqchip_state(irq->host_irq,
							IRQCHIP_STATE_PENDING,
							false));
			irq->pending_latch = false;
			raw_spin_unlock_irqrestore(&irq->irq_lock, flags);
		}