From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUi5A-0002ws-FI for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:46:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUi58-0002vG-Lv for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:46:23 -0500 Received: from [199.232.76.173] (port=37325 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUi58-0002v7-EV for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:46:22 -0500 Received: from mx2.redhat.com ([66.187.237.31]:34147) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUi57-0000h5-V0 for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:46:22 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n14DkLXs010774 for ; Wed, 4 Feb 2009 08:46:21 -0500 Message-Id: <20090204133924.445066836@localhost.localdomain> References: <20090204133303.113145633@localhost.localdomain> Date: Wed, 04 Feb 2009 11:33:16 -0200 From: Marcelo Tosatti Content-Disposition: inline; filename=pci-warning-size Subject: [Qemu-devel] [patch 13/18] qemu: warn if PCI region is not power of two Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcelo Tosatti Otherwise the PCI size for such regions can be calculated erroneously. Signed-off-by: Marcelo Tosatti Index: trunk/hw/pci.c =================================================================== --- trunk.orig/hw/pci.c +++ trunk/hw/pci.c @@ -249,6 +249,11 @@ void pci_register_io_region(PCIDevice *p if ((unsigned int)region_num >= PCI_NUM_REGIONS) return; + + if (size & (size-1)) + term_printf("WARNING: PCI region size must be pow2 " + "type=0x%x, size=0x%x\n", type, size); + r = &pci_dev->io_regions[region_num]; r->addr = -1; r->size = size; --