From nobody Tue Nov 4 18:44:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530339770763155.5981556230771; Fri, 29 Jun 2018 23:22:50 -0700 (PDT) Received: from localhost ([::1]:45724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ9HV-0005u2-VT for importer@patchew.org; Sat, 30 Jun 2018 02:22:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ96A-0004Dg-3C for qemu-devel@nongnu.org; Sat, 30 Jun 2018 02:11:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fZ969-00027i-1l for qemu-devel@nongnu.org; Sat, 30 Jun 2018 02:11:06 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:50480) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fZ968-00026Q-OZ for qemu-devel@nongnu.org; Sat, 30 Jun 2018 02:11:04 -0400 Received: by mail-wm0-x235.google.com with SMTP id v25-v6so3127228wmc.0 for ; Fri, 29 Jun 2018 23:11:04 -0700 (PDT) Received: from donizetti.lan ([82.84.124.111]) by smtp.gmail.com with ESMTPSA id 24-v6sm563454wrz.94.2018.06.29.23.11.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jun 2018 23:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uYuYG5Q7e8ZCofGVeD4Z4X1I3oUBODLktzO3kHSlRmw=; b=NiXI0+Exb+IlAfksHo0sN7W7b0vkUscS9XjnaAfWhS/MIvkc4LFjVY1OE+ngLwiKV8 7+BQJ5SgMK3Vw8V9gg8OHGM15dluJ/33GmjxB4KEeHt55rHQpz853csEK5QeBD8L7mwz r/NJG1bGxO/IpcMBv8q6990DUZFdjqThSioRVXHUsNGaLr4m1x3k97LYrKELrHaaZdJc arlpqE27RKZxhIP3JT+GY39ucDcDY7KAqs362/9XFV3GBsepF3IEUG70IOYHduJBCUF2 o/ymUgu5dATDlmm5KvJbsOD7PjrV+A2JJMNMtdPE9XP/nPiqKwoLcDjg/LqMpsONWH3u qJQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=uYuYG5Q7e8ZCofGVeD4Z4X1I3oUBODLktzO3kHSlRmw=; b=j67c5nEI6JrNYneQ/W2xsJAsz8KPz4yjJXzOLqLrIS7PA7LmFaYPD1plRgSK/mOr+4 d4nlwI980yQgpgRrWTXlyjmqgvl69HWexTmqRmk+BfwGCC49+E/Qf8hRRtipixxVaL4B yMwD7AUpf83oY/kSN1eHLSX9I9bt7qqo07qgrf6dUVnCyigntThLCKgpdAGsmJ4aUOrw dr4/EyW8jjkOcUNo2ZtZaGGv45mm3zH4O4XWVcTCSBYS7FoT3yVLcvkNdrlvlZJZWK1l Le0kJg0QfbEt74fD9ULQzBtSRdkO/odEeECmtnh5Pso9ZtREGGCjFr5b32jHyDNSrPsR yJ2Q== X-Gm-Message-State: APt69E23rCfFf3WN460477g82+xDmSvHfxL5KgTGWNxaP5IL50WIZ/D6 jc7OVrs0FvZBsEVVpmdrQoFgjsdw X-Google-Smtp-Source: AAOMgpdBZnuITltHwDbkRPHJl24v8MJWOvreoYEls1DZ1YWDiaZQiizWBlL4AFQHTm3W0Mvup/pfkg== X-Received: by 2002:a1c:6341:: with SMTP id x62-v6mr3627088wmb.35.1530339063571; Fri, 29 Jun 2018 23:11:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sat, 30 Jun 2018 08:10:13 +0200 Message-Id: <20180630061040.6018-21-pbonzini@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180630061040.6018-1-pbonzini@redhat.com> References: <20180630061040.6018-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::235 Subject: [Qemu-devel] [PULL 20/47] hw/sparc: Use the IEC binary prefix definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 It eases code review, unit is explicit. Patch generated using: $ git grep -E '(1024|2048|4096|8192|(<<|>>).?(10|20|30))' hw/ include/hw/ and modified manually. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180625124238.25339-19-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/sparc/leon3.c | 10 ++++++---- hw/sparc/sun4m.c | 10 +++++----- hw/sparc64/niagara.c | 3 ++- hw/sparc64/sun4u.c | 4 ++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 98fa6ad..fa98ab8 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" @@ -139,9 +140,10 @@ static void leon3_generic_hw_init(MachineState *machin= e) env->qemu_irq_ack =3D leon3_irq_manager; =20 /* Allocate RAM */ - if ((uint64_t)ram_size > (1UL << 30)) { - error_report("Too much memory for this machine: %d, maximum 1G", - (unsigned int)(ram_size / (1024 * 1024))); + if (ram_size > 1 * GiB) { + error_report("Too much memory for this machine: %" PRId64 "MB," + " maximum 1G", + ram_size / MiB); exit(1); } =20 @@ -149,7 +151,7 @@ static void leon3_generic_hw_init(MachineState *machine) memory_region_add_subregion(address_space_mem, 0x40000000, ram); =20 /* Allocate BIOS */ - prom_size =3D 8 * 1024 * 1024; /* 8Mb */ + prom_size =3D 8 * MiB; memory_region_init_ram(prom, NULL, "Leon3.bios", prom_size, &error_fat= al); memory_region_set_readonly(prom, true); memory_region_add_subregion(address_space_mem, 0x00000000, prom); diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index b984d2d..a9d4775 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -45,7 +46,6 @@ #include "hw/loader.h" #include "elf.h" #include "trace.h" -#include "qemu/cutils.h" =20 /* * Sun4m architecture was used in the following machines: @@ -66,7 +66,7 @@ #define KERNEL_LOAD_ADDR 0x00004000 #define CMDLINE_ADDR 0x007ff000 #define INITRD_LOAD_ADDR 0x00800000 -#define PROM_SIZE_MAX (1024 * 1024) +#define PROM_SIZE_MAX (1 * MiB) #define PROM_VADDR 0xffd00000 #define PROM_FILENAME "openbios-sparc32" #define CFG_ADDR 0xd00000510ULL @@ -774,9 +774,9 @@ static void ram_init(hwaddr addr, ram_addr_t RAM_size, =20 /* allocate RAM */ if ((uint64_t)RAM_size > max_mem) { - error_report("Too much memory for this machine: %d, maximum %d", - (unsigned int)(RAM_size / (1024 * 1024)), - (unsigned int)(max_mem / (1024 * 1024))); + error_report("Too much memory for this machine: %" PRId64 "," + " maximum %" PRId64, + RAM_size / MiB, max_mem / MiB); exit(1); } dev =3D qdev_create(NULL, "memory"); diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c index 22c4655..4fa8cb2 100644 --- a/hw/sparc64/niagara.c +++ b/hw/sparc64/niagara.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "qemu-common.h" #include "cpu.h" #include "hw/hw.h" @@ -84,7 +85,7 @@ typedef struct NiagaraBoardState { #define NIAGARA_PROM_BASE 0xfff0000000ULL #define NIAGARA_Q_OFFSET 0x10000ULL #define NIAGARA_OBP_OFFSET 0x80000ULL -#define PROM_SIZE_MAX (4 * 1024 * 1024) +#define PROM_SIZE_MAX (4 * MiB) =20 static void add_rom_or_fail(const char *file, const hwaddr addr) { diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 3975a7b..97d1269 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" @@ -52,11 +53,10 @@ #include "hw/loader.h" #include "elf.h" #include "trace.h" -#include "qemu/cutils.h" =20 #define KERNEL_LOAD_ADDR 0x00404000 #define CMDLINE_ADDR 0x003ff000 -#define PROM_SIZE_MAX (4 * 1024 * 1024) +#define PROM_SIZE_MAX (4 * MiB) #define PROM_VADDR 0x000ffd00000ULL #define PBM_SPECIAL_BASE 0x1fe00000000ULL #define PBM_MEM_BASE 0x1ff00000000ULL --=20 1.8.3.1