From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MEOml-0005bS-Ji for qemu-devel@nongnu.org; Wed, 10 Jun 2009 10:28:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MEOmg-0005XY-In for qemu-devel@nongnu.org; Wed, 10 Jun 2009 10:28:14 -0400 Received: from [199.232.76.173] (port=54950 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MEOmg-0005XI-Ch for qemu-devel@nongnu.org; Wed, 10 Jun 2009 10:28:10 -0400 Received: from mx2.redhat.com ([66.187.237.31]:60685) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MEOmf-0004xz-Tc for qemu-devel@nongnu.org; Wed, 10 Jun 2009 10:28:10 -0400 Date: Wed, 10 Jun 2009 17:25:08 +0300 From: "Michael S. Tsirkin" Subject: Re: [Qemu-devel] [PATCH 05/11] qemu: MSI-X support functions Message-ID: <20090610142508.GA28409@redhat.com> References: <200906100019.59981.paul@codesourcery.com> <20090610094604.GD6844@redhat.com> <200906101507.39823.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200906101507.39823.paul@codesourcery.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: Carsten Otte , kvm@vger.kernel.org, Rusty Russell , qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, Blue Swirl , Christian Borntraeger , Avi Kivity On Wed, Jun 10, 2009 at 03:07:34PM +0100, Paul Brook wrote: > > > > Note that platform must set a flag to declare MSI supported. > > > > For PC this will be set by APIC. > > > > > > This sounds wrong. The device shouldn't know or care whether the system > > > has a MSI capable interrupt controller. That's for the guest OS to figure > > > out. > > > > You are right of course. In theory there's nothing that breaks if I > > set this flag to on, on all platforms. OTOH if qemu emulates some > > controller incorrectly, guest might misdetect MSI support in the > > controller, and things will break horribly. > > > > It seems safer to have a flag that can be enabled by people > > that know about a specific platform. > > No. The solution is to fix whatever is broken. That's easy enough then. Patch below. > > If we really need to avoid MSI-X capable devices then that should be done > explicity per-device. i.e. you have a different virtio-net device that does > not use MSI-X. > > Paul Why should it be done per-device? ---> Don't add an option for platforms to disable MSI-X in all devices. Paul Brook will find and fix all platforms that have broken MSI-X emulation. Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/apic.c b/hw/apic.c index ed03a36..9d44061 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -945,7 +945,6 @@ int apic_init(CPUState *env) s->cpu_env = env; apic_reset(s); - msix_supported = 1; /* XXX: mapping more APICs at the same memory location */ if (apic_io_memory == 0) { diff --git a/hw/msix.c b/hw/msix.c index ce4e6ba..16efb27 100644 --- a/hw/msix.c +++ b/hw/msix.c @@ -62,9 +62,6 @@ /* Flag to globally disable MSI-X support */ int msix_disable; -/* Flag for interrupt controller to declare MSI-X support */ -int msix_supported; - /* Add MSI-X capability to the config space for the device. */ /* Given a bar and its size, add MSI-X table on top of it * and fill MSI-X capability in the config space. @@ -232,10 +229,7 @@ void msix_mmio_map(PCIDevice *d, int region_num, int msix_init(struct PCIDevice *dev, unsigned short nentries, unsigned bar_nr, unsigned bar_size) { - int ret = -ENOMEM; - /* Nothing to do if MSI is not supported by interrupt controller */ - if (!msix_supported) - return -ENOTTY; + int ret; if (nentries > MSIX_MAX_ENTRIES) return -EINVAL; diff --git a/hw/msix.h b/hw/msix.h index 79e84a3..2fcadd3 100644 --- a/hw/msix.h +++ b/hw/msix.h @@ -30,6 +30,5 @@ void msix_notify(PCIDevice *dev, unsigned vector); void msix_reset(PCIDevice *dev); extern int msix_disable; -extern int msix_supported; #endif -- MST