From: Michael S. Tsirkin <[email protected]>

When running on host kernel which does not let the guest manupulate the
gsi routing, and user requested MSI-X to be enabled, we get the
following warnings:

  kvm_msix_add: kvm_get_irq_route_gsi failed: No space left on device
  kvm_msix_update: kvm_update_routing_entry failed: Invalid argument

What really happens is that we report a failure to allocate
a vector to the guest, it will retry and finally disable MSI.

Make this clearer by checking for gsi capability and warning about
the error in a readable form.

Reported-by: Juan Quintela <[email protected]>
Suggested-by: Christoph Hellwig <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>

diff --git a/hw/msix.c b/hw/msix.c
index 5fccb2f..832eb04 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -121,6 +121,13 @@ static int kvm_msix_add(PCIDevice *dev, unsigned vector)
     struct kvm_irq_routing_entry *entry = dev->msix_irq_entries + vector;
     int r;
 
+    if (!kvm_has_gsi_routing(kvm_context)) {
+        fprintf(stderr, "Warning: no MSI-X support found. "
+                "At least kernel 2.6.30 is required for MSI-X support.\n"
+               );
+        return -EOPNOTSUPP;
+    }
+
     r = kvm_get_irq_route_gsi(kvm_context);
     if (r < 0) {
         fprintf(stderr, "%s: kvm_get_irq_route_gsi failed: %s\n", __func__, 
strerror(-r));
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to