diff mbox

qemu-kvm: require 4K aligned resource size for memory

Message ID 20091020171508.GD13378@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael S. Tsirkin Oct. 20, 2009, 5:15 p.m. UTC
None
diff mbox

Patch

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 237060f..c2ef31f 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -381,6 +381,14 @@  static int assigned_dev_register_regions(PCIRegion *io_regions,
             int t = cur_region->type & IORESOURCE_PREFETCH
                 ? PCI_ADDRESS_SPACE_MEM_PREFETCH
                 : PCI_ADDRESS_SPACE_MEM;
+            if (cur_region->size & 0xFFF) {
+                fprintf(stderr, "Unable to assign device: PCI region %d "
+                        "at address 0x%llx has size 0x%x, "
+                        " which is not a multiple of 4K\n",
+                        i, (unsigned long long)cur_region->base_addr,
+                        cur_region->size);
+                return -1;
+            }
 
             /* map physical memory */
             pci_dev->v_addrs[i].e_physbase = cur_region->base_addr;