qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] hw/misc/allwinner-h3-dramc: enforce 64-bit multiply when


From: Peter Maydell
Subject: Re: [PATCH 2/2] hw/misc/allwinner-h3-dramc: enforce 64-bit multiply when calculating row mirror address
Date: Sun, 22 Mar 2020 21:18:28 +0000

On Sun, 22 Mar 2020 at 20:54, Niek Linnenbank <address@hidden> wrote:
>
> The allwinner_h3_dramc_map_rows function simulates row addressing behavior
> when bootloader software attempts to detect the amount of available SDRAM.
>
> Currently the line that calculates the 64-bit address of the mirrored row
> uses a signed 32-bit multiply operation that in theory could result in the
> upper 32-bit be all 1s. This commit ensures that the row mirror address
> is calculated using only 64-bit operations.
>
> Reported-by: Peter Maydell <address@hidden>
> Signed-off-by: Niek Linnenbank <address@hidden>
> ---
>  hw/misc/allwinner-h3-dramc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/misc/allwinner-h3-dramc.c b/hw/misc/allwinner-h3-dramc.c
> index 2b5260260e..f9f05b5384 100644
> --- a/hw/misc/allwinner-h3-dramc.c
> +++ b/hw/misc/allwinner-h3-dramc.c
> @@ -85,8 +85,8 @@ static void allwinner_h3_dramc_map_rows(AwH3DramCtlState 
> *s, uint8_t row_bits,
>
>      } else if (row_bits_actual) {
>          /* Row bits not matching ram_size, install the rows mirror */
> -        hwaddr row_mirror = s->ram_addr + ((1 << (row_bits_actual +
> -                                                  bank_bits)) * page_size);
> +        hwaddr row_mirror = s->ram_addr + ((1UL << (row_bits_actual +
> +                                                    bank_bits)) * page_size);

This needs to be a "ULL" suffix... (I just sent a different email
with the rationale).

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]