From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQAx1-00069n-4n for qemu-devel@nongnu.org; Sun, 29 Sep 2013 02:57:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VQAwu-0002V0-Ur for qemu-devel@nongnu.org; Sun, 29 Sep 2013 02:57:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQAwu-0002Un-Lx for qemu-devel@nongnu.org; Sun, 29 Sep 2013 02:57:48 -0400 Date: Sun, 29 Sep 2013 10:00:08 +0300 From: "Michael S. Tsirkin" Message-ID: <1380437951-21788-9-git-send-email-mst@redhat.com> References: <1380437951-21788-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1380437951-21788-1-git-send-email-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 08/14] pci: remove explicit check to 64K ioport size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?us-ascii?B?PT9VVEYtOD9xP0hlcnY9QzM9QTk9MjBQb3Vzc2luZWF1Pz0=?= , Richard Henderson From: Herv=E9 Poussineau This check is useless, as bigger addresses will be ignored when added to 'io' MemoryRegion, which has a size of 64K. However, some architectures don't use the 'io' MemoryRegion, like the alpha and versatile platforms. They create a PCI I/O region bigger than 64K, so let them handle PCI I/O BARs in the higher range. MST: reinstated work-around for BAR sizing. Signed-off-by: Herv=E9 Poussineau Reviewed-by: Richard Henderson Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 52cbab7..00554a0 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1028,8 +1028,10 @@ static pcibus_t pci_bar_address(PCIDevice *d, } new_addr =3D pci_get_long(d->config + bar) & ~(size - 1); last_addr =3D new_addr + size - 1; - /* NOTE: we have only 64K ioports on PC */ - if (last_addr <=3D new_addr || new_addr =3D=3D 0 || last_addr > = UINT16_MAX) { + /* Check if 32 bit BAR wraps around explicitly. + * TODO: make priorities correct and remove this work around. + */ + if (last_addr <=3D new_addr || new_addr =3D=3D 0 || last_addr >=3D= UINT32_MAX) { return PCI_BAR_UNMAPPED; } return new_addr; --=20 MST