qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [Qemu-devel] [PULL 23/47] hw/xtensa: Use the IEC binary prefix definitions
Date: Sat, 30 Jun 2018 08:10:16 +0200	[thread overview]
Message-ID: <20180630061040.6018-24-pbonzini@redhat.com> (raw)
In-Reply-To: <20180630061040.6018-1-pbonzini@redhat.com>

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

It eases code review, unit is explicit.

Patch generated using:

  $ git grep -E '(1024|2048|4096|8192|(<<|>>).?(10|20|30))' hw/ include/hw/
  $ git grep -n '[<>][<>]= ?[1-5]0'

and modified manually.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Message-Id: <20180625124238.25339-22-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/xtensa/xtfpga.c     | 9 +++++----
 target/xtensa/helper.c | 5 +++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index 5dc1303..b3161de 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -26,6 +26,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "qapi/error.h"
 #include "cpu.h"
 #include "sysemu/sysemu.h"
@@ -152,7 +153,7 @@ static void xtfpga_net_init(MemoryRegion *address_space,
             sysbus_mmio_get_region(s, 1));
 
     ram = g_malloc(sizeof(*ram));
-    memory_region_init_ram_nomigrate(ram, OBJECT(s), "open_eth.ram", 16384,
+    memory_region_init_ram_nomigrate(ram, OBJECT(s), "open_eth.ram", 16 * KiB,
                            &error_fatal);
     vmstate_register_ram_global(ram);
     memory_region_add_subregion(address_space, buffers, ram);
@@ -229,7 +230,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
     const char *kernel_cmdline = qemu_opt_get(machine_opts, "append");
     const char *dtb_filename = qemu_opt_get(machine_opts, "dtb");
     const char *initrd_filename = qemu_opt_get(machine_opts, "initrd");
-    const unsigned system_io_size = 224 * 1024 * 1024;
+    const unsigned system_io_size = 224 * MiB;
     int n;
 
     for (n = 0; n < smp_cpus; n++) {
@@ -342,7 +343,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
             cpu_physical_memory_write(cur_lowmem, fdt, fdt_size);
             cur_tagptr = put_tag(cur_tagptr, BP_TAG_FDT,
                                  sizeof(dtb_addr), &dtb_addr);
-            cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + fdt_size, 4096);
+            cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + fdt_size, 4 * KiB);
         }
 #else
         if (dtb_filename) {
@@ -370,7 +371,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
             initrd_location.end = tswap32(cur_lowmem + initrd_size);
             cur_tagptr = put_tag(cur_tagptr, BP_TAG_INITRD,
                                  sizeof(initrd_location), &initrd_location);
-            cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + initrd_size, 4096);
+            cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + initrd_size, 4 * KiB);
         }
         cur_tagptr = put_tag(cur_tagptr, BP_TAG_LAST, 0, NULL);
         env->regs[2] = tagptr;
diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
index 34844ee..c9a6132 100644
--- a/target/xtensa/helper.c
+++ b/target/xtensa/helper.c
@@ -26,6 +26,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/gdbstub.h"
@@ -726,10 +727,10 @@ static void dump_tlb(FILE *f, fprintf_function cpu_fprintf,
         bool print_header = true;
 
         if (sz >= 0x100000) {
-            sz >>= 20;
+            sz /= MiB;
             sz_text = "MB";
         } else {
-            sz >>= 10;
+            sz /= KiB;
             sz_text = "KB";
         }
 
-- 
1.8.3.1

  parent reply	other threads:[~2018-06-30  6:11 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-30  6:09 [Qemu-devel] [PULL 00/47] More misc patches for 3.0 soft freeze Paolo Bonzini
2018-06-30  6:09 ` [Qemu-devel] [PULL 01/47] i386/kvm: add support for Hyper-V TLB flush Paolo Bonzini
2018-06-30  6:09 ` [Qemu-devel] [PULL 02/47] configure: add sanity check to catch builds from "git archive" Paolo Bonzini
2018-06-30  6:09 ` [Qemu-devel] [PULL 03/47] include: Add IEC binary prefixes in "qemu/units.h" Paolo Bonzini
2018-06-30  6:09 ` [Qemu-devel] [PULL 04/47] vdi: Use definitions from "qemu/units.h" Paolo Bonzini
2018-06-30  6:09 ` [Qemu-devel] [PULL 05/47] x86/cpu: " Paolo Bonzini
2018-06-30  6:09 ` [Qemu-devel] [PULL 06/47] checkpatch: Recognize IEC binary prefix definitions Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 07/47] hw: Use IEC binary prefix definitions from "qemu/units.h" Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 08/47] hw: Directly use "qemu/units.h" instead of "qemu/cutils.h" Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 09/47] hw/ivshmem: Use the IEC binary prefix definitions Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 10/47] hw/ipack: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 11/47] hw/scsi: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 12/47] hw/smbios: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 13/47] hw/xen: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 14/47] hw/tpm: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 15/47] hw/block: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 16/47] hw/display: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 17/47] hw/misc: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 18/47] hw/riscv: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 19/47] hw/m68k: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 20/47] hw/sparc: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 21/47] hw/s390x: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 22/47] hw/hppa: " Paolo Bonzini
2018-06-30  6:10 ` Paolo Bonzini [this message]
2018-06-30  6:10 ` [Qemu-devel] [PULL 24/47] hw/alpha: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 25/47] hw/tricore: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 26/47] hw/microblaze: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 27/47] hw/nios2: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 28/47] hw/cris: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 29/47] hw/lm32: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 30/47] hw/sh4: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 31/47] hw/mips/r4k: Constify params_size Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 32/47] hw/mips: Use the IEC binary prefix definitions Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 33/47] hw/ppc: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 34/47] hw/i386: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 35/47] hw/net: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 36/47] hw/usb: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 37/47] hw/sd: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 38/47] hw/vfio: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 39/47] hw/virtio: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 40/47] hw/rdma: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 41/47] cutils: Do not include "qemu/units.h" directly Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 42/47] monitor: Use the IEC binary prefix definitions Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 43/47] vl: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 44/47] tests/crypto: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 45/47] linux-user: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 46/47] bsd-user: " Paolo Bonzini
2018-06-30  6:10 ` [Qemu-devel] [PULL 47/47] serial: Open non-block Paolo Bonzini
2018-06-30 15:39 ` [Qemu-devel] [PULL 00/47] More misc patches for 3.0 soft freeze Peter Maydell
2018-06-30 15:51   ` Paolo Bonzini
2018-06-30 16:50     ` [Qemu-devel] [PATCH] !fixup 052f529eb3d07170b18b8d0920bc8c450e389a2f Philippe Mathieu-Daudé
2018-07-02  8:37       ` Paolo Bonzini
2018-07-02 13:32       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180630061040.6018-24-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).