From patchwork Mon Sep 21 14:51:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 49063 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8LErgCW009619 for ; Mon, 21 Sep 2009 14:53:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752240AbZIUOx2 (ORCPT ); Mon, 21 Sep 2009 10:53:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750933AbZIUOx1 (ORCPT ); Mon, 21 Sep 2009 10:53:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13414 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbZIUOx1 (ORCPT ); Mon, 21 Sep 2009 10:53:27 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8LErT6E000916; Mon, 21 Sep 2009 10:53:29 -0400 Received: from redhat.com (vpn-10-54.str.redhat.com [10.32.10.54]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8LErMBS028246 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 21 Sep 2009 10:53:27 -0400 Date: Mon, 21 Sep 2009 17:51:37 +0300 From: "Michael S. Tsirkin" To: kvm@vger.kernel.org, avi@redhat.com Cc: quintela@redhat.com, hch@lst.de Subject: [PATCH] qemu-kvm: fix no gsi routing warning Message-ID: <20090921145136.GA29405@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 Suggested-by: Christoph Hellwig Signed-off-by: Michael S. Tsirkin --- 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));