hw/mips/mips_int: De-duplicate KVM interrupt delivery
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Wed, 29 Apr 2020 08:21:05 +0000 (10:21 +0200)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Tue, 26 May 2020 11:21:12 +0000 (13:21 +0200)
Refactor duplicated code in a single place.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200429082916.10669-2-f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/mips/mips_int.c

index 796730b11d04e5794ec2bf7b0308ecb570947992..4a1bf846da8df4bbc6753f6b93bb13c7abd0b363 100644 (file)
@@ -47,17 +47,12 @@ static void cpu_mips_irq_request(void *opaque, int irq, int level)
 
     if (level) {
         env->CP0_Cause |= 1 << (irq + CP0Ca_IP);
-
-        if (kvm_enabled() && irq == 2) {
-            kvm_mips_set_interrupt(cpu, irq, level);
-        }
-
     } else {
         env->CP0_Cause &= ~(1 << (irq + CP0Ca_IP));
+    }
 
-        if (kvm_enabled() && irq == 2) {
-            kvm_mips_set_interrupt(cpu, irq, level);
-        }
+    if (kvm_enabled() && irq == 2) {
+        kvm_mips_set_interrupt(cpu, irq, level);
     }
 
     if (env->CP0_Cause & CP0Ca_IP_mask) {