Skip to contentSkip to conversation

[6604] qemu: warn if PCI region is not power of two (Marcelo Tosatti)

Qemu-devel Anthony Liguori 1 participant 1 message Feb 11, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 6604

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6604
Author:   aliguori
Date:     2009-02-11 15:21:16 +0000 (Wed, 11 Feb 2009)

Log Message:
-----------
qemu: warn if PCI region is not power of two (Marcelo Tosatti)

Otherwise the PCI size for such regions can be calculated erroneously.

Modified Paths:
--------------
trunk/hw/pci.c

Modified: trunk/hw/pci.c
===================================================================

hw/pci.c +7 -0
@@ -247,6 +247,13 @@
 
     if ((unsigned int)region_num >= PCI_NUM_REGIONS)
         return;
+
+    if (size & (size-1)) {
+        fprintf(stderr, "ERROR: PCI region size must be pow2 "
+                    "type=0x%x, size=0x%x\n", type, size);
+        exit(1);
+    }
+
     r = &pci_dev->io_regions[region_num];
     r->addr = -1;
     r->size = size;