[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/10] hw/riscv/sifive_u.c: simplify create_fdt()
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH 03/10] hw/riscv/sifive_u.c: simplify create_fdt() |
Date: |
Wed, 11 Jan 2023 14:09:41 -0300 |
'cmdline' isn't being used. Remove it.
A MachineState pointer is being retrieved via a MACHINE() macro calling
qdev_get_machine(). Use MACHINE(s) instead to avoid calling qdev().
'mem_size' is being set as machine->ram_size by the caller. Retrieve it
via ms->ram_size.
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
hw/riscv/sifive_u.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 9a75d4aa62..ccad386920 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -94,9 +94,10 @@ static const MemMapEntry sifive_u_memmap[] = {
#define GEM_REVISION 0x10070109
static void create_fdt(SiFiveUState *s, const MemMapEntry *memmap,
- uint64_t mem_size, const char *cmdline, bool is_32_bit)
+ bool is_32_bit)
{
- MachineState *ms = MACHINE(qdev_get_machine());
+ MachineState *ms = MACHINE(s);
+ uint64_t mem_size = ms->ram_size;
void *fdt;
int cpu, fdt_size;
uint32_t *cells;
@@ -560,8 +561,7 @@ static void sifive_u_machine_init(MachineState *machine)
qemu_allocate_irq(sifive_u_machine_reset, NULL, 0));
/* create device tree */
- create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline,
- riscv_is_32bit(&s->soc.u_cpus));
+ create_fdt(s, memmap, riscv_is_32bit(&s->soc.u_cpus));
if (s->start_in_flash) {
/*
--
2.39.0
- [PATCH 00/10] riscv: create_fdt() related cleanups, Daniel Henrique Barboza, 2023/01/11
- [PATCH 01/10] hw/riscv/spike.c: simplify create_fdt(), Daniel Henrique Barboza, 2023/01/11
- [PATCH 02/10] hw/riscv/virt.c: simplify create_fdt(), Daniel Henrique Barboza, 2023/01/11
- [PATCH 03/10] hw/riscv/sifive_u.c: simplify create_fdt(),
Daniel Henrique Barboza <=
- [PATCH 04/10] hw/riscv/virt.c: remove 'is_32_bit' param from create_fdt_socket_cpus(), Daniel Henrique Barboza, 2023/01/11
- [PATCH 06/10] hw/riscv: use ms->fdt in riscv_socket_fdt_write_distance_matrix(), Daniel Henrique Barboza, 2023/01/11
- [PATCH 08/10] hw/riscv/virt.c: calculate socket count once in create_fdt_imsic(), Daniel Henrique Barboza, 2023/01/11
- [PATCH 05/10] hw/riscv: use MachineState::fdt in riscv_socket_fdt_write_id(), Daniel Henrique Barboza, 2023/01/11
- [PATCH 07/10] hw/riscv: simplify riscv_load_fdt(), Daniel Henrique Barboza, 2023/01/11