From nobody Mon Feb 9 05:14:16 2026 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529930931265643.7702558173194; Mon, 25 Jun 2018 05:48:51 -0700 (PDT) Received: from localhost ([::1]:46635 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXQvK-00051F-GA for importer@patchew.org; Mon, 25 Jun 2018 08:48:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXQqM-0001K6-8N for qemu-devel@nongnu.org; Mon, 25 Jun 2018 08:43:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXQqJ-0007en-67 for qemu-devel@nongnu.org; Mon, 25 Jun 2018 08:43:42 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:35367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXQqJ-0007eb-25; Mon, 25 Jun 2018 08:43:39 -0400 Received: by mail-qk0-x244.google.com with SMTP id u21-v6so1772449qku.2; Mon, 25 Jun 2018 05:43:38 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id m15-v6sm12549562qtm.84.2018.06.25.05.43.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 05:43:38 -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=Zh1e1cXNw3DKZtCDbdrfbkiCXZMg8qqGWos+WoeWfTo=; b=d6oc+CaW+PISqGSmMTdr9xF3OEPGtPlARTil1vu3sIM+TlTJMxhtXVxsHQbFbb5Kx4 zl6qmbBIQBTu5cD9acetJ/EMy92NJVbQo9cRltGxrTRJ0kz5sN0UjiPlOSmNW+ML6uWV LPRMf4zg84LRGsOTgrcVs57WP9IfAZ8BaYiAbKfJRZYHVn3PJwWxnFhWQ2xyogOWjKm9 lVRTrwKL7Ws3FAUJZUouh3xMYS/kpMbFFI7DRkFLx1VKF9xrsiOop8RnvUd4kL5pUlln 8HKniTosWZkZ2DRW6om+eyX4nMEjwEmjpgJoj3B++BlpMeyNopk/gHaufc0w0vu/5IrM Bc3Q== 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=Zh1e1cXNw3DKZtCDbdrfbkiCXZMg8qqGWos+WoeWfTo=; b=dkvGjaZIJgTpgwo4DzJEHaRBptqZspDm8uqsYFcL+WHQs2E5s5xOgm8IrP7qASSLeF 5BynITLAKVc7wTadAw0qPloCb7aUnpcqW+4ROtze+CM6SDT24lWwpdB45kL+fmpIzlAF dlBkPPlD82tIAcgFgCwt/Sp6AJx04WUHXbQqbyOgBxhGxK8xh3XmmmuxPFooCgO0zPPE nD6G0lPzPo3Y3jnmVm3UmZc+8Ih8JD+BGg0o21MqiJtkkBB7bb7QnyeowpY62Ifhg5Yq zpGZ3A6KixX7vM2QR75XjW2RvpJ6P1miy1QKRegE1JL7FIRp+6RsK4wAh9S6V5NuukD0 D/8A== X-Gm-Message-State: APt69E2LtDDkXm3GupgwoEXawPSM6QTKKTg7joZfRVfYZ3HCUUcvGfY6 Tb/lCilM2A2hlQvpS5GdZq9AZ/dRnmo= X-Google-Smtp-Source: ADUXVKKuUEc6bAea6WerfkU7xGNLUpDg7KygIoJez6lbcHMQPOH2qJ7XZSukk+XRHaT1V9ojTjp70w== X-Received: by 2002:ae9:e113:: with SMTP id g19-v6mr10681764qkm.9.1529930618498; Mon, 25 Jun 2018 05:43:38 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Thomas Huth , Stefan Weil Date: Mon, 25 Jun 2018 09:42:03 -0300 Message-Id: <20180625124238.25339-12-f4bug@amsat.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180625124238.25339-1-f4bug@amsat.org> References: <20180625124238.25339-1-f4bug@amsat.org> 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: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PATCH v5 11/46] hw/xen: 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: Kevin Wolf , Stefano Stabellini , Eduardo Habkost , "open list:Block layer core" , "Michael S. Tsirkin" , qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, "open list:X86" , Anthony Perard , Paolo Bonzini , Max Reitz , Richard Henderson 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 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 Reviewed-by: Alan Robinson --- 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 9fbc0cdb87..36eff94f84 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -20,6 +20,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include #include =20 @@ -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); =20 /* 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 628b813a11..4e4f069a24 100644 --- a/hw/i386/xen/xen-mapcache.c +++ b/hw/i386/xen/xen-mapcache.c @@ -9,6 +9,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "qemu/error-report.h" =20 #include @@ -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) =20 typedef struct MapCacheEntry { hwaddr paddr_index; diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c index 027f76fad1..188acaca16 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); =20 /* 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); =20 /* cpus */ for (i =3D 0; i < smp_cpus; i++) { @@ -113,7 +114,7 @@ int xenstore_domain_init2(int xenstore_port, int xensto= re_mfn, =20 /* 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 =20 - rc =3D xc_domain_setmaxmem(xen_xc, xen_domid, ram_size >> 10); + rc =3D 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 =3D xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0); console_port =3D xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0); =20 - rc =3D xc_linux_build(xen_xc, xen_domid, ram_size >> 20, + rc =3D xc_linux_build(xen_xc, xen_domid, ram_size / MiB, kernel, ramdisk, cmdline, 0, flags, xenstore_port, &xenstore_mfn, --=20 2.18.0