On 3/12/25 16:39, Zhao Liu wrote:
On Wed, Dec 03, 2025 at 07:09:33AM +0100, Philippe Mathieu-Daudé wrote:
Date: Wed,  3 Dec 2025 07:09:33 +0100
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH-for-11.0 v6 05/13] hw/nvram/fw_cfg: Propagate I/O
  MemoryRegion to fw_cfg_init_io_dma()
X-Mailer: git-send-email 2.51.0

To allow callers to use I/O MemoryRegion different than the
global get_system_io(), pass it as argument.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
  include/hw/nvram/fw_cfg.h | 4 ++--
  hw/i386/fw_cfg.c          | 3 ++-
  hw/i386/microvm.c         | 3 ++-
  hw/i386/pc.c              | 3 ++-
  hw/nvram/fw_cfg.c         | 5 ++---
  5 files changed, 10 insertions(+), 8 deletions(-)

...

diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 94d22a232ac..69f04d74a15 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -289,6 +289,7 @@ static void microvm_memory_init(MicrovmMachineState *mms)
      X86MachineState *x86ms = X86_MACHINE(mms);
      MemoryRegion *ram_below_4g, *ram_above_4g;
      MemoryRegion *system_memory = get_system_memory();
+    MemoryRegion *io_memory = get_system_io();
      FWCfgState *fw_cfg;
      ram_addr_t lowmem = 0xc0000000; /* 3G */
      int i;
@@ -319,7 +320,7 @@ static void microvm_memory_init(MicrovmMachineState *mms)
          e820_add_entry(0x100000000ULL, x86ms->above_4g_mem_size, E820_RAM);
      }
- fw_cfg = fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4,
+    fw_cfg = fw_cfg_init_io_dma(io_memory, FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4,

It seems here we can use get_system_io() directly :).

I tried to follow the function style (see local system_memory
declaration); I don't mind ;)


Otherwise,

Reviewed-by: Zhao Liu <[email protected]>

Thanks!


                                  &address_space_memory);
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, machine->smp.cpus);


Reply via email to