From 04fa27f5ae5f025424bb7b88d3453c46e8900102 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Wed, 16 May 2012 15:41:10 -0300 Subject: kvm: Introduce basic MSI support for in-kernel irqchips This patch basically adds kvm_irqchip_send_msi, a service for sending arbitrary MSI messages to KVM's in-kernel irqchip models. As the original KVM API requires us to establish a static route from a pseudo GSI to the target MSI message and inject the MSI via toggling that virtual IRQ, we need to play some tricks to make this interface transparent. We create those routes on demand and keep them in a hash table. Succeeding messages can then search for an existing route in the table first and reuse it whenever possible. If we should run out of limited GSIs, we simply flush the table and rebuild it as messages are sent. This approach is rather simple and could be optimized further. However, latest kernels contains a more efficient MSI injection interface that will obsolete the GSI-based dynamic injection. Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- kvm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'kvm.h') diff --git a/kvm.h b/kvm.h index 4ccae8c0c8..7857dbfb05 100644 --- a/kvm.h +++ b/kvm.h @@ -132,6 +132,7 @@ int kvm_arch_on_sigbus(int code, void *addr); void kvm_arch_init_irq_routing(KVMState *s); int kvm_irqchip_set_irq(KVMState *s, int irq, int level); +int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg); void kvm_irqchip_add_route(KVMState *s, int gsi, int irqchip, int pin); int kvm_irqchip_commit_routes(KVMState *s); -- cgit v1.2.1