]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
LoongArch: KVM: Move AVEC interrupt injection into switch loop
authorBibo Mao <maobibo@loongson.cn>
Mon, 4 May 2026 01:00:48 +0000 (09:00 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Mon, 4 May 2026 01:00:48 +0000 (09:00 +0800)
When AVEC interrupt controller is emulated in user space, AVEC interrupt
is injected by software like SIP0/SIP1/TI/IPI interrupts. Here also move
the AVEC interrupt injection in switch loop.

Cc: stable@vger.kernel.org
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kvm/interrupt.c

index 32930959f7c25606e61fe01c8f206d6842e0fd37..53dac8ab8fb1306bcfbbf094d2a97af1c4719804 100644 (file)
@@ -33,13 +33,12 @@ static int kvm_irq_deliver(struct kvm_vcpu *vcpu, unsigned int priority)
        if (priority < EXCCODE_INT_NUM)
                irq = priority_to_irq[priority];
 
-       if (kvm_guest_has_msgint(&vcpu->arch) && (priority == INT_AVEC)) {
-               dmsintc_inject_irq(vcpu);
-               set_gcsr_estat(irq);
-               return 1;
-       }
-
        switch (priority) {
+       case INT_AVEC:
+               if (!kvm_guest_has_msgint(&vcpu->arch))
+                       break;
+               dmsintc_inject_irq(vcpu);
+               fallthrough;
        case INT_TI:
        case INT_IPI:
        case INT_SWI0:
@@ -66,12 +65,11 @@ static int kvm_irq_clear(struct kvm_vcpu *vcpu, unsigned int priority)
        if (priority < EXCCODE_INT_NUM)
                irq = priority_to_irq[priority];
 
-       if (kvm_guest_has_msgint(&vcpu->arch) && (priority == INT_AVEC)) {
-               clear_gcsr_estat(irq);
-               return 1;
-       }
-
        switch (priority) {
+       case INT_AVEC:
+               if (!kvm_guest_has_msgint(&vcpu->arch))
+                       break;
+               fallthrough;
        case INT_TI:
        case INT_IPI:
        case INT_SWI0: