From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MEMyY-00016q-ET for qemu-devel@nongnu.org; Wed, 10 Jun 2009 08:32:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MEMyT-00014J-Dz for qemu-devel@nongnu.org; Wed, 10 Jun 2009 08:32:17 -0400 Received: from [199.232.76.173] (port=33036 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MEMyT-00014F-9O for qemu-devel@nongnu.org; Wed, 10 Jun 2009 08:32:13 -0400 Received: from mx2.redhat.com ([66.187.237.31]:47822) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MEMyS-0003iP-A5 for qemu-devel@nongnu.org; Wed, 10 Jun 2009 08:32:12 -0400 Date: Wed, 10 Jun 2009 15:28:42 +0300 From: "Michael S. Tsirkin" Message-ID: <20090610122842.GG27174@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCHv4 06/13] qemu: add flag to disable MSI-X by default List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 , Anthony Liguori , Glauber Costa 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 a448eab..ce4e6ba 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 fa549c3..ed92ec2 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 f08f0f3..8c116c7 100644 --- a/vl.c +++ b/vl.c @@ -135,6 +135,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" @@ -5681,6 +5682,8 @@ int main(int argc, char **argv, char **envp) xen_mode = XEN_ATTACH; break; #endif + case QEMU_OPTION_disable_msix: + msix_disable = 1; } } } -- 1.6.3.1.56.g79e1.dirty