From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 771C9C04EBF for ; Mon, 23 Sep 2019 13:13:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A88120835 for ; Mon, 23 Sep 2019 13:13:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A88120835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCOA4-0003X9-SE for qemu-devel@archiver.kernel.org; Mon, 23 Sep 2019 09:13:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55033) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCO7g-0001wp-2R for qemu-devel@nongnu.org; Mon, 23 Sep 2019 09:11:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCO7e-0006Ux-VC for qemu-devel@nongnu.org; Mon, 23 Sep 2019 09:11:23 -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 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-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , Richard Henderson , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefano Garzarella Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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