[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/12] hw/char: riscv_htif: Drop useless assignment of memory
From: |
Bin Meng |
Subject: |
[PATCH v2 03/12] hw/char: riscv_htif: Drop useless assignment of memory region |
Date: |
Thu, 29 Dec 2022 17:18:19 +0800 |
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: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
(no changes since v1)
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
- [PATCH v2 00/12] hw/riscv: Improve Spike HTIF emulation fidelity, Bin Meng, 2022/12/29
- [PATCH v2 03/12] hw/char: riscv_htif: Drop useless assignment of memory region,
Bin Meng <=
- [PATCH v2 05/12] hw/char: riscv_htif: Move registers from CPUArchState to HTIFState, Bin Meng, 2022/12/29
- [PATCH v2 08/12] hw/riscv: spike: Remove the out-of-date comments, Bin Meng, 2022/12/29
- [PATCH v2 09/12] hw/riscv/boot.c: make riscv_find_firmware() static, Bin Meng, 2022/12/29
- [PATCH v2 11/12] hw/riscv/boot.c: Introduce riscv_find_firmware(), Bin Meng, 2022/12/29
- [PATCH v2 10/12] hw/riscv/boot.c: introduce riscv_default_firmware_name(), Bin Meng, 2022/12/29
- Re: [PATCH v2 00/12] hw/riscv: Improve Spike HTIF emulation fidelity, Daniel Henrique Barboza, 2022/12/29
- [PATCH v2 12/12] hw/riscv: spike: Decouple create_fdt() dependency to ELF loading, Bin Meng, 2022/12/29