Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iCO7q-00022l-MI for mharc-qemu-trivial@gnu.org; Mon, 23 Sep 2019 09:11:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55051) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCO7k-00020Y-DY for qemu-trivial@nongnu.org; Mon, 23 Sep 2019 09:11:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCO7i-0006Vs-F1 for qemu-trivial@nongnu.org; Mon, 23 Sep 2019 09:11:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56514) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iCO7a-0006Tk-1d; Mon, 23 Sep 2019 09:11:19 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A62A4C01B81A; Mon, 23 Sep 2019 13:11:16 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.15]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1659710013D9; Mon, 23 Sep 2019 13:11:10 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Stefano Garzarella , Thomas Huth Subject: [PATCH v2] hw/arm/boot: Use the IEC binary prefix definitions Date: Mon, 23 Sep 2019 15:11:08 +0200 Message-Id: <20190923131108.21459-1-philmd@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 23 Sep 2019 13:11:16 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2019 13:11:30 -0000 IEC binary prefixes ease code review: the unit is explicit. Reviewed-by: Richard Henderson Reviewed-by: Stefano Garzarella Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v2: Use 4*GiB in arm_load_dtb (sgarzare) --- hw/arm/boot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index bf97ef3e33..bc3e7be1e6 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -575,7 +575,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_i= nfo *binfo, goto fail; } =20 - if (scells < 2 && binfo->ram_size >=3D (1ULL << 32)) { + if (scells < 2 && binfo->ram_size >=3D 4 * GiB) { /* This is user error so deserves a friendlier error message * than the failure of setprop_sized_cells would provide */ @@ -1095,7 +1095,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cp= u, * we might still make a bad choice here. */ info->initrd_start =3D info->loader_start + - MIN(info->ram_size / 2, 128 * 1024 * 1024); + MIN(info->ram_size / 2, 128 * MiB); if (image_high_addr) { info->initrd_start =3D MAX(info->initrd_start, image_high_addr); } @@ -1155,13 +1155,13 @@ static void arm_setup_direct_kernel_boot(ARMCPU *= cpu, * * Let's play safe and prealign it to 2MB to give us som= e space. */ - align =3D 2 * 1024 * 1024; + align =3D 2 * MiB; } else { /* * Some 32bit kernels will trash anything in the 4K page= the * initrd ends in, so make sure the DTB isn't caught up = in that. */ - align =3D 4096; + align =3D 4 * KiB; } =20 /* Place the DTB after the initrd in memory with alignment. = */ @@ -1178,7 +1178,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cp= u, info->loader_start + KERNEL_ARGS_ADDR; fixupcontext[FIXUP_ARGPTR_HI] =3D (info->loader_start + KERNEL_ARGS_ADDR) >> 32; - if (info->ram_size >=3D (1ULL << 32)) { + if (info->ram_size >=3D 4 * GiB) { error_report("RAM size must be less than 4GB to boot" " Linux kernel using ATAGS (try passing a d= evice tree" " using -dtb)"); --=20 2.20.1