From: Igor Mammedov <imammedo@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 26/30] hw/smbios: use the BYTE-based definitions
Date: Mon, 5 Mar 2018 13:32:26 +0100 [thread overview]
Message-ID: <20180305133226.5bf18bd8@redhat.com> (raw)
In-Reply-To: <20180215042900.16078-27-f4bug@amsat.org>
On Thu, 15 Feb 2018 01:28:56 -0300
Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> It ease code review, unit is explicit.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> hw/smbios/smbios.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index 27a07e96f4..fa02f9ce3f 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -625,10 +625,6 @@ static void smbios_build_type_11_table(void)
> SMBIOS_BUILD_TABLE_POST;
> }
>
> -#define ONE_KB ((ram_addr_t)1 << 10)
> -#define ONE_MB ((ram_addr_t)1 << 20)
> -#define ONE_GB ((ram_addr_t)1 << 30)
> -
> #define MAX_T16_STD_SZ 0x80000000 /* 2T in Kilobytes */
>
> static void smbios_build_type_16_table(unsigned dimm_cnt)
> @@ -640,7 +636,7 @@ static void smbios_build_type_16_table(unsigned dimm_cnt)
> t->location = 0x01; /* Other */
> t->use = 0x03; /* System memory */
> t->error_correction = 0x06; /* Multi-bit ECC (for Microsoft, per SeaBIOS) */
> - size_kb = QEMU_ALIGN_UP(ram_size, ONE_KB) / ONE_KB;
> + size_kb = QEMU_ALIGN_UP(ram_size, K_BYTE) / K_BYTE;
> if (size_kb < MAX_T16_STD_SZ) {
> t->maximum_capacity = cpu_to_le32(size_kb);
> t->extended_maximum_capacity = cpu_to_le64(0);
> @@ -668,7 +664,7 @@ static void smbios_build_type_17_table(unsigned instance, uint64_t size)
> t->memory_error_information_handle = cpu_to_le16(0xFFFE); /* Not provided */
> t->total_width = cpu_to_le16(0xFFFF); /* Unknown */
> t->data_width = cpu_to_le16(0xFFFF); /* Unknown */
> - size_mb = QEMU_ALIGN_UP(size, ONE_MB) / ONE_MB;
> + size_mb = QEMU_ALIGN_UP(size, M_BYTE) / M_BYTE;
> if (size_mb < MAX_T17_STD_SZ) {
> t->size = cpu_to_le16(size_mb);
> t->extended_size = cpu_to_le32(0);
> @@ -707,8 +703,8 @@ static void smbios_build_type_19_table(unsigned instance,
>
> end = start + size - 1;
> assert(end > start);
> - start_kb = start / ONE_KB;
> - end_kb = end / ONE_KB;
> + start_kb = start / K_BYTE;
> + end_kb = end / K_BYTE;
> if (start_kb < UINT32_MAX && end_kb < UINT32_MAX) {
> t->starting_address = cpu_to_le32(start_kb);
> t->ending_address = cpu_to_le32(end_kb);
> @@ -869,7 +865,7 @@ void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
>
> smbios_build_type_11_table();
>
> -#define MAX_DIMM_SZ (16ll * ONE_GB)
> +#define MAX_DIMM_SZ (16 * G_BYTE)
> #define GET_DIMM_SZ ((i < dimm_cnt - 1) ? MAX_DIMM_SZ \
> : ((ram_size - 1) % MAX_DIMM_SZ) + 1)
>
next prev parent reply other threads:[~2018-03-05 12:32 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 4:28 [Qemu-devel] [PATCH 00/30] hw: use the BYTE-based definitions when useful Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 01/30] util/cutils: extract byte-based definitions into a new header: "qemu/cunits.h" Philippe Mathieu-Daudé
2018-02-15 9:55 ` Marc-André Lureau
2018-02-15 11:11 ` Thomas Huth
2018-02-15 4:28 ` [Qemu-devel] [PATCH 02/30] hw: include "qemu/cunits.h" and clean unused "qemu/cutils.h" Philippe Mathieu-Daudé
2018-02-15 6:10 ` Thomas Huth
2018-03-05 10:50 ` Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 03/30] hw/block/nvme: include the "qemu/cutils.h" in the source file Philippe Mathieu-Daudé
2018-02-15 6:07 ` Thomas Huth
2018-02-15 4:28 ` [Qemu-devel] [PATCH 04/30] hw/lm32/milkymist: remove unused include Philippe Mathieu-Daudé
2018-02-15 6:20 ` Thomas Huth
2018-02-15 4:28 ` [Qemu-devel] [PATCH 05/30] hw/mips/r4k: constify params_size Philippe Mathieu-Daudé
2018-02-15 6:19 ` Thomas Huth
2018-02-15 12:27 ` Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 06/30] hw/mips: use the BYTE-based definitions Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 07/30] hw/arm: " Philippe Mathieu-Daudé
2018-02-15 22:31 ` Alistair Francis
2018-02-15 22:39 ` Philippe Mathieu-Daudé
2018-02-15 23:03 ` Alistair Francis
2018-02-15 23:09 ` Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 08/30] hw/i386: " Philippe Mathieu-Daudé
2018-03-05 12:29 ` Igor Mammedov
2018-03-05 13:00 ` Igor Mammedov
2018-02-15 4:28 ` [Qemu-devel] [PATCH 09/30] hw/sparc: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 10/30] hw/ppc: " Philippe Mathieu-Daudé
2018-02-15 4:38 ` David Gibson
2018-02-15 4:28 ` [Qemu-devel] [PATCH 11/30] hw/s390x: " Philippe Mathieu-Daudé
2018-02-15 7:05 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-03-05 10:06 ` [Qemu-devel] " Cornelia Huck
2018-02-15 4:28 ` [Qemu-devel] [PATCH 12/30] hw/hppa: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 13/30] hw/xtensa: " Philippe Mathieu-Daudé
2018-02-15 17:37 ` Max Filippov
2018-02-15 4:28 ` [Qemu-devel] [PATCH 14/30] hw/alpha: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 15/30] hw/lm32: " Philippe Mathieu-Daudé
2018-02-15 15:14 ` Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 16/30] hw/sh4: " Philippe Mathieu-Daudé
2018-02-15 14:43 ` Eric Blake
2018-02-15 15:09 ` Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 17/30] hw/tricore: " Philippe Mathieu-Daudé
2018-02-20 16:04 ` Bastian Koppelmann
2018-02-15 4:28 ` [Qemu-devel] [PATCH 18/30] hw/microblaze: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 19/30] hw/nios2: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 20/30] hw/cris: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 21/30] hw/misc: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 22/30] hw/display: " Philippe Mathieu-Daudé
2018-02-15 10:02 ` Gerd Hoffmann
2018-02-15 4:28 ` [Qemu-devel] [PATCH 23/30] hw/net: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 24/30] hw/ipack: " Philippe Mathieu-Daudé
2018-02-15 8:01 ` Alberto Garcia
2018-02-15 4:28 ` [Qemu-devel] [PATCH 25/30] hw/scsi: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 26/30] hw/smbios: " Philippe Mathieu-Daudé
2018-03-05 12:32 ` Igor Mammedov [this message]
2018-02-15 4:28 ` [Qemu-devel] [PATCH 27/30] vfio/pci: " Philippe Mathieu-Daudé
2018-02-15 4:28 ` [Qemu-devel] [PATCH 28/30] ivshmem: " Philippe Mathieu-Daudé
2018-02-15 15:16 ` Philippe Mathieu-Daudé
2018-02-15 15:40 ` Marc-André Lureau
2018-02-15 4:28 ` [Qemu-devel] [PATCH 29/30] tpm: " Philippe Mathieu-Daudé
2018-02-15 9:51 ` Marc-André Lureau
2018-02-15 4:29 ` [Qemu-devel] [PATCH 30/30] xen: " Philippe Mathieu-Daudé
2018-02-15 11:00 ` [Qemu-devel] [Xen-devel] " Alan Robinson
2018-02-15 12:23 ` Philippe Mathieu-Daudé
2018-02-15 13:28 ` Alan Robinson
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=20180305133226.5bf18bd8@redhat.com \
--to=imammedo@redhat.com \
--cc=f4bug@amsat.org \
--cc=mst@redhat.com \
--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).