From patchwork Sun Sep 29 07:00:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 278812 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 23F972C00E0 for ; Sun, 29 Sep 2013 17:03:19 +1000 (EST) Received: from localhost ([::1]:43746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQB2C-0006Zk-I6 for incoming@patchwork.ozlabs.org; Sun, 29 Sep 2013 03:03:16 -0400 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 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8T6vl8U012219 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 29 Sep 2013 02:57:48 -0400 Received: from redhat.com (vpn1-5-44.ams2.redhat.com [10.36.5.44]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8T6vjmJ008266; Sun, 29 Sep 2013 02:57:46 -0400 Date: Sun, 29 Sep 2013 10:00:08 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org 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-Disposition: inline In-Reply-To: <1380437951-21788-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r8T6vl8U012219 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: =?us-ascii?B?PT9VVEYtOD9xP0hlcnY9QzM9QTk9MjBQb3Vzc2luZWF1Pz0=?= , Richard Henderson Subject: [Qemu-devel] [PULL 08/14] pci: remove explicit check to 64K ioport size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hervé 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é 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 = pci_get_long(d->config + bar) & ~(size - 1); last_addr = new_addr + size - 1; - /* NOTE: we have only 64K ioports on PC */ - if (last_addr <= new_addr || new_addr == 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 <= new_addr || new_addr == 0 || last_addr >= UINT32_MAX) { return PCI_BAR_UNMAPPED; } return new_addr;