From patchwork Sun Nov 23 11:18:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 413386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 735CE1400F1 for ; Sun, 23 Nov 2014 22:23:00 +1100 (AEDT) Received: from localhost ([::1]:48244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsVFq-00023z-Kp for incoming@patchwork.ozlabs.org; Sun, 23 Nov 2014 06:22:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsVBQ-0002zQ-MU for qemu-devel@nongnu.org; Sun, 23 Nov 2014 06:18:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XsVBK-0004j0-I1 for qemu-devel@nongnu.org; Sun, 23 Nov 2014 06:18:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsVBK-0004io-BN for qemu-devel@nongnu.org; Sun, 23 Nov 2014 06:18:18 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sANBI5wo021182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 23 Nov 2014 06:18:06 -0500 Received: from redhat.com (ovpn-116-38.ams2.redhat.com [10.36.116.38]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id sANBI2ei030099; Sun, 23 Nov 2014 06:18:03 -0500 Date: Sun, 23 Nov 2014 13:18:01 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1416741307-32307-8-git-send-email-mst@redhat.com> References: <1416741307-32307-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1416741307-32307-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Peter Crosthwaite , zhanghailiang , Tang Chen , Anthony Liguori , Igor Mammedov Subject: [Qemu-devel] [PULL 07/15] pc: pc-dimm: use backend alignment during address auto allocation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/mem/pc-dimm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 4944f0f..d431834 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -146,6 +146,9 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start, uint64_t new_addr, ret = 0; uint64_t address_space_end = address_space_start + address_space_size; + g_assert(QEMU_ALIGN_UP(address_space_start, align) == address_space_start); + g_assert(QEMU_ALIGN_UP(address_space_size, align) == address_space_size); + if (!address_space_size) { error_setg(errp, "memory hotplug is not enabled, " "please add maxmem option"); @@ -189,7 +192,7 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start, error_setg(errp, "address range conflicts with '%s'", d->id); goto out; } - new_addr = dimm->addr + dimm_size; + new_addr = QEMU_ALIGN_UP(dimm->addr + dimm_size, align); } } ret = new_addr;