qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Zhao Liu <zhao1.liu@intel.com>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "Igor Mammedov" <imammedo@redhat.com>,
	"Xiaoyao Li" <xiaoyao.li@intel.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	qemu-riscv@nongnu.org, qemu-arm@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Sergio Lopez" <slp@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [PATCH-for-11.0 v6 05/13] hw/nvram/fw_cfg: Propagate I/O MemoryRegion to fw_cfg_init_io_dma()
Date: Wed,  3 Dec 2025 07:09:33 +0100	[thread overview]
Message-ID: <20251203060942.57851-6-philmd@linaro.org> (raw)
In-Reply-To: <20251203060942.57851-1-philmd@linaro.org>

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é <philmd@linaro.org>
---
 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/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index c4c49886754..7348cbfbc34 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -305,8 +305,8 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s,
                                     Object *parent, const char *part,
                                     const char *filename, Error **errp);
 
-FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
-                                AddressSpace *dma_as);
+FWCfgState *fw_cfg_init_io_dma(MemoryRegion *io, uint32_t iobase,
+                               uint32_t dma_iobase, AddressSpace *dma_as);
 FWCfgState *fw_cfg_init_mem_nodma(hwaddr ctl_addr, hwaddr data_addr,
                                   unsigned data_width);
 FWCfgState *fw_cfg_init_mem_dma(hwaddr ctl_addr,
diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
index 5c0bcd5f8a9..498da9ec69c 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -127,7 +127,8 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms,
     const CPUArchIdList *cpus = mc->possible_cpu_arch_ids(ms);
     int nb_numa_nodes = ms->numa_state->num_nodes;
 
-    fw_cfg = fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4,
+    fw_cfg = fw_cfg_init_io_dma(get_system_io(),
+                                FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4,
                                 &address_space_memory);
     fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, boot_cpus);
 
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,
                                 &address_space_memory);
 
     fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, machine->smp.cpus);
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 2b8d3982c4a..5c52079be31 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -659,7 +659,8 @@ void xen_load_linux(PCMachineState *pcms)
 
     assert(MACHINE(pcms)->kernel_filename != NULL);
 
-    fw_cfg = fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4,
+    fw_cfg = fw_cfg_init_io_dma(get_system_io(),
+                                FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4,
                                 &address_space_memory);
     fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus);
     rom_set_fw(fw_cfg);
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 3f0d337eb9c..34d7d107678 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -1019,14 +1019,13 @@ static void fw_cfg_common_realize(DeviceState *dev, Error **errp)
     qemu_add_machine_init_done_notifier(&s->machine_ready);
 }
 
-FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
-                                AddressSpace *dma_as)
+FWCfgState *fw_cfg_init_io_dma(MemoryRegion *iomem, uint32_t iobase,
+                               uint32_t dma_iobase, AddressSpace *dma_as)
 {
     DeviceState *dev;
     SysBusDevice *sbd;
     FWCfgIoState *ios;
     FWCfgState *s;
-    MemoryRegion *iomem = get_system_io();
     bool dma_requested = dma_iobase && dma_as;
 
     dev = qdev_new(TYPE_FW_CFG_IO);
-- 
2.51.0



  parent reply	other threads:[~2025-12-03  6:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03  6:09 [PATCH-for-11.0 v6 00/13] hw/sparc64/sun4u: Use fw_cfg_init_io_nodma() Philippe Mathieu-Daudé
2025-12-03  6:09 ` [PATCH-for-11.0 v6 01/13] hw/ppc/mac: Use fw_cfg_init_mem_nodma() Philippe Mathieu-Daudé
2025-12-03 15:34   ` Zhao Liu
2025-12-03  6:09 ` [PATCH-for-11.0 v6 02/13] hw/sparc/sun4m: " Philippe Mathieu-Daudé
2025-12-03 15:35   ` Zhao Liu
2025-12-03  6:09 ` [PATCH-for-11.0 v6 03/13] hw/nvram/fw_cfg: Factor fw_cfg_init_mem_internal() out Philippe Mathieu-Daudé
2025-12-03  6:09 ` [PATCH-for-11.0 v6 04/13] hw/nvram/fw_cfg: Rename fw_cfg_init_mem_wide() -> fw_cfg_init_mem_dma() Philippe Mathieu-Daudé
2025-12-03  6:09 ` Philippe Mathieu-Daudé [this message]
2025-12-03 15:39   ` [PATCH-for-11.0 v6 05/13] hw/nvram/fw_cfg: Propagate I/O MemoryRegion to fw_cfg_init_io_dma() Zhao Liu
2025-12-03 17:13     ` Philippe Mathieu-Daudé
2025-12-03  6:09 ` [PATCH-for-11.0 v6 06/13] hw/nvram/fw_cfg: Factor fw_cfg_init_io_internal() out Philippe Mathieu-Daudé
2025-12-03 15:40   ` Zhao Liu
2025-12-03  6:09 ` [PATCH-for-11.0 v6 07/13] hw/nvram/fw_cfg: Add fw_cfg_init_io_nodma() helper Philippe Mathieu-Daudé
2025-12-03 15:41   ` Zhao Liu
2025-12-03  6:09 ` [PATCH-for-11.0 v6 08/13] hw/sparc64/sun4u: Use fw_cfg_init_io_nodma() Philippe Mathieu-Daudé
2025-12-03 15:51   ` Zhao Liu
2025-12-03 17:14     ` Philippe Mathieu-Daudé
2025-12-04  2:01       ` Mark Cave-Ayland
2025-12-03  6:09 ` [PATCH-for-11.0 v6 09/13] hw/nvram/fw_cfg: Remove fw_cfg_io_properties::dma_enabled Philippe Mathieu-Daudé
2025-12-03  6:09 ` [PATCH-for-11.0 v6 10/13] hw/i386/x86: Remove X86MachineClass::fwcfg_dma_enabled field Philippe Mathieu-Daudé
2025-12-03  6:09 ` [PATCH-for-11.0 v6 11/13] hw/i386/pc: Remove multiboot.bin Philippe Mathieu-Daudé
2025-12-03  6:09 ` [PATCH-for-11.0 v6 12/13] hw/i386: Assume fw_cfg DMA is always enabled Philippe Mathieu-Daudé
2025-12-03  7:01   ` Philippe Mathieu-Daudé
2025-12-03  6:09 ` [PATCH-for-11.0 v6 13/13] hw/i386: Remove linuxboot.bin Philippe Mathieu-Daudé
2025-12-03  7:01 ` [PATCH-for-11.0 v6 00/13] hw/sparc64/sun4u: Use fw_cfg_init_io_nodma() Philippe Mathieu-Daudé
2025-12-04  8:04 ` Michael S. Tsirkin

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=20251203060942.57851-6-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=eduardo@habkost.net \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=slp@redhat.com \
    --cc=xiaoyao.li@intel.com \
    --cc=zhao1.liu@intel.com \
    /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).