From patchwork Mon May 25 12:25:50 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: 25817 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 n4PCUMB5006746 for ; Mon, 25 May 2009 12:30:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752446AbZEYM30 (ORCPT ); Mon, 25 May 2009 08:29:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752162AbZEYM3Z (ORCPT ); Mon, 25 May 2009 08:29:25 -0400 Received: from mx2.redhat.com ([66.187.237.31]:33549 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752803AbZEYM3W (ORCPT ); Mon, 25 May 2009 08:29:22 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n4PCQoW1022844; Mon, 25 May 2009 08:26:50 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n4PCQmS1029444; Mon, 25 May 2009 08:26:49 -0400 Received: from redhat.com (vpn-10-50.str.redhat.com [10.32.10.50]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n4PCQj1R014961; Mon, 25 May 2009 08:26:45 -0400 Date: Mon, 25 May 2009 15:25:50 +0300 From: "Michael S. Tsirkin" To: Paul Brook , Avi Kivity , qemu-devel@nongnu.org, Carsten Otte , kvm@vger.kernel.org, Rusty Russell , virtualization@lists.linux-foundation.org, Christian Borntraeger , Blue Swirl Subject: [PATCH 06/11] qemu: add flag to disable MSI-X by default Message-ID: <20090525122550.GG5046@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add global flag to disable MSI-X by default. This is useful primarily to make images loadable by older qemu (without msix). Even when MSI-X is disabled by flag, you can still load images that have MSI-X enabled. Signed-off-by: Michael S. Tsirkin --- hw/msix.c | 3 +++ qemu-options.hx | 2 ++ vl.c | 3 +++ 3 files changed, 8 insertions(+), 0 deletions(-) diff --git a/hw/msix.c b/hw/msix.c index 4db2fc1..970a8ca 100644 --- a/hw/msix.c +++ b/hw/msix.c @@ -122,6 +122,9 @@ void msix_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len) { unsigned enable_pos = dev->msix_cap + MSIX_ENABLE_OFFSET; + if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) + return; + if (addr + len <= enable_pos || addr > enable_pos) return; diff --git a/qemu-options.hx b/qemu-options.hx index 87af798..fd041a4 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1575,3 +1575,5 @@ DEF("semihosting", 0, QEMU_OPTION_semihosting, DEF("old-param", 0, QEMU_OPTION_old_param, "-old-param old param mode\n") #endif +DEF("disable-msix", 0, QEMU_OPTION_disable_msix, + "-disable-msix disable msix support for PCI devices (enabled by default)\n") diff --git a/vl.c b/vl.c index 2c1f0e0..2757d4f 100644 --- a/vl.c +++ b/vl.c @@ -134,6 +134,7 @@ int main(int argc, char **argv) #include "hw/usb.h" #include "hw/pcmcia.h" #include "hw/pc.h" +#include "hw/msix.h" #include "hw/audiodev.h" #include "hw/isa.h" #include "hw/baum.h" @@ -5557,6 +5558,8 @@ int main(int argc, char **argv, char **envp) xen_mode = XEN_ATTACH; break; #endif + case QEMU_OPTION_disable_msix: + msix_disable = 1; } } }