Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: kvm@vger.kernel.org, avi@redhat.com
Cc: quintela@redhat.com, hch@lst.de
Subject: [PATCH] qemu-kvm: fix no gsi routing warning
Date: Mon, 21 Sep 2009 17:51:37 +0300	[thread overview]
Message-ID: <20090921145136.GA29405@redhat.com> (raw)

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 <quintela@redhat.com>
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/msix.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/hw/msix.c b/hw/msix.c
index fcd425f..5695582 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -129,6 +129,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));
-- 
1.6.2.5

             reply	other threads:[~2009-09-21 14:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-21 14:51 Michael S. Tsirkin [this message]
2009-09-21 14:56 ` [PATCH] qemu-kvm: fix no gsi routing warning Avi Kivity
2009-09-21 19:50   ` Michael S. Tsirkin
2009-09-23  9:04     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090921145136.GA29405@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=hch@lst.de \
    --cc=kvm@vger.kernel.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox