From: David Gibson <david@gibson.dropbear.id.au>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/8] ppc4xx: Use ram_addr_t in ppc4xx_sdram_adjust()
Date: Wed, 2 Jan 2019 15:15:07 +1100 [thread overview]
Message-ID: <20190102041507.GN27457@umbus.fritz.box> (raw)
In-Reply-To: <16d6e1b4987d30c11ace0211e9d6a57303784467.1546394798.git.balaton@eik.bme.hu>
[-- Attachment #1: Type: text/plain, Size: 3305 bytes --]
On Wed, Jan 02, 2019 at 03:06:38AM +0100, BALATON Zoltan wrote:
> To avoid overflow if larger values are added later use ram_addr_t for
> the sdram_bank_sizes parameter to match ram_size to which it is
> compared.
So, technically I think these should be 'hwaddr' (which represents a
guest physical address) rather tham ram_addr_t which
represents... something subtley different I've never properly
understood.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> hw/ppc/ppc440_bamboo.c | 2 +-
> hw/ppc/ppc4xx_devs.c | 4 ++--
> hw/ppc/sam460ex.c | 2 +-
> include/hw/ppc/ppc4xx.h | 2 +-
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
> index b8aa55d526..8277c0f784 100644
> --- a/hw/ppc/ppc440_bamboo.c
> +++ b/hw/ppc/ppc440_bamboo.c
> @@ -49,7 +49,7 @@
>
> #define PPC440EP_SDRAM_NR_BANKS 4
>
> -static const unsigned int ppc440ep_sdram_bank_sizes[] = {
> +static const ram_addr_t ppc440ep_sdram_bank_sizes[] = {
> 256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 16 * MiB, 8 * MiB, 0
> };
>
> diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c
> index 9b6e4c60fa..9418478575 100644
> --- a/hw/ppc/ppc4xx_devs.c
> +++ b/hw/ppc/ppc4xx_devs.c
> @@ -679,12 +679,12 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks,
> MemoryRegion ram_memories[],
> hwaddr ram_bases[],
> hwaddr ram_sizes[],
> - const unsigned int sdram_bank_sizes[])
> + const ram_addr_t sdram_bank_sizes[])
> {
> MemoryRegion *ram = g_malloc0(sizeof(*ram));
> ram_addr_t size_left = ram_size;
> ram_addr_t base = 0;
> - unsigned int bank_size;
> + ram_addr_t bank_size;
> int i;
> int j;
>
> diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
> index 2bb91ed21b..7cbd2f54c6 100644
> --- a/hw/ppc/sam460ex.c
> +++ b/hw/ppc/sam460ex.c
> @@ -77,7 +77,7 @@
> #define SDRAM_NR_BANKS 4
>
> /* FIXME: See u-boot.git 8ac41e, also fix in ppc440_uc.c */
> -static const unsigned int ppc460ex_sdram_bank_sizes[] = {
> +static const ram_addr_t ppc460ex_sdram_bank_sizes[] = {
> 1 * GiB, 512 * MiB, 256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 0
> };
>
> diff --git a/include/hw/ppc/ppc4xx.h b/include/hw/ppc/ppc4xx.h
> index 3a2a04c8ce..39a7ba1ce6 100644
> --- a/include/hw/ppc/ppc4xx.h
> +++ b/include/hw/ppc/ppc4xx.h
> @@ -43,7 +43,7 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks,
> MemoryRegion ram_memories[],
> hwaddr ram_bases[],
> hwaddr ram_sizes[],
> - const unsigned int sdram_bank_sizes[]);
> + const ram_addr_t sdram_bank_sizes[]);
>
> void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq irq, int nbanks,
> MemoryRegion ram_memories[],
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-01-02 4:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-02 2:06 [Qemu-devel] [PATCH 0/8] Misc sam460ex related patches BALATON Zoltan
2019-01-02 2:06 ` [Qemu-devel] [PATCH 7/8] sam460ex: Fix support for memory larger than 1GB BALATON Zoltan
2019-01-02 2:06 ` [Qemu-devel] [PATCH 4/8] ppc4xx: Use ram_addr_t in ppc4xx_sdram_adjust() BALATON Zoltan
2019-01-02 4:15 ` David Gibson [this message]
2019-01-03 14:03 ` BALATON Zoltan
2019-01-04 5:17 ` David Gibson
2019-01-07 22:00 ` BALATON Zoltan
2019-01-02 2:06 ` [Qemu-devel] [PATCH 1/8] smbus: Add a helper to generate SPD EEPROM data BALATON Zoltan
2019-01-02 4:09 ` David Gibson
2019-01-02 12:36 ` BALATON Zoltan
2019-01-03 1:54 ` David Gibson
2019-01-02 2:06 ` [Qemu-devel] [PATCH 5/8] ppc4xx: Rename ppc4xx_sdram_t in ppc440_uc.c to ppc440_sdram_t BALATON Zoltan
2019-01-02 4:15 ` David Gibson
2019-01-02 2:06 ` [Qemu-devel] [PATCH 2/8] sam460ex: Clean up SPD EEPROM creation BALATON Zoltan
2019-01-02 4:11 ` David Gibson
2019-01-02 12:49 ` BALATON Zoltan
2019-01-03 1:54 ` David Gibson
2019-01-02 2:06 ` [Qemu-devel] [PATCH 3/8] ppc4xx: Disable debug logging by default BALATON Zoltan
2019-01-02 4:27 ` David Gibson
2019-01-02 2:06 ` [Qemu-devel] [PATCH 6/8] ppc4xx: Pass array index to function instead of pointer into the array BALATON Zoltan
2019-01-02 4:17 ` David Gibson
2019-01-02 2:06 ` [Qemu-devel] [PATCH 8/8] MAINTAINERS: Add more files to sam460ex BALATON Zoltan
2019-01-02 4:29 ` David Gibson
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=20190102041507.GN27457@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=balaton@eik.bme.hu \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).