From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOCSN-0003UD-As for qemu-devel@nongnu.org; Wed, 18 Feb 2015 16:46:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOCSJ-0003te-D6 for qemu-devel@nongnu.org; Wed, 18 Feb 2015 16:46:55 -0500 Received: from mail.kernel.org ([198.145.29.136]:51541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOCSJ-0003tW-81 for qemu-devel@nongnu.org; Wed, 18 Feb 2015 16:46:51 -0500 Date: Wed, 18 Feb 2015 22:46:45 +0100 From: "Michael S. Tsirkin" Message-ID: <1424295164-4774-28-git-send-email-mst@redhat.com> References: <1424295164-4774-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1424295164-4774-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 27/96] exec: round up size on MR resize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , dgilbert@redhat.com, Paolo Bonzini , Juan Quintela Block size must fundamentally be a multiple of target page size. Aligning automatically removes need to worry about the alignment from callers. Note: the only caller of qemu_ram_resize (acpi) already happens to have size padded to a power of 2, but we would like to drop the padding in ACPI core, and don't want to expose target page size knowledge to ACPI. Signed-off-by: Michael S. Tsirkin Acked-by: Paolo Bonzini --- exec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exec.c b/exec.c index 6dff7bc..878dc54 100644 --- a/exec.c +++ b/exec.c @@ -1298,6 +1298,8 @@ int qemu_ram_resize(ram_addr_t base, ram_addr_t newsize, Error **errp) assert(block); + newsize = TARGET_PAGE_ALIGN(newsize); + if (block->used_length == newsize) { return 0; } -- MST