qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Laurent Vivier" <laurent@vivier.eu>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Michael Tokarev" <mjt@tls.msk.ru>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Frederic Konrad" <konrad.frederic@yahoo.fr>,
	"Clément Chigot" <chigot@adacore.com>,
	qemu-trivial@nongnu.org, "Fabien Chouteau" <chouteau@adacore.com>
Subject: Re: [PATCH 2/2] hw/sparc/leon3: Have write_bootloader() take a void pointer argument
Date: Thu, 15 Feb 2024 14:13:41 +0000	[thread overview]
Message-ID: <CAFEAcA_we0joWBdAeyhRAAWaTF_gZSSUVJTNv=jQwpS+cUUuGg@mail.gmail.com> (raw)
In-Reply-To: <20240215132824.67363-3-philmd@linaro.org>

On Thu, 15 Feb 2024 at 13:28, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Directly use the void pointer argument returned
> by memory_region_get_ram_ptr().
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/sparc/leon3.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
> index d096fb04cb..8717c72e77 100644
> --- a/hw/sparc/leon3.c
> +++ b/hw/sparc/leon3.c
> @@ -94,9 +94,9 @@ static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val)
>   * state (eg: initialized by the bootloader). This little code reproduces
>   * this behavior.
>   */
> -static void write_bootloader(uint8_t *base, hwaddr kernel_addr)
> +static void write_bootloader(void *ptr, hwaddr kernel_addr)
>  {
> -    uint32_t *p = (uint32_t *) base;
> +    uint32_t *p = (uint32_t *) ptr;

I don't think you need the cast any more now ptr is void*.
(If you do, then our coding style doesn't put a space after
the cast.)

>
>      /* Initialize the UARTs                                        */
>      /* *UART_CONTROL = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE; */
> @@ -338,10 +338,7 @@ static void leon3_generic_hw_init(MachineState *machine)
>               * the machine in an initialized state through a little
>               * bootloader.
>               */
> -            uint8_t *bootloader_entry;
> -
> -            bootloader_entry = memory_region_get_ram_ptr(prom);
> -            write_bootloader(bootloader_entry, entry);
> +            write_bootloader(memory_region_get_ram_ptr(prom), entry);
>              env->pc = LEON3_PROM_OFFSET;
>              env->npc = LEON3_PROM_OFFSET + 4;
>              reset_info->entry = LEON3_PROM_OFFSET;
> --

Either way,
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


  reply	other threads:[~2024-02-15 14:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 13:28 [PATCH 0/2] hw/sparc/leon3: Trivial cleanups around write_bootloader() Philippe Mathieu-Daudé
2024-02-15 13:28 ` [PATCH 1/2] hw/sparc/leon3: Remove unused 'env' argument of write_bootloader() Philippe Mathieu-Daudé
2024-02-15 14:11   ` Peter Maydell
2024-02-15 13:28 ` [PATCH 2/2] hw/sparc/leon3: Have write_bootloader() take a void pointer argument Philippe Mathieu-Daudé
2024-02-15 14:13   ` Peter Maydell [this message]
2024-02-15 14:24     ` Philippe Mathieu-Daudé
2024-02-15 17:49 ` [PATCH 0/2] hw/sparc/leon3: Trivial cleanups around write_bootloader() Philippe Mathieu-Daudé

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='CAFEAcA_we0joWBdAeyhRAAWaTF_gZSSUVJTNv=jQwpS+cUUuGg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=atar4qemu@gmail.com \
    --cc=chigot@adacore.com \
    --cc=chouteau@adacore.com \
    --cc=konrad.frederic@yahoo.fr \
    --cc=laurent@vivier.eu \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mjt@tls.msk.ru \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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).