qemu-kvm: enable msi with irqchip
PATCH 1/1 qemu-kvm: enable msi with irqchip
Support msi-x with irqchip in kernel: allocate entries when they are used, and update when they are unmasked.
Signed-off-by Michael S. Tsirkin <[email protected]>
---
This gets qemu-kvm.git on par with qemu.git with respect to MSI support.
Note: it probably makes sense to rewrite msi support in assigned devices on top of this infrastructure. There's an old untested patch of mine for this floating around but I don't think I'll have the time for this anytime soon - any takers?
hw/apic.c | 4 +-- hw/msix.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- hw/pci.h | 3 ++ libkvm-all.h | 14 +++++++++ qemu-kvm.c | 52 +++++++++++++++++++++++++++++++++ 5 files changed, 157 insertions(+), 6 deletions(-)
hw/apic.c +1 -3
@@ -1088,9 +1088,7 @@ int apic_init(CPUState *env) s->cpu_env = env;apic_reset (s); -if (!kvm_enabled () || !qemu_kvm_irqchip_in_kernel ()) { - msix_supported =1 ; - } + msix_supported =1 ;/* XXX: mapping more APICs at the same memory location */ if (apic_io_memory ==0 ) {
hw/msix.c +87 -3
137 lines not on this page · raw message
hw/pci.h +3 -0
@@ -5,6 +5,8 @@#include "qdev.h" +struct kvm_irq_routing_entry ; +/* PCI includes legacy ISA access. */ #include "isa.h"
@@ -232,6 +234,7 @@ struct PCIDevice {unsigned *msix_entry_used;/* Region including the MSI-X table */ uint32_t msix_bar_size; +struct kvm_irq_routing_entry *msix_irq_entries;/* Device capability configuration space */ struct {
libkvm-all.h +14 -0
@@ -898,6 +898,20 @@ int kvm_del_routing_entry(kvm_context_t kvm, struct kvm_irq_routing_entry* entry);/*! +* \brief Updates a routing in the temporary irq routing table +* +* Update a routing in the temporary irq routing table +* with a new value. entry type and GSI can not be changed. +* Nothing is committed to the running VM. +* +* \param kvm Pointer to the current kvm_context +*/ +int kvm_update_routing_entry (kvm_context_t kvm, +struct kvm_irq_routing_entry * entry, +struct kvm_irq_routing_entry * newentry +); + +/*! * \brief Commit the temporary irq routing table * * Commit the temporary irq routing table to the running VM.
qemu-kvm.c +52 -0
58 lines not on this page · raw message
Signature · 1 line
1.6.2.2