From: Alistair Francis <alistair23@gmail.com>
To: Bin Meng <bmeng@tinylab.org>
Cc: "Alistair Francis" <Alistair.Francis@wdc.com>,
qemu-devel@nongnu.org,
"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
"Bin Meng" <bin.meng@windriver.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
qemu-riscv@nongnu.org
Subject: Re: [PATCH 03/12] hw/char: riscv_htif: Drop useless assignment of memory region
Date: Wed, 28 Dec 2022 13:33:43 +1000 [thread overview]
Message-ID: <CAKmqyKNRk4LL7wdUp=-pf7QoS8zZ+=ux-26YdOp6JjwPQmea3w@mail.gmail.com> (raw)
In-Reply-To: <20221227064812.1903326-4-bmeng@tinylab.org>
On Tue, Dec 27, 2022 at 4:50 PM Bin Meng <bmeng@tinylab.org> wrote:
>
> struct HTIFState has 3 members for address space and memory region,
> and are initialized during htif_mm_init(). But they are actually
> useless. Drop them.
>
> Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>
> include/hw/char/riscv_htif.h | 7 ++-----
> hw/char/riscv_htif.c | 7 ++-----
> hw/riscv/spike.c | 5 ++---
> 3 files changed, 6 insertions(+), 13 deletions(-)
>
> diff --git a/include/hw/char/riscv_htif.h b/include/hw/char/riscv_htif.h
> index 3eccc1914f..6d172ebd6d 100644
> --- a/include/hw/char/riscv_htif.h
> +++ b/include/hw/char/riscv_htif.h
> @@ -34,9 +34,6 @@ typedef struct HTIFState {
> hwaddr tohost_offset;
> hwaddr fromhost_offset;
> MemoryRegion mmio;
> - MemoryRegion *address_space;
> - MemoryRegion *main_mem;
> - void *main_mem_ram_ptr;
>
> CPURISCVState *env;
> CharBackend chr;
> @@ -54,7 +51,7 @@ void htif_symbol_callback(const char *st_name, int st_info, uint64_t st_value,
> bool htif_uses_elf_symbols(void);
>
> /* legacy pre qom */
> -HTIFState *htif_mm_init(MemoryRegion *address_space, MemoryRegion *main_mem,
> - CPURISCVState *env, Chardev *chr, uint64_t nonelf_base);
> +HTIFState *htif_mm_init(MemoryRegion *address_space, CPURISCVState *env,
> + Chardev *chr, uint64_t nonelf_base);
>
> #endif
> diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
> index 088556bb04..e7e319ca1d 100644
> --- a/hw/char/riscv_htif.c
> +++ b/hw/char/riscv_htif.c
> @@ -265,8 +265,8 @@ bool htif_uses_elf_symbols(void)
> return (address_symbol_set == 3) ? true : false;
> }
>
> -HTIFState *htif_mm_init(MemoryRegion *address_space, MemoryRegion *main_mem,
> - CPURISCVState *env, Chardev *chr, uint64_t nonelf_base)
> +HTIFState *htif_mm_init(MemoryRegion *address_space, CPURISCVState *env,
> + Chardev *chr, uint64_t nonelf_base)
> {
> uint64_t base, size, tohost_offset, fromhost_offset;
>
> @@ -281,9 +281,6 @@ HTIFState *htif_mm_init(MemoryRegion *address_space, MemoryRegion *main_mem,
> fromhost_offset = fromhost_addr - base;
>
> HTIFState *s = g_new0(HTIFState, 1);
> - s->address_space = address_space;
> - s->main_mem = main_mem;
> - s->main_mem_ram_ptr = memory_region_get_ram_ptr(main_mem);
> s->env = env;
> s->tohost_offset = tohost_offset;
> s->fromhost_offset = fromhost_offset;
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index 1e1d752c00..82cf41ac27 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -317,9 +317,8 @@ static void spike_board_init(MachineState *machine)
> fdt_load_addr);
>
> /* initialize HTIF using symbols found in load_kernel */
> - htif_mm_init(system_memory, mask_rom,
> - &s->soc[0].harts[0].env, serial_hd(0),
> - memmap[SPIKE_HTIF].base);
> + htif_mm_init(system_memory, &s->soc[0].harts[0].env,
> + serial_hd(0), memmap[SPIKE_HTIF].base);
> }
>
> static void spike_machine_instance_init(Object *obj)
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2022-12-28 3:34 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-27 6:48 [PATCH 00/12] hw/riscv: Improve Spike HTIF emulation fidelity Bin Meng
2022-12-27 6:48 ` [PATCH 01/12] hw/char: riscv_htif: Avoid using magic numbers Bin Meng
2022-12-27 17:28 ` Daniel Henrique Barboza
2022-12-28 3:31 ` Alistair Francis
2022-12-27 6:48 ` [PATCH 02/12] hw/char: riscv_htif: Drop {to, from}host_size in HTIFState Bin Meng
2022-12-27 17:29 ` [PATCH 02/12] hw/char: riscv_htif: Drop {to,from}host_size " Daniel Henrique Barboza
2022-12-28 3:32 ` [PATCH 02/12] hw/char: riscv_htif: Drop {to, from}host_size " Alistair Francis
2022-12-27 6:48 ` [PATCH 03/12] hw/char: riscv_htif: Drop useless assignment of memory region Bin Meng
2022-12-27 17:30 ` Daniel Henrique Barboza
2022-12-28 3:33 ` Alistair Francis [this message]
2022-12-27 6:48 ` [PATCH 04/12] hw/char: riscv_htif: Use conventional 's' for HTIFState Bin Meng
2022-12-27 17:32 ` Daniel Henrique Barboza
2022-12-28 3:35 ` Alistair Francis
2022-12-27 6:48 ` [PATCH 05/12] hw/char: riscv_htif: Move registers from CPUArchState to HTIFState Bin Meng
2022-12-27 17:33 ` Daniel Henrique Barboza
2022-12-28 4:19 ` Alistair Francis
2022-12-27 6:48 ` [PATCH 06/12] hw/char: riscv_htif: Remove forward declarations for non-existent variables Bin Meng
2022-12-27 17:35 ` Daniel Henrique Barboza
2022-12-28 4:22 ` Alistair Francis
2022-12-27 6:48 ` [PATCH 07/12] hw/char: riscv_htif: Support console output via proxy syscall Bin Meng
2022-12-27 17:37 ` Daniel Henrique Barboza
2022-12-28 4:30 ` Alistair Francis
2022-12-27 6:48 ` [PATCH 08/12] hw/riscv: spike: Remove the out-of-date comments Bin Meng
2022-12-27 17:37 ` Daniel Henrique Barboza
2022-12-28 4:30 ` Alistair Francis
2022-12-27 6:48 ` [PATCH 09/12] hw/riscv/boot.c: make riscv_find_firmware() static Bin Meng
2022-12-27 6:48 ` [PATCH 10/12] hw/riscv/boot.c: introduce riscv_default_firmware_name() Bin Meng
2022-12-27 6:48 ` [PATCH 11/12] hw/riscv/boot.c: Introduce riscv_find_firmware() Bin Meng
2022-12-27 17:40 ` Daniel Henrique Barboza
2022-12-28 4:35 ` Alistair Francis
2022-12-27 6:48 ` [PATCH 12/12] hw/riscv: spike: Decouple create_fdt() dependency to ELF loading Bin Meng
2022-12-27 14:33 ` Daniel Henrique Barboza
2022-12-27 17:51 ` [PATCH 00/12] hw/riscv: Improve Spike HTIF emulation fidelity Daniel Henrique Barboza
2022-12-28 3:58 ` Bin Meng
2022-12-28 4:21 ` Alistair Francis
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='CAKmqyKNRk4LL7wdUp=-pf7QoS8zZ+=ux-26YdOp6JjwPQmea3w@mail.gmail.com' \
--to=alistair23@gmail.com \
--cc=Alistair.Francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=bmeng@tinylab.org \
--cc=dbarboza@ventanamicro.com \
--cc=marcandre.lureau@redhat.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@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).