[PATCH 15/16] qemu-kvm: Use KVM-optimized interrupt handler

Jan Kiszka
2011-05-13T12:14:21Z

Instead of hooking into tcg_handler_interrupt, set cpu_interrupt_handler
just like upstream and move kvm_update_interrupt_request to
kvm_handle_interrupt. It's not worth keeping the check for !irqchip, we
will only rarely get here in the in-kernel irqchip case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
exec.c | 2 --
kvm-all.c | 3 ++-
qemu-kvm.c | 2 ++
3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/exec.c b/exec.c
index 169f9f4..6c4b32b 100644
--- a/exec.c
+++ b/exec.c
@@ -1646,8 +1646,6 @@ static void tcg_handle_interrupt(CPUState *env, int mask)

old_mask = env->interrupt_request;
env->interrupt_request |= mask;
- if (kvm_enabled() && !kvm_irqchip_in_kernel())
- kvm_update_interrupt_request(env);

/*
* If called from iothread context, wake the target cpu in
diff --git a/kvm-all.c b/kvm-all.c
index a2c517e..8ded95c 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -683,7 +683,6 @@ static CPUPhysMemoryClient kvm_cpu_phys_memory_client = {
.log_stop = kvm_log_stop,
};

-#ifdef OBSOLETE_KVM_IMPL
static void kvm_handle_interrupt(CPUState *env, int mask)
{
env->interrupt_request |= mask;
@@ -691,8 +690,10 @@ static void kvm_handle_interrupt(CPUState *env, int mask)
if (!qemu_cpu_is_self(env)) {
qemu_cpu_kick(env);
}
+ kvm_update_interrupt_request(env);
}

+#ifdef OBSOLETE_KVM_IMPL
int kvm_init(void)
{
static const char upgrade_note[] =
diff --git a/qemu-kvm.c b/qemu-kvm.c
index df8e817..5ba5b0a 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1409,6 +1409,8 @@ static int kvm_create_context(void)

kvm_init_ap();

+ cpu_interrupt_handler = kvm_handle_interrupt;
+
return 0;
}

--
1.7.1