The X86MachineClass::fwcfg_dma_enabled boolean was only used
by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got
removed. Remove it and simplify.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/i386/x86.h | 2 --
hw/i386/microvm.c | 3 ---
hw/i386/multiboot.c | 7 +------
hw/i386/x86-common.c | 3 +--
hw/i386/x86.c | 2 --
5 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index fc460b82f82..29d37af11e6 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -29,8 +29,6 @@
struct X86MachineClass {
MachineClass parent;
- /* use DMA capable linuxboot option rom */
- bool fwcfg_dma_enabled;
/* CPU and apic information: */
bool apic_xrupt_override;
};
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index e0daf0d4fc3..b1262fb1523 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -637,7 +637,6 @@ GlobalProperty microvm_properties[] = {
static void microvm_class_init(ObjectClass *oc, const void *data)
{
- X86MachineClass *x86mc = X86_MACHINE_CLASS(oc);
MicrovmMachineClass *mmc = MICROVM_MACHINE_CLASS(oc);
MachineClass *mc = MACHINE_CLASS(oc);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
@@ -671,8 +670,6 @@ static void microvm_class_init(ObjectClass *oc, const void *data)
hc->unplug_request = microvm_device_unplug_request_cb;
hc->unplug = microvm_device_unplug_cb;
- x86mc->fwcfg_dma_enabled = true;
-
object_class_property_add(oc, MICROVM_MACHINE_RTC, "OnOffAuto",
microvm_machine_get_rtc,
microvm_machine_set_rtc,
diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index 6e6b96bc345..bfa7e8f1e83 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -153,7 +153,6 @@ int load_multiboot(X86MachineState *x86ms,
int kernel_file_size,
uint8_t *header)
{
- bool multiboot_dma_enabled = X86_MACHINE_GET_CLASS(x86ms)->fwcfg_dma_enabled;
int i, is_multiboot = 0;
uint32_t flags = 0;
uint32_t mh_entry_addr;
@@ -402,11 +401,7 @@ int load_multiboot(X86MachineState *x86ms,
fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
sizeof(bootinfo));
- if (multiboot_dma_enabled) {
- option_rom[nb_option_roms].name = "multiboot_dma.bin";
- } else {
- option_rom[nb_option_roms].name = "multiboot.bin";
- }
+ option_rom[nb_option_roms].name = "multiboot_dma.bin";
option_rom[nb_option_roms].bootindex = 0;
nb_option_roms++;
diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index 1b0671c5239..27254a0e9f1 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -634,7 +634,6 @@ void x86_load_linux(X86MachineState *x86ms,
int acpi_data_size,
bool pvh_enabled)
{
- bool linuxboot_dma_enabled = X86_MACHINE_GET_CLASS(x86ms)->fwcfg_dma_enabled;
uint16_t protocol;
int setup_size, kernel_size, cmdline_size;
int dtb_size, setup_data_offset;
@@ -993,7 +992,7 @@ void x86_load_linux(X86MachineState *x86ms,
option_rom[nb_option_roms].bootindex = 0;
option_rom[nb_option_roms].name = "linuxboot.bin";
- if (linuxboot_dma_enabled && fw_cfg_dma_enabled(fw_cfg)) {
+ if (fw_cfg_dma_enabled(fw_cfg)) {
option_rom[nb_option_roms].name = "linuxboot_dma.bin";
}
nb_option_roms++;
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index f80533df1c5..dbf104d60af 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -375,14 +375,12 @@ static void x86_machine_initfn(Object *obj)
static void x86_machine_class_init(ObjectClass *oc, const void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
- X86MachineClass *x86mc = X86_MACHINE_CLASS(oc);
NMIClass *nc = NMI_CLASS(oc);
mc->cpu_index_to_instance_props = x86_cpu_index_to_props;
mc->get_default_cpu_node_id = x86_get_default_cpu_node_id;
mc->possible_cpu_arch_ids = x86_possible_cpu_arch_ids;
mc->kvm_type = x86_kvm_type;
- x86mc->fwcfg_dma_enabled = true;
nc->nmi_monitor_handler = x86_nmi;
object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto",
--
2.47.1
On 01/05/2025 19:36, Philippe Mathieu-Daudé wrote:
> The X86MachineClass::fwcfg_dma_enabled boolean was only used
> by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got
> removed. Remove it and simplify.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/i386/x86.h | 2 --
> hw/i386/microvm.c | 3 ---
> hw/i386/multiboot.c | 7 +------
> hw/i386/x86-common.c | 3 +--
> hw/i386/x86.c | 2 --
> 5 files changed, 2 insertions(+), 15 deletions(-)
>
> diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
> index fc460b82f82..29d37af11e6 100644
> --- a/include/hw/i386/x86.h
> +++ b/include/hw/i386/x86.h
> @@ -29,8 +29,6 @@
> struct X86MachineClass {
> MachineClass parent;
>
> - /* use DMA capable linuxboot option rom */
> - bool fwcfg_dma_enabled;
> /* CPU and apic information: */
> bool apic_xrupt_override;
> };
> diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
> index e0daf0d4fc3..b1262fb1523 100644
> --- a/hw/i386/microvm.c
> +++ b/hw/i386/microvm.c
> @@ -637,7 +637,6 @@ GlobalProperty microvm_properties[] = {
>
> static void microvm_class_init(ObjectClass *oc, const void *data)
> {
> - X86MachineClass *x86mc = X86_MACHINE_CLASS(oc);
> MicrovmMachineClass *mmc = MICROVM_MACHINE_CLASS(oc);
> MachineClass *mc = MACHINE_CLASS(oc);
> HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
> @@ -671,8 +670,6 @@ static void microvm_class_init(ObjectClass *oc, const void *data)
> hc->unplug_request = microvm_device_unplug_request_cb;
> hc->unplug = microvm_device_unplug_cb;
>
> - x86mc->fwcfg_dma_enabled = true;
> -
> object_class_property_add(oc, MICROVM_MACHINE_RTC, "OnOffAuto",
> microvm_machine_get_rtc,
> microvm_machine_set_rtc,
> diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
> index 6e6b96bc345..bfa7e8f1e83 100644
> --- a/hw/i386/multiboot.c
> +++ b/hw/i386/multiboot.c
> @@ -153,7 +153,6 @@ int load_multiboot(X86MachineState *x86ms,
> int kernel_file_size,
> uint8_t *header)
> {
> - bool multiboot_dma_enabled = X86_MACHINE_GET_CLASS(x86ms)->fwcfg_dma_enabled;
> int i, is_multiboot = 0;
> uint32_t flags = 0;
> uint32_t mh_entry_addr;
> @@ -402,11 +401,7 @@ int load_multiboot(X86MachineState *x86ms,
> fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
> sizeof(bootinfo));
>
> - if (multiboot_dma_enabled) {
> - option_rom[nb_option_roms].name = "multiboot_dma.bin";
> - } else {
> - option_rom[nb_option_roms].name = "multiboot.bin";
> - }
> + option_rom[nb_option_roms].name = "multiboot_dma.bin";
Question: now that all machines support DMA-capable fw_cfg, does that
mean that the non-DMA options roms above can also be removed?
> option_rom[nb_option_roms].bootindex = 0;
> nb_option_roms++;
>
> diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
> index 1b0671c5239..27254a0e9f1 100644
> --- a/hw/i386/x86-common.c
> +++ b/hw/i386/x86-common.c
> @@ -634,7 +634,6 @@ void x86_load_linux(X86MachineState *x86ms,
> int acpi_data_size,
> bool pvh_enabled)
> {
> - bool linuxboot_dma_enabled = X86_MACHINE_GET_CLASS(x86ms)->fwcfg_dma_enabled;
> uint16_t protocol;
> int setup_size, kernel_size, cmdline_size;
> int dtb_size, setup_data_offset;
> @@ -993,7 +992,7 @@ void x86_load_linux(X86MachineState *x86ms,
>
> option_rom[nb_option_roms].bootindex = 0;
> option_rom[nb_option_roms].name = "linuxboot.bin";
> - if (linuxboot_dma_enabled && fw_cfg_dma_enabled(fw_cfg)) {
> + if (fw_cfg_dma_enabled(fw_cfg)) {
> option_rom[nb_option_roms].name = "linuxboot_dma.bin";
> }
And same question here too.
> nb_option_roms++;
> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index f80533df1c5..dbf104d60af 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -375,14 +375,12 @@ static void x86_machine_initfn(Object *obj)
> static void x86_machine_class_init(ObjectClass *oc, const void *data)
> {
> MachineClass *mc = MACHINE_CLASS(oc);
> - X86MachineClass *x86mc = X86_MACHINE_CLASS(oc);
> NMIClass *nc = NMI_CLASS(oc);
>
> mc->cpu_index_to_instance_props = x86_cpu_index_to_props;
> mc->get_default_cpu_node_id = x86_get_default_cpu_node_id;
> mc->possible_cpu_arch_ids = x86_possible_cpu_arch_ids;
> mc->kvm_type = x86_kvm_type;
> - x86mc->fwcfg_dma_enabled = true;
> nc->nmi_monitor_handler = x86_nmi;
>
> object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto",
ATB,
Mark.
On 2/5/25 11:08, Mark Cave-Ayland wrote:
> On 01/05/2025 19:36, Philippe Mathieu-Daudé wrote:
>
>> The X86MachineClass::fwcfg_dma_enabled boolean was only used
>> by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got
>> removed. Remove it and simplify.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> include/hw/i386/x86.h | 2 --
>> hw/i386/microvm.c | 3 ---
>> hw/i386/multiboot.c | 7 +------
>> hw/i386/x86-common.c | 3 +--
>> hw/i386/x86.c | 2 --
>> 5 files changed, 2 insertions(+), 15 deletions(-)
>>
>> diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
>> index fc460b82f82..29d37af11e6 100644
>> --- a/include/hw/i386/x86.h
>> +++ b/include/hw/i386/x86.h
>> @@ -29,8 +29,6 @@
>> struct X86MachineClass {
>> MachineClass parent;
>> - /* use DMA capable linuxboot option rom */
>> - bool fwcfg_dma_enabled;
>> /* CPU and apic information: */
>> bool apic_xrupt_override;
>> };
>> diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
>> index 6e6b96bc345..bfa7e8f1e83 100644
>> --- a/hw/i386/multiboot.c
>> +++ b/hw/i386/multiboot.c
>> @@ -153,7 +153,6 @@ int load_multiboot(X86MachineState *x86ms,
>> int kernel_file_size,
>> uint8_t *header)
>> {
>> - bool multiboot_dma_enabled = X86_MACHINE_GET_CLASS(x86ms)-
>> >fwcfg_dma_enabled;
>> int i, is_multiboot = 0;
>> uint32_t flags = 0;
>> uint32_t mh_entry_addr;
>> @@ -402,11 +401,7 @@ int load_multiboot(X86MachineState *x86ms,
>> fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
>> sizeof(bootinfo));
>> - if (multiboot_dma_enabled) {
>> - option_rom[nb_option_roms].name = "multiboot_dma.bin";
>> - } else {
>> - option_rom[nb_option_roms].name = "multiboot.bin";
>> - }
>> + option_rom[nb_option_roms].name = "multiboot_dma.bin";
>
> Question: now that all machines support DMA-capable fw_cfg, does that
> mean that the non-DMA options roms above can also be removed?
All x86 machines, but there are still 2 not supporting it: HPPA and
MIPS Loongson-3:
hw/hppa/machine.c:204: fw_cfg = fw_cfg_init_mem(addr, addr + 4);
hw/mips/loongson3_virt.c:289: fw_cfg = fw_cfg_init_mem_wide(cfg_addr,
cfg_addr + 8, 8, 0, NULL);
On 02/05/2025 12.45, Philippe Mathieu-Daudé wrote:
> On 2/5/25 11:08, Mark Cave-Ayland wrote:
>> On 01/05/2025 19:36, Philippe Mathieu-Daudé wrote:
>>
>>> The X86MachineClass::fwcfg_dma_enabled boolean was only used
>>> by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got
>>> removed. Remove it and simplify.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> ---
>>> include/hw/i386/x86.h | 2 --
>>> hw/i386/microvm.c | 3 ---
>>> hw/i386/multiboot.c | 7 +------
>>> hw/i386/x86-common.c | 3 +--
>>> hw/i386/x86.c | 2 --
>>> 5 files changed, 2 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
>>> index fc460b82f82..29d37af11e6 100644
>>> --- a/include/hw/i386/x86.h
>>> +++ b/include/hw/i386/x86.h
>>> @@ -29,8 +29,6 @@
>>> struct X86MachineClass {
>>> MachineClass parent;
>>> - /* use DMA capable linuxboot option rom */
>>> - bool fwcfg_dma_enabled;
>>> /* CPU and apic information: */
>>> bool apic_xrupt_override;
>>> };
>
>
>>> diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
>>> index 6e6b96bc345..bfa7e8f1e83 100644
>>> --- a/hw/i386/multiboot.c
>>> +++ b/hw/i386/multiboot.c
>>> @@ -153,7 +153,6 @@ int load_multiboot(X86MachineState *x86ms,
>>> int kernel_file_size,
>>> uint8_t *header)
>>> {
>>> - bool multiboot_dma_enabled = X86_MACHINE_GET_CLASS(x86ms)-
>>> >fwcfg_dma_enabled;
>>> int i, is_multiboot = 0;
>>> uint32_t flags = 0;
>>> uint32_t mh_entry_addr;
>>> @@ -402,11 +401,7 @@ int load_multiboot(X86MachineState *x86ms,
>>> fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
>>> sizeof(bootinfo));
>>> - if (multiboot_dma_enabled) {
>>> - option_rom[nb_option_roms].name = "multiboot_dma.bin";
>>> - } else {
>>> - option_rom[nb_option_roms].name = "multiboot.bin";
>>> - }
>>> + option_rom[nb_option_roms].name = "multiboot_dma.bin";
>>
>> Question: now that all machines support DMA-capable fw_cfg, does that mean
>> that the non-DMA options roms above can also be removed?
>
> All x86 machines, but there are still 2 not supporting it: HPPA and
> MIPS Loongson-3:
>
> hw/hppa/machine.c:204: fw_cfg = fw_cfg_init_mem(addr, addr + 4);
>
> hw/mips/loongson3_virt.c:289: fw_cfg = fw_cfg_init_mem_wide(cfg_addr,
> cfg_addr + 8, 8, 0, NULL);
>
But these don't use "multiboot.bin", do they? So I think you could remove
pc-bios/multiboot.bin now from the repo?
Same question for "linuxboot.bin" : All users in hw/i386 seem to enable DMA,
so fw_cfg_dma_enabled() should always return true here? If so, I think the
normal "linuxboot.bin" could go away, too?
Thomas
© 2016 - 2025 Red Hat, Inc.