From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMdZU-0003G5-Pt for qemu-devel@nongnu.org; Wed, 27 Aug 2014 09:47:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMdZO-0001x3-7D for qemu-devel@nongnu.org; Wed, 27 Aug 2014 09:47:32 -0400 Date: Wed, 27 Aug 2014 15:47:51 +0200 From: "Michael S. Tsirkin" Message-ID: <20140827134751.GA18523@redhat.com> References: <1408407718-10835-1-git-send-email-mdroth@linux.vnet.ibm.com> <1408407718-10835-9-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1408407718-10835-9-git-send-email-mdroth@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH 08/12] pci: allow 0 address for PCI IO regions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de, ncmike@ncultra.org, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com On Mon, Aug 18, 2014 at 07:21:54PM -0500, Michael Roth wrote: > Some kernels program a 0 address for io regions. PCI 3.0 spec > section 6.2.5.1 doesn't seem to disallow this. > > Signed-off-by: Michael Roth Yes the PCI spec does not care. But unfortunately as documented in the comment, at least for PC (maybe others) priorities aren't currently setup correctly, so programming PCI BAR at address zero (during sizing) conflicts with whatever else is there. To make address 0 work, you'll have to fix up the prioriorities for a bunch of machine types :( > --- > hw/pci/pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index 351d320..9578749 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -1035,7 +1035,7 @@ static pcibus_t pci_bar_address(PCIDevice *d, > /* Check if 32 bit BAR wraps around explicitly. > * TODO: make priorities correct and remove this work around. > */ > - if (last_addr <= new_addr || new_addr == 0 || last_addr >= UINT32_MAX) { > + if (last_addr <= new_addr || last_addr >= UINT32_MAX) { > return PCI_BAR_UNMAPPED; > } > return new_addr; > -- > 1.9.1 >