[PATCH-for-11.0 v6 12/13] hw/i386: Assume fw_cfg DMA is always enabled

Philippe Mathieu-Daudé posted 13 patches 1 week, 4 days ago
[PATCH-for-11.0 v6 12/13] hw/i386: Assume fw_cfg DMA is always enabled
Posted by Philippe Mathieu-Daudé 1 week, 4 days ago
From: Zhao Liu <zhao1.liu@intel.com>

Now all calls of x86 machines to fw_cfg_init_io_dma() pass DMA
arguments, so the FWCfgState (FWCfgIoState) created by x86 machines
enables DMA by default.

Then 'linuxboot.bin' isn't used anymore, and it will be removed in the
next commit.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/fw_cfg.c     | 1 +
 hw/i386/x86-common.c | 6 ++----
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
index bf38338fb47..528862d2e33 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -226,6 +226,7 @@ void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg)
      * of the i/o region used is FW_CFG_CTL_SIZE; And the DMA control
      * register is located at FW_CFG_DMA_IO_BASE + 4
      */
+    assert(fw_cfg_dma_enabled(fw_cfg));
     io_size = ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t);
 
     aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002")));
diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index 1ee55382dab..e8dc4d903bd 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -1002,10 +1002,8 @@ void x86_load_linux(X86MachineState *x86ms,
     }
 
     option_rom[nb_option_roms].bootindex = 0;
-    option_rom[nb_option_roms].name = "linuxboot.bin";
-    if (fw_cfg_dma_enabled(fw_cfg)) {
-        option_rom[nb_option_roms].name = "linuxboot_dma.bin";
-    }
+    assert(fw_cfg_dma_enabled(fw_cfg));
+    option_rom[nb_option_roms].name = "linuxboot_dma.bin";
     nb_option_roms++;
 }
 
-- 
2.51.0


Re: [PATCH-for-11.0 v6 12/13] hw/i386: Assume fw_cfg DMA is always enabled
Posted by Philippe Mathieu-Daudé 1 week, 3 days ago
On 3/12/25 07:09, Philippe Mathieu-Daudé wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> Now all calls of x86 machines to fw_cfg_init_io_dma() pass DMA
> arguments, so the FWCfgState (FWCfgIoState) created by x86 machines
> enables DMA by default.
> 
> Then 'linuxboot.bin' isn't used anymore, and it will be removed in the
> next commit.
> 
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>

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

> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/i386/fw_cfg.c     | 1 +
>   hw/i386/x86-common.c | 6 ++----
>   2 files changed, 3 insertions(+), 4 deletions(-)