From patchwork Tue Oct 20 17:15:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 54981 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9KHHP8Q026534 for ; Tue, 20 Oct 2009 17:17:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752703AbZJTRRS (ORCPT ); Tue, 20 Oct 2009 13:17:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752484AbZJTRRS (ORCPT ); Tue, 20 Oct 2009 13:17:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27803 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751477AbZJTRRS (ORCPT ); Tue, 20 Oct 2009 13:17:18 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9KHHMfA016384 for ; Tue, 20 Oct 2009 13:17:23 -0400 Received: from redhat.com (vpn-10-137.str.redhat.com [10.32.10.137]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n9KHHK0f014790; Tue, 20 Oct 2009 13:17:20 -0400 Date: Tue, 20 Oct 2009 19:15:09 +0200 From: "Michael S. Tsirkin" To: Chris Wright Cc: Avi Kivity , Dor Laor , kvm@vger.kernel.org Subject: qemu-kvm: require 4K aligned resource size for memory Message-ID: <20091020171508.GD13378@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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;