Skip to contentSkip to conversation

qemu-kvm: enable msi with irqchip

PATCH Applied Michael S. Tsirkin 3 participants 3 messages Jul 5, 2009 – Jul 7, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH v4 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.

---
Changes since v3:
style comments from Avi
Changes since v2:
move all kvm-specific code into kvm_msi_XXX helpers
Changes since v1:
add braces as per CODING_STYLE

 hw/apic.c    |    4 +-
 hw/msix.c    |  125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 hw/pci.h     |    3 +
 libkvm-all.h |   14 ++++++
 qemu-kvm.c   |   44 ++++++++++++++++++++
 5 files changed, 185 insertions(+), 5 deletions(-)
hw/apic.c +1 -3
index 778a853..cdb5972 100644
@@ -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 +123 -2

179 lines not on this page · raw message

hw/pci.h +3 -0
index 7ae9c93..66235e4 100644
@@ -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
index ecd3065..4a98bcb 100644
@@ -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 +44 -0

50 lines not on this page · raw message

Signature · 1 line
1.6.2.5
Applied
#1 lore raw
Quoted 3 lines · Michael S. Tsirkin

Support msi-x with irqchip in kernel: allocate entries when they are used, and update when they are unmasked.

Applied, thanks. I changed fprintf(r) to fprintf(strerror(-r)).

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 7 lines · Avi Kivity
Quoted 3 lines · Michael S. Tsirkin

Support msi-x with irqchip in kernel: allocate entries when they are used, and update when they are unmasked.

Applied, thanks. I changed fprintf(r) to fprintf(strerror(-r)).

Breaks --disable-kvm build. Michael, will you fix this?

Jan