@samitouri / QOSamiQemu / commits / fb642dc302

hw/nvram/fw_cfg: Remove support for I/O port fw_cfg without DMA

Currently fw_cfg_init_io_dma() allows the caller to pass a NULL dma_as argument, which causes it to create a fw_cfg without the DMA port or DMA support. None of the callers use this capability: they all pass &address_space_memory. We don't really want to leave the door open for some future x86 machine type which doesn't support DMA for the fw_cfg device, so remove this, and instead make the function assert that it has a non-NULL dma_as argument, like fw_cfg_init_mem_dma(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@mailo.com> Message-id: 20260529174639.451353-5-peter.maydell@linaro.org Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

Peter Maydell committed May 29, 2026 at 18:46 UTC fb642dc302b9cd4e3ba1c9fb66da010ee1949923
1 file changed +2 -4
hw/nvram/fw_cfg.c
+2 -4
@@ -1026,12 +1026,10 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, AddressSpace *dma_as)
1026 FWCfgIoState *ios;
1027 FWCfgState *s;
1028 MemoryRegion *iomem = get_system_io();
1029 - bool dma_requested = dma_as;
1029 +
1030 + assert(dma_as);
1031
1032 dev = qdev_new(TYPE_FW_CFG_IO);
1032 - if (!dma_requested) {
1033 - qdev_prop_set_bit(dev, "dma_enabled", false);
1034 - }
1033
1034 object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
1035 OBJECT(dev));