hw/mips/mips_int: De-duplicate KVM interrupt delivery

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>
This commit is contained in:
Philippe Mathieu-Daudé 2020-04-29 10:21:05 +02:00
parent c707f06fb1
commit 56b92eeeac

View File

@ -47,18 +47,13 @@ static void cpu_mips_irq_request(void *opaque, int irq, int level)
if (level) { if (level) {
env->CP0_Cause |= 1 << (irq + CP0Ca_IP); env->CP0_Cause |= 1 << (irq + CP0Ca_IP);
if (kvm_enabled() && irq == 2) {
kvm_mips_set_interrupt(cpu, irq, level);
}
} else { } else {
env->CP0_Cause &= ~(1 << (irq + CP0Ca_IP)); env->CP0_Cause &= ~(1 << (irq + CP0Ca_IP));
}
if (kvm_enabled() && irq == 2) { if (kvm_enabled() && irq == 2) {
kvm_mips_set_interrupt(cpu, irq, level); kvm_mips_set_interrupt(cpu, irq, level);
} }
}
if (env->CP0_Cause & CP0Ca_IP_mask) { if (env->CP0_Cause & CP0Ca_IP_mask) {
cpu_interrupt(cs, CPU_INTERRUPT_HARD); cpu_interrupt(cs, CPU_INTERRUPT_HARD);