[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/47] hw/xen: Use the IEC binary prefix definitions
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 13/47] hw/xen: Use the IEC binary prefix definitions |
Date: |
Sat, 30 Jun 2018 08:10:06 +0200 |
From: Philippe Mathieu-Daudé <address@hidden>
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é <address@hidden>
Reviewed-by: Alan Robinson <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/block/xen_disk.c | 3 ++-
hw/i386/xen/xen-mapcache.c | 3 ++-
hw/xenpv/xen_domainbuild.c | 13 +++++++------
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 9fbc0cd..36eff94 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -20,6 +20,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include <sys/ioctl.h>
#include <sys/uio.h>
@@ -814,7 +815,7 @@ static int blk_connect(struct XenDevice *xendev)
xen_pv_printf(xendev, 1, "type \"%s\", fileproto \"%s\", filename \"%s\","
" size %" PRId64 " (%" PRId64 " MB)\n",
blkdev->type, blkdev->fileproto, blkdev->filename,
- blkdev->file_size, blkdev->file_size >> 20);
+ blkdev->file_size, blkdev->file_size / MiB);
/* Fill in number of sector size and number of sectors */
xenstore_write_be_int(xendev, "sector-size", blkdev->file_blk);
diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c
index 628b813..4e4f069 100644
--- a/hw/i386/xen/xen-mapcache.c
+++ b/hw/i386/xen/xen-mapcache.c
@@ -9,6 +9,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include "qemu/error-report.h"
#include <sys/resource.h>
@@ -46,7 +47,7 @@
* From empirical tests I observed that qemu use 75MB more than the
* max_mcache_size.
*/
-#define NON_MCACHE_MEMORY_SIZE (80 * 1024 * 1024)
+#define NON_MCACHE_MEMORY_SIZE (80 * MiB)
typedef struct MapCacheEntry {
hwaddr paddr_index;
diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c
index 027f76f..188acac 100644
--- a/hw/xenpv/xen_domainbuild.c
+++ b/hw/xenpv/xen_domainbuild.c
@@ -1,4 +1,5 @@
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include "hw/xen/xen_backend.h"
#include "xen_domainbuild.h"
#include "qemu/timer.h"
@@ -75,9 +76,9 @@ int xenstore_domain_init1(const char *kernel, const char
*ramdisk,
xenstore_write_str(dom, "vm", vm);
/* memory */
- xenstore_write_int(dom, "memory/target", ram_size >> 10); // kB
- xenstore_write_int(vm, "memory", ram_size >> 20); // MB
- xenstore_write_int(vm, "maxmem", ram_size >> 20); // MB
+ xenstore_write_int(dom, "memory/target", ram_size / KiB);
+ xenstore_write_int(vm, "memory", ram_size / MiB);
+ xenstore_write_int(vm, "maxmem", ram_size / MiB);
/* cpus */
for (i = 0; i < smp_cpus; i++) {
@@ -113,7 +114,7 @@ int xenstore_domain_init2(int xenstore_port, int
xenstore_mfn,
/* console */
xenstore_write_str(dom, "console/type", "ioemu");
- xenstore_write_int(dom, "console/limit", 128 * 1024);
+ xenstore_write_int(dom, "console/limit", 128 * KiB);
xenstore_write_int(dom, "console/ring-ref", console_mfn);
xenstore_write_int(dom, "console/port", console_port);
xen_config_dev_console(0);
@@ -260,7 +261,7 @@ int xen_domain_build_pv(const char *kernel, const char
*ramdisk,
}
#endif
- rc = xc_domain_setmaxmem(xen_xc, xen_domid, ram_size >> 10);
+ rc = xc_domain_setmaxmem(xen_xc, xen_domid, ram_size / KiB);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_setmaxmem() failed\n");
goto err;
@@ -269,7 +270,7 @@ int xen_domain_build_pv(const char *kernel, const char
*ramdisk,
xenstore_port = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
console_port = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
- rc = xc_linux_build(xen_xc, xen_domid, ram_size >> 20,
+ rc = xc_linux_build(xen_xc, xen_domid, ram_size / MiB,
kernel, ramdisk, cmdline,
0, flags,
xenstore_port, &xenstore_mfn,
--
1.8.3.1
- [Qemu-devel] [PULL 03/47] include: Add IEC binary prefixes in "qemu/units.h", (continued)
- [Qemu-devel] [PULL 03/47] include: Add IEC binary prefixes in "qemu/units.h", Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 02/47] configure: add sanity check to catch builds from "git archive", Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 05/47] x86/cpu: Use definitions from "qemu/units.h", Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 06/47] checkpatch: Recognize IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 04/47] vdi: Use definitions from "qemu/units.h", Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 01/47] i386/kvm: add support for Hyper-V TLB flush, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 08/47] hw: Directly use "qemu/units.h" instead of "qemu/cutils.h", Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 09/47] hw/ivshmem: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 07/47] hw: Use IEC binary prefix definitions from "qemu/units.h", Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 10/47] hw/ipack: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 13/47] hw/xen: Use the IEC binary prefix definitions,
Paolo Bonzini <=
- [Qemu-devel] [PULL 12/47] hw/smbios: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 11/47] hw/scsi: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 17/47] hw/misc: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 18/47] hw/riscv: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 19/47] hw/m68k: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 14/47] hw/tpm: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 16/47] hw/display: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 15/47] hw/block: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 22/47] hw/hppa: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30
- [Qemu-devel] [PULL 25/47] hw/tricore: Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/30