[Top][All Lists]

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

Re: [PATCH 02/15] hw/riscv/spike: use 'fdt' from MachineState

From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 02/15] hw/riscv/spike: use 'fdt' from MachineState
Date: Thu, 22 Dec 2022 15:25:12 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

On 21/12/22 19:22, Daniel Henrique Barboza wrote:
The MachineState object provides a 'fdt' pointer that is already being
used by other RISC-V machines, and it's also used by the 'dumpdtb' QMP

Remove the 'fdt' pointer from SpikeState and use MachineState::fdt

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
  hw/riscv/spike.c         | 12 +++++-------
  include/hw/riscv/spike.h |  2 --
  2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
index 13946acf0d..d96f013e2e 100644
--- a/hw/riscv/spike.c
+++ b/hw/riscv/spike.c
@@ -52,6 +52,7 @@ static void create_fdt(SpikeState *s, const MemMapEntry 
                         uint64_t mem_size, const char *cmdline, bool is_32_bit)
      void *fdt;
+    int fdt_size;
      uint64_t addr, size;
      unsigned long clint_addr;
      int cpu, socket;
@@ -64,7 +65,7 @@ static void create_fdt(SpikeState *s, const MemMapEntry 
          "sifive,clint0", "riscv,clint0"
- fdt = s->fdt = create_device_tree(&s->fdt_size);
+    fdt = mc->fdt = create_device_tree(&fdt_size);

We use 'ms' for MachineState and 'mc' for MachineClass. I first got
scared while looking at that patch that a class field was used. The
variable is simply badly named. Possible future cleanup: s/mc/ms/.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

reply via email to

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