hw/i386/pc: Remove deprecated 2.6 and 2.7 PC machines
Subsystems (3)
v4 cover hw/i386/pc: Remove deprecated 2.6 and 2.7 PC machines
Since v3:
- Addressed Thomas and Zhao review comments
- Rename fw_cfg_init_mem_[no]dma() helpers
- Remove unused CPU properties
- Remove {multi,linux}boot.bin
- Added R-b tags
Since v2:
- Addressed Mark review comments and added his R-b tags
The versioned 'pc' and 'q35' machines up to 2.12 been marked as deprecated two releases ago, and are older than 6 years, so according to our support policy we can remove them.
This series only includes the 2.6 and 2.7 machines removal, as it is a big enough number of LoC removed. Rest will follow.
Based-on: <[email protected]>
Philippe Mathieu-Daudé (27):
hw/i386/pc: Remove deprecated pc-q35-2.6 and pc-i440fx-2.6 machines hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field hw/nvram/fw_cfg: Rename fw_cfg_init_mem() with '_nodma' suffix hw/mips/loongson3_virt: Prefer using fw_cfg_init_mem_nodma() hw/nvram/fw_cfg: Factor fw_cfg_init_mem_internal() out hw/nvram/fw_cfg: Rename fw_cfg_init_mem_wide() ->
fw_cfg_init_mem_dma()
hw/i386/x86: Remove X86MachineClass::fwcfg_dma_enabled field hw/i386/pc: Remove multiboot.bin
hw/nvram/fw_cfg: Remove fw_cfg_io_properties::dma_enabled hw/i386/pc: Remove linuxboot.bin
hw/i386/pc: Remove pc_compat_2_6[] array
target/i386/cpu: Remove CPUX86State::enable_cpuid_0xb field target/i386/cpu: Remove CPUX86State::fill_mtrr_mask field hw/intc/apic: Remove APICCommonState::legacy_instance_id field hw/core/machine: Remove hw_compat_2_6[] array hw/virtio/virtio-mmio: Remove
VirtIOMMIOProxy::format_transport_address field
hw/i386/pc: Remove deprecated pc-q35-2.7 and pc-i440fx-2.7 machines hw/i386/pc: Remove pc_compat_2_7[] array
target/i386/cpu: Remove CPUX86State::full_cpuid_auto_level field target/i386/cpu: Remove CPUX86State::enable_l3_cache field hw/audio/pcspk: Remove PCSpkState::migrate field hw/core/machine: Remove hw_compat_2_7[] array hw/i386/intel_iommu: Remove IntelIOMMUState::buggy_eim field hw/intc/ioapic: Remove IOAPICCommonState::version field hw/virtio/virtio-pci: Remove VirtIOPCIProxy::ignore_backend_features
field
hw/char/virtio-serial: Do not expose the 'emergency-write' property hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_PAGE_PER_VQ definition
hw/intc/ioapic_internal.h | 3 +- include/hw/acpi/cpu_hotplug.h | 3 - include/hw/boards.h | 6 - include/hw/i386/apic_internal.h | 1 - include/hw/i386/intel_iommu.h | 1 - include/hw/i386/pc.h | 9 -- include/hw/i386/x86.h | 2 - include/hw/nvram/fw_cfg.h | 9 +- include/hw/virtio/virtio-mmio.h | 1 - include/hw/virtio/virtio-pci.h | 2 - include/hw/virtio/virtio-serial.h | 2 - pc-bios/optionrom/optionrom.h | 4 - target/i386/cpu.h | 15 -- hw/acpi/cpu_hotplug.c | 230 --------------------------- hw/arm/virt.c | 2 +- hw/audio/pcspk.c | 10 -- hw/char/virtio-serial-bus.c | 9 +- hw/core/machine.c | 17 -- hw/display/virtio-vga.c | 10 -- hw/hppa/machine.c | 2 +- hw/i386/acpi-build.c | 4 +- hw/i386/fw_cfg.c | 5 +- hw/i386/intel_iommu.c | 5 +- hw/i386/microvm.c | 3 - hw/i386/multiboot.c | 7 +- hw/i386/pc.c | 22 +-- hw/i386/pc_piix.c | 23 --- hw/i386/pc_q35.c | 24 --- hw/i386/x86-common.c | 6 +- hw/i386/x86.c | 2 - hw/intc/apic_common.c | 5 - hw/intc/ioapic.c | 18 +-- hw/intc/ioapic_common.c | 2 +- hw/mips/loongson3_virt.c | 2 +- hw/nvram/fw_cfg.c | 48 +++--- hw/riscv/virt.c | 4 +- hw/virtio/virtio-mmio.c | 15 -- hw/virtio/virtio-pci.c | 12 +- target/i386/cpu.c | 152 ++++++++---------- target/i386/kvm/kvm.c | 10 +- tests/qtest/test-x86-cpuid-compat.c | 11 -- pc-bios/meson.build | 2 - pc-bios/multiboot.bin | Bin 1024 -> 0 bytes pc-bios/optionrom/Makefile | 2 +- pc-bios/optionrom/linuxboot.S | 195 ----------------------- pc-bios/optionrom/multiboot.S | 232 --------------------------- pc-bios/optionrom/multiboot_dma.S | 234 +++++++++++++++++++++++++++- 47 files changed, 349 insertions(+), 1034 deletions(-) delete mode 100644 pc-bios/multiboot.bin delete mode 100644 pc-bios/optionrom/linuxboot.S delete mode 100644 pc-bios/optionrom/multiboot.S
Signature · 1 line
2.47.1
PATCH v4 1/27 hw/i386/pc: Remove deprecated pc-q35-2.6 and pc-i440fx-2.6 machines
These machines has been supported for a period of more than 6 years. According to our versioned machine support policy (see commit ce80c4fa6ff "docs: document special exception for machine type deprecation & removal") they can now be removed.
--- hw/i386/pc_piix.c | 14 -------------- hw/i386/pc_q35.c | 14 -------------- 2 files changed, 28 deletions(-)
hw/i386/pc_piix.c +0 -14
@@ -764,20 +764,6 @@ static void pc_i440fx_machine_2_7_options(MachineClass *m)DEFINE_I440FX_MACHINE (2 ,7 ); -static void pc_i440fx_machine_2_6_options (MachineClass *m) -{ -X86MachineClass *x86mc =X86_MACHINE_CLASS (m); -PCMachineClass *pcmc =PC_MACHINE_CLASS (m); - -pc_i440fx_machine_2_7_options (m); - pcmc->legacy_cpu_hotplug = true; - x86mc->fwcfg_dma_enabled = false; -compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len); -compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len); -} - -DEFINE_I440FX_MACHINE (2 ,6 ); -#ifdef CONFIG_ISAPC static void isapc_machine_options (MachineClass *m) {
hw/i386/pc_q35.c +0 -14
@@ -658,17 +658,3 @@ static void pc_q35_machine_2_7_options(MachineClass *m) }DEFINE_Q35_MACHINE (2 ,7 ); - -static void pc_q35_machine_2_6_options (MachineClass *m) -{ -X86MachineClass *x86mc =X86_MACHINE_CLASS (m); -PCMachineClass *pcmc =PC_MACHINE_CLASS (m); - -pc_q35_machine_2_7_options (m); - pcmc->legacy_cpu_hotplug = true; - x86mc->fwcfg_dma_enabled = false; -compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len); -compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len); -} - -DEFINE_Q35_MACHINE (2 ,6 );
Signature · 1 line
2.47.1
Re: [PATCH v4 01/27] hw/i386/pc: Remove deprecated pc-q35-2.6 and pc-i440fx-2.6 machines
Quoted 4 lines · On Thu, 8 May 2025 15:35:24 +0200 Philippe Mathieu-Daudé <[email protected]>…
These machines has been supported for a period of more than 6 years. According to our versioned machine support policy (see commit
ce80c4fa6ff"docs: document special exception for machine type deprecation & removal") they can now be removed.
if these machine types are the last users of compat arrays, it's better to remove array at the same time, aka squash those patches later in series into this one.
That leaves no illusion that compats could be used in the later patches.
Quoted 57 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>Reviewed-by Zhao Liu <[email protected]>--- hw/i386/pc_piix.c | 14 -------------- hw/i386/pc_q35.c | 14 -------------- 2 files changed, 28 deletions(-)hw/i386/pc_piix.c +0
-14@@ -764,20 +764,6 @@ static void pc_i440fx_machine_2_7_options(MachineClass *m)DEFINE_I440FX_MACHINE (2 ,7 ); -static void pc_i440fx_machine_2_6_options (MachineClass *m) -{ -X86MachineClass *x86mc =X86_MACHINE_CLASS (m); -PCMachineClass *pcmc =PC_MACHINE_CLASS (m); - -pc_i440fx_machine_2_7_options (m); - pcmc->legacy_cpu_hotplug = true; - x86mc->fwcfg_dma_enabled = false; -compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len); -compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len); -} - -DEFINE_I440FX_MACHINE (2 ,6 ); -#ifdef CONFIG_ISAPC static void isapc_machine_options (MachineClass *m) {hw/i386/pc_q35.c +0
-14@@ -658,17 +658,3 @@ static void pc_q35_machine_2_7_options(MachineClass *m) }DEFINE_Q35_MACHINE (2 ,7 ); - -static void pc_q35_machine_2_6_options (MachineClass *m) -{ -X86MachineClass *x86mc =X86_MACHINE_CLASS (m); -PCMachineClass *pcmc =PC_MACHINE_CLASS (m); - -pc_q35_machine_2_7_options (m); - pcmc->legacy_cpu_hotplug = true; - x86mc->fwcfg_dma_enabled = false; -compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len); -compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len); -} - -DEFINE_Q35_MACHINE (2 ,6 );
Re: [PATCH v4 01/27] hw/i386/pc: Remove deprecated pc-q35-2.6 and pc-i440fx-2.6 machines
Quoted 8 lines · Igor Mammedov
Quoted 4 lines · On Thu, 8 May 2025 15:35:24 +0200 Philippe Mathieu-Daudé <[email protected]>…
These machines has been supported for a period of more than 6 years. According to our versioned machine support policy (see commit
ce80c4fa6ff"docs: document special exception for machine type deprecation & removal") they can now be removed.
Quoted 4 lines
if these machine types are the last users of compat arrays, it's better to remove array at the same time, aka squash those patches later in series into this one.
That leaves no illusion that compats could be used in the later patches.
IMHO the generic hw_compat array should be treated separately since this is independent from x86. So in case someone ever needs to backport these patches to an older branch, they can decide more easily whether they want to apply the generic hw_compat part or only the x86-specific part of this series.
Thomas
Re: [PATCH v4 01/27] hw/i386/pc: Remove deprecated pc-q35-2.6 and pc-i440fx-2.6 machines
Quoted 9 lines · Thomas Huth
Quoted 8 lines · Igor Mammedov
Quoted 4 lines · On Thu, 8 May 2025 15:35:24 +0200 Philippe Mathieu-Daudé <[email protected]>…
These machines has been supported for a period of more than 6 years. According to our versioned machine support policy (see commit
ce80c4fa6ff"docs: document special exception for machine type deprecation & removal") they can now be removed.
Quoted 6 lines
Quoted 4 lines
if these machine types are the last users of compat arrays, it's better to remove array at the same time, aka squash those patches later in series into this one.
That leaves no illusion that compats could be used in the later patches.IMHO the generic
hw_compatarray should be treated separately since this is independent from x86. So in case someone ever needs to backport these patches to an older branch, they can decide more easily whether they want to apply the generichw_compatpart or only the x86-specific part of this series.
Yes, it is clearer this way than squashed.
Re: [PATCH v4 01/27] hw/i386/pc: Remove deprecated pc-q35-2.6 and pc-i440fx-2.6 machines
Quoted 15 lines · On Mon, 2 Jun 2025 10:53:19 +0200 Philippe Mathieu-Daudé <[email protected]>…
Quoted 14 lines · Thomas Huth
Quoted 12 lines · Igor Mammedov
Quoted 4 lines · On Thu, 8 May 2025 15:35:24 +0200 Philippe Mathieu-Daudé <[email protected]>…
These machines has been supported for a period of more than 6 years. According to our versioned machine support policy (see commit
ce80c4fa6ff"docs: document special exception for machine type deprecation & removal") they can now be removed.if these machine types are the last users of compat arrays, it's better to remove array at the same time, aka squash those patches later in series into this one.
That leaves no illusion that compats could be used in the later patches.
Quoted 7 lines
Quoted 5 lines
IMHO the generic
hw_compatarray should be treated separately since this is independent from x86. So in case someone ever needs to backport these patches to an older branch, they can decide more easily whether they want to apply the generichw_compatpart or only the x86-specific part of this series.Yes, it is clearer this way than squashed.
ok, let's leave it as is.
Quoted 1 line
PATCH v4 2/27 hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field
In reply to Philippe Mathieu-DaudéThe PCMachineClass::legacy_cpu_hotplug boolean was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it and simplify build_dsdt(), removing build_legacy_cpu_hotplug_aml() altogether.
Note, this field was added by commit 679dd1a957d ("pc: use new CPU hotplug interface since 2.7 machine type"):
Quoted 11 lines
For compatibility reasons PC/Q35 will start with legacy CPU hotplug interface by default but with new CPU hotplug AML code since 2.7 machine type. That way legacy firmware that doesn't use QEMU generated ACPI tables will be able to continue using legacy CPU hotplug interface.
While new machine type, with firmware supporting QEMU provided ACPI tables, will generate new CPU hotplug AML, which will switch to new CPU hotplug interface when guest OS executes its
_INImethod on ACPI tables loading.
--- include/hw/acpi/cpu_hotplug.h | 3 - include/hw/i386/pc.h | 3 - hw/acpi/cpu_hotplug.c | 230 ---------------------------------- hw/i386/acpi-build.c | 4 +- 4 files changed, 1 insertion(+), 239 deletions(-)
include/hw/acpi/cpu_hotplug.h +0 -3
@@ -34,7 +34,4 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,void acpi_switch_to_modern_cphp (AcpiCpuHotplug *gpe_cpu,CPUHotplugState *cpuhp_state,uint16_t io_port); - -void build_legacy_cpu_hotplug_aml (Aml *ctx,MachineState *machine, -uint16_t io_base);#endif
include/hw/i386/pc.h +0 -3
@@ -110,9 +110,6 @@ struct PCMachineClass {bool enforce_amd_1tb_hole;bool isa_bios_alias; -/* generate legacy CPU hotplug AML */ -bool legacy_cpu_hotplug; -/* use PVH to load kernels that support this feature */ bool pvh_enabled;
hw/acpi/cpu_hotplug.c +0 -230
233 lines not on this page · raw message
hw/i386/acpi-build.c +1 -3
@@ -1465,9 +1465,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, }aml_append (dsdt, scope); -if (pcmc->legacy_cpu_hotplug) { -build_legacy_cpu_hotplug_aml (dsdt, machine, pm->cpu_hp_io_base); - }else { + {CPUHotplugFeatures opts = { .acpi_1_compatible = true, .has_legacy_cphp = true, .smi_path = pm->smi_on_cpuhp ?"\\_SB.PCI0.SMI0.SMIC" :NULL ,
Signature · 1 line
2.47.1
Re: [PATCH v4 02/27] hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field
Quoted 31 lines · On Thu, 8 May 2025 15:35:25 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
PCMachineClass::legacy_cpu_hotplugboolean was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it and simplifybuild_dsdt(), removingbuild_legacy_cpu_hotplug_aml()altogether.Note, this field was added by commit
679dd1a957d("pc: use new CPU hotplug interface since 2.7 machine type"):Quoted 11 lines
For compatibility reasons PC/Q35 will start with legacy CPU hotplug interface by default but with new CPU hotplug AML code since 2.7 machine type. That way legacy firmware that doesn't use QEMU generated ACPI tables will be able to continue using legacy CPU hotplug interface.
While new machine type, with firmware supporting QEMU provided ACPI tables, will generate new CPU hotplug AML, which will switch to new CPU hotplug interface when guest OS executes its
_INImethod on ACPI tables loading.Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>Reviewed-by Zhao Liu <[email protected]>--- include/hw/acpi/cpu_hotplug.h | 3 - include/hw/i386/pc.h | 3 - hw/acpi/cpu_hotplug.c | 230 ---------------------------------- hw/i386/acpi-build.c | 4 +- 4 files changed, 1 insertion(+), 239 deletions(-)
...
Quoted 5 lines
hw/i386/acpi-build.c +0
-0
hw/i386/acpi-build.c build_dsdt(GArray *table_data, BIOSLinker *linker, · line 1470
Quoted 9 lines
hw/i386/acpi-build.c +1
-3@@ -1465,9 +1465,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, }aml_append (dsdt, scope); -if (pcmc->legacy_cpu_hotplug) { -build_legacy_cpu_hotplug_aml (dsdt, machine, pm->cpu_hp_io_base); - }else { + {CPUHotplugFeatures opts = { .acpi_1_compatible = true, .has_legacy_cphp = true,
^^^^^
that still leaves legacy CPU hotplug hardware around, which we should remove at the same time as legacy AML.
i.e.:
drop _INI in hw/acpi/cpu.c
and at the same time replace legacy_acpi_cpu_hotplug_init() at call sites with cpu_hotplug_hw_init()
after that you can safely remove legacy_cpu_hotplug and no longer needed hw/acpi/cpu_hotplug.c && co
Quoted 1 line
hw/i386/acpi-build.c +0
-0.smi_path = pm->smi_on_cpuhp ? "\\_SB.PCI0.SMI0.SMIC" : NULL,
PATCH v5 1/1 hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field
In reply to Philippe Mathieu-DaudéFor compatibility reasons PC/Q35 will start with legacy CPU hotplug interface by default but with new CPU hotplug AML code since 2.7 machine type. That way legacy firmware that doesn't use QEMU generated ACPI tables was able to continue using legacy CPU hotplug interface.
While later machine types, with firmware supporting QEMU provided ACPI tables, generate new CPU hotplug AML, which will switch to new CPU hotplug interface when guest OS executes its _INI method on ACPI tables loading.
Since 2.6 machine type is now gone, drop legacy CPU hotplug code (both ACPI and related hardware bits) and initialize 'modern' hotplug from the very beginning.
---
PS:
it does compile but I do not remember if I've actually tested hotplug path
--- include/hw/acpi/cpu.h | 1 - include/hw/acpi/cpu_hotplug.h | 37 ------ include/hw/acpi/ich9.h | 3 - include/hw/acpi/piix4.h | 4 +- tests/qtest/bios-tables-test-allowed-diff.h | 42 +++++++ hw/acpi/acpi-cpu-hotplug-stub.c | 18 +-- hw/acpi/cpu.c | 10 -- hw/acpi/cpu_hotplug.c | 118 -------------------- hw/acpi/generic_event_device.c | 1 + hw/acpi/ich9.c | 61 ++-------- hw/acpi/meson.build | 2 +- hw/acpi/piix4.c | 60 ++-------- hw/i386/acpi-build.c | 4 +- hw/i386/pc.c | 3 +- hw/i386/pc_piix.c | 2 - hw/i386/pc_q35.c | 2 - hw/i386/x86-common.c | 1 - hw/loongarch/virt-acpi-build.c | 1 - 18 files changed, 65 insertions(+), 305 deletions(-) delete mode 100644 include/hw/acpi/cpu_hotplug.h delete mode 100644 hw/acpi/cpu_hotplug.c
include/hw/acpi/cpu.h +0 -1
@@ -54,7 +54,6 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,typedef struct CPUHotplugFeatures {bool acpi_1_compatible; -bool has_legacy_cphp;bool fw_unplugs_cpu;const char *smi_path; }CPUHotplugFeatures ;
include/hw/acpi/cpu_hotplug.h deleted +0 -37
@@ -1,37 +0,0 @@ -/* -* QEMU ACPI hotplug utilities -* -* Copyright (C) 2013 Red Hat Inc -* -* Authors: -* Igor Mammedov <[email protected]> -* -* This work is licensed under the terms of the GNU GPL, version 2 or later. -* See the COPYING file in the top-level directory. -*/ - -#ifndef HW_ACPI_CPU_HOTPLUG_H -#define HW_ACPI_CPU_HOTPLUG_H - -#include "hw/acpi/acpi.h" -#include "hw/acpi/pc-hotplug.h" -#include "hw/acpi/aml-build.h" -#include "hw/hotplug.h" -#include "hw/acpi/cpu.h" - -typedef struct AcpiCpuHotplug { -Object *device; -MemoryRegion io; -uint8_t sts[ACPI_GPE_PROC_LEN ]; -}AcpiCpuHotplug ; - -void legacy_acpi_cpu_plug_cb (HotplugHandler *hotplug_dev, -AcpiCpuHotplug *g,DeviceState *dev,Error **errp); - -void legacy_acpi_cpu_hotplug_init (MemoryRegion *parent,Object *owner, -AcpiCpuHotplug *gpe_cpu,uint16_t base); - -void acpi_switch_to_modern_cphp (AcpiCpuHotplug *gpe_cpu, -CPUHotplugState *cpuhp_state, -uint16_t io_port); -#endif
include/hw/acpi/ich9.h +0 -3
@@ -22,7 +22,6 @@#define HW_ACPI_ICH9_H #include "hw/acpi/acpi.h" -#include "hw/acpi/cpu_hotplug.h" #include "hw/acpi/cpu.h" #include "hw/acpi/pcihp.h" #include "hw/acpi/memory_hotplug.h"
@@ -53,8 +52,6 @@ typedef struct ICH9LPCPMRegs {uint32_t pm_io_base;Notifier powerdown_notifier; -bool cpu_hotplug_legacy; -AcpiCpuHotplug gpe_cpu;CPUHotplugState cpuhp_state;bool keep_pci_slot_hpc;
include/hw/acpi/piix4.h +1 -3
@@ -24,11 +24,11 @@#include "hw/pci/pci_device.h" #include "hw/acpi/acpi.h" -#include "hw/acpi/cpu_hotplug.h" #include "hw/acpi/memory_hotplug.h" #include "hw/acpi/pcihp.h" #include "hw/i2c/pm_smbus.h" #include "hw/isa/apm.h" +#include "hw/acpi/cpu.h" #define TYPE_PIIX4_PM "PIIX4_PM"OBJECT_DECLARE_SIMPLE_TYPE (PIIX4PMState,PIIX4_PM )
@@ -63,8 +63,6 @@ struct PIIX4PMState {uint8_t disable_s4;uint8_t s4_val; -bool cpu_hotplug_legacy; -AcpiCpuHotplug gpe_cpu;CPUHotplugState cpuhp_state;MemHotplugState acpi_memory_hotplug;
tests/qtest/bios-tables-test-allowed-diff.h +42 -0
43 lines not on this page · raw message
hw/acpi/acpi-cpu-hotplug-stub.c +1 -17
@@ -1,22 +1,11 @@#include "qemu/osdep.h" -#include "hw/acpi/cpu_hotplug.h" #include "migration/vmstate.h" +#include "hw/acpi/cpu.h" /* Following stubs are all related to ACPI cpu hotplug */ const VMStateDescription vmstate_cpu_hotplug; -void acpi_switch_to_modern_cphp (AcpiCpuHotplug *gpe_cpu, -CPUHotplugState *cpuhp_state, -uint16_t io_port) -{ -} - -void legacy_acpi_cpu_hotplug_init (MemoryRegion *parent,Object *owner, -AcpiCpuHotplug *gpe_cpu,uint16_t base) -{ -} -void cpu_hotplug_hw_init (MemoryRegion *as,Object *owner,CPUHotplugState *state,hwaddr base_addr) {
@@ -31,11 +20,6 @@ void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, { } -void legacy_acpi_cpu_plug_cb (HotplugHandler *hotplug_dev, -AcpiCpuHotplug *g,DeviceState *dev,Error **errp) -{ -} -void acpi_cpu_unplug_cb (CPUHotplugState *cpu_st,DeviceState *dev,Error **errp) {
hw/acpi/cpu.c +0 -10
@@ -408,16 +408,6 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,aml_append (field,aml_reserved_field (4 *8 ));aml_append (field,aml_named_field (CPU_DATA ,32 ));aml_append (cpu_ctrl_dev, field); - -if (opts.has_legacy_cphp) { - method =aml_method ("_INI" ,0 ,AML_SERIALIZED ); -/* switch off legacy CPU hotplug HW and use new one, -* on reboot system is in new mode and writing 0 -* in CPU_SELECTOR selects BSP, which is NOP at -* the time _INI is called */ -aml_append (method,aml_store (zero,aml_name (CPU_SELECTOR ))); -aml_append (cpu_ctrl_dev, method); - } }aml_append (sb_scope, cpu_ctrl_dev);
hw/acpi/cpu_hotplug.c deleted +0 -118
118 lines not on this page · raw message
hw/acpi/generic_event_device.c +1 -0
@@ -13,6 +13,7 @@#include "qapi/error.h" #include "hw/acpi/acpi.h" #include "hw/acpi/pcihp.h" +#include "hw/acpi/cpu.h" #include "hw/acpi/generic_event_device.h" #include "hw/pci/pci.h" #include "hw/irq.h"
hw/acpi/ich9.c +7 -54
123 lines not on this page · raw message
hw/acpi/meson.build +1 -1
@@ -6,7 +6,7 @@ acpi_ss.add(files( 'core.c', 'utils.c', )) -acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c', 'cpu_hotplug.c')) +acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c')) acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_false: files('acpi-cpu-hotplug-stub.c')) acpi_ss.add(when: 'CONFIG_ACPI_MEMORY_HOTPLUG', if_true: files('memory_hotplug.c')) acpi_ss.add(when: 'CONFIG_ACPI_MEMORY_HOTPLUG', if_false: files('acpi-mem-hotplug-stub.c'))
hw/acpi/piix4.c +7 -53
118 lines not on this page · raw message
hw/i386/acpi-build.c +3 -1
@@ -35,6 +35,7 @@#include "hw/acpi/acpi-defs.h" #include "hw/acpi/acpi.h" #include "hw/acpi/cpu.h" +#include "hw/acpi/pc-hotplug.h" #include "hw/nvram/fw_cfg.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/acpi/acpi_aml_interface.h"
@@ -78,6 +79,7 @@#include "hw/acpi/hmat.h" #include "hw/acpi/viot.h" +#include CONFIG_DEVICES /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
@@ -962,7 +964,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, {CPUHotplugFeatures opts = { - .acpi_1_compatible = true, .has_legacy_cphp = true, + .acpi_1_compatible = true, .smi_path = pm->smi_on_cpuhp ?"\\_SB.PCI0.SMI0.SMIC" :NULL , .fw_unplugs_cpu = pm->smi_on_cpu_unplug, };
hw/i386/pc.c +2 -1
@@ -48,7 +48,8 @@#include "hw/xen/xen.h" #include "qobject/qlist.h" #include "qemu/error-report.h" -#include "hw/acpi/cpu_hotplug.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/pc-hotplug.h" #include "acpi-build.h" #include "hw/mem/nvdimm.h" #include "hw/cxl/cxl_host.h"
hw/i386/pc_piix.c +0 -2
@@ -736,10 +736,8 @@ DEFINE_I440FX_MACHINE(2, 7);static void pc_i440fx_machine_2_6_options (MachineClass *m) {X86MachineClass *x86mc =X86_MACHINE_CLASS (m); -PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_machine_2_7_options (m); - pcmc->legacy_cpu_hotplug = true; x86mc->fwcfg_dma_enabled = false;compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len);compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len);
hw/i386/pc_q35.c +0 -2
@@ -685,10 +685,8 @@ DEFINE_Q35_MACHINE(2, 7);static void pc_q35_machine_2_6_options (MachineClass *m) {X86MachineClass *x86mc =X86_MACHINE_CLASS (m); -PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_machine_2_7_options (m); - pcmc->legacy_cpu_hotplug = true; x86mc->fwcfg_dma_enabled = false;compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len);compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len);
hw/i386/x86-common.c +0 -1
@@ -36,7 +36,6 @@#include "hw/rtc/mc146818rtc.h" #include "target/i386/sev.h" -#include "hw/acpi/cpu_hotplug.h" #include "hw/irq.h" #include "hw/loader.h" #include "multiboot.h"
hw/loongarch/virt-acpi-build.c +0 -1
@@ -370,7 +370,6 @@ build_la_ged_aml(Aml *dsdt, MachineState *machine)if (event &ACPI_GED_CPU_HOTPLUG_EVT ) { opts.acpi_1_compatible = false; - opts.has_legacy_cphp = false; opts.fw_unplugs_cpu = false; opts.smi_path =NULL ;
Signature · 1 line
2.47.3
Re: [PATCH v5] hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field
tests/qtest/bios-tables-test-allowed-diff.h
Quoted 152 lines · Igor Mammedov
For compatibility reasons PC/Q35 will start with legacy CPU hotplug interface by default but with new CPU hotplug AML code since 2.7 machine type. That way legacy firmware that doesn't use QEMU generated ACPI tables was able to continue using legacy CPU hotplug interface.
While later machine types, with firmware supporting QEMU provided ACPI tables, generate new CPU hotplug AML, which will switch to new CPU hotplug interface when guest OS executes its
_INImethod on ACPI tables loading.Since 2.6 machine type is now gone, drop legacy CPU hotplug code (both ACPI and related hardware bits) and initialize 'modern' hotplug from the very beginning.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Igor Mammedov <[email protected]>---
PS:
it does compile but I do not remember if I've actually tested hotplug path---
include/hw/acpi/cpu.h | 1 - include/hw/acpi/cpu_hotplug.h | 37 ------ include/hw/acpi/ich9.h | 3 - include/hw/acpi/piix4.h | 4 +- tests/qtest/bios-tables-test-allowed-diff.h | 42 +++++++ hw/acpi/acpi-cpu-hotplug-stub.c | 18 +-- hw/acpi/cpu.c | 10 -- hw/acpi/cpu_hotplug.c | 118 -------------------- hw/acpi/generic_event_device.c | 1 + hw/acpi/ich9.c | 61 ++-------- hw/acpi/meson.build | 2 +- hw/acpi/piix4.c | 60 ++-------- hw/i386/acpi-build.c | 4 +- hw/i386/pc.c | 3 +- hw/i386/pc_piix.c | 2 - hw/i386/pc_q35.c | 2 - hw/i386/x86-common.c | 1 - hw/loongarch/virt-acpi-build.c | 1 - 18 files changed, 65 insertions(+), 305 deletions(-)delete mode 100644
include/hw/acpi/cpu_hotplug.hdelete mode 100644hw/acpi/cpu_hotplug.cinclude/hw/acpi/cpu.h +0
-1@@ -54,7 +54,6 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,typedef struct CPUHotplugFeatures {bool acpi_1_compatible; -bool has_legacy_cphp;bool fw_unplugs_cpu;const char *smi_path; }CPUHotplugFeatures ;include/hw/acpi/cpu_hotplug.h deleted +0
-37@@ -1,37 +0,0 @@ -/* -* QEMU ACPI hotplug utilities -* -* Copyright (C) 2013 Red Hat Inc -* -* Authors: -* Igor Mammedov <[email protected]> -* -* This work is licensed under the terms of the GNU GPL, version 2 or later. -* See the COPYING file in the top-level directory. -*/ - -#ifndef HW_ACPI_CPU_HOTPLUG_H -#define HW_ACPI_CPU_HOTPLUG_H - -#include "hw/acpi/acpi.h" -#include "hw/acpi/pc-hotplug.h" -#include "hw/acpi/aml-build.h" -#include "hw/hotplug.h" -#include "hw/acpi/cpu.h" - -typedef struct AcpiCpuHotplug { -Object *device; -MemoryRegion io; -uint8_t sts[ACPI_GPE_PROC_LEN ]; -}AcpiCpuHotplug ; - -void legacy_acpi_cpu_plug_cb (HotplugHandler *hotplug_dev, -AcpiCpuHotplug *g,DeviceState *dev,Error **errp); - -void legacy_acpi_cpu_hotplug_init (MemoryRegion *parent,Object *owner, -AcpiCpuHotplug *gpe_cpu,uint16_t base); - -void acpi_switch_to_modern_cphp (AcpiCpuHotplug *gpe_cpu, -CPUHotplugState *cpuhp_state, -uint16_t io_port); -#endif include/hw/acpi/ich9.h +0
-3@@ -22,7 +22,6 @@#define HW_ACPI_ICH9_H #include "hw/acpi/acpi.h" -#include "hw/acpi/cpu_hotplug.h" #include "hw/acpi/cpu.h" #include "hw/acpi/pcihp.h" #include "hw/acpi/memory_hotplug.h" @@ -53,8 +52,6 @@ typedef struct ICH9LPCPMRegs {uint32_t pm_io_base;Notifier powerdown_notifier; -bool cpu_hotplug_legacy; -AcpiCpuHotplug gpe_cpu;CPUHotplugState cpuhp_state;bool keep_pci_slot_hpc;include/hw/acpi/piix4.h +1
-3@@ -24,11 +24,11 @@#include "hw/pci/pci_device.h" #include "hw/acpi/acpi.h" -#include "hw/acpi/cpu_hotplug.h" #include "hw/acpi/memory_hotplug.h" #include "hw/acpi/pcihp.h" #include "hw/i2c/pm_smbus.h" #include "hw/isa/apm.h" +#include "hw/acpi/cpu.h" #define TYPE_PIIX4_PM "PIIX4_PM"OBJECT_DECLARE_SIMPLE_TYPE (PIIX4PMState,PIIX4_PM )@@ -63,8 +63,6 @@ struct PIIX4PMState {uint8_t disable_s4;uint8_t s4_val; -bool cpu_hotplug_legacy; -AcpiCpuHotplug gpe_cpu;CPUHotplugState cpuhp_state;MemHotplugState acpi_memory_hotplug;tests/qtest/bios-tables-test-allowed-diff.h +0
-0@@ -1 +1,43 @@
Does this belong here?
Quoted 33 lines
tests/qtest/bios-tables-test-allowed-diff.h +32
-0/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/x86/pc/DSDT" , +"tests/data/acpi/x86/q35/DSDT" , +"tests/data/acpi/x86/pc/DSDT.bridge" , +"tests/data/acpi/x86/pc/DSDT.ipmikcs" , +"tests/data/acpi/x86/pc/DSDT.cphp" , +"tests/data/acpi/x86/pc/DSDT.numamem" , +"tests/data/acpi/x86/pc/DSDT.nohpet" , +"tests/data/acpi/x86/pc/DSDT.memhp" , +"tests/data/acpi/x86/pc/DSDT.dimmpxm" , +"tests/data/acpi/x86/pc/DSDT.acpihmat" , +"tests/data/acpi/x86/pc/DSDT.acpierst" , +"tests/data/acpi/x86/pc/DSDT.roothp" , +"tests/data/acpi/x86/pc/DSDT.hpbridge" , +"tests/data/acpi/x86/pc/DSDT.hpbrroot" , +"tests/data/acpi/x86/q35/DSDT.tis.tpm2" , +"tests/data/acpi/x86/q35/DSDT.tis.tpm12" , +"tests/data/acpi/x86/q35/DSDT.bridge" , +"tests/data/acpi/x86/q35/DSDT.noacpihp" , +"tests/data/acpi/x86/q35/DSDT.multi-bridge" , +"tests/data/acpi/x86/q35/DSDT.ipmibt" , +"tests/data/acpi/x86/q35/DSDT.cphp" , +"tests/data/acpi/x86/q35/DSDT.numamem" , +"tests/data/acpi/x86/q35/DSDT.nohpet" , +"tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator" , +"tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x" , +"tests/data/acpi/x86/q35/DSDT.memhp" , +"tests/data/acpi/x86/q35/DSDT.dimmpxm" , +"tests/data/acpi/x86/q35/DSDT.acpihmat" , +"tests/data/acpi/x86/q35/DSDT.mmio64" , +"tests/data/acpi/x86/q35/DSDT.acpierst" , +"tests/data/acpi/x86/q35/DSDT.applesmc" , +"tests/data/acpi/x86/q35/DSDT.pvpanic-isa",
tests/qtest/bios-tables-test-allowed-diff.h line 43
Quoted 10 lines
tests/qtest/bios-tables-test-allowed-diff.h +10
-0+"tests/data/acpi/x86/q35/DSDT.ivrs" , +"tests/data/acpi/x86/q35/DSDT.type4-count" , +"tests/data/acpi/x86/q35/DSDT.core-count" , +"tests/data/acpi/x86/q35/DSDT.core-count2" , +"tests/data/acpi/x86/q35/DSDT.thread-count" , +"tests/data/acpi/x86/q35/DSDT.thread-count2" , +"tests/data/acpi/x86/q35/DSDT.viot" , +"tests/data/acpi/x86/q35/DSDT.cxl" , +"tests/data/acpi/x86/q35/DSDT.ipmismbus" , +"tests/data/acpi/x86/q35/DSDT.xapic",
Regards,
BALATON Zoltan
Re: [PATCH v5] hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field
On Sat, 1 Nov 2025 00:27:36 +0100 (CET)
BALATON Zoltan <[email protected]> wrote:
[...]
Quoted 7 lines
tests/qtest/bios-tables-test-allowed-diff.h
Quoted 5 lines
tests/qtest/bios-tables-test-allowed-diff.h +0
-0@@ -1 +1,43 @@Does this belong here?
thanks for spotting it, it should be a separate preceding patch,
and then expected blobs update patch after this patch,
that would cleanup bios-tables-test-allowed-diff.h along with new blobs. /i.e. as per process described in bios-tables-test.c /
Quoted 47 lines
Quoted 34 lines
tests/qtest/bios-tables-test-allowed-diff.h +32
-0/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/x86/pc/DSDT" , +"tests/data/acpi/x86/q35/DSDT" , +"tests/data/acpi/x86/pc/DSDT.bridge" , +"tests/data/acpi/x86/pc/DSDT.ipmikcs" , +"tests/data/acpi/x86/pc/DSDT.cphp" , +"tests/data/acpi/x86/pc/DSDT.numamem" , +"tests/data/acpi/x86/pc/DSDT.nohpet" , +"tests/data/acpi/x86/pc/DSDT.memhp" , +"tests/data/acpi/x86/pc/DSDT.dimmpxm" , +"tests/data/acpi/x86/pc/DSDT.acpihmat" , +"tests/data/acpi/x86/pc/DSDT.acpierst" , +"tests/data/acpi/x86/pc/DSDT.roothp" , +"tests/data/acpi/x86/pc/DSDT.hpbridge" , +"tests/data/acpi/x86/pc/DSDT.hpbrroot" , +"tests/data/acpi/x86/q35/DSDT.tis.tpm2" , +"tests/data/acpi/x86/q35/DSDT.tis.tpm12" , +"tests/data/acpi/x86/q35/DSDT.bridge" , +"tests/data/acpi/x86/q35/DSDT.noacpihp" , +"tests/data/acpi/x86/q35/DSDT.multi-bridge" , +"tests/data/acpi/x86/q35/DSDT.ipmibt" , +"tests/data/acpi/x86/q35/DSDT.cphp" , +"tests/data/acpi/x86/q35/DSDT.numamem" , +"tests/data/acpi/x86/q35/DSDT.nohpet" , +"tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator" , +"tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x" , +"tests/data/acpi/x86/q35/DSDT.memhp" , +"tests/data/acpi/x86/q35/DSDT.dimmpxm" , +"tests/data/acpi/x86/q35/DSDT.acpihmat" , +"tests/data/acpi/x86/q35/DSDT.mmio64" , +"tests/data/acpi/x86/q35/DSDT.acpierst" , +"tests/data/acpi/x86/q35/DSDT.applesmc" , +"tests/data/acpi/x86/q35/DSDT.pvpanic-isa",tests/qtest/bios-tables-test-allowed-diff.h line 43
Quoted 10 lines
tests/qtest/bios-tables-test-allowed-diff.h +10
-0+"tests/data/acpi/x86/q35/DSDT.ivrs" , +"tests/data/acpi/x86/q35/DSDT.type4-count" , +"tests/data/acpi/x86/q35/DSDT.core-count" , +"tests/data/acpi/x86/q35/DSDT.core-count2" , +"tests/data/acpi/x86/q35/DSDT.thread-count" , +"tests/data/acpi/x86/q35/DSDT.thread-count2" , +"tests/data/acpi/x86/q35/DSDT.viot" , +"tests/data/acpi/x86/q35/DSDT.cxl" , +"tests/data/acpi/x86/q35/DSDT.ipmismbus" , +"tests/data/acpi/x86/q35/DSDT.xapic",Regards,
BALATON Zoltan
Re: [PATCH v5] hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field
Quoted 10 lines · Igor Mammedov
Date: Mon, 3 Nov 2025 10:42:31 +0100
From: Igor Mammedov <[email protected]>
Subject: Re: [PATCH v5] hw/i386/pc: Remove
PCMachineClass::legacy_cpu_hotplugfield
X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-redhat-linux-gnu)On Sat, 1 Nov 2025 00:27:36 +0100 (CET)
BALATON Zoltan <[email protected]> wrote:[...]
Quoted 8 lines
Quoted 7 lines
tests/qtest/bios-tables-test-allowed-diff.h
Quoted 5 lines
tests/qtest/bios-tables-test-allowed-diff.h +0
-0@@ -1 +1,43 @@Does this belong here?
thanks for spotting it, it should be a separate preceding patch,
Thanks! I think I see :-) - I should follow the gudience in tests/qtest/bios-tables-test.c, to split this patch.
Quoted 3 lines
and then expected blobs update patch after this patch,
that would cleanupbios-tables-test-allowed-diff.halong with new blobs. /i.e. as per process described inbios-tables-test.c/
Regards,
Zhao
Re: [PATCH v5] hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field
In reply to Igor MammedovHi Igor,
I find after removing legacy cpu hotplug totally, it seems necessary to update docs/specs/acpi_cpu_hotplug.rst as well, since then QEMU doesn't have legacy cpu hotplug. Do you agree?
I also attached my update for that doc. If this change is fine for you, I will squash that doc change into another patch that removes cpu_hotplug.[h|c] - I split your this patch into several parts (following you another previous suggestion [*] to make review easier). :)
[*]: https://lore.kernel.org/qemu-devel/[email protected]/
Thanks,
Zhao
---
From ff3da76cf7de097c42bdaf64850dc4df65b4bf4a Mon Sep 17 00:00:00 2001
From: Zhao Liu <[email protected]>
Date: Wed, 26 Nov 2025 23:06:09 +0800
Subject: [PATCH] docs/specs/acpi_cpu_hotplug.rst: remove legacy cpu hotplug
descriptions
Legacy cpu hotplug has been removed totally and machines start with modern cpu hotplug interface directly.
Therefore, update the documentation to describe current QEMU cpu hotplug logic.
--- docs/specs/acpi_cpu_hotplug.rst | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)
docs/specs/acpi_cpu_hotplug.rst +3 -25
@@ -8,22 +8,6 @@ ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add and hot-remove events. -Legacy ACPI CPU hotplug interface registers -------------------------------------------- - -CPU present bitmap for: - -- ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access) -- PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access) -- One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only. -- The first DWORD in bitmap is used in write mode to switch from legacy - to modern CPU hotplug interface, write 0 into it to do switch. - -QEMU sets corresponding CPU bit on hot-add event and issues SCI -with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler -to notify OS about CPU hot-add events. CPU hot-remove isn't supported. - - Modern ACPI CPU hotplug interface registers -------------------------------------------
@@ -189,20 +173,14 @@ Typical usecases (x86) Detecting and enabling modern CPU hotplug interface ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -QEMU starts with legacy CPU hotplug interface enabled. Detecting and -switching to modern interface is based on the 2 legacy CPU hotplug features: - -#. Writes into CPU bitmap are ignored. -#. CPU bitmap always has bit #0 set, corresponding to boot CPU. - -Use following steps to detect and enable modern CPU hotplug interface: +QEMU starts with modern CPU hotplug interface enabled. Use following steps to +detect modern CPU hotplug interface: -#. Store 0x0 to the 'CPU selector' register, attempting to switch to modern mode #. Store 0x0 to the 'CPU selector' register, to ensure valid selector value #. Store 0x0 to the 'Command field' register #. Read the 'Command data 2' register. If read value is 0x0, the modern interface is enabled. - Otherwise legacy or no CPU hotplug interface available + Otherwise no CPU hotplug interface available Get a cpu with pending event ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--
2.34.1
Re: [PATCH v5] hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field
Quoted 11 lines · On Wed, 26 Nov 2025 23:37:32 +0800 Zhao Liu <[email protected]> wrote:
Hi Igor,
I find after removing legacy cpu hotplug totally, it seems necessary to update
docs/specs/acpi_cpu_hotplug.rstas well, since then QEMU doesn't have legacy cpu hotplug. Do you agree?I also attached my update for that doc. If this change is fine for you, I will squash that doc change into another patch that removes cpu_hotplug.[h|c] - I split your this patch into several parts (following you another previous suggestion [*] to make review easier). :)
sure thing, whatever makes it easier to read/review
Quoted 12 lines
[*]: https://lore.kernel.org/qemu-devel/[email protected]/
Thanks,
Zhao
---
Fromff3da76cf7de097c42bdaf64850dc4df65b4bf4aMon Sep 17 00:00:00 2001
From: Zhao Liu <[email protected]>
Date: Wed, 26 Nov 2025 23:06:09 +0800
Subject: [PATCH]docs/specs/acpi_cpu_hotplug.rst: remove legacy cpu hotplug
descriptions
Quoted 7 lines
Legacy cpu hotplug has been removed totally and machines start with modern cpu hotplug interface directly.
Therefore, update the documentation to describe current QEMU cpu hotplug logic.
Signed-off-by Zhao Liu <[email protected]>
LGTM
Quoted 58 lines
--- docs/specs/acpi_cpu_hotplug.rst | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)docs/specs/acpi_cpu_hotplug.rst +3
-26@@ -8,22 +8,6 @@ ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add and hot-remove events. -Legacy ACPI CPU hotplug interface registers -------------------------------------------- - -CPU present bitmap for: - -- ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access) -- PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access) -- One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only. -- The first DWORD in bitmap is used in write mode to switch from legacy - to modern CPU hotplug interface, write 0 into it to do switch. - -QEMU sets corresponding CPU bit on hot-add event and issues SCI -with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler -to notify OS about CPU hot-add events. CPU hot-remove isn't supported. - - Modern ACPI CPU hotplug interface registers -------------------------------------------@@ -189,20 +173,14 @@ Typical usecases (x86) Detecting and enabling modern CPU hotplug interface ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -QEMU starts with legacy CPU hotplug interface enabled. Detecting and -switching to modern interface is based on the 2 legacy CPU hotplug features: - -#. Writes into CPU bitmap are ignored. -#. CPU bitmap always has bit #0 set, corresponding to boot CPU. - -Use following steps to detect and enable modern CPU hotplug interface: +QEMU starts with modern CPU hotplug interface enabled. Use following steps to +detect modern CPU hotplug interface: -#. Store 0x0 to the 'CPU selector' register, attempting to switch to modern mode #. Store 0x0 to the 'CPU selector' register, to ensure valid selector value #. Store 0x0 to the 'Command field' register #. Read the 'Command data 2' register. If read value is 0x0, the modern interface is enabled. - Otherwise legacy or no CPU hotplug interface available + Otherwise no CPU hotplug interface available Get a cpu with pending event ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --2.34.1
PATCH v4 3/27 hw/nvram/fw_cfg: Rename fw_cfg_init_mem() with '_nodma' suffix
In reply to Philippe Mathieu-DaudéRename fw_cfg_init_mem() as fw_cfg_init_mem_nodma() to distinct with the DMA version (currently named fw_cfg_init_mem_wide).
--- include/hw/nvram/fw_cfg.h | 3 ++- hw/hppa/machine.c | 2 +- hw/nvram/fw_cfg.c | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-)
include/hw/nvram/fw_cfg.h +2 -1
@@ -307,7 +307,8 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s,FWCfgState *fw_cfg_init_io_dma (uint32_t iobase,uint32_t dma_iobase,AddressSpace *dma_as); -FWCfgState *fw_cfg_init_mem (hwaddr ctl_addr,hwaddr data_addr); +FWCfgState *fw_cfg_init_mem_nodma (hwaddr ctl_addr,hwaddr data_addr, +unsigned data_width);FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr,hwaddr data_addr,uint32_t data_width,hwaddr dma_addr,AddressSpace *dma_as);
hw/hppa/machine.c +1 -1
@@ -201,7 +201,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIBus *pci_bus,int btlb_entries =HPPA_BTLB_ENTRIES (&cpu[0 ]->env);int len; - fw_cfg =fw_cfg_init_mem (addr, addr +4 ); + fw_cfg =fw_cfg_init_mem_nodma (addr, addr +4 ,1 );fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , ms->smp.cpus);fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS ,HPPA_MAX_CPUS );fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , ms->ram_size);
hw/nvram/fw_cfg.c +3 -4
@@ -1087,11 +1087,10 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,return s; } -FWCfgState *fw_cfg_init_mem (hwaddr ctl_addr,hwaddr data_addr) +FWCfgState *fw_cfg_init_mem_nodma (hwaddr ctl_addr,hwaddr data_addr, +unsigned data_width) { -return fw_cfg_init_mem_wide (ctl_addr, data_addr, - fw_cfg_data_mem_ops.valid.max_access_size, -0 ,NULL ); +return fw_cfg_init_mem_wide (ctl_addr, data_addr, data_width,0 ,NULL ); }
Signature · 1 line
2.47.1
Re: [PATCH v4 03/27] hw/nvram/fw_cfg: Rename fw_cfg_init_mem() with '_nodma' suffix
Quoted 10 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:26 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 03/27] hw/nvram/fw_cfg: Renamefw_cfg_init_mem()with
'_nodma' suffix
X-Mailer: git-send-email 2.47.1Rename
fw_cfg_init_mem()asfw_cfg_init_mem_nodma()to distinct with the DMA version (currently namedfw_cfg_init_mem_wide).
Quoted 7 lines
Suggested-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/nvram/fw_cfg.h | 3 ++- hw/hppa/machine.c | 2 +- hw/nvram/fw_cfg.c | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-)
Re: [PATCH v4 03/27] hw/nvram/fw_cfg: Rename fw_cfg_init_mem() with '_nodma' suffix
In reply to Philippe Mathieu-DaudéQuoted 6 lines · On Thu, 8 May 2025 15:35:26 +0200 Philippe Mathieu-Daudé <[email protected]>…
Rename
fw_cfg_init_mem()asfw_cfg_init_mem_nodma()to distinct with the DMA version (currently namedfw_cfg_init_mem_wide).Suggested-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 52 lines
--- include/hw/nvram/fw_cfg.h | 3 ++- hw/hppa/machine.c | 2 +- hw/nvram/fw_cfg.c | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-)include/hw/nvram/fw_cfg.h +2
-1@@ -307,7 +307,8 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s,FWCfgState *fw_cfg_init_io_dma (uint32_t iobase,uint32_t dma_iobase,AddressSpace *dma_as); -FWCfgState *fw_cfg_init_mem (hwaddr ctl_addr,hwaddr data_addr); +FWCfgState *fw_cfg_init_mem_nodma (hwaddr ctl_addr,hwaddr data_addr, +unsigned data_width);FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr,hwaddr data_addr,uint32_t data_width,hwaddr dma_addr,AddressSpace *dma_as);hw/hppa/machine.c +1
-1@@ -201,7 +201,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIBus *pci_bus,int btlb_entries =HPPA_BTLB_ENTRIES (&cpu[0 ]->env);int len; - fw_cfg =fw_cfg_init_mem (addr, addr +4 ); + fw_cfg =fw_cfg_init_mem_nodma (addr, addr +4 ,1 );fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , ms->smp.cpus);fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS ,HPPA_MAX_CPUS );fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , ms->ram_size);hw/nvram/fw_cfg.c +3
-4@@ -1087,11 +1087,10 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,return s; } -FWCfgState *fw_cfg_init_mem (hwaddr ctl_addr,hwaddr data_addr) +FWCfgState *fw_cfg_init_mem_nodma (hwaddr ctl_addr,hwaddr data_addr, +unsigned data_width) { -return fw_cfg_init_mem_wide (ctl_addr, data_addr, - fw_cfg_data_mem_ops.valid.max_access_size, -0 ,NULL ); +return fw_cfg_init_mem_wide (ctl_addr, data_addr, data_width,0 ,NULL ); }
Re: [PATCH v4 03/27] hw/nvram/fw_cfg: Rename fw_cfg_init_mem() with '_nodma' suffix
In reply to Philippe Mathieu-DaudéQuoted 31 lines · Philippe Mathieu-Daudé
Rename
fw_cfg_init_mem()asfw_cfg_init_mem_nodma()to distinct with the DMA version (currently namedfw_cfg_init_mem_wide).Suggested-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/nvram/fw_cfg.h | 3 ++- hw/hppa/machine.c | 2 +- hw/nvram/fw_cfg.c | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-)include/hw/nvram/fw_cfg.h +2
-1@@ -307,7 +307,8 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s,FWCfgState *fw_cfg_init_io_dma (uint32_t iobase,uint32_t dma_iobase,AddressSpace *dma_as); -FWCfgState *fw_cfg_init_mem (hwaddr ctl_addr,hwaddr data_addr); +FWCfgState *fw_cfg_init_mem_nodma (hwaddr ctl_addr,hwaddr data_addr, +unsigned data_width);FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr,hwaddr data_addr,uint32_t data_width,hwaddr dma_addr,AddressSpace *dma_as);hw/hppa/machine.c +0
-0
hw/hppa/machine.c static FWCfgState *create_fw_cfg(MachineState *ms, PCIBus *pci_bus, · line 204
Quoted 5 lines
hw/hppa/machine.c +1
-1@@ -201,7 +201,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIBus *pci_bus,int btlb_entries =HPPA_BTLB_ENTRIES (&cpu[0 ]->env);int len; - fw_cfg =fw_cfg_init_mem (addr, addr +4 ); + fw_cfg =fw_cfg_init_mem_nodma (addr, addr +4 ,1 );
It does additional job to replace fw_cfg_data_mem_ops.valid.max_access_size with a hardcode 1.
It needs clarification at least in commit message that doing it is safe that fw_cfg_data_mem_ops.valid.max_access_size is not changed by other code.
It's even better to put this in a seperate patch.
For the pure rename part:
Quoted 22 lines
hw/hppa/machine.c +0
-0fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , ms->smp.cpus);fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS ,HPPA_MAX_CPUS );fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , ms->ram_size);hw/nvram/fw_cfg.c +3
-4@@ -1087,11 +1087,10 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,return s; } -FWCfgState *fw_cfg_init_mem (hwaddr ctl_addr,hwaddr data_addr) +FWCfgState *fw_cfg_init_mem_nodma (hwaddr ctl_addr,hwaddr data_addr, +unsigned data_width) { -return fw_cfg_init_mem_wide (ctl_addr, data_addr, - fw_cfg_data_mem_ops.valid.max_access_size, -0 ,NULL ); +return fw_cfg_init_mem_wide (ctl_addr, data_addr, data_width,0 ,NULL ); }
PATCH v4 4/27 hw/mips/loongson3_virt: Prefer using fw_cfg_init_mem_nodma()
In reply to Philippe Mathieu-Daudéfw_cfg_init_mem_wide() is prefered to initialize fw_cfg with DMA support. Without DMA, use fw_cfg_init_mem_nodma().
--- hw/mips/loongson3_virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/mips/loongson3_virt.c +1 -1
@@ -286,7 +286,7 @@ static void fw_conf_init(void)FWCfgState *fw_cfg;hwaddr cfg_addr = virt_memmap[VIRT_FW_CFG ].base; - fw_cfg =fw_cfg_init_mem_wide (cfg_addr, cfg_addr +8 ,8 ,0 ,NULL ); + fw_cfg =fw_cfg_init_mem_nodma (cfg_addr, cfg_addr +8 ,8 );fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )current_machine->smp.cpus);fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS , (uint16_t )current_machine->smp.max_cpus);fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , loaderparams.ram_size);
Signature · 1 line
2.47.1
Re: [PATCH v4 04/27] hw/mips/loongson3_virt: Prefer using fw_cfg_init_mem_nodma()
Quoted 6 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:27 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 04/27] hw/mips/loongson3_virt: Prefer using
fw_cfg_init_mem_nodma()
X-Mailer: git-send-email 2.47.1
Quoted 7 lines
fw_cfg_init_mem_wide()is prefered to initializefw_cfgwith DMA support. Without DMA, usefw_cfg_init_mem_nodma().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/mips/loongson3_virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH v4 04/27] hw/mips/loongson3_virt: Prefer using fw_cfg_init_mem_nodma()
In reply to Philippe Mathieu-DaudéQuoted 4 lines · On Thu, 8 May 2025 15:35:27 +0200 Philippe Mathieu-Daudé <[email protected]>…
fw_cfg_init_mem_wide()is prefered to initializefw_cfgwith DMA support. Without DMA, usefw_cfg_init_mem_nodma().Signed-off-by Philippe Mathieu-Daudé <[email protected]>
hw/mips/loongson3_virt.c static void fw_conf_init(void) · line 289
Quoted 13 lines
--- hw/mips/loongson3_virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/mips/loongson3_virt.c +0
-1@@ -286,7 +286,7 @@ static void fw_conf_init(void)FWCfgState *fw_cfg;hwaddr cfg_addr = virt_memmap[VIRT_FW_CFG ].base; - fw_cfg =fw_cfg_init_mem_wide (cfg_addr, cfg_addr +8 ,8 ,0 ,NULL );
just a question, given it's a rather modern machine is there a reason why it is not using DMA here?
Quoted 4 lines
hw/mips/loongson3_virt.c +1
-0+ fw_cfg =fw_cfg_init_mem_nodma (cfg_addr, cfg_addr +8 ,8 );fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )current_machine->smp.cpus);fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS , (uint16_t )current_machine->smp.max_cpus);fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , loaderparams.ram_size);
Re: [PATCH v4 04/27] hw/mips/loongson3_virt: Prefer using fw_cfg_init_mem_nodma()
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
fw_cfg_init_mem_wide()is prefered to initializefw_cfgwith DMA support. Without DMA, usefw_cfg_init_mem_nodma().Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 17 lines
--- hw/mips/loongson3_virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/mips/loongson3_virt.c +1
-1@@ -286,7 +286,7 @@ static void fw_conf_init(void)FWCfgState *fw_cfg;hwaddr cfg_addr = virt_memmap[VIRT_FW_CFG ].base; - fw_cfg =fw_cfg_init_mem_wide (cfg_addr, cfg_addr +8 ,8 ,0 ,NULL ); + fw_cfg =fw_cfg_init_mem_nodma (cfg_addr, cfg_addr +8 ,8 );fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )current_machine->smp.cpus);fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS , (uint16_t )current_machine->smp.max_cpus);fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , loaderparams.ram_size);
PATCH v4 5/27 hw/nvram/fw_cfg: Factor fw_cfg_init_mem_internal() out
In reply to Philippe Mathieu-DaudéFactor fw_cfg_init_mem_internal() out of fw_cfg_init_mem_wide(). In fw_cfg_init_mem_wide(), assert DMA arguments are provided. Callers without DMA have to use the fw_cfg_init_mem() helper.
--- hw/nvram/fw_cfg.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
hw/nvram/fw_cfg.c +13 -4
@@ -1053,9 +1053,9 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,return s; } -FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr, -hwaddr data_addr,uint32_t data_width, -hwaddr dma_addr,AddressSpace *dma_as) +static FWCfgState *fw_cfg_init_mem_internal (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as) {DeviceState *dev;SysBusDevice *sbd;
@@ -1087,10 +1087,19 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,return s; } +FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as) +{ +assert (dma_addr && dma_as); +return fw_cfg_init_mem_internal (ctl_addr, data_addr, data_addr, + dma_addr, dma_as); +} +FWCfgState *fw_cfg_init_mem_nodma (hwaddr ctl_addr,hwaddr data_addr,unsigned data_width) { -return fw_cfg_init_mem_wide (ctl_addr, data_addr, data_width,0 ,NULL ); +return fw_cfg_init_mem_internal (ctl_addr, data_addr, data_width,0 ,NULL ); }
Signature · 1 line
2.47.1
Re: [PATCH v4 05/27] hw/nvram/fw_cfg: Factor fw_cfg_init_mem_internal() out
Quoted 6 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:28 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 05/27] hw/nvram/fw_cfg: Factor
fw_cfg_init_mem_internal()out
X-Mailer: git-send-email 2.47.1
Quoted 8 lines
Factor
fw_cfg_init_mem_internal()out offw_cfg_init_mem_wide(). Infw_cfg_init_mem_wide(), assert DMA arguments are provided. Callers without DMA have to use thefw_cfg_init_mem()helper.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/nvram/fw_cfg.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
Fine for me,
Re: [PATCH v4 05/27] hw/nvram/fw_cfg: Factor fw_cfg_init_mem_internal() out
In reply to Philippe Mathieu-DaudéQuoted 5 lines · On Thu, 8 May 2025 15:35:28 +0200 Philippe Mathieu-Daudé <[email protected]>…
Factor
fw_cfg_init_mem_internal()out offw_cfg_init_mem_wide(). Infw_cfg_init_mem_wide(), assert DMA arguments are provided. Callers without DMA have to use thefw_cfg_init_mem()helper.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 42 lines
--- hw/nvram/fw_cfg.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)hw/nvram/fw_cfg.c +13
-4@@ -1053,9 +1053,9 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,return s; } -FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr, -hwaddr data_addr,uint32_t data_width, -hwaddr dma_addr,AddressSpace *dma_as) +static FWCfgState *fw_cfg_init_mem_internal (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as) {DeviceState *dev;SysBusDevice *sbd;@@ -1087,10 +1087,19 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,return s; } +FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as) +{ +assert (dma_addr && dma_as); +return fw_cfg_init_mem_internal (ctl_addr, data_addr, data_addr, + dma_addr, dma_as); +} +FWCfgState *fw_cfg_init_mem_nodma (hwaddr ctl_addr,hwaddr data_addr,unsigned data_width) { -return fw_cfg_init_mem_wide (ctl_addr, data_addr, data_width,0 ,NULL ); +return fw_cfg_init_mem_internal (ctl_addr, data_addr, data_width,0 ,NULL ); }
Re: [PATCH v4 05/27] hw/nvram/fw_cfg: Factor fw_cfg_init_mem_internal() out
In reply to Philippe Mathieu-DaudéQuoted 5 lines · Philippe Mathieu-Daudé
Factor
fw_cfg_init_mem_internal()out offw_cfg_init_mem_wide(). Infw_cfg_init_mem_wide(), assert DMA arguments are provided. Callers without DMA have to use thefw_cfg_init_mem()helper.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 42 lines
--- hw/nvram/fw_cfg.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)hw/nvram/fw_cfg.c +13
-4@@ -1053,9 +1053,9 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,return s; } -FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr, -hwaddr data_addr,uint32_t data_width, -hwaddr dma_addr,AddressSpace *dma_as) +static FWCfgState *fw_cfg_init_mem_internal (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as) {DeviceState *dev;SysBusDevice *sbd;@@ -1087,10 +1087,19 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,return s; } +FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as) +{ +assert (dma_addr && dma_as); +return fw_cfg_init_mem_internal (ctl_addr, data_addr, data_addr, + dma_addr, dma_as); +} +FWCfgState *fw_cfg_init_mem_nodma (hwaddr ctl_addr,hwaddr data_addr,unsigned data_width) { -return fw_cfg_init_mem_wide (ctl_addr, data_addr, data_width,0 ,NULL ); +return fw_cfg_init_mem_internal (ctl_addr, data_addr, data_width,0 ,NULL ); }
Re: [PATCH v4 05/27] hw/nvram/fw_cfg: Factor fw_cfg_init_mem_internal() out
In reply to Philippe Mathieu-Daudéhw/nvram/fw_cfg.c FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr, · line 1095
Quoted 6 lines
hw/nvram/fw_cfg.c +6
-0+FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as) +{ +assert (dma_addr && dma_as); + return fw_cfg_init_mem_internal(ctl_addr, data_addr, data_addr,
^^^^^^^^^
a typo: data_width...The type was converted "silently", making it easy to be missed.
Quoted 1 line
+
dma_addr,dma_as);
Thanks,
Zhao
PATCH v4 6/27 hw/nvram/fw_cfg: Rename fw_cfg_init_mem_wide() -> fw_cfg_init_mem_dma()
In reply to Philippe Mathieu-Daudé"wide" in fw_cfg_init_mem_wide() means "DMA support". Rename for clarity.
--- include/hw/nvram/fw_cfg.h | 6 +++--- hw/arm/virt.c | 2 +- hw/nvram/fw_cfg.c | 6 +++--- hw/riscv/virt.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-)
include/hw/nvram/fw_cfg.h +3 -3
@@ -309,9 +309,9 @@ FWCfgState *fw_cfg_init_io_dma(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_wide (hwaddr ctl_addr, -hwaddr data_addr,uint32_t data_width, -hwaddr dma_addr,AddressSpace *dma_as); +FWCfgState *fw_cfg_init_mem_dma (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as);FWCfgState *fw_cfg_find (void );bool fw_cfg_dma_enabled (void *opaque);
hw/arm/virt.c +1 -1
@@ -1361,7 +1361,7 @@ static FWCfgState *create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)FWCfgState *fw_cfg;char *nodename; - fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); + fw_cfg =fw_cfg_init_mem_dma (base +8 , base,8 , base +16 , as);fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )ms->smp.cpus); nodename =g_strdup_printf ("/fw-cfg@%" PRIx64, base);
hw/nvram/fw_cfg.c +3 -3
@@ -1087,9 +1087,9 @@ static FWCfgState *fw_cfg_init_mem_internal(hwaddr ctl_addr,return s; } -FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr, -hwaddr data_addr,uint32_t data_width, -hwaddr dma_addr,AddressSpace *dma_as) +FWCfgState *fw_cfg_init_mem_dma (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as) {assert (dma_addr && dma_as); return fw_cfg_init_mem_internal(ctl_addr, data_addr, data_addr,
hw/riscv/virt.c +2 -2
@@ -1266,8 +1266,8 @@ static FWCfgState *create_fw_cfg(const MachineState *ms)hwaddr base = virt_memmap[VIRT_FW_CFG ].base;FWCfgState *fw_cfg; - fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , - &address_space_memory); + fw_cfg =fw_cfg_init_mem_dma (base +8 , base,8 , base +16 , + &address_space_memory);fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )ms->smp.cpus);return fw_cfg;
Signature · 1 line
2.47.1
Re: [PATCH v4 06/27] hw/nvram/fw_cfg: Rename fw_cfg_init_mem_wide() -> fw_cfg_init_mem_dma()
Quoted 9 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:29 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 06/27] hw/nvram/fw_cfg: Renamefw_cfg_init_mem_wide()->
fw_cfg_init_mem_dma()
X-Mailer: git-send-email 2.47.1"wide" in
fw_cfg_init_mem_wide()means "DMA support". Rename for clarity.
Quoted 8 lines
Suggested-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/nvram/fw_cfg.h | 6 +++--- hw/arm/virt.c | 2 +- hw/nvram/fw_cfg.c | 6 +++--- hw/riscv/virt.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-)
Re: [PATCH v4 06/27] hw/nvram/fw_cfg: Rename fw_cfg_init_mem_wide() -> fw_cfg_init_mem_dma()
In reply to Philippe Mathieu-DaudéQuoted 23 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:29 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 06/27] hw/nvram/fw_cfg: Renamefw_cfg_init_mem_wide()->
fw_cfg_init_mem_dma()
X-Mailer: git-send-email 2.47.1"wide" in
fw_cfg_init_mem_wide()means "DMA support". Rename for clarity.Suggested-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/nvram/fw_cfg.h | 6 +++--- hw/arm/virt.c | 2 +- hw/nvram/fw_cfg.c | 6 +++--- hw/riscv/virt.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-)include/hw/nvram/fw_cfg.h +0
-0
include/hw/nvram/fw_cfg.h FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase, · line 314
Quoted 9 lines
include/hw/nvram/fw_cfg.h +3
-3@@ -309,9 +309,9 @@ FWCfgState *fw_cfg_init_io_dma(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_wide (hwaddr ctl_addr, -hwaddr data_addr,uint32_t data_width, -hwaddr dma_addr,AddressSpace *dma_as); +FWCfgState *fw_cfg_init_mem_dma (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as);
There's one more use in latest master:
git grep fw_cfg_init_mem_widehw/loongarch/fw_cfg.c: fw_cfg = fw_cfg_init_mem_wide(VIRT_FWCFG_BASE + 8, VIRT_FWCFG_BASE, 8,
Igor Mammedov
Reviewed-byRe: [PATCH v4 06/27] hw/nvram/fw_cfg: Rename fw_cfg_init_mem_wide() -> fw_cfg_init_mem_dma()
Quoted 36 lines · On Fri, 9 May 2025 14:51:07 +0800 Zhao Liu <[email protected]> wrote:
Quoted 23 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:29 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 06/27] hw/nvram/fw_cfg: Renamefw_cfg_init_mem_wide()->
fw_cfg_init_mem_dma()
X-Mailer: git-send-email 2.47.1"wide" in
fw_cfg_init_mem_wide()means "DMA support". Rename for clarity.Suggested-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/nvram/fw_cfg.h | 6 +++--- hw/arm/virt.c | 2 +- hw/nvram/fw_cfg.c | 6 +++--- hw/riscv/virt.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-)include/hw/nvram/fw_cfg.h +0
-0include/hw/nvram/fw_cfg.h FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase, · line 314
Quoted 9 lines
include/hw/nvram/fw_cfg.h +3
-3@@ -309,9 +309,9 @@ FWCfgState *fw_cfg_init_io_dma(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_wide (hwaddr ctl_addr, -hwaddr data_addr,uint32_t data_width, -hwaddr dma_addr,AddressSpace *dma_as); +FWCfgState *fw_cfg_init_mem_dma (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as);There's one more use in latest master:
Quoted 2 lines
git grep
fw_cfg_init_mem_widehw/loongarch/fw_cfg.c:fw_cfg= fw_cfg_init_mem_wide(VIRT_FWCFG_BASE + 8,VIRT_FWCFG_BASE, 8,
with that fixed:
Re: [PATCH v4 06/27] hw/nvram/fw_cfg: Rename fw_cfg_init_mem_wide() -> fw_cfg_init_mem_dma()
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
"wide" in
fw_cfg_init_mem_wide()means "DMA support". Rename for clarity.
PS: at the time when fw_cfg_init_mem_wide() was first introcuded, 'wide' was exactly for data_width. see commit 6c87e3d5967a.
Quoted 2 lines
Suggested-by Zhao Liu <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
with the usage in hw/loongarch/fw_cfg.c fixed,
Quoted 69 lines
--- include/hw/nvram/fw_cfg.h | 6 +++--- hw/arm/virt.c | 2 +- hw/nvram/fw_cfg.c | 6 +++--- hw/riscv/virt.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-)include/hw/nvram/fw_cfg.h +3
-3@@ -309,9 +309,9 @@ FWCfgState *fw_cfg_init_io_dma(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_wide (hwaddr ctl_addr, -hwaddr data_addr,uint32_t data_width, -hwaddr dma_addr,AddressSpace *dma_as); +FWCfgState *fw_cfg_init_mem_dma (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as);FWCfgState *fw_cfg_find (void );bool fw_cfg_dma_enabled (void *opaque);hw/arm/virt.c +1
-1@@ -1361,7 +1361,7 @@ static FWCfgState *create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)FWCfgState *fw_cfg;char *nodename; - fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); + fw_cfg =fw_cfg_init_mem_dma (base +8 , base,8 , base +16 , as);fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )ms->smp.cpus); nodename =g_strdup_printf ("/fw-cfg@%" PRIx64, base);hw/nvram/fw_cfg.c +3
-3@@ -1087,9 +1087,9 @@ static FWCfgState *fw_cfg_init_mem_internal(hwaddr ctl_addr,return s; } -FWCfgState *fw_cfg_init_mem_wide (hwaddr ctl_addr, -hwaddr data_addr,uint32_t data_width, -hwaddr dma_addr,AddressSpace *dma_as) +FWCfgState *fw_cfg_init_mem_dma (hwaddr ctl_addr, +hwaddr data_addr,uint32_t data_width, +hwaddr dma_addr,AddressSpace *dma_as) {assert (dma_addr && dma_as); return fw_cfg_init_mem_internal(ctl_addr, data_addr, data_addr,hw/riscv/virt.c +2
-2@@ -1266,8 +1266,8 @@ static FWCfgState *create_fw_cfg(const MachineState *ms)hwaddr base = virt_memmap[VIRT_FW_CFG ].base;FWCfgState *fw_cfg; - fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , - &address_space_memory); + fw_cfg =fw_cfg_init_mem_dma (base +8 , base,8 , base +16 , + &address_space_memory);fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )ms->smp.cpus);return fw_cfg;
PATCH v4 7/27 hw/i386/x86: Remove X86MachineClass::fwcfg_dma_enabled field
In reply to Philippe Mathieu-Daudé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.
'multiboot.bin' isn't used anymore, we'll remove it in the next commit.
--- 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(-)
include/hw/i386/x86.h +0 -2
@@ -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; };
hw/i386/microvm.c +0 -3
@@ -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,
hw/i386/multiboot.c +1 -6
@@ -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++;
hw/i386/x86-common.c +1 -2
@@ -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++;
hw/i386/x86.c +0 -2
@@ -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",
Signature · 1 line
2.47.1
Re: [PATCH v4 07/27] hw/i386/x86: Remove X86MachineClass::fwcfg_dma_enabled field
Quoted 13 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:30 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 07/27] hw/i386/x86: Remove
X86MachineClass::fwcfg_dma_enabledfield
X-Mailer: git-send-email 2.47.1The
X86MachineClass::fwcfg_dma_enabledboolean was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it and simplify.'multiboot.bin' isn't used anymore, we'll remove it in the next commit.
Quoted 8 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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(-)
Re: [PATCH v4 07/27] hw/i386/x86: Remove X86MachineClass::fwcfg_dma_enabled field
In reply to Philippe Mathieu-DaudéQuoted 63 lines · On Thu, 8 May 2025 15:35:30 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
X86MachineClass::fwcfg_dma_enabledboolean was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it and simplify.'multiboot.bin' isn't used anymore, we'll remove it in the next commit.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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(-)include/hw/i386/x86.h +0
-2@@ -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; };hw/i386/microvm.c +0
-3@@ -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,hw/i386/multiboot.c +0
-1@@ -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;
hw/i386/multiboot.c int load_multiboot(X86MachineState *x86ms, · line 408
Quoted 7 lines
hw/i386/multiboot.c +0
-4@@ -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" ;
shouldn't we remove "multiboot.bin" as well?
Quoted 45 lines
hw/i386/multiboot.c +1
-1- } + option_rom[nb_option_roms].name ="multiboot_dma.bin" ; option_rom[nb_option_roms].bootindex =0 ; nb_option_roms++;hw/i386/x86-common.c +1
-2@@ -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++;hw/i386/x86.c +0
-2@@ -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",
Igor Mammedov
Reviewed-byRe: [PATCH v4 07/27] hw/i386/x86: Remove X86MachineClass::fwcfg_dma_enabled field
Quoted 69 lines · On Fri, 9 May 2025 17:41:25 +0200 Igor Mammedov <[email protected]> wrote:
Quoted 66 lines · On Thu, 8 May 2025 15:35:30 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
X86MachineClass::fwcfg_dma_enabledboolean was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it and simplify.'multiboot.bin' isn't used anymore, we'll remove it in the next commit.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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(-)include/hw/i386/x86.h +0
-2@@ -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; };hw/i386/microvm.c +0
-3@@ -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,hw/i386/multiboot.c +0
-1@@ -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));
Quoted 6 lines
hw/i386/multiboot.c int load_multiboot(X86MachineState *x86ms, · line 408
Quoted 4 lines
hw/i386/multiboot.c +0
-4-if (multiboot_dma_enabled) { - option_rom[nb_option_roms].name ="multiboot_dma.bin" ; - }else { - option_rom[nb_option_roms].name ="multiboot.bin" ;shouldn't we remove "multiboot.bin" as well?
never mind, I see it's being removed by the next patch
PATCH v4 8/27 hw/i386/pc: Remove multiboot.bin
In reply to Philippe Mathieu-DaudéAll PC machines now use the multiboot_dma.bin binary, we can remove the non-DMA version (multiboot.bin).
--- pc-bios/optionrom/optionrom.h | 4 - hw/i386/pc.c | 1 - pc-bios/meson.build | 1 - pc-bios/multiboot.bin | Bin 1024 -> 0 bytes pc-bios/optionrom/Makefile | 2 +- pc-bios/optionrom/multiboot.S | 232 ----------------------------- pc-bios/optionrom/multiboot_dma.S | 234 +++++++++++++++++++++++++++++- 7 files changed, 233 insertions(+), 241 deletions(-) delete mode 100644 pc-bios/multiboot.bin delete mode 100644 pc-bios/optionrom/multiboot.S
pc-bios/optionrom/optionrom.h +0 -4
@@ -117,16 +117,12 @@* * Clobbers: %eax, %edx, %es, %ecx, %edi and adresses %esp-20 to %esp */ -#ifdef USE_FW_CFG_DMA #define read_fw_blob_dma (var) \ read_fw var ## _SIZE; \ mov %eax, %ecx; \ read_fw var ## _ADDR; \ mov %eax, %edi ; \ read_fw_dma var ## _DATA, %ecx, %edi -#else -#define read_fw_blob_dma (var) read_fw_blob(var) -#endif #define read_fw_blob_pre (var) \ read_fw var ## _SIZE; \
hw/i386/pc.c +0 -1
@@ -657,7 +657,6 @@ void xen_load_linux(PCMachineState *pcms)assert (!strcmp (option_rom[i].name,"linuxboot.bin" ) || !strcmp (option_rom[i].name,"linuxboot_dma.bin" ) || !strcmp (option_rom[i].name,"pvh.bin" ) || - !strcmp (option_rom[i].name,"multiboot.bin" ) || !strcmp (option_rom[i].name,"multiboot_dma.bin" ));rom_add_option (option_rom[i].name, option_rom[i].bootindex); }
pc-bios/meson.build +0 -1
@@ -62,7 +62,6 @@ blobs = [ 'efi-e1000e.rom', 'efi-vmxnet3.rom', 'qemu-nsis.bmp', - 'multiboot.bin', 'multiboot_dma.bin', 'linuxboot.bin', 'linuxboot_dma.bin',
pc-bios/multiboot.bin deleted binary +0 -0
pc-bios/optionrom/Makefile +1 -1
@@ -2,7 +2,7 @@ include config.mak SRC_DIR := $(TOPSRC_DIR)/pc-bios/optionrom VPATH = $(SRC_DIR) -all: multiboot.bin multiboot_dma.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin +all: multiboot_dma.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin # Dummy command so that make thinks it has done something @true
pc-bios/optionrom/multiboot.S deleted +0 -232
232 lines not on this page · raw message
pc-bios/optionrom/multiboot_dma.S +232 -2
234 lines not on this page · raw message
Signature · 1 line
2.47.1
Re: [PATCH v4 08/27] hw/i386/pc: Remove multiboot.bin
Quoted 30 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:31 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 08/27] hw/i386/pc: Remove multiboot.bin
X-Mailer: git-send-email 2.47.1All PC machines now use the multiboot_dma.bin binary, we can remove the non-DMA version (multiboot.bin).
Suggested-by Thomas Huth <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- pc-bios/optionrom/optionrom.h | 4 - hw/i386/pc.c | 1 - pc-bios/meson.build | 1 - pc-bios/multiboot.bin | Bin 1024 -> 0 bytes pc-bios/optionrom/Makefile | 2 +- pc-bios/optionrom/multiboot.S | 232 ----------------------------- pc-bios/optionrom/multiboot_dma.S | 234 +++++++++++++++++++++++++++++- 7 files changed, 233 insertions(+), 241 deletions(-) delete mode 100644 pc-bios/multiboot.bin delete mode 100644 pc-bios/optionrom/multiboot.Spc-bios/optionrom/optionrom.h +0
-0@@ -117,16 +117,12 @@* * Clobbers: %eax, %edx, %es, %ecx, %edi and adresses %esp-20 to %esp */
pc-bios/optionrom/optionrom.h line 129
Quoted 10 lines
pc-bios/optionrom/optionrom.h +0
-4-#ifdef USE_FW_CFG_DMA #define read_fw_blob_dma (var) \ read_fw var ## _SIZE; \ mov %eax, %ecx; \ read_fw var ## _ADDR; \ mov %eax, %edi ; \ read_fw_dma var ## _DATA, %ecx, %edi -#else -#define read_fw_blob_dma (var) read_fw_blob(var) -#endif
It seems read_fw_blob() could be dropped as well and this is not a big deal. So,
PATCH v4 9/27 hw/nvram/fw_cfg: Remove fw_cfg_io_properties::dma_enabled
In reply to Philippe Mathieu-DaudéNow than all calls to fw_cfg_init_io_dma() pass DMA arguments, the 'dma_enabled' of the TYPE_FW_CFG_IO type is not used anymore. Remove it, simplifying fw_cfg_init_io_dma() and fw_cfg_io_realize().
Note, we can not remove the equivalent in fw_cfg_mem_properties[] because it is still used in HPPA and MIPS Loongson3 machines:
$ git grep -w fw_cfg_init_mem_nodma hw/hppa/machine.c:204: fw_cfg = fw_cfg_init_mem_nodma(addr, addr + 4, 1); hw/mips/loongson3_virt.c:289: fw_cfg = fw_cfg_init_mem_nodma(cfg_addr, cfg_addr + 8, 8);
'linuxboot.bin' isn't used anymore, we'll remove it in the next commit.
--- hw/i386/fw_cfg.c | 5 +---- hw/i386/x86-common.c | 5 +---- hw/nvram/fw_cfg.c | 26 ++++++++------------------ 3 files changed, 10 insertions(+), 26 deletions(-)
hw/i386/fw_cfg.c +1 -4
@@ -221,10 +221,7 @@ void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg)* of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the * DMA control register is located at FW_CFG_DMA_IO_BASE + 4 */ -Object *obj =OBJECT (fw_cfg); -uint8_t io_size =object_property_get_bool (obj,"dma_enabled" ,NULL ) ? -ROUND_UP (FW_CFG_CTL_SIZE ,4 ) +sizeof (dma_addr_t) : -FW_CFG_CTL_SIZE ; +uint8_t io_size =ROUND_UP (FW_CFG_CTL_SIZE ,4 ) +sizeof (dma_addr_t);Aml *dev =aml_device ("FWCF" );Aml *crs =aml_resource_template ();
hw/i386/x86-common.c +1 -4
@@ -991,10 +991,7 @@ 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" ; - } + option_rom[nb_option_roms].name ="linuxboot_dma.bin" ; nb_option_roms++; }
hw/nvram/fw_cfg.c +8 -18
@@ -1026,12 +1026,9 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,FWCfgIoState *ios;FWCfgState *s;MemoryRegion *iomem =get_system_io (); -bool dma_requested = dma_iobase && dma_as; +assert (dma_iobase); dev =qdev_new (TYPE_FW_CFG_IO ); -if (!dma_requested) { -qdev_prop_set_bit (dev,"dma_enabled" , false); - }object_property_add_child (OBJECT (qdev_get_machine ()),TYPE_FW_CFG ,OBJECT (dev));
@@ -1042,13 +1039,10 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,memory_region_add_subregion (iomem, iobase, &ios->comb_iomem); s =FW_CFG (dev); - -if (s->dma_enabled) { -/* 64 bits for the address field */ - s->dma_as = dma_as; - s->dma_addr =0 ; -memory_region_add_subregion (iomem, dma_iobase, &s->dma_iomem); - } +/* 64 bits for the address field */ + s->dma_as = dma_as; + s->dma_addr =0 ; +memory_region_add_subregion (iomem, dma_iobase, &s->dma_iomem);return s; }
@@ -1185,8 +1179,6 @@ static void fw_cfg_file_slots_allocate(FWCfgState *s, Error **errp) }static const Property fw_cfg_io_properties[] = { -DEFINE_PROP_BOOL ("dma_enabled" , FWCfgIoState, parent_obj.dma_enabled, - true),DEFINE_PROP_UINT16 ("x-file-slots" , FWCfgIoState, parent_obj.file_slots,FW_CFG_FILE_SLOTS_DFLT ), };
@@ -1207,11 +1199,9 @@ static void fw_cfg_io_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->comb_iomem,OBJECT (s), &fw_cfg_comb_mem_ops,FW_CFG (s),"fwcfg" ,FW_CFG_CTL_SIZE ); -if (FW_CFG (s)->dma_enabled) { -memory_region_init_io (&FW_CFG (s)->dma_iomem,OBJECT (s), - &fw_cfg_dma_mem_ops,FW_CFG (s),"fwcfg.dma" , -sizeof (dma_addr_t)); - } +memory_region_init_io (&FW_CFG (s)->dma_iomem,OBJECT (s), + &fw_cfg_dma_mem_ops,FW_CFG (s),"fwcfg.dma" , +sizeof (dma_addr_t));fw_cfg_common_realize (dev, errp); }
Signature · 1 line
2.47.1
Re: [PATCH v4 09/27] hw/nvram/fw_cfg: Remove fw_cfg_io_properties::dma_enabled
Quoted 65 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:32 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 09/27] hw/nvram/fw_cfg: Remove
fw_cfg_io_properties::dma_enabled
X-Mailer: git-send-email 2.47.1Now than all calls to
fw_cfg_init_io_dma()pass DMA arguments, the 'dma_enabled' of theTYPE_FW_CFG_IOtype is not used anymore. Remove it, simplifyingfw_cfg_init_io_dma()andfw_cfg_io_realize().Note, we can not remove the equivalent in fw_cfg_mem_properties[] because it is still used in HPPA and MIPS Loongson3 machines:
$ git grep -w fw_cfg_init_mem_nodma hw/hppa/machine.c:204: fw_cfg = fw_cfg_init_mem_nodma(addr, addr + 4, 1); hw/mips/loongson3_virt.c:289: fw_cfg = fw_cfg_init_mem_nodma(cfg_addr, cfg_addr + 8, 8);'linuxboot.bin' isn't used anymore, we'll remove it in the next commit.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Zhao Liu <[email protected]>--- hw/i386/fw_cfg.c | 5 +---- hw/i386/x86-common.c | 5 +---- hw/nvram/fw_cfg.c | 26 ++++++++------------------ 3 files changed, 10 insertions(+), 26 deletions(-)hw/i386/fw_cfg.c +1
-4@@ -221,10 +221,7 @@ void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg)* of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the * DMA control register is located at FW_CFG_DMA_IO_BASE + 4 */ -Object *obj =OBJECT (fw_cfg); -uint8_t io_size =object_property_get_bool (obj,"dma_enabled" ,NULL ) ? -ROUND_UP (FW_CFG_CTL_SIZE ,4 ) +sizeof (dma_addr_t) : -FW_CFG_CTL_SIZE ; +uint8_t io_size =ROUND_UP (FW_CFG_CTL_SIZE ,4 ) +sizeof (dma_addr_t);Aml *dev =aml_device ("FWCF" );Aml *crs =aml_resource_template ();hw/i386/x86-common.c +1
-4@@ -991,10 +991,7 @@ 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" ; - } + option_rom[nb_option_roms].name ="linuxboot_dma.bin" ; nb_option_roms++; }hw/nvram/fw_cfg.c +0
-0
hw/nvram/fw_cfg.c FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase, · line 1030
Quoted 6 lines
hw/nvram/fw_cfg.c +1
-1@@ -1026,12 +1026,9 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,FWCfgIoState *ios;FWCfgState *s;MemoryRegion *iomem =get_system_io (); -bool dma_requested = dma_iobase && dma_as; +assert (dma_iobase);
Maybe a rebase nit? In v3, it is:
assert(dma_iobase && dma_as);
Others are fine for me.
Re: [PATCH v4 09/27] hw/nvram/fw_cfg: Remove fw_cfg_io_properties::dma_enabled
In reply to Philippe Mathieu-DaudéQuoted 91 lines · On Thu, 8 May 2025 15:35:32 +0200 Philippe Mathieu-Daudé <[email protected]>…
Now than all calls to
fw_cfg_init_io_dma()pass DMA arguments, the 'dma_enabled' of theTYPE_FW_CFG_IOtype is not used anymore. Remove it, simplifyingfw_cfg_init_io_dma()andfw_cfg_io_realize().Note, we can not remove the equivalent in fw_cfg_mem_properties[] because it is still used in HPPA and MIPS Loongson3 machines:
$ git grep -w fw_cfg_init_mem_nodma hw/hppa/machine.c:204: fw_cfg = fw_cfg_init_mem_nodma(addr, addr + 4, 1); hw/mips/loongson3_virt.c:289: fw_cfg = fw_cfg_init_mem_nodma(cfg_addr, cfg_addr + 8, 8);'linuxboot.bin' isn't used anymore, we'll remove it in the next commit.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Zhao Liu <[email protected]>--- hw/i386/fw_cfg.c | 5 +---- hw/i386/x86-common.c | 5 +---- hw/nvram/fw_cfg.c | 26 ++++++++------------------ 3 files changed, 10 insertions(+), 26 deletions(-)hw/i386/fw_cfg.c +1
-4@@ -221,10 +221,7 @@ void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg)* of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the * DMA control register is located at FW_CFG_DMA_IO_BASE + 4 */ -Object *obj =OBJECT (fw_cfg); -uint8_t io_size =object_property_get_bool (obj,"dma_enabled" ,NULL ) ? -ROUND_UP (FW_CFG_CTL_SIZE ,4 ) +sizeof (dma_addr_t) : -FW_CFG_CTL_SIZE ; +uint8_t io_size =ROUND_UP (FW_CFG_CTL_SIZE ,4 ) +sizeof (dma_addr_t);Aml *dev =aml_device ("FWCF" );Aml *crs =aml_resource_template ();hw/i386/x86-common.c +1
-4@@ -991,10 +991,7 @@ 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" ; - } + option_rom[nb_option_roms].name ="linuxboot_dma.bin" ; nb_option_roms++; }hw/nvram/fw_cfg.c +5
-11@@ -1026,12 +1026,9 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,FWCfgIoState *ios;FWCfgState *s;MemoryRegion *iomem =get_system_io (); -bool dma_requested = dma_iobase && dma_as; +assert (dma_iobase); dev =qdev_new (TYPE_FW_CFG_IO ); -if (!dma_requested) { -qdev_prop_set_bit (dev,"dma_enabled" , false); - }object_property_add_child (OBJECT (qdev_get_machine ()),TYPE_FW_CFG ,OBJECT (dev));@@ -1042,13 +1039,10 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,memory_region_add_subregion (iomem, iobase, &ios->comb_iomem); s =FW_CFG (dev); - -if (s->dma_enabled) { -/* 64 bits for the address field */ - s->dma_as = dma_as; - s->dma_addr =0 ; -memory_region_add_subregion (iomem, dma_iobase, &s->dma_iomem); - } +/* 64 bits for the address field */ + s->dma_as = dma_as; + s->dma_addr =0 ; +memory_region_add_subregion (iomem, dma_iobase, &s->dma_iomem);return s; }
hw/nvram/fw_cfg.c static void fw_cfg_file_slots_allocate(FWCfgState *s, Error **errp) · line 1189
Quoted 5 lines
hw/nvram/fw_cfg.c +0
-2@@ -1185,8 +1179,6 @@ static void fw_cfg_file_slots_allocate(FWCfgState *s, Error **errp) }static const Property fw_cfg_io_properties[] = { -DEFINE_PROP_BOOL ("dma_enabled" , FWCfgIoState, parent_obj.dma_enabled, - true),
in 7/27 you still have, fw_cfg_dma_enabled(fw_cfg) which works around now missing property (in IO case) in obscure way.
that is also used in bios_linker_loader_can_write_pointer().
It would be better to get rid of fw_cfg_dma_enabled() as well or keep property as RO and replace fw_cfg_dma_enabled() with property accessor if both calls can happen on nondma path
Quoted 18 lines
hw/nvram/fw_cfg.c +3
-5DEFINE_PROP_UINT16("x-file-slots", FWCfgIoState, parent_obj.file_slots, FW_CFG_FILE_SLOTS_DFLT), };@@ -1207,11 +1199,9 @@ static void fw_cfg_io_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->comb_iomem,OBJECT (s), &fw_cfg_comb_mem_ops,FW_CFG (s),"fwcfg" ,FW_CFG_CTL_SIZE ); -if (FW_CFG (s)->dma_enabled) { -memory_region_init_io (&FW_CFG (s)->dma_iomem,OBJECT (s), - &fw_cfg_dma_mem_ops,FW_CFG (s),"fwcfg.dma" , -sizeof (dma_addr_t)); - } +memory_region_init_io (&FW_CFG (s)->dma_iomem,OBJECT (s), + &fw_cfg_dma_mem_ops,FW_CFG (s),"fwcfg.dma" , +sizeof (dma_addr_t));fw_cfg_common_realize (dev, errp); }
Re: [PATCH v4 09/27] hw/nvram/fw_cfg: Remove fw_cfg_io_properties::dma_enabled
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:32 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 09/27] hw/nvram/fw_cfg: Remove
fw_cfg_io_properties::dma_enabled
X-Mailer: git-send-email 2.47.1Now than all calls to
fw_cfg_init_io_dma()pass DMA arguments,
Yes,
Quoted 2 lines
the '
dma_enabled' of theTYPE_FW_CFG_IOtype is not used anymore. Remove it, simplifyingfw_cfg_init_io_dma()andfw_cfg_io_realize().
but the 'dma_enabled' of the TYPE_FW_CFG_IO type is still used in hw/sparc64/sun4u.c:
dev = qdev_new(TYPE_FW_CFG_IO);
qdev_prop_set_bit(dev, "dma_enabled", false);The creation of TYPE_FW_CFG_IO is similar to fw_cfg_init_io_dma(), but it still has little difference so I find sun4uv can't use fw_cfg_init_io_dma() directly for now, or it may require more careful clarification that it can use fw_cfg_init_io_dma().
So, at least we have to keep "dma_enabled" property in fw_cfg_io_properties[].
...
Quoted 5 lines
hw/i386/x86-common.c +0
-0
hw/i386/x86-common.c void x86_load_linux(X86MachineState *x86ms, · line 996
Quoted 10 lines
hw/i386/x86-common.c +1
-4@@ -991,10 +991,7 @@ 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" ; - } + option_rom[nb_option_roms].name ="linuxboot_dma.bin" ; nb_option_roms++; }
But now all x86 machines have enabled dma, so it's still possible to drop "linuxboot.bin".
For this, I think we could add a DMA check in the x86 common code to guarantee DMA is enabled and then we won't need to constantly check DMA enable in every corner.
Regards,
Zhao
PATCH v4 10/27 hw/i386/pc: Remove linuxboot.bin
In reply to Philippe Mathieu-DaudéAll PC machines now use the linuxboot_dma.bin binary, we can remove the non-DMA version (linuxboot.bin).
--- hw/i386/pc.c | 3 +- pc-bios/meson.build | 1 - pc-bios/optionrom/Makefile | 2 +- pc-bios/optionrom/linuxboot.S | 195 ---------------------------------- 4 files changed, 2 insertions(+), 199 deletions(-) delete mode 100644 pc-bios/optionrom/linuxboot.S
hw/i386/pc.c +1 -2
@@ -654,8 +654,7 @@ void xen_load_linux(PCMachineState *pcms)x86_load_linux (x86ms, fw_cfg,PC_FW_DATA , pcmc->pvh_enabled);for (i =0 ; i < nb_option_roms; i++) { -assert (!strcmp (option_rom[i].name,"linuxboot.bin" ) || - !strcmp (option_rom[i].name,"linuxboot_dma.bin" ) || +assert (!strcmp (option_rom[i].name,"linuxboot_dma.bin" ) || !strcmp (option_rom[i].name,"pvh.bin" ) || !strcmp (option_rom[i].name,"multiboot_dma.bin" ));rom_add_option (option_rom[i].name, option_rom[i].bootindex);
pc-bios/meson.build +0 -1
@@ -63,7 +63,6 @@ blobs = [ 'efi-vmxnet3.rom', 'qemu-nsis.bmp', 'multiboot_dma.bin', - 'linuxboot.bin', 'linuxboot_dma.bin', 'kvmvapic.bin', 'pvh.bin',
pc-bios/optionrom/Makefile +1 -1
@@ -2,7 +2,7 @@ include config.mak SRC_DIR := $(TOPSRC_DIR)/pc-bios/optionrom VPATH = $(SRC_DIR) -all: multiboot_dma.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin +all: multiboot_dma.bin linuxboot_dma.bin kvmvapic.bin pvh.bin # Dummy command so that make thinks it has done something @true
pc-bios/optionrom/linuxboot.S deleted +0 -195
195 lines not on this page · raw message
Signature · 1 line
2.47.1
Re: [PATCH v4 10/27] hw/i386/pc: Remove linuxboot.bin
Quoted 10 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:33 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 10/27] hw/i386/pc: Remove linuxboot.bin
X-Mailer: git-send-email 2.47.1All PC machines now use the linuxboot_dma.bin binary, we can remove the non-DMA version (linuxboot.bin).
Suggested-by Thomas Huth <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 7 lines
--- hw/i386/pc.c | 3 +- pc-bios/meson.build | 1 - pc-bios/optionrom/Makefile | 2 +- pc-bios/optionrom/linuxboot.S | 195 ---------------------------------- 4 files changed, 2 insertions(+), 199 deletions(-) delete mode 100644 pc-bios/optionrom/linuxboot.S
Re: [PATCH v4 10/27] hw/i386/pc: Remove linuxboot.bin
In reply to Philippe Mathieu-DaudéQuoted 7 lines · On Thu, 8 May 2025 15:35:33 +0200 Philippe Mathieu-Daudé <[email protected]>…
All PC machines now use the linuxboot_dma.bin binary, we can remove the non-DMA version (linuxboot.bin).
Suggested-by Thomas Huth <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/pc.c | 3 +-
linuxboot.bin is referenced in a few more files:
hw/i386/x86-common.c: option_rom[nb_option_roms].name = "linuxboot.bin";
hw/nvram/fw_cfg.c: { "genroms/linuxboot.bin", 60 },are you sure we should keep it there?
Quoted 246 lines
pc-bios/meson.build | 1 - pc-bios/optionrom/Makefile | 2 +- pc-bios/optionrom/linuxboot.S | 195 ---------------------------------- 4 files changed, 2 insertions(+), 199 deletions(-) delete mode 100644 pc-bios/optionrom/linuxboot.Shw/i386/pc.c +1
-2@@ -654,8 +654,7 @@ void xen_load_linux(PCMachineState *pcms)x86_load_linux (x86ms, fw_cfg,PC_FW_DATA , pcmc->pvh_enabled);for (i =0 ; i < nb_option_roms; i++) { -assert (!strcmp (option_rom[i].name,"linuxboot.bin" ) || - !strcmp (option_rom[i].name,"linuxboot_dma.bin" ) || +assert (!strcmp (option_rom[i].name,"linuxboot_dma.bin" ) || !strcmp (option_rom[i].name,"pvh.bin" ) || !strcmp (option_rom[i].name,"multiboot_dma.bin" ));rom_add_option (option_rom[i].name, option_rom[i].bootindex);pc-bios/meson.build +0
-1@@ -63,7 +63,6 @@ blobs = [ 'efi-vmxnet3.rom', 'qemu-nsis.bmp', 'multiboot_dma.bin', - 'linuxboot.bin', 'linuxboot_dma.bin', 'kvmvapic.bin', 'pvh.bin',pc-bios/optionrom/Makefile +1
-1@@ -2,7 +2,7 @@ include config.mak SRC_DIR := $(TOPSRC_DIR)/pc-bios/optionrom VPATH = $(SRC_DIR) -all: multiboot_dma.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin +all: multiboot_dma.bin linuxboot_dma.bin kvmvapic.bin pvh.bin # Dummy command so that make thinks it has done something @truepc-bios/optionrom/linuxboot.S deleted +0
-195@@ -1,195 +0,0 @@ -/* - * Linux Boot Option ROM - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see <http://www.gnu.org/licenses/>. - * - * Copyright Novell Inc, 2009 - * Authors: Alexander Graf <[email protected]> - * - * Based on code in hw/pc.c. - */ - -#include "optionrom.h" - -#define BOOT_ROM_PRODUCT "Linux loader" - -BOOT_ROM_START - -run_linuxboot: - - cli - cld - - jmp copy_kernel -boot_kernel: - - read_fw FW_CFG_SETUP_ADDR - - mov %eax, %ebx - shr $4, %ebx - - /* All segments contain real_addr */ - mov %bx, %ds - mov %bx, %es - mov %bx, %fs - mov %bx, %gs - mov %bx, %ss - - /* CX = CS we want to jump to */ - add $0x20, %bx - mov %bx, %cx - - /* SP = cmdline_addr-real_addr-16 */ - read_fw FW_CFG_CMDLINE_ADDR - mov %eax, %ebx - read_fw FW_CFG_SETUP_ADDR - sub %eax, %ebx - sub $16, %ebx - mov %ebx, %esp - - /* Build indirect lret descriptor */ - pushw %cx /* CS */ - xor %ax, %ax - pushw %ax /* IP = 0 */ - - /* Clear registers */ - xor %eax, %eax - xor %ebx, %ebx - xor %ecx, %ecx - xor %edx, %edx - xor %edi, %edi - xor %ebp, %ebp - - /* Jump to Linux */ - lret - - -copy_kernel: - /* Read info block in low memory (0x10000 or 0x90000) */ - read_fw FW_CFG_SETUP_ADDR - shr $4, %eax - mov %eax, %es - xor %edi, %edi - read_fw_blob_addr32_edi(FW_CFG_SETUP) - - cmpw $0x203, %es:0x206 // if protocol >= 0x203 - jae 1f // have initrd_max - movl $0x37ffffff, %es:0x22c // else assume 0x37ffffff -1: - - /* Check if using kernel-specified initrd address */ - read_fw FW_CFG_INITRD_ADDR - mov %eax, %edi // (load_kernel wants it in %edi) - read_fw FW_CFG_INITRD_SIZE // find end of initrd - add %edi, %eax - xor %es:0x22c, %eax // if it matches es:0x22c - and $-4096, %eax // (apart from padding for page) - jz load_kernel // then initrd is not at top - // of memory - - /* pc.c placed the initrd at end of memory. Compute a better - * initrd address based on e801 data. - */ - mov $0xe801, %ax - xor %cx, %cx - xor %dx, %dx - int $0x15 - - /* Output could be in AX/BX or CX/DX */ - or %cx, %cx - jnz 1f - or %dx, %dx - jnz 1f - mov %ax, %cx - mov %bx, %dx -1: - - or %dx, %dx - jnz 2f - addw $1024, %cx /* add 1 MB */ - movzwl %cx, %edi - shll $10, %edi /* convert to bytes */ - jmp 3f - -2: - addw $16777216 >> 16, %dx /* add 16 MB */ - movzwl %dx, %edi - shll $16, %edi /* convert to bytes */ - -3: - read_fw FW_CFG_INITRD_SIZE - subl %eax, %edi - andl $-4096, %edi /* EDI = start of initrd */ - movl %edi, %es:0x218 /* put it in the header */ - -load_kernel: - /* We need to load the kernel into memory we can't access in 16 bit - mode, so let's get into 32 bit mode, write the kernel and jump - back again. */ - - /* Reserve space on the stack for our GDT descriptor. */ - mov %esp, %ebp - sub $16, %esp - - /* Now create the GDT descriptor */ - movw $((3 * 8) - 1), -16(%bp) - mov %cs, %eax - movzwl %ax, %eax - shl $4, %eax - addl $gdt, %eax - movl %eax, -14(%bp) - - /* And load the GDT */ - data32 lgdt -16(%bp) - mov %ebp, %esp - - /* Get us to protected mode now */ - mov $1, %eax - mov %eax, %cr0 - - /* So we can set ES to a 32-bit segment */ - mov $0x10, %eax - mov %eax, %es - - /* We're now running in 16-bit CS, but 32-bit ES! */ - - /* Load kernel and initrd */ - read_fw_blob_addr32_edi(FW_CFG_INITRD) - read_fw_blob_addr32(FW_CFG_KERNEL) - read_fw_blob_addr32(FW_CFG_CMDLINE) - - /* And now jump into Linux! */ - mov $0, %eax - mov %eax, %cr0 - - /* ES = CS */ - mov %cs, %ax - mov %ax, %es - - jmp boot_kernel - -/* Variables */ - -.align 4, 0 -gdt: - /* 0x00 */ -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - /* 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) */ -.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x9a, 0xcf, 0x00 - - /* 0x10: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) */ -.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00 - -BOOT_ROM_END
Re: [PATCH v4 10/27] hw/i386/pc: Remove linuxboot.bin
Quoted 5 lines · Igor Mammedov
Date: Fri, 9 May 2025 18:04:11 +0200
From: Igor Mammedov <[email protected]>
Subject: Re: [PATCH v4 10/27] hw/i386/pc: Remove linuxboot.bin
X-Mailer: Claws Mail 4.3.1 (GTK 3.24.43; x86_64-redhat-linux-gnu)
Quoted 10 lines
Quoted 7 lines · On Thu, 8 May 2025 15:35:33 +0200 Philippe Mathieu-Daudé <[email protected]>…
All PC machines now use the linuxboot_dma.bin binary, we can remove the non-DMA version (linuxboot.bin).
Suggested-by Thomas Huth <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/pc.c | 3 +-
(After a long interval, more of a note.)
Quoted 3 lines
linuxboot.bin is referenced in a few more files:
hw/i386/x86-common.c: option_rom[nb_option_roms].name = "linuxboot.bin";
this case is removed in previous patch (which considerred x86 machines all have DMA enabled).
Quoted 1 line
hw/nvram/fw_cfg.c: { "genroms/linuxboot.bin", 60 },
this case is removed in commit 6160ce208419 ("hw/nvram/fw_cfg: Remove legacy FW_CFG_ORDER_OVERRIDE").
Regards,
Zhao
PATCH v4 11/27 hw/i386/pc: Remove pc_compat_2_6[] array
In reply to Philippe Mathieu-DaudéThe pc_compat_2_6[] array was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it.
--- include/hw/i386/pc.h | 3 --- hw/i386/pc.c | 8 -------- 2 files changed, 11 deletions(-)
include/hw/i386/pc.h +0 -3
@@ -292,9 +292,6 @@ extern const size_t pc_compat_2_8_len;extern GlobalProperty pc_compat_2_7[];extern const size_t pc_compat_2_7_len; -extern GlobalProperty pc_compat_2_6[]; -extern const size_t pc_compat_2_6_len; -#define DEFINE_PC_MACHINE (suffix, namestr, initfn, optsfn) \ static void pc_machine_##suffix##_class_init(ObjectClass *oc, \ const void *data) \
hw/i386/pc.c +0 -8
@@ -251,14 +251,6 @@ GlobalProperty pc_compat_2_7[] = { };const size_t pc_compat_2_7_len =G_N_ELEMENTS (pc_compat_2_7); -GlobalProperty pc_compat_2_6[] = { - {TYPE_X86_CPU ,"cpuid-0xb" ,"off" }, - {"vmxnet3" ,"romfile" ,"" }, - {TYPE_X86_CPU ,"fill-mtrr-mask" ,"off" }, - {"apic-common" ,"legacy-instance-id" ,"on" , } -}; -const size_t pc_compat_2_6_len =G_N_ELEMENTS (pc_compat_2_6); -/* * @PC_FW_DATA: * Size of the chunk of memory at the top of RAM for the BIOS ACPI tables
Signature · 1 line
2.47.1
Re: [PATCH v4 11/27] hw/i386/pc: Remove pc_compat_2_6[] array
Quoted 8 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:34 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 11/27] hw/i386/pc: Remove pc_compat_2_6[] array
X-Mailer: git-send-email 2.47.1The pc_compat_2_6[] array was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it.
Quoted 8 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>Reviewed-by Zhao Liu <[email protected]>--- include/hw/i386/pc.h | 3 --- hw/i386/pc.c | 8 -------- 2 files changed, 11 deletions(-)
Re: [PATCH v4 11/27] hw/i386/pc: Remove pc_compat_2_6[] array
In reply to Philippe Mathieu-DaudéQuoted 2 lines · On Thu, 8 May 2025 15:35:34 +0200 Philippe Mathieu-Daudé <[email protected]>…
The pc_compat_2_6[] array was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it.
see my comment in 1/27
Quoted 43 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>Reviewed-by Zhao Liu <[email protected]>--- include/hw/i386/pc.h | 3 --- hw/i386/pc.c | 8 -------- 2 files changed, 11 deletions(-)include/hw/i386/pc.h +0
-3@@ -292,9 +292,6 @@ extern const size_t pc_compat_2_8_len;extern GlobalProperty pc_compat_2_7[];extern const size_t pc_compat_2_7_len; -extern GlobalProperty pc_compat_2_6[]; -extern const size_t pc_compat_2_6_len; -#define DEFINE_PC_MACHINE (suffix, namestr, initfn, optsfn) \ static void pc_machine_##suffix##_class_init(ObjectClass *oc, \ const void *data) \hw/i386/pc.c +0
-8@@ -251,14 +251,6 @@ GlobalProperty pc_compat_2_7[] = { };const size_t pc_compat_2_7_len =G_N_ELEMENTS (pc_compat_2_7); -GlobalProperty pc_compat_2_6[] = { - {TYPE_X86_CPU ,"cpuid-0xb" ,"off" }, - {"vmxnet3" ,"romfile" ,"" }, - {TYPE_X86_CPU ,"fill-mtrr-mask" ,"off" }, - {"apic-common" ,"legacy-instance-id" ,"on" , } -}; -const size_t pc_compat_2_6_len =G_N_ELEMENTS (pc_compat_2_6); -/* * @PC_FW_DATA: * Size of the chunk of memory at the top of RAM for the BIOS ACPI tables
PATCH v4 12/27 target/i386/cpu: Remove CPUX86State::enable_cpuid_0xb field
In reply to Philippe Mathieu-DaudéThe CPUX86State::enable_cpuid_0xb boolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplify cpu_x86_cpuid().
--- target/i386/cpu.h | 3 --- target/i386/cpu.c | 6 ------ 2 files changed, 9 deletions(-)
target/i386/cpu.h +0 -3
@@ -2241,9 +2241,6 @@ struct ArchCPU {*/ bool legacy_multi_node; -/* Compatibility bits for old machine types: */ -bool enable_cpuid_0xb; -/* Enable auto level-increase for all CPUID leaves */ bool full_cpuid_auto_level;
target/i386/cpu.c +0 -6
@@ -6982,11 +6982,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,break ;case 0xB :/* Extended Topology Enumeration Leaf */ -if (!cpu->enable_cpuid_0xb) { - *eax = *ebx = *ecx = *edx =0 ; -break ; - } - *ecx = count &0xff ; *edx = cpu->apic_id;
@@ -8828,7 +8823,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT64 ("ucode-rev" ,X86CPU , ucode_rev,0 ),DEFINE_PROP_BOOL ("full-cpuid-auto-level" ,X86CPU , full_cpuid_auto_level, true),DEFINE_PROP_STRING ("hv-vendor-id" ,X86CPU , hyperv_vendor), -DEFINE_PROP_BOOL ("cpuid-0xb" ,X86CPU , enable_cpuid_0xb, true),DEFINE_PROP_BOOL ("x-vendor-cpuid-only" ,X86CPU , vendor_cpuid_only, true),DEFINE_PROP_BOOL ("x-amd-topoext-features-only" ,X86CPU , amd_topoext_features_only, true), DEFINE_PROP_BOOL("lmce", X86CPU, enable_lmce, false),
Signature · 1 line
2.47.1
Re: [PATCH v4 12/27] target/i386/cpu: Remove CPUX86State::enable_cpuid_0xb field
Quoted 42 lines · Philippe Mathieu-Daudé
The
CPUX86State::enable_cpuid_0xbboolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplifycpu_x86_cpuid().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 3 --- target/i386/cpu.c | 6 ------ 2 files changed, 9 deletions(-)target/i386/cpu.h +0
-3@@ -2241,9 +2241,6 @@ struct ArchCPU {*/ bool legacy_multi_node; -/* Compatibility bits for old machine types: */ -bool enable_cpuid_0xb; -/* Enable auto level-increase for all CPUID leaves */ bool full_cpuid_auto_level;target/i386/cpu.c +0
-5@@ -6982,11 +6982,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,break ;case 0xB :/* Extended Topology Enumeration Leaf */ -if (!cpu->enable_cpuid_0xb) { - *eax = *ebx = *ecx = *edx =0 ; -break ; - } - *ecx = count &0xff ; *edx = cpu->apic_id;
target/i386/cpu.c static const Property x86_cpu_properties[] = { · line 8831
Quoted 4 lines
target/i386/cpu.c +0
-1@@ -8828,7 +8823,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT64 ("ucode-rev" ,X86CPU , ucode_rev,0 ),DEFINE_PROP_BOOL ("full-cpuid-auto-level" ,X86CPU , full_cpuid_auto_level, true), DEFINE_PROP_STRING("hv-vendor-id", X86CPU, hyperv_vendor), - DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true),
It's deprecating the "cpuid-0xb" property.
I think we need go with the standard process to deprecate it.
Quoted 3 lines
target/i386/cpu.c +0
-0DEFINE_PROP_BOOL ("x-vendor-cpuid-only" ,X86CPU , vendor_cpuid_only, true),DEFINE_PROP_BOOL ("x-amd-topoext-features-only" ,X86CPU , amd_topoext_features_only, true), DEFINE_PROP_BOOL("lmce", X86CPU, enable_lmce, false),
Re: [PATCH v4 12/27] target/i386/cpu: Remove CPUX86State::enable_cpuid_0xb field
Quoted 52 lines · Xiaoyao Li
Date: Fri, 9 May 2025 14:49:27 +0800
From: Xiaoyao Li <[email protected]>
Subject: Re: [PATCH v4 12/27] target/i386/cpu: Remove
CPUX86State::enable_cpuid_0xbfieldQuoted 39 lines · Philippe Mathieu-Daudé
The
CPUX86State::enable_cpuid_0xbboolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplifycpu_x86_cpuid().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 3 --- target/i386/cpu.c | 6 ------ 2 files changed, 9 deletions(-)target/i386/cpu.h +0
-3@@ -2241,9 +2241,6 @@ struct ArchCPU {*/ bool legacy_multi_node; -/* Compatibility bits for old machine types: */ -bool enable_cpuid_0xb; -/* Enable auto level-increase for all CPUID leaves */ bool full_cpuid_auto_level;target/i386/cpu.c +0
-5@@ -6982,11 +6982,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,break ;case 0xB :/* Extended Topology Enumeration Leaf */ -if (!cpu->enable_cpuid_0xb) { - *eax = *ebx = *ecx = *edx =0 ; -break ; - } - *ecx = count &0xff ; *edx = cpu->apic_id;target/i386/cpu.c static const Property x86_cpu_properties[] = { · line 8831
Quoted 4 lines
target/i386/cpu.c +0
-1@@ -8828,7 +8823,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT64 ("ucode-rev" ,X86CPU , ucode_rev,0 ),DEFINE_PROP_BOOL ("full-cpuid-auto-level" ,X86CPU , full_cpuid_auto_level, true), DEFINE_PROP_STRING("hv-vendor-id", X86CPU, hyperv_vendor), - DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true),It's deprecating the "cpuid-0xb" property.
Quoted 1 line
I think we need go with the standard process to deprecate it.
Thanks! I got your point.
Though this property is introduced for compatibility, as its comment said "Compatibility bits for old machine types", it is also useful for somer users.
Fo example, in the early development stages of TDX, when there was no full support for CPU topology, Intel had disable this property for testing and found this bug:
https://lore.kernel.org/qemu-devel/[email protected]/
So, I think there may be other similar use cases as well.
And, if someone wants to emulate ancient x86 CPUs (though I can't currently confirm from which generation of CPUs 0xb support started), he may want to consider disable this property as well.
The main problem here is that the "property" mechanism doesn't distinguish between internal use/public use, and although it was originally intended for internal QEMU use, it also leaks to the user, creating some external use cases.
@Philippe, thank you for cleaning up this case! I think we can keep this property, and if you don't mind, I can modify its comment later to indicate that it's used to adjust the topology support for the CPU.
Thanks,
Zhao
How to mark internal properties (was: Re: [PATCH v4 12/27] target/i386/cpu: Remove CPUX86State::enable_cpuid_0xb field)
Quoted 53 lines · Zhao Liu
Quoted 52 lines · Xiaoyao Li
Date: Fri, 9 May 2025 14:49:27 +0800
From: Xiaoyao Li <[email protected]>
Subject: Re: [PATCH v4 12/27] target/i386/cpu: Remove
CPUX86State::enable_cpuid_0xbfieldQuoted 39 lines · Philippe Mathieu-Daudé
The
CPUX86State::enable_cpuid_0xbboolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplifycpu_x86_cpuid().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 3 --- target/i386/cpu.c | 6 ------ 2 files changed, 9 deletions(-)target/i386/cpu.h +0
-3@@ -2241,9 +2241,6 @@ struct ArchCPU {*/ bool legacy_multi_node; -/* Compatibility bits for old machine types: */ -bool enable_cpuid_0xb; -/* Enable auto level-increase for all CPUID leaves */ bool full_cpuid_auto_level;target/i386/cpu.c +0
-5@@ -6982,11 +6982,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,break ;case 0xB :/* Extended Topology Enumeration Leaf */ -if (!cpu->enable_cpuid_0xb) { - *eax = *ebx = *ecx = *edx =0 ; -break ; - } - *ecx = count &0xff ; *edx = cpu->apic_id;target/i386/cpu.c static const Property x86_cpu_properties[] = { · line 8831
Quoted 4 lines
target/i386/cpu.c +0
-1@@ -8828,7 +8823,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT64 ("ucode-rev" ,X86CPU , ucode_rev,0 ),DEFINE_PROP_BOOL ("full-cpuid-auto-level" ,X86CPU , full_cpuid_auto_level, true), DEFINE_PROP_STRING("hv-vendor-id", X86CPU, hyperv_vendor), - DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true),It's deprecating the "cpuid-0xb" property.
Quoted 7 lines
Quoted 1 line
I think we need go with the standard process to deprecate it.
Thanks! I got your point.
Though this property is introduced for compatibility, as its comment said "Compatibility bits for old machine types", it is also useful for somer users.
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
Thomas
Quoted 25 lines
Fo example, in the early development stages of TDX, when there was no full support for CPU topology, Intel had disable this property for testing and found this bug:
https://lore.kernel.org/qemu-devel/[email protected]/
So, I think there may be other similar use cases as well.
And, if someone wants to emulate ancient x86 CPUs (though I can't currently confirm from which generation of CPUs
0xbsupport started), he may want to consider disable this property as well.The main problem here is that the "property" mechanism doesn't distinguish between internal use/public use, and although it was originally intended for internal QEMU use, it also leaks to the user, creating some external use cases.
@Philippe, thank you for cleaning up this case! I think we can keep this property, and if you don't mind, I can modify its comment later to indicate that it's used to adjust the topology support for the CPU.
Thanks,
Zhao
Re: How to mark internal properties (was: Re: [PATCH v4 12/27] target/i386/cpu: Remove CPUX86State::enable_cpuid_0xb field)
Quoted 67 lines · Thomas Huth
Date: Fri, 9 May 2025 12:04:19 +0200
From: Thomas Huth <[email protected]>
Subject: How to mark internal properties (was: Re: [PATCH v4 12/27]
target/i386/cpu: RemoveCPUX86State::enable_cpuid_0xbfield)Quoted 53 lines · Zhao Liu
Quoted 52 lines · Xiaoyao Li
Date: Fri, 9 May 2025 14:49:27 +0800
From: Xiaoyao Li <[email protected]>
Subject: Re: [PATCH v4 12/27] target/i386/cpu: Remove
CPUX86State::enable_cpuid_0xbfieldQuoted 39 lines · Philippe Mathieu-Daudé
The
CPUX86State::enable_cpuid_0xbboolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplifycpu_x86_cpuid().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 3 --- target/i386/cpu.c | 6 ------ 2 files changed, 9 deletions(-)target/i386/cpu.h +0
-3@@ -2241,9 +2241,6 @@ struct ArchCPU {*/ bool legacy_multi_node; -/* Compatibility bits for old machine types: */ -bool enable_cpuid_0xb; -/* Enable auto level-increase for all CPUID leaves */ bool full_cpuid_auto_level;target/i386/cpu.c +0
-5@@ -6982,11 +6982,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,break ;case 0xB :/* Extended Topology Enumeration Leaf */ -if (!cpu->enable_cpuid_0xb) { - *eax = *ebx = *ecx = *edx =0 ; -break ; - } - *ecx = count &0xff ; *edx = cpu->apic_id;target/i386/cpu.c static const Property x86_cpu_properties[] = { · line 8831
Quoted 4 lines
target/i386/cpu.c +0
-1@@ -8828,7 +8823,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT64 ("ucode-rev" ,X86CPU , ucode_rev,0 ),DEFINE_PROP_BOOL ("full-cpuid-auto-level" ,X86CPU , full_cpuid_auto_level, true), DEFINE_PROP_STRING("hv-vendor-id", X86CPU, hyperv_vendor), - DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true),It's deprecating the "cpuid-0xb" property.
Quoted 7 lines
Quoted 1 line
I think we need go with the standard process to deprecate it.
Thanks! I got your point.
Though this property is introduced for compatibility, as its comment said "Compatibility bits for old machine types", it is also useful for somer users.
Quoted 6 lines
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
Hi Thomas, thank you.
AFAIK, there are two ways to configure whether an object/device is allowed to be created by user or not:
* TYPE_USER_CREATABLE
* DeviceClass: user_creatable
So, it looks like it would be tricky to change the infrastructure around object_property_add because it's not easy to be compatible with both of the above user creation ways.
Quoted 6 lines
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
Therefore, I think the “q-” prefix might be a good way, simple and effective.
Let's see if any other maintainers have a better idea.
Regards,
Zhao
Re: How to mark internal properties
In reply to Thomas HuthQuoted 62 lines · Thomas Huth
Quoted 53 lines · Zhao Liu
Quoted 52 lines · Xiaoyao Li
Date: Fri, 9 May 2025 14:49:27 +0800
From: Xiaoyao Li <[email protected]>
Subject: Re: [PATCH v4 12/27] target/i386/cpu: Remove
CPUX86State::enable_cpuid_0xbfieldQuoted 39 lines · Philippe Mathieu-Daudé
The
CPUX86State::enable_cpuid_0xbboolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplifycpu_x86_cpuid().Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
target/i386/cpu.h| 3 ---target/i386/cpu.c| 6 ------2 files changed, 9 deletions(-)target/i386/cpu.h +0
-3@@ -2241,9 +2241,6 @@ struct ArchCPU {*/ bool legacy_multi_node; -/* Compatibility bits for old machine types: */ -bool enable_cpuid_0xb; -/* Enable auto level-increase for all CPUID leaves */ bool full_cpuid_auto_level;target/i386/cpu.c +0
-5@@ -6982,11 +6982,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,break ;case 0xB :/* Extended Topology Enumeration Leaf */ -if (!cpu->enable_cpuid_0xb) { - *eax = *ebx = *ecx = *edx =0 ; -break ; - } - *ecx = count &0xff ; *edx = cpu->apic_id;target/i386/cpu.c static const Property x86_cpu_properties[] = { · line 8831
Quoted 4 lines
target/i386/cpu.c +0
-1@@ -8828,7 +8823,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT64 ("ucode-rev" ,X86CPU , ucode_rev,0 ),DEFINE_PROP_BOOL ("full-cpuid-auto-level" ,X86CPU , full_cpuid_auto_level, true), DEFINE_PROP_STRING("hv-vendor-id", X86CPU, hyperv_vendor), - DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true),It's deprecating the "cpuid-0xb" property.
Quoted 7 lines
Quoted 1 line
I think we need go with the standard process to deprecate it.
Thanks! I got your point.
Though this property is introduced for compatibility, as its comment said "Compatibility bits for old machine types", it is also useful for somer users.
Quoted 6 lines
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
Correct.
Exposing properties meant for internal use at the external interface inevitably leads to (uncertainty about) external use.
Quoted 6 lines
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
This papers over our inability / unwillingness to isolate the external interface from internal detail.
The proper solution is to make the internal properties inaccessible at the external interface. This requires declaring properties' intent. Which strikes me as a very good idea.
A naming convention is a simple, stupid way to do that. There are drawbacks, as experience with the "x-" prefix has shown:
* Flipping a flag bit involves changing the name. Tolerable when all uses are internal, compatibility break when not. Not a problem when the bit governs external access, of course.
* Name capture: consider InputBarrier properties x-origin, y-origin. Oops.
* If we have multiple flag bits, their prefixes can accumulate. This gets ugly and confusing real quick. Not an issue when at most one of the flags can be set, as is the case for "unstable" and "internal use".
* QAPI reserves "q_" for the generator's use. Since "q-" would get mapped to "q_" in C, we risk name clashes.
For what it's worth, QAPI abandoned the "x-" naming convention (commit a3c45b3e629 (qapi: New special feature flag "unstable"), commit message appended for your convenience). Developers are free to use "x-" to help guide human users, but the feature flag is the sole source of thruth.
[...]
commit a3c45b3e62962f99338716b1347cfb0d427cea44
Author: Markus Armbruster <[email protected]> Date: Thu Oct 28 12:25:12 2021 +0200
qapi: New special feature flag "unstable"
By convention, names starting with "x-" are experimental. The parts of external interfaces so named may be withdrawn or changed incompatibly in future releases.
The naming convention makes unstable interfaces easy to recognize. Promoting something from experimental to stable involves a name change. Client code needs to be updated. Occasionally bothersome.
Worse, the convention is not universally observed:
* QOM type "input-barrier" has properties "x-origin", "y-origin". Looks accidental, but it's ABI since 4.2.
* QOM types "memory-backend-file", "memory-backend-memfd", "memory-backend-ram", and "memory-backend-epc" have a property "x-use-canonical-path-for-ramblock-id" that is documented to be stable despite its name.
We could document these exceptions, but documentation helps only humans. We want to recognize "unstable" in code, like "deprecated".
So support recognizing it the same way: introduce new special feature flag "unstable". It will be treated specially by the QAPI generator, like the existing feature flag "deprecated", and unlike regular feature flags.
This commit updates documentation and prepares tests. The next commit updates the QAPI schema. The remaining patches update the QAPI generator and wire up -compat policy checking.
Management applications can then use query-qmp-schema and -compat to manage or guard against use of unstable interfaces the same way as for deprecated interfaces.
docs/devel/qapi-code-gen.txt no longer mandates the naming convention. Using it anyway might help writers of programs that aren't full-fledged management applications. Not using it can save us bothersome renames. We'll see how that shakes out.
Message-Id: <[email protected]>
Re: How to mark internal properties (was: Re: [PATCH v4 12/27] target/i386/cpu: Remove CPUX86State::enable_cpuid_0xb field)
In reply to Thomas HuthQuoted 7 lines · Thomas Huth
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
Quoted 6 lines
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
I think a q-prefix is potentially a bit clunky unless we also have infrastructure to say eg DEFINE_INTERNAL_PROP_BOOL("foo", ...) and have it auto-add the prefix, and to have the C APIs for setting properties search for both "foo" and "q-foo" so you don't have to write qdev_prop_set_bit(dev, "q-foo", ...).
thanks
-- PMM
Re: How to mark internal properties (was: Re: [PATCH v4 12/27] target/i386/cpu: Remove CPUX86State::enable_cpuid_0xb field)
Quoted 15 lines · Peter Maydell
Quoted 7 lines · Thomas Huth
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
Quoted 6 lines
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
Quoted 5 lines
I think a q-prefix is potentially a bit clunky unless we also have infrastructure to say eg
DEFINE_INTERNAL_PROP_BOOL("foo", ...)and have it auto-add the prefix, and to have the C APIs for setting properties search for both "foo" and "q-foo" so you don't have to writeqdev_prop_set_bit(dev, "q-foo", ...).
I think it is also not obvious enough that a 'q-' prefix means private.
Perhaps borrow from the C world and declare that a leading underscore indicates a private property. People are more likely to understand and remember that, than 'q-'.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: How to mark internal properties
Quoted 16 lines · Daniel P. Berrangé
Quoted 15 lines · Peter Maydell
Quoted 13 lines · Thomas Huth
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
Quoted 5 lines
Quoted 5 lines
I think a q-prefix is potentially a bit clunky unless we also have infrastructure to say eg
DEFINE_INTERNAL_PROP_BOOL("foo", ...)and have it auto-add the prefix, and to have the C APIs for setting properties search for both "foo" and "q-foo" so you don't have to writeqdev_prop_set_bit(dev, "q-foo", ...).
If we make intent explicit with DEFINE_INTERNAL_PROP_FOO(), is repeating intent in the name useful?
Quoted 1 line
I think it is also not obvious enough that a 'q-' prefix means private.
Concur.
Quoted 3 lines
Perhaps borrow from the C world and declare that a leading underscore indicates a private property. People are more likely to understand and remember that, than 'q-'.
This is fine for device properties now. It's not fine for properties of user-creatable objects, because these are defined in QAPI, and QAPI prohibits names starting with a single underscore. I append relevant parts of docs/devel/qapi-code-gen.rst for your convenience.
Why does QAPI prohibit leading underscores? Chiefly because such names are reserved identifiers in C. Instead of complicating the mapping from QAPI name to C identifier, we restrict QAPI names and call it a day.
The mapping between device property name and C identifiers is entirely manual. When a property is backed by a member of the device state struct, naming the member exactly like the property makes sense. Having to mentally strip / insert a leading underscore would hardly be terrible, just a bit of friction. I'd prefer not to.
Naming rules and reserved names
-------------------------------
All names must begin with a letter, and contain only ASCII letters, digits, hyphen, and underscore. There are two exceptions: enum values may start with a digit, and names that are downstream extensions (see section Downstream extensions_) start with underscore.
Names beginning with ``q_`` are reserved for the generator, which uses them for munging QMP names that resemble C keywords or other problematic strings. For example, a member named ``default`` in qapi becomes ``q_default`` in the generated C code.
[...]
Downstream extensions
---------------------
QAPI schema names that are externally visible, say in the Client JSON Protocol, need to be managed with care. Names starting with a downstream prefix of the form __RFQDN_ are reserved for the downstream who controls the valid, reverse fully qualified domain name RFQDN. RFQDN may only contain ASCII letters, digits, hyphen and period.
Example: Red Hat, Inc. controls redhat.com, and may therefore add a downstream command ``__com.redhat_drive-mirror``.
Re: How to mark internal properties
Quoted 17 lines · Markus Armbruster
Quoted 15 lines · Daniel P. Berrangé
Quoted 14 lines · Peter Maydell
Quoted 13 lines · Thomas Huth
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
I think a q-prefix is potentially a bit clunky unless we also have infrastructure to say eg
DEFINE_INTERNAL_PROP_BOOL("foo", ...)and have it auto-add the prefix, and to have the C APIs for setting properties search for both "foo" and "q-foo" so you don't have to writeqdev_prop_set_bit(dev, "q-foo", ...).If we make intent explicit with
DEFINE_INTERNAL_PROP_FOO(), is repeating intent in the name useful?
+1 for DEFINE_INTERNAL_PROP_FOO(). I have the same thought.
We need something in code to restrict the *internal* property really internal, i.e., not user settable. What the name of the property is doesn't matter.
Re: How to mark internal properties
Quoted 23 lines · Xiaoyao Li
Quoted 21 lines · Markus Armbruster
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Peter Maydell
Quoted 7 lines · Thomas Huth
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
Quoted 6 lines
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
I think a q-prefix is potentially a bit clunky unless we also have infrastructure to say eg
DEFINE_INTERNAL_PROP_BOOL("foo", ...)and have it auto-add the prefix, and to have the C APIs for setting properties search for both "foo" and "q-foo" so you don't have to writeqdev_prop_set_bit(dev, "q-foo", ...).
Quoted 6 lines
Quoted 2 lines
If we make intent explicit with
DEFINE_INTERNAL_PROP_FOO(), is repeating intent in the name useful?+1 for
DEFINE_INTERNAL_PROP_FOO(). I have the same thought.We need something in code to restrict the *internal* property really internal, i.e., not user settable. What the name of the property is doesn't matter.
What's an internal property? Properties are there to make some field of an object introspectable and settable from command line and QEMU monitor or other external interfaces. If that's not needed for something why is it defined as a property in the first place and not just e.g. C accessor functions as part of the device's interface instead? I think this may be overusing QOM for things that may not need it and adding complexity where not needed. It reminds me of patches that wanted to export via-ide IRQs or ISA IRQs just to be able to connect them to other parts _of the same chip_ becuase this chip is modeled as multiple QOM objects for reusing code from those. But in reality the chip does not have such pins and these are internal connections so I think it would be better to model these as functions and not QOM constructs that the user can change. In general, if the device or object has an external connection or a knob that the user may need to change or connect to another device (like building a board from parts you can wire pins together) then those need properties or qemu_irqs but other "internal properties" may need some other way to access and often simple accessor functions are enough for this as these internal properties are only accessed form the code. That way we would not need even more complexity to hide these from the user, instead of that just don't expose them but use something else where a property is not needed. A property is just like an accessor function with additional complexity to expose it to other interfaces so it's externally settable and introspectable but we don't need those for internal properties so we can drop that complexity and get back to the accessor function at the bottom of it.
Regards,
BALATON Zoltan
Re: How to mark internal properties
Quoted 1 line · BALATON Zoltan
On Mon, 12 May 2025, Xiaoyao Li wrote:
...
Quoted 3 lines
Quoted 1 line
We need something in code to restrict the *internal* property really internal, i.e., not user settable. What the name of the property is doesn't matter.
What's an internal property? Properties are there to make some field of an object introspectable and settable from command line and QEMU monitor or other external interfaces. If that's not needed for something why is it defined as a property in the first place and not just e.g. C accessor functions as part of the device's interface instead? I think this may be overusing QOM for things that may not need it and adding complexity where not needed.
Maybe some things could easily be simplified indeed, but for some others, it's currently the way it's deeply rooted in the logic of QEMU. Have a look at the hw_compat arrays in hw/core/machine.c ... it all goes via properties, so there is certainly no easy and quick solution for this.
Thomas
Re: How to mark internal properties
In reply to Markus ArmbrusterQuoted 31 lines · Markus Armbruster
Quoted 16 lines · Daniel P. Berrangé
Quoted 15 lines · Peter Maydell
Quoted 13 lines · Thomas Huth
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
Quoted 5 lines
Quoted 5 lines
I think a q-prefix is potentially a bit clunky unless we also have infrastructure to say eg
DEFINE_INTERNAL_PROP_BOOL("foo", ...)and have it auto-add the prefix, and to have the C APIs for setting properties search for both "foo" and "q-foo" so you don't have to writeqdev_prop_set_bit(dev, "q-foo", ...).If we make intent explicit with
DEFINE_INTERNAL_PROP_FOO(), is repeating intent in the name useful?Quoted 1 line
I think it is also not obvious enough that a 'q-' prefix means private.
Concur.
Quoted 8 lines
Quoted 3 lines
Perhaps borrow from the C world and declare that a leading underscore indicates a private property. People are more likely to understand and remember that, than 'q-'.
This is fine for device properties now. It's not fine for properties of user-creatable objects, because these are defined in QAPI, and QAPI prohibits names starting with a single underscore. I append relevant parts of
docs/devel/qapi-code-gen.rstfor your convenience.
On a related note this also brings us back to the discussion as to the relationship between qdev and QOM: at one point I was under the impression that qdev properties were simply QOM properties that were exposed externally, i.e on the commmand line for use with -device.
Can you provide an update on what the current thinking is in this area, in particular re: scoping of qdev vs QOM properties?
ATB,
Mark.
Re: How to mark internal properties
Quoted 3 lines · Mark Cave-Ayland
On a related note this also brings us back to the discussion as to the relationship between qdev and QOM: at one point I was under the impression that qdev properties were simply QOM properties that were exposed externally, i.e on the commmand line for use with -device.
Can you provide an update on what the current thinking is in this area, in particular re: scoping of qdev vs QOM properties?
qdev is a leaky layer above QOM.
qdev properties are also QOM properties.
All device properties are exposed externally.
We use device properties for:
* Letting users configure pluggable devices, with -device or device_add
* Letting code configure onboard devices
For onboard devices that are also pluggable, everything exposed to code is also exposed externally. This might be a mistake in places.
* Letting the machine versioning machinery adjust device configuration
Some properties are meant to be used just for this. They're exposed externally regardless, which is a mistake.
Re: How to mark internal properties
Quoted 10 lines · Markus Armbruster
Quoted 3 lines · Mark Cave-Ayland
On a related note this also brings us back to the discussion as to the relationship between qdev and QOM: at one point I was under the impression that qdev properties were simply QOM properties that were exposed externally, i.e on the commmand line for use with -device.
Can you provide an update on what the current thinking is in this area, in particular re: scoping of qdev vs QOM properties?
qdev is a leaky layer above QOM.
qdev properties are also QOM properties.
All device properties are exposed externally.
That was clear but the question was if QOM properties (that are not qdev properties) exist and if so are they also exposed? If not exposed it may be used for internal properties (where simpler solutions aren't convenient) but maybe qdev also adds easier definition of properties that's why they used instead of QOM properties?
Quoted 8 lines
We use device properties for:
* Letting users configure pluggable devices, with -device or
device_add* Letting code configure onboard devices
For onboard devices that are also pluggable, everything exposed to code is also exposed externally. This might be a mistake in places.
If a device is pluggable, theoretically a user could create a machine from them declaratively, e.g. starting from a "none" machine or like plugging cards in a motherboard so their properties should be exposed as long as those properties correspond to the device pins they model or configurable options. Only properties that are implementation details should not be exposed because setting them can break the device. There are a few places where we have such properties. But you say "in places" so I think you meant the same.
Quoted 4 lines
* Letting the machine versioning machinery adjust device configuration
Some properties are meant to be used just for this. They're exposed externally regardless, which is a mistake.
Question is if we want to allow users to tweak these compatibility options, like selectively enable/disable when migrating between QEMU versions or for testing. It might have some uses and maybe that's the reason why people would like these to go through deprecation instead of just dropping them. Marking some properties not exposed would get the same resistance then so may not solve the issue.
Regards,
BALATON Zoltan
Re: How to mark internal properties
Quoted 14 lines · BALATON Zoltan
Quoted 13 lines · Markus Armbruster
Quoted 7 lines · Mark Cave-Ayland
On a related note this also brings us back to the discussion as to the relationship between qdev and QOM: at one point I was under the impression that qdev properties were simply QOM properties that were exposed externally, i.e on the commmand line for use with -device.
Can you provide an update on what the current thinking is in this area, in particular re: scoping of qdev vs QOM properties?
qdev is a leaky layer above QOM.
qdev properties are also QOM properties.
Quoted 7 lines
Quoted 1 line
All device properties are exposed externally.
That was clear but the question was if QOM properties (that are not qdev properties) exist and if so are they also exposed? If not exposed it may be used for internal properties (where simpler solutions aren't convenient) but maybe qdev also adds easier definition of properties that's why they used instead of QOM properties?
NB, not everything we expose is a QDev. We directly expose QOM via "-object" if they implement the 'UserCreatable' interface. If we want internal properties, that should likely be wired in to the QOM level directly.
Conceptually you could even say that everything QEMU creates should live under -object, and no other args ought to need to exist. We have decades of evolved code making that impractical though.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: How to mark internal properties
Quoted 23 lines · Daniel P. Berrangé
Quoted 14 lines · BALATON Zoltan
Quoted 13 lines · Markus Armbruster
Quoted 7 lines · Mark Cave-Ayland
On a related note this also brings us back to the discussion as to the relationship between qdev and QOM: at one point I was under the impression that qdev properties were simply QOM properties that were exposed externally, i.e on the commmand line for use with -device.
Can you provide an update on what the current thinking is in this area, in particular re: scoping of qdev vs QOM properties?
qdev is a leaky layer above QOM.
qdev properties are also QOM properties.
Quoted 7 lines
Quoted 1 line
All device properties are exposed externally.
That was clear but the question was if QOM properties (that are not qdev properties) exist and if so are they also exposed? If not exposed it may be used for internal properties (where simpler solutions aren't convenient) but maybe qdev also adds easier definition of properties that's why they used instead of QOM properties?
Quoted 4 lines
NB, not everything we expose is a QDev. We directly expose QOM via "-object" if they implement the 'UserCreatable' interface. If we want internal properties, that should likely be wired in to the QOM level directly.
Yes.
As is, all properties of QOM types implementing UserCreatable are part of the -object / object_add stable external interface. We lack means to add properties just for internal use.
Properties of all QOM types (UserCreatable or not) are exposed externally via qom-get & friends. This isn't a stable interface except when it is, but that's a separate problem.
Quoted 3 lines
Conceptually you could even say that everything QEMU creates should live under -object, and no other args ought to need to exist. We have decades of evolved code making that impractical though.
I doubt we would've invented qdev had QOM existed already.
Re: How to mark internal properties
In reply to BALATON ZoltanQuoted 16 lines · BALATON Zoltan
Quoted 10 lines · Markus Armbruster
Quoted 3 lines · Mark Cave-Ayland
On a related note this also brings us back to the discussion as to the relationship between qdev and QOM: at one point I was under the impression that qdev properties were simply QOM properties that were exposed externally, i.e on the commmand line for use with -device.
Can you provide an update on what the current thinking is in this area, in particular re: scoping of qdev vs QOM properties?
qdev is a leaky layer above QOM.
qdev properties are also QOM properties.
All device properties are exposed externally.
That was clear but the question was if QOM properties (that are not qdev properties) exist and if so are they also exposed? If not exposed it may be used for internal properties (where simpler solutions aren't convenient) but maybe qdev also adds easier definition of properties that's why they used instead of QOM properties?
Quoted 2 lines
We use device properties for:
Quoted 8 lines
Quoted 6 lines
* Letting users configure pluggable devices, with -device or
device_add* Letting code configure onboard devices
For onboard devices that are also pluggable, everything exposed to code is also exposed externally. This might be a mistake in places.
If a device is pluggable, theoretically a user could create a machine from them declaratively, e.g. starting from a "none" machine or like plugging cards in a motherboard so their properties should be exposed as long as those properties correspond to the device pins they model or configurable options. Only properties that are implementation details should not be exposed because setting them can break the device. There are a few places where we have such properties. But you say "in places" so I think you meant the same.
Building machines declaratively has been the dream for many years.
I chose to write "might be in places", because I can't point to examples offhand to support a stronger claim :)
External interfaces should be intentional, i.e. carefully curated to serve actual use cases. They should also be stable and documented.
The QOM parts of our external interfaces are largely accidental, unstable, and undocumented. We have some internal need, we create something to serve it, and expose it externally simply because we lack the means not to.
Quoted 6 lines
Quoted 4 lines
* Letting the machine versioning machinery adjust device configuration
Some properties are meant to be used just for this. They're exposed externally regardless, which is a mistake.
Question is if we want to allow users to tweak these compatibility options, like selectively enable/disable when migrating between QEMU versions or for testing. It might have some uses and maybe that's the reason why people would like these to go through deprecation instead of just dropping them. Marking some properties not exposed would get the same resistance then so may not solve the issue.
If you need to mess with properties to make migration work, that's a bug. That's versioning machinery's job.
External interfaces just for testing can be okay. We should not promise stability there. We should still be intentional, and we should still document.
Attempts to get rid of external interfaces always draw resistance, even when they're accidental.
Re: How to mark internal properties
In reply to BALATON ZoltanQuoted 6 lines · BALATON Zoltan
Quoted 5 lines · Markus Armbruster
Quoted 3 lines · Mark Cave-Ayland
On a related note this also brings us back to the discussion as to the relationship between qdev and QOM: at one point I was under the impression that qdev properties were simply QOM properties that were exposed externally, i.e on the commmand line for use with -device.
Can you provide an update on what the current thinking is in this area, in particular re: scoping of qdev vs QOM properties?
Quoted 7 lines
Quoted 5 lines
qdev is a leaky layer above QOM.
qdev properties are also QOM properties.
All device properties are exposed externally.
That was clear but the question was if QOM properties (that are not qdev properties) exist and if so are they also exposed? If not exposed it may be used for internal properties (where simpler solutions aren't convenient) but maybe qdev also adds easier definition of properties that's why they used instead of QOM properties?
I'm afraid we haven't answered your question clearly, yet. The answer is yes, QOM properties that are not qdev properties do exist. The first one that comes along: ich9_pm_add_properties() adds a bunch to device ICH9-LPC. They are exposted externally. To see them, try
$ qemu-system-x86_64 -device ICH9-LPC,help
[...]
Re: How to mark internal properties
In reply to Markus ArmbrusterQuoted 18 lines · On Mon, 12 May 2025 12:54:26 +0200 Markus Armbruster <[email protected]> wrote:
Quoted 16 lines · Daniel P. Berrangé
Quoted 15 lines · Peter Maydell
Quoted 13 lines · Thomas Huth
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
I think a q-prefix is potentially a bit clunky unless we also have infrastructure to say eg
DEFINE_INTERNAL_PROP_BOOL("foo", ...)and have it auto-add the prefix, and to have the C APIs for setting properties search for both "foo" and "q-foo" so you don't have to writeqdev_prop_set_bit(dev, "q-foo", ...).If we make intent explicit with
DEFINE_INTERNAL_PROP_FOO(), is repeating intent in the name useful?
While we are inventing a new API, I'd say that _INTERNAL_ is not the only thing on my wish-list wrt properties.
It would be also nice to know when a property is set by internal or external user or if it still has default value.
Basically we are looking at different flags for properties and INERNAL being one of them.
Maybe instead of specialized macro, we should have a more generic
DEFINE_PROP_WITH_FLAGS_FOO(...,flags)
So we won't have to rewrite it again when we think of another flag to turn on/off.
From previous uses of x- flag, some of such properties are created as temporary | developer-only and occasionally as a crutch (still no intended for end user). But then sometimes such properties get promoted to ABI with fat warnings not to touch them. Having stable|unstable flag could help here without
need to rename property (and prevent breaking users who (ab)used it if we care).
Re: How to mark internal properties
Quoted 27 lines · Igor Mammedov
Quoted 24 lines · On Mon, 12 May 2025 12:54:26 +0200 Markus Armbruster <[email protected]> wrote:
Quoted 21 lines · Daniel P. Berrangé
Quoted 20 lines · Peter Maydell
Quoted 7 lines · Thomas Huth
Thanks for your clarifications, Zhao! But I think this shows again the problem that we have hit a couple of times in the past already: Properties are currently used for both, config knobs for the users and internal switches for configuration of the machine. We lack a proper way to say "this property is usable for the user" and "this property is meant for internal configuration only".
Quoted 6 lines
I wonder whether we could maybe come up with a naming scheme to better distinguish the two sets, e.g. by using a prefix similar to the "x-" prefix for experimental properties? We could e.g. say that all properties starting with a "q-" are meant for QEMU-internal configuration only or something similar (and maybe even hide those from the default help output when running "-device xyz,help" ?)? Anybody any opinions or better ideas on this?
I think a q-prefix is potentially a bit clunky unless we also have infrastructure to say eg
DEFINE_INTERNAL_PROP_BOOL("foo", ...)and have it auto-add the prefix, and to have the C APIs for setting properties search for both "foo" and "q-foo" so you don't have to writeqdev_prop_set_bit(dev, "q-foo", ...).
Quoted 7 lines
Quoted 2 lines
If we make intent explicit with
DEFINE_INTERNAL_PROP_FOO(), is repeating intent in the name useful?While we are inventing a new API, I'd say that _INTERNAL_ is not the only thing on my wish-list wrt properties.
It would be also nice to know when a property is set by internal or external user or if it still has default value.
We commonly assume "value is default implies user didn't touch it", which is of course wrong unless it's a value the user cannot set.
Quoted 8 lines
Basically we are looking at different flags for properties and INERNAL being one of them.
Maybe instead of specialized macro, we should have a more generic
DEFINE_PROP_WITH_FLAGS_FOO(...,flags)
So we won't have to rewrite it again when we think of another flag to turn on/off.
Quoted 5 lines
From previous uses of x- flag, some of such properties are created as temporary | developer-only and occasionally as a crutch (still no intended for end user). But then sometimes such properties get promoted to ABI with fat warnings not to touch them. Having stable|unstable flag could help here without
need to rename property (and prevent breaking users who (ab)used it if we care).
I think QAPI's explicit 'unstable' and 'deprecated' flags have been a success. Their meaning is clear, and they come with documentation (because adding them without won't compile).
Pushing QOM closer to QAPI when we can makes sense to me.
Re: [PATCH v4 12/27] target/i386/cpu: Remove CPUX86State::enable_cpuid_0xb field
In reply to Zhao LiuQuoted 13 lines · On Fri, 9 May 2025 15:32:30 +0800 Zhao Liu <[email protected]> wrote:
Quoted 12 lines · Xiaoyao Li
Date: Fri, 9 May 2025 14:49:27 +0800
From: Xiaoyao Li <[email protected]>
Subject: Re: [PATCH v4 12/27] target/i386/cpu: Remove
CPUX86State::enable_cpuid_0xbfieldQuoted 6 lines · Philippe Mathieu-Daudé
The
CPUX86State::enable_cpuid_0xbboolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplifycpu_x86_cpuid().Signed-off-by Philippe Mathieu-Daudé <[email protected]>
...
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
target/i386/cpu.c +0
-1@@ -8828,7 +8823,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT64 ("ucode-rev" ,X86CPU , ucode_rev,0 ),DEFINE_PROP_BOOL ("full-cpuid-auto-level" ,X86CPU , full_cpuid_auto_level, true), DEFINE_PROP_STRING("hv-vendor-id", X86CPU, hyperv_vendor), - DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true),
...
Quoted 3 lines
@Philippe, thank you for cleaning up this case! I think we can keep this property, and if you don't mind, I can modify its comment later to indicate that it's used to adjust the topology support for the CPU.
+1, we should not delete this without due process (aka deprecation). So perhaps deprecate now and remove in couple of releases
PATCH v4 13/27 target/i386/cpu: Remove CPUX86State::fill_mtrr_mask field
In reply to Philippe Mathieu-DaudéThe CPUX86State::fill_mtrr_mask boolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplify kvm_get_msrs().
--- target/i386/cpu.h | 3 --- target/i386/cpu.c | 1 - target/i386/kvm/kvm.c | 10 +++------- 3 files changed, 3 insertions(+), 11 deletions(-)
target/i386/cpu.h +0 -3
@@ -2253,9 +2253,6 @@ struct ArchCPU {/* Enable auto level-increase for Intel Processor Trace leave */ bool intel_pt_auto_level; -/* if true fill the top bits of the MTRR_PHYSMASKn variable range */ -bool fill_mtrr_mask; -/* if true override the phys_bits value with a value read from the host */ bool host_phys_bits;
target/i386/cpu.c +0 -1
@@ -8810,7 +8810,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT32 ("guest-phys-bits" ,X86CPU , guest_phys_bits,-1 ),DEFINE_PROP_BOOL ("host-phys-bits" ,X86CPU , host_phys_bits, false),DEFINE_PROP_UINT8 ("host-phys-bits-limit" ,X86CPU , host_phys_bits_limit,0 ), -DEFINE_PROP_BOOL ("fill-mtrr-mask" ,X86CPU , fill_mtrr_mask, true),DEFINE_PROP_UINT32 ("level-func7" ,X86CPU , env.cpuid_level_func7,UINT32_MAX ), DEFINE_PROP_UINT32("level", X86CPU, env.cpuid_level, UINT32_MAX),
target/i386/kvm/kvm.c +3 -7
@@ -4635,13 +4635,9 @@ static int kvm_get_msrs(X86CPU *cpu)* we're migrating to. */ -if (cpu->fill_mtrr_mask) { -QEMU_BUILD_BUG_ON (TARGET_PHYS_ADDR_SPACE_BITS >52 ); -assert (cpu->phys_bits <=TARGET_PHYS_ADDR_SPACE_BITS ); - mtrr_top_bits =MAKE_64BIT_MASK (cpu->phys_bits,52 - cpu->phys_bits); - }else { - mtrr_top_bits =0 ; - } +QEMU_BUILD_BUG_ON (TARGET_PHYS_ADDR_SPACE_BITS >52 ); +assert (cpu->phys_bits <=TARGET_PHYS_ADDR_SPACE_BITS ); + mtrr_top_bits =MAKE_64BIT_MASK (cpu->phys_bits,52 - cpu->phys_bits);for (i =0 ; i < ret; i++) {uint32_t index = msrs[i].index;
Signature · 1 line
2.47.1
Re: [PATCH v4 13/27] target/i386/cpu: Remove CPUX86State::fill_mtrr_mask field
Quoted 11 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:36 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 13/27] target/i386/cpu: Remove
CPUX86State::fill_mtrr_maskfield
X-Mailer: git-send-email 2.47.1The
CPUX86State::fill_mtrr_maskboolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplifykvm_get_msrs().
Quoted 6 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 3 --- target/i386/cpu.c | 1 - target/i386/kvm/kvm.c | 10 +++------- 3 files changed, 3 insertions(+), 11 deletions(-)
No case found for external user use, so,
Re: [PATCH v4 13/27] target/i386/cpu: Remove CPUX86State::fill_mtrr_mask field
In reply to Philippe Mathieu-DaudéQuoted 31 lines · On Thu, 8 May 2025 15:35:36 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
CPUX86State::fill_mtrr_maskboolean was only disabled for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Being now always %true, we can remove it and simplifykvm_get_msrs().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 3 --- target/i386/cpu.c | 1 - target/i386/kvm/kvm.c | 10 +++------- 3 files changed, 3 insertions(+), 11 deletions(-)target/i386/cpu.h +0
-3@@ -2253,9 +2253,6 @@ struct ArchCPU {/* Enable auto level-increase for Intel Processor Trace leave */ bool intel_pt_auto_level; -/* if true fill the top bits of the MTRR_PHYSMASKn variable range */ -bool fill_mtrr_mask; -/* if true override the phys_bits value with a value read from the host */ bool host_phys_bits;target/i386/cpu.c +0
-0
target/i386/cpu.c static const Property x86_cpu_properties[] = { · line 8813
Quoted 4 lines
target/i386/cpu.c +0
-1@@ -8810,7 +8810,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT32 ("guest-phys-bits" ,X86CPU , guest_phys_bits,-1 ),DEFINE_PROP_BOOL ("host-phys-bits" ,X86CPU , host_phys_bits, false), DEFINE_PROP_UINT8("host-phys-bits-limit", X86CPU, host_phys_bits_limit, 0), - DEFINE_PROP_BOOL("fill-mtrr-mask", X86CPU, fill_mtrr_mask, true),
same as previous patch, deprecate 1st then remove
Quoted 24 lines
target/i386/cpu.c +0
-0DEFINE_PROP_UINT32 ("level-func7" ,X86CPU , env.cpuid_level_func7,UINT32_MAX ), DEFINE_PROP_UINT32("level", X86CPU, env.cpuid_level, UINT32_MAX),target/i386/kvm/kvm.c +3
-7@@ -4635,13 +4635,9 @@ static int kvm_get_msrs(X86CPU *cpu)* we're migrating to. */ -if (cpu->fill_mtrr_mask) { -QEMU_BUILD_BUG_ON (TARGET_PHYS_ADDR_SPACE_BITS >52 ); -assert (cpu->phys_bits <=TARGET_PHYS_ADDR_SPACE_BITS ); - mtrr_top_bits =MAKE_64BIT_MASK (cpu->phys_bits,52 - cpu->phys_bits); - }else { - mtrr_top_bits =0 ; - } +QEMU_BUILD_BUG_ON (TARGET_PHYS_ADDR_SPACE_BITS >52 ); +assert (cpu->phys_bits <=TARGET_PHYS_ADDR_SPACE_BITS ); + mtrr_top_bits =MAKE_64BIT_MASK (cpu->phys_bits,52 - cpu->phys_bits);for (i =0 ; i < ret; i++) {uint32_t index = msrs[i].index;
PATCH v4 14/27 hw/intc/apic: Remove APICCommonState::legacy_instance_id field
In reply to Philippe Mathieu-DaudéThe APICCommonState::legacy_instance_id boolean was only set in the pc_compat_2_6[] array, via the 'legacy-instance-id=on' property. We removed all machines using that array, lets remove that property, simplifying apic_common_realize().
Because instance_id is initialized as initial_apic_id, we can not register vmstate_apic_common directly via dc->vmsd.
--- include/hw/i386/apic_internal.h | 1 - hw/intc/apic_common.c | 5 ----- 2 files changed, 6 deletions(-)
include/hw/i386/apic_internal.h +0 -1
@@ -188,7 +188,6 @@ struct APICCommonState {uint32_t vapic_control;DeviceState *vapic;hwaddr vapic_paddr;/* note: persistence via kvmvapic */ -bool legacy_instance_id;uint32_t extended_log_dest; };
hw/intc/apic_common.c +0 -5
@@ -294,9 +294,6 @@ static void apic_common_realize(DeviceState *dev, Error **errp) info->enable_tpr_reporting (s, true); } -if (s->legacy_instance_id) { - instance_id =VMSTATE_INSTANCE_ID_ANY ; - }vmstate_register_with_alias_id (NULL , instance_id, &vmstate_apic_common, s,-1 ,0 ,NULL );
@@ -412,8 +409,6 @@ static const Property apic_properties_common[] = {DEFINE_PROP_UINT8 ("version" , APICCommonState, version,0x14 ),DEFINE_PROP_BIT ("vapic" , APICCommonState, vapic_control,VAPIC_ENABLE_BIT , true), -DEFINE_PROP_BOOL ("legacy-instance-id" , APICCommonState, legacy_instance_id, - false), }; static void apic_common_get_id(Object *obj, Visitor *v, const char *name,
Signature · 1 line
2.47.1
Re: [PATCH v4 14/27] hw/intc/apic: Remove APICCommonState::legacy_instance_id field
Quoted 14 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:37 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 14/27] hw/intc/apic: Remove
APICCommonState::legacy_instance_idfield
X-Mailer: git-send-email 2.47.1The
APICCommonState::legacy_instance_idboolean was only set in the pc_compat_2_6[] array, via the 'legacy-instance-id=on' property. We removed all machines using that array, lets remove that property, simplifyingapic_common_realize().Because
instance_idis initialized asinitial_apic_id, we can not registervmstate_apic_commondirectly viadc->vmsd.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- include/hw/i386/apic_internal.h | 1 - hw/intc/apic_common.c | 5 ----- 2 files changed, 6 deletions(-)
Re: [PATCH v4 14/27] hw/intc/apic: Remove APICCommonState::legacy_instance_id field
In reply to Philippe Mathieu-DaudéQuoted 7 lines · On Thu, 8 May 2025 15:35:37 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
APICCommonState::legacy_instance_idboolean was only set in the pc_compat_2_6[] array, via the 'legacy-instance-id=on' property. We removed all machines using that array, lets remove that property, simplifyingapic_common_realize().Because
instance_idis initialized asinitial_apic_id, we can not registervmstate_apic_commondirectly viadc->vmsd.
I think just removing this property is pretty save, it's highly unlikely to be used by any external user as it's purpose was to keep migration working for 2.6. With the later gone there is not need for the property at all.
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>
Quoted 40 lines
--- include/hw/i386/apic_internal.h | 1 - hw/intc/apic_common.c | 5 ----- 2 files changed, 6 deletions(-)include/hw/i386/apic_internal.h +0
-1@@ -188,7 +188,6 @@ struct APICCommonState {uint32_t vapic_control;DeviceState *vapic;hwaddr vapic_paddr;/* note: persistence via kvmvapic */ -bool legacy_instance_id;uint32_t extended_log_dest; };hw/intc/apic_common.c +0
-5@@ -294,9 +294,6 @@ static void apic_common_realize(DeviceState *dev, Error **errp) info->enable_tpr_reporting (s, true); } -if (s->legacy_instance_id) { - instance_id =VMSTATE_INSTANCE_ID_ANY ; - }vmstate_register_with_alias_id (NULL , instance_id, &vmstate_apic_common, s,-1 ,0 ,NULL );@@ -412,8 +409,6 @@ static const Property apic_properties_common[] = {DEFINE_PROP_UINT8 ("version" , APICCommonState, version,0x14 ),DEFINE_PROP_BIT ("vapic" , APICCommonState, vapic_control,VAPIC_ENABLE_BIT , true), -DEFINE_PROP_BOOL ("legacy-instance-id" , APICCommonState, legacy_instance_id, - false), }; static void apic_common_get_id(Object *obj, Visitor *v, const char *name,
PATCH v4 15/27 hw/core/machine: Remove hw_compat_2_6[] array
In reply to Philippe Mathieu-DaudéThe hw_compat_2_6[] array was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it.
--- include/hw/boards.h | 3 --- hw/core/machine.c | 8 -------- 2 files changed, 11 deletions(-)
include/hw/boards.h +0 -3
@@ -841,7 +841,4 @@ extern const size_t hw_compat_2_8_len;extern GlobalProperty hw_compat_2_7[];extern const size_t hw_compat_2_7_len; -extern GlobalProperty hw_compat_2_6[]; -extern const size_t hw_compat_2_6_len; -#endif
hw/core/machine.c +0 -8
@@ -275,14 +275,6 @@ GlobalProperty hw_compat_2_7[] = { };const size_t hw_compat_2_7_len =G_N_ELEMENTS (hw_compat_2_7); -GlobalProperty hw_compat_2_6[] = { - {"virtio-mmio" ,"format_transport_address" ,"off" }, -/* Optional because not all virtio-pci devices support legacy mode */ - {"virtio-pci" ,"disable-modern" ,"on" , .optional = true }, - {"virtio-pci" ,"disable-legacy" ,"off" , .optional = true }, -}; -const size_t hw_compat_2_6_len =G_N_ELEMENTS (hw_compat_2_6); -MachineState *current_machine;static char *machine_get_kernel (Object *obj,Error **errp)
Signature · 1 line
2.47.1
Re: [PATCH v4 15/27] hw/core/machine: Remove hw_compat_2_6[] array
Quoted 8 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:38 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 15/27] hw/core/machine: Remove hw_compat_2_6[] array
X-Mailer: git-send-email 2.47.1The hw_compat_2_6[] array was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- include/hw/boards.h | 3 --- hw/core/machine.c | 8 -------- 2 files changed, 11 deletions(-)
Re: [PATCH v4 15/27] hw/core/machine: Remove hw_compat_2_6[] array
In reply to Philippe Mathieu-DaudéQuoted 2 lines · On Thu, 8 May 2025 15:35:38 +0200 Philippe Mathieu-Daudé <[email protected]>…
The hw_compat_2_6[] array was only used by the pc-q35-2.6 and pc-i440fx-2.6 machines, which got removed. Remove it.
see my comment in 1/27
Quoted 40 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- include/hw/boards.h | 3 --- hw/core/machine.c | 8 -------- 2 files changed, 11 deletions(-)include/hw/boards.h +0
-3@@ -841,7 +841,4 @@ extern const size_t hw_compat_2_8_len;extern GlobalProperty hw_compat_2_7[];extern const size_t hw_compat_2_7_len; -extern GlobalProperty hw_compat_2_6[]; -extern const size_t hw_compat_2_6_len; -#endif hw/core/machine.c +0
-8@@ -275,14 +275,6 @@ GlobalProperty hw_compat_2_7[] = { };const size_t hw_compat_2_7_len =G_N_ELEMENTS (hw_compat_2_7); -GlobalProperty hw_compat_2_6[] = { - {"virtio-mmio" ,"format_transport_address" ,"off" }, -/* Optional because not all virtio-pci devices support legacy mode */ - {"virtio-pci" ,"disable-modern" ,"on" , .optional = true }, - {"virtio-pci" ,"disable-legacy" ,"off" , .optional = true }, -}; -const size_t hw_compat_2_6_len =G_N_ELEMENTS (hw_compat_2_6); -MachineState *current_machine;static char *machine_get_kernel (Object *obj,Error **errp)
PATCH v4 16/27 hw/virtio/virtio-mmio: Remove VirtIOMMIOProxy::format_transport_address field
In reply to Philippe Mathieu-DaudéThe VirtIOMMIOProxy::format_transport_address boolean was only set in the hw_compat_2_6[] array, via the 'format_transport_address=off' property. We removed all machines using that array, lets remove that property, simplifying virtio_mmio_bus_get_dev_path().
--- include/hw/virtio/virtio-mmio.h | 1 - hw/virtio/virtio-mmio.c | 15 --------------- 2 files changed, 16 deletions(-)
include/hw/virtio/virtio-mmio.h +0 -1
@@ -66,7 +66,6 @@ struct VirtIOMMIOProxy {uint32_t guest_page_shift;/* virtio-bus */ VirtioBusState bus; -bool format_transport_address;/* Fields only used for non-legacy (v2) devices */ uint32_t guest_features[2 ];VirtIOMMIOQueue vqs[VIRTIO_QUEUE_MAX ];
hw/virtio/virtio-mmio.c +0 -15
@@ -752,8 +752,6 @@ static void virtio_mmio_pre_plugged(DeviceState *d, Error **errp)/* virtio-mmio device */ static const Property virtio_mmio_properties[] = { -DEFINE_PROP_BOOL ("format_transport_address" , VirtIOMMIOProxy, - format_transport_address, true),DEFINE_PROP_BOOL ("force-legacy" , VirtIOMMIOProxy, legacy, true),DEFINE_PROP_BIT ("ioeventfd" , VirtIOMMIOProxy, flags,VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT , true),
@@ -815,19 +813,6 @@ static char *virtio_mmio_bus_get_dev_path(DeviceState *dev) virtio_mmio_proxy =VIRTIO_MMIO (virtio_mmio_bus->parent); proxy_path =qdev_get_dev_path (DEVICE (virtio_mmio_proxy)); -/* -* If @format_transport_address is false, then we just perform the same as -* virtio_bus_get_dev_path(): we delegate the address formatting for the -* device on the virtio-mmio bus to the bus that the virtio-mmio proxy -* (i.e., the device that implements the virtio-mmio bus) resides on. In -* this case the base address of the virtio-mmio transport will be -* invisible. -*/ -if (!virtio_mmio_proxy->format_transport_address) { -return proxy_path; - } - -/* Otherwise, we append the base address of the transport. */ section =memory_region_find (&virtio_mmio_proxy->iomem,0 ,0x200 );assert (section.mr);
Signature · 1 line
2.47.1
Re: [PATCH v4 16/27] hw/virtio/virtio-mmio: Remove VirtIOMMIOProxy::format_transport_address field
Quoted 11 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:39 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 16/27] hw/virtio/virtio-mmio: Remove
VirtIOMMIOProxy::format_transport_addressfield
X-Mailer: git-send-email 2.47.1The
VirtIOMMIOProxy::format_transport_addressboolean was only set in the hw_compat_2_6[] array, via the 'format_transport_address=off' property. We removed all machines using that array, lets remove that property, simplifyingvirtio_mmio_bus_get_dev_path().
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- include/hw/virtio/virtio-mmio.h | 1 - hw/virtio/virtio-mmio.c | 15 --------------- 2 files changed, 16 deletions(-)
PATCH v4 17/27 hw/i386/pc: Remove deprecated pc-q35-2.7 and pc-i440fx-2.7 machines
In reply to Philippe Mathieu-DaudéThese machines has been supported for a period of more than 6 years. According to our versioned machine support policy (see commit ce80c4fa6ff "docs: document special exception for machine type deprecation & removal") they can now be removed. Remove the qtest in test-x86-cpuid-compat.c file.
--- hw/i386/pc_piix.c | 9 --------- hw/i386/pc_q35.c | 10 ---------- tests/qtest/test-x86-cpuid-compat.c | 11 ----------- 3 files changed, 30 deletions(-)
hw/i386/pc_piix.c +0 -9
@@ -755,15 +755,6 @@ static void pc_i440fx_machine_2_8_options(MachineClass *m)DEFINE_I440FX_MACHINE (2 ,8 ); -static void pc_i440fx_machine_2_7_options (MachineClass *m) -{ -pc_i440fx_machine_2_8_options (m); -compat_props_add (m->compat_props, hw_compat_2_7, hw_compat_2_7_len); -compat_props_add (m->compat_props, pc_compat_2_7, pc_compat_2_7_len); -} - -DEFINE_I440FX_MACHINE (2 ,7 ); -#ifdef CONFIG_ISAPC static void isapc_machine_options (MachineClass *m) {
hw/i386/pc_q35.c +0 -10
@@ -648,13 +648,3 @@ static void pc_q35_machine_2_8_options(MachineClass *m) }DEFINE_Q35_MACHINE (2 ,8 ); - -static void pc_q35_machine_2_7_options (MachineClass *m) -{ -pc_q35_machine_2_8_options (m); - m->max_cpus =255 ; -compat_props_add (m->compat_props, hw_compat_2_7, hw_compat_2_7_len); -compat_props_add (m->compat_props, pc_compat_2_7, pc_compat_2_7_len); -} - -DEFINE_Q35_MACHINE (2 ,7 );
tests/qtest/test-x86-cpuid-compat.c +0 -11
@@ -345,17 +345,6 @@ int main(int argc, char **argv)/* Check compatibility of old machine-types that didn't * auto-increase level/xlevel/xlevel2: */ -if (qtest_has_machine ("pc-i440fx-2.7" )) { -add_cpuid_test ("x86/cpuid/auto-level/pc-2.7" , -"486" ,"arat=on,avx512vbmi=on,xsaveopt=on" , -"pc-i440fx-2.7" ,"level" ,1 ); -add_cpuid_test ("x86/cpuid/auto-xlevel/pc-2.7" , -"486" ,"3dnow=on,sse4a=on,invtsc=on,npt=on,svm=on" , -"pc-i440fx-2.7" ,"xlevel" ,0 ); -add_cpuid_test ("x86/cpuid/auto-xlevel2/pc-2.7" , -"486" ,"xstore=on" ,"pc-i440fx-2.7" , -"xlevel2" ,0 ); - }if (qtest_has_machine ("pc-i440fx-2.9" )) { add_cpuid_test("x86/cpuid/auto-level7/pc-i440fx-2.9/off", "Conroe", NULL, "pc-i440fx-2.9",
Signature · 1 line
2.47.1
Re: [PATCH v4 17/27] hw/i386/pc: Remove deprecated pc-q35-2.7 and pc-i440fx-2.7 machines
Quoted 12 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:40 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 17/27] hw/i386/pc: Remove deprecated pc-q35-2.7 and
pc-i440fx-2.7 machines
X-Mailer: git-send-email 2.47.1These machines has been supported for a period of more than 6 years. According to our versioned machine support policy (see commit
ce80c4fa6ff"docs: document special exception for machine type deprecation & removal") they can now be removed. Remove the qtest intest-x86-cpuid-compat.cfile.
Quoted 8 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- hw/i386/pc_piix.c | 9 --------- hw/i386/pc_q35.c | 10 ---------- tests/qtest/test-x86-cpuid-compat.c | 11 ----------- 3 files changed, 30 deletions(-)
Re: [PATCH v4 17/27] hw/i386/pc: Remove deprecated pc-q35-2.7 and pc-i440fx-2.7 machines
In reply to Philippe Mathieu-DaudéQuoted 5 lines · On Thu, 8 May 2025 15:35:40 +0200 Philippe Mathieu-Daudé <[email protected]>…
These machines has been supported for a period of more than 6 years. According to our versioned machine support policy (see commit
ce80c4fa6ff"docs: document special exception for machine type deprecation & removal") they can now be removed. Remove the qtest intest-x86-cpuid-compat.cfile.
same comment as 1/27,
I'd squash pc|hw_compat_2_7 removal in here
other than that loos good to me, with above
Quoted 69 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- hw/i386/pc_piix.c | 9 --------- hw/i386/pc_q35.c | 10 ---------- tests/qtest/test-x86-cpuid-compat.c | 11 ----------- 3 files changed, 30 deletions(-)hw/i386/pc_piix.c +0
-9@@ -755,15 +755,6 @@ static void pc_i440fx_machine_2_8_options(MachineClass *m)DEFINE_I440FX_MACHINE (2 ,8 ); -static void pc_i440fx_machine_2_7_options (MachineClass *m) -{ -pc_i440fx_machine_2_8_options (m); -compat_props_add (m->compat_props, hw_compat_2_7, hw_compat_2_7_len); -compat_props_add (m->compat_props, pc_compat_2_7, pc_compat_2_7_len); -} - -DEFINE_I440FX_MACHINE (2 ,7 ); -#ifdef CONFIG_ISAPC static void isapc_machine_options (MachineClass *m) {hw/i386/pc_q35.c +0
-10@@ -648,13 +648,3 @@ static void pc_q35_machine_2_8_options(MachineClass *m) }DEFINE_Q35_MACHINE (2 ,8 ); - -static void pc_q35_machine_2_7_options (MachineClass *m) -{ -pc_q35_machine_2_8_options (m); - m->max_cpus =255 ; -compat_props_add (m->compat_props, hw_compat_2_7, hw_compat_2_7_len); -compat_props_add (m->compat_props, pc_compat_2_7, pc_compat_2_7_len); -} - -DEFINE_Q35_MACHINE (2 ,7 );tests/qtest/test-x86-cpuid-compat.c +0
-11@@ -345,17 +345,6 @@ int main(int argc, char **argv)/* Check compatibility of old machine-types that didn't * auto-increase level/xlevel/xlevel2: */ -if (qtest_has_machine ("pc-i440fx-2.7" )) { -add_cpuid_test ("x86/cpuid/auto-level/pc-2.7" , -"486" ,"arat=on,avx512vbmi=on,xsaveopt=on" , -"pc-i440fx-2.7" ,"level" ,1 ); -add_cpuid_test ("x86/cpuid/auto-xlevel/pc-2.7" , -"486" ,"3dnow=on,sse4a=on,invtsc=on,npt=on,svm=on" , -"pc-i440fx-2.7" ,"xlevel" ,0 ); -add_cpuid_test ("x86/cpuid/auto-xlevel2/pc-2.7" , -"486" ,"xstore=on" ,"pc-i440fx-2.7" , -"xlevel2" ,0 ); - }if (qtest_has_machine ("pc-i440fx-2.9" )) { add_cpuid_test("x86/cpuid/auto-level7/pc-i440fx-2.9/off", "Conroe", NULL, "pc-i440fx-2.9",
PATCH v4 18/27 hw/i386/pc: Remove pc_compat_2_7[] array
In reply to Philippe Mathieu-DaudéThe pc_compat_2_7[] array was only used by the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Remove it.
--- include/hw/i386/pc.h | 3 --- hw/i386/pc.c | 10 ---------- 2 files changed, 13 deletions(-)
include/hw/i386/pc.h +0 -3
@@ -289,9 +289,6 @@ extern const size_t pc_compat_2_9_len;extern GlobalProperty pc_compat_2_8[];extern const size_t pc_compat_2_8_len; -extern GlobalProperty pc_compat_2_7[]; -extern const size_t pc_compat_2_7_len; -#define DEFINE_PC_MACHINE (suffix, namestr, initfn, optsfn) \ static void pc_machine_##suffix##_class_init(ObjectClass *oc, \ const void *data) \
hw/i386/pc.c +0 -10
@@ -241,16 +241,6 @@ GlobalProperty pc_compat_2_8[] = { };const size_t pc_compat_2_8_len =G_N_ELEMENTS (pc_compat_2_8); -GlobalProperty pc_compat_2_7[] = { - {TYPE_X86_CPU ,"l3-cache" ,"off" }, - {TYPE_X86_CPU ,"full-cpuid-auto-level" ,"off" }, - {"Opteron_G3" "-" TYPE_X86_CPU ,"family" ,"15" }, - {"Opteron_G3" "-" TYPE_X86_CPU ,"model" ,"6" }, - {"Opteron_G3" "-" TYPE_X86_CPU ,"stepping" ,"1" }, - {"isa-pcspk" ,"migrate" ,"off" }, -}; -const size_t pc_compat_2_7_len =G_N_ELEMENTS (pc_compat_2_7); -/* * @PC_FW_DATA: * Size of the chunk of memory at the top of RAM for the BIOS ACPI tables
Signature · 1 line
2.47.1
Re: [PATCH v4 18/27] hw/i386/pc: Remove pc_compat_2_7[] array
Quoted 8 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:41 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 18/27] hw/i386/pc: Remove pc_compat_2_7[] array
X-Mailer: git-send-email 2.47.1The pc_compat_2_7[] array was only used by the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Remove it.
Quoted 6 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>--- include/hw/i386/pc.h | 3 --- hw/i386/pc.c | 10 ---------- 2 files changed, 13 deletions(-)
PATCH v4 19/27 target/i386/cpu: Remove CPUX86State::full_cpuid_auto_level field
In reply to Philippe Mathieu-DaudéThe CPUX86State::full_cpuid_auto_level boolean was only disabled for the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Being now always %true, we can remove it and simplify x86_cpu_expand_features().
--- target/i386/cpu.h | 3 -- target/i386/cpu.c | 106 ++++++++++++++++++++++------------------------ 2 files changed, 51 insertions(+), 58 deletions(-)
target/i386/cpu.h +0 -3
@@ -2241,9 +2241,6 @@ struct ArchCPU {*/ bool legacy_multi_node; -/* Enable auto level-increase for all CPUID leaves */ -bool full_cpuid_auto_level; -/* Only advertise CPUID leaves defined by the vendor */ bool vendor_cpuid_only;
target/i386/cpu.c +51 -55
126 lines not on this page · raw message
Signature · 1 line
2.47.1
Re: [PATCH v4 19/27] target/i386/cpu: Remove CPUX86State::full_cpuid_auto_level field
Quoted 11 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:42 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 19/27] target/i386/cpu: Remove
CPUX86State::full_cpuid_auto_levelfield
X-Mailer: git-send-email 2.47.1The
CPUX86State::full_cpuid_auto_levelboolean was only disabled for the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Being now always %true, we can remove it and simplifyx86_cpu_expand_features().
Quoted 5 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 3 -- target/i386/cpu.c | 106 ++++++++++++++++++++++------------------------ 2 files changed, 51 insertions(+), 58 deletions(-)
This property is a fix, so,
Re: [PATCH v4 19/27] target/i386/cpu: Remove CPUX86State::full_cpuid_auto_level field
In reply to Philippe Mathieu-DaudéQuoted 4 lines · On Thu, 8 May 2025 15:35:42 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
CPUX86State::full_cpuid_auto_levelboolean was only disabled for the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Being now always %true, we can remove it and simplifyx86_cpu_expand_features().
I've found field being mentioned only by some external rust library, that's likely shouldn't concern QEMU qemu though.
I'm not confident enough to ack it but I won't object either
Quoted 152 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 3 -- target/i386/cpu.c | 106 ++++++++++++++++++++++------------------------ 2 files changed, 51 insertions(+), 58 deletions(-)target/i386/cpu.h +0
-3@@ -2241,9 +2241,6 @@ struct ArchCPU {*/ bool legacy_multi_node; -/* Enable auto level-increase for all CPUID leaves */ -bool full_cpuid_auto_level; -/* Only advertise CPUID leaves defined by the vendor */ bool vendor_cpuid_only;target/i386/cpu.c +51
-55@@ -7843,68 +7843,65 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)/* CPUID[EAX=7,ECX=0].EBX always increased level automatically: */ x86_cpu_adjust_feat_level (cpu,FEAT_7_0_EBX ); -if (cpu->full_cpuid_auto_level) { -x86_cpu_adjust_feat_level (cpu,FEAT_1_EDX ); -x86_cpu_adjust_feat_level (cpu,FEAT_1_ECX ); -x86_cpu_adjust_feat_level (cpu,FEAT_6_EAX ); -x86_cpu_adjust_feat_level (cpu,FEAT_7_0_ECX ); -x86_cpu_adjust_feat_level (cpu,FEAT_7_1_EAX ); -x86_cpu_adjust_feat_level (cpu,FEAT_7_1_EDX ); -x86_cpu_adjust_feat_level (cpu,FEAT_7_2_EDX ); -x86_cpu_adjust_feat_level (cpu,FEAT_8000_0001_EDX ); -x86_cpu_adjust_feat_level (cpu,FEAT_8000_0001_ECX ); -x86_cpu_adjust_feat_level (cpu,FEAT_8000_0007_EDX ); -x86_cpu_adjust_feat_level (cpu,FEAT_8000_0008_EBX ); -x86_cpu_adjust_feat_level (cpu,FEAT_C000_0001_EDX ); -x86_cpu_adjust_feat_level (cpu,FEAT_SVM ); -x86_cpu_adjust_feat_level (cpu,FEAT_XSAVE ); +x86_cpu_adjust_feat_level (cpu,FEAT_1_EDX ); +x86_cpu_adjust_feat_level (cpu,FEAT_1_ECX ); +x86_cpu_adjust_feat_level (cpu,FEAT_6_EAX ); +x86_cpu_adjust_feat_level (cpu,FEAT_7_0_ECX ); +x86_cpu_adjust_feat_level (cpu,FEAT_7_1_EAX ); +x86_cpu_adjust_feat_level (cpu,FEAT_7_1_EDX ); +x86_cpu_adjust_feat_level (cpu,FEAT_7_2_EDX ); +x86_cpu_adjust_feat_level (cpu,FEAT_8000_0001_EDX ); +x86_cpu_adjust_feat_level (cpu,FEAT_8000_0001_ECX ); +x86_cpu_adjust_feat_level (cpu,FEAT_8000_0007_EDX ); +x86_cpu_adjust_feat_level (cpu,FEAT_8000_0008_EBX ); +x86_cpu_adjust_feat_level (cpu,FEAT_C000_0001_EDX ); +x86_cpu_adjust_feat_level (cpu,FEAT_SVM ); +x86_cpu_adjust_feat_level (cpu,FEAT_XSAVE ); -/* Intel Processor Trace requires CPUID[0x14] */ -if ((env->features[FEAT_7_0_EBX ] &CPUID_7_0_EBX_INTEL_PT )) { -if (cpu->intel_pt_auto_level) { -x86_cpu_adjust_level (cpu, &cpu->env.cpuid_min_level,0x14 ); - }else if (cpu->env.cpuid_min_level <0x14 ) { -mark_unavailable_features (cpu,FEAT_7_0_EBX , -CPUID_7_0_EBX_INTEL_PT , -"Intel PT need CPUID leaf 0x14, please set by \"-cpu ...,intel-pt=on,min-level=0x14\"" ); - } +/* Intel Processor Trace requires CPUID[0x14] */ +if ((env->features[FEAT_7_0_EBX ] &CPUID_7_0_EBX_INTEL_PT )) { +if (cpu->intel_pt_auto_level) { +x86_cpu_adjust_level (cpu, &cpu->env.cpuid_min_level,0x14 ); + }else if (cpu->env.cpuid_min_level <0x14 ) { +mark_unavailable_features (cpu,FEAT_7_0_EBX ,CPUID_7_0_EBX_INTEL_PT , +"Intel PT need CPUID leaf 0x14, please set by \"-cpu ...,intel-pt=on,min-level=0x14\"" ); } + } -/* -* Intel CPU topology with multi-dies support requires CPUID[0x1F]. -* For AMD Rome/Milan, cpuid level is 0x10, and guest OS should detect -* extended toplogy by leaf 0xB. Only adjust it for Intel CPU, unless -* cpu->vendor_cpuid_only has been unset for compatibility with older -* machine types. -*/ -if (x86_has_extended_topo (env->avail_cpu_topo) && - (IS_INTEL_CPU (env) || !cpu->vendor_cpuid_only)) { -x86_cpu_adjust_level (cpu, &env->cpuid_min_level,0x1F ); - } +/* +* Intel CPU topology with multi-dies support requires CPUID[0x1F]. +* For AMD Rome/Milan, cpuid level is 0x10, and guest OS should detect +* extended toplogy by leaf 0xB. Only adjust it for Intel CPU, unless +* cpu->vendor_cpuid_only has been unset for compatibility with older +* machine types. +*/ +if (x86_has_extended_topo (env->avail_cpu_topo) && + (IS_INTEL_CPU (env) || !cpu->vendor_cpuid_only)) { +x86_cpu_adjust_level (cpu, &env->cpuid_min_level,0x1F ); + } -/* Advanced Vector Extensions 10 (AVX10) requires CPUID[0x24] */ -if (env->features[FEAT_7_1_EDX ] &CPUID_7_1_EDX_AVX10 ) { -x86_cpu_adjust_level (cpu, &env->cpuid_min_level,0x24 ); - } +/* Advanced Vector Extensions 10 (AVX10) requires CPUID[0x24] */ +if (env->features[FEAT_7_1_EDX ] &CPUID_7_1_EDX_AVX10 ) { +x86_cpu_adjust_level (cpu, &env->cpuid_min_level,0x24 ); + } -/* SVM requires CPUID[0x8000000A] */ -if (env->features[FEAT_8000_0001_ECX ] &CPUID_EXT3_SVM ) { -x86_cpu_adjust_level (cpu, &env->cpuid_min_xlevel,0x8000000A ); - } +/* SVM requires CPUID[0x8000000A] */ +if (env->features[FEAT_8000_0001_ECX ] &CPUID_EXT3_SVM ) { +x86_cpu_adjust_level (cpu, &env->cpuid_min_xlevel,0x8000000A ); + } -/* SEV requires CPUID[0x8000001F] */ -if (sev_enabled ()) { -x86_cpu_adjust_level (cpu, &env->cpuid_min_xlevel,0x8000001F ); - } +/* SEV requires CPUID[0x8000001F] */ +if (sev_enabled ()) { +x86_cpu_adjust_level (cpu, &env->cpuid_min_xlevel,0x8000001F ); + } -if (env->features[FEAT_8000_0021_EAX ]) { -x86_cpu_adjust_level (cpu, &env->cpuid_min_xlevel,0x80000021 ); - } +if (env->features[FEAT_8000_0021_EAX ]) { +x86_cpu_adjust_level (cpu, &env->cpuid_min_xlevel,0x80000021 ); + } -/* SGX requires CPUID[0x12] for EPC enumeration */ -if (env->features[FEAT_7_0_EBX ] &CPUID_7_0_EBX_SGX ) { -x86_cpu_adjust_level (cpu, &env->cpuid_min_level,0x12 ); - } +/* SGX requires CPUID[0x12] for EPC enumeration */ +if (env->features[FEAT_7_0_EBX ] &CPUID_7_0_EBX_SGX ) { +x86_cpu_adjust_level (cpu, &env->cpuid_min_level,0x12 ); }/* Set cpuid_*level* based on cpuid_min_*level, if not explicitly set */ @@ -8820,7 +8817,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_UINT32 ("min-xlevel2" ,X86CPU , env.cpuid_min_xlevel2,0 ),DEFINE_PROP_UINT8 ("avx10-version" ,X86CPU , env.avx10_version,0 ),DEFINE_PROP_UINT64 ("ucode-rev" ,X86CPU , ucode_rev,0 ), -DEFINE_PROP_BOOL ("full-cpuid-auto-level" ,X86CPU , full_cpuid_auto_level, true),DEFINE_PROP_STRING ("hv-vendor-id" ,X86CPU , hyperv_vendor),DEFINE_PROP_BOOL ("x-vendor-cpuid-only" ,X86CPU , vendor_cpuid_only, true), DEFINE_PROP_BOOL("x-amd-topoext-features-only", X86CPU, amd_topoext_features_only, true),
PATCH v4 20/27 target/i386/cpu: Remove CPUX86State::enable_l3_cache field
In reply to Philippe Mathieu-DaudéThe CPUX86State::enable_l3_cache boolean was only disabled for the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Being now always %true, we can remove it and simplify cpu_x86_cpuid() and encode_cache_cpuid80000006().
--- target/i386/cpu.h | 6 ------ target/i386/cpu.c | 39 +++++++++++++-------------------------- 2 files changed, 13 insertions(+), 32 deletions(-)
target/i386/cpu.h +0 -6
@@ -2219,12 +2219,6 @@ struct ArchCPU {*/ bool enable_lmce; -/* Compatibility bits for old machine types. -* If true present virtual l3 cache for VM, the vcpus in the same virtual -* socket share an virtual l3 cache. -*/ -bool enable_l3_cache; -/* Compatibility bits for old machine types. * If true present L1 cache as per-thread, not per-core. */
target/i386/cpu.c +13 -26
@@ -468,17 +468,13 @@ static void encode_cache_cpuid80000006(CPUCacheInfo *l2, (AMD_ENC_ASSOC (l2->associativity) <<12 ) | (l2->lines_per_tag <<8 ) | (l2->line_size); -if (l3) { -assert (l3->size % (512 *1024 ) ==0 ); -assert (l3->associativity >0 ); -assert (l3->lines_per_tag >0 ); -assert (l3->line_size >0 ); - *edx = ((l3->size / (512 *1024 )) <<18 ) | - (AMD_ENC_ASSOC (l3->associativity) <<12 ) | - (l3->lines_per_tag <<8 ) | (l3->line_size); - }else { - *edx =0 ; - } +assert (l3->size % (512 *1024 ) ==0 ); +assert (l3->associativity >0 ); +assert (l3->lines_per_tag >0 ); +assert (l3->line_size >0 ); + *edx = ((l3->size / (512 *1024 )) <<18 ) | + (AMD_ENC_ASSOC (l3->associativity) <<12 ) | + (l3->lines_per_tag <<8 ) | (l3->line_size); }/* Encode cache info for CPUID[8000001D] */
@@ -6849,11 +6845,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, } *eax =1 ;/* Number of CPUID[EAX=2] calls required */ *ebx =0 ; -if (!cpu->enable_l3_cache) { - *ecx =0 ; - }else { - *ecx =cpuid2_cache_descriptor (env->cache_info_cpuid2.l3_cache); - } + *ecx =cpuid2_cache_descriptor (env->cache_info_cpuid2.l3_cache); *edx = (cpuid2_cache_descriptor (env->cache_info_cpuid2.l1d_cache) <<16 ) | (cpuid2_cache_descriptor (env->cache_info_cpuid2.l1i_cache) <<8 ) | (cpuid2_cache_descriptor (env->cache_info_cpuid2.l2_cache));
@@ -6907,13 +6899,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, eax, ebx, ecx, edx);break ;case 3 :/* L3 cache info */ -if (cpu->enable_l3_cache) { -encode_cache_cpuid4 (env->cache_info_cpuid4.l3_cache, - topo_info, - eax, ebx, ecx, edx); -break ; - } -/* fall through */ +encode_cache_cpuid4 (env->cache_info_cpuid4.l3_cache, + topo_info, + eax, ebx, ecx, edx); +break ;default :/* end of info */ *eax = *ebx = *ecx = *edx =0 ;break ;
@@ -7284,8 +7273,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, (AMD_ENC_ASSOC (L2_ITLB_4K_ASSOC ) <<12 ) | (L2_ITLB_4K_ENTRIES );encode_cache_cpuid80000006 (env->cache_info_amd.l2_cache, - cpu->enable_l3_cache ? - env->cache_info_amd.l3_cache :NULL , + env->cache_info_amd.l3_cache, ecx, edx);break ;case 0x80000007 :
@@ -8821,7 +8809,6 @@ static const Property x86_cpu_properties[] = {DEFINE_PROP_BOOL ("x-vendor-cpuid-only" ,X86CPU , vendor_cpuid_only, true),DEFINE_PROP_BOOL ("x-amd-topoext-features-only" ,X86CPU , amd_topoext_features_only, true),DEFINE_PROP_BOOL ("lmce" ,X86CPU , enable_lmce, false), -DEFINE_PROP_BOOL ("l3-cache" ,X86CPU , enable_l3_cache, true),DEFINE_PROP_BOOL ("kvm-pv-enforce-cpuid" ,X86CPU , kvm_pv_enforce_cpuid, false), DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU, vmware_cpuid_freq, true),
Signature · 1 line
2.47.1
Re: [PATCH v4 20/27] target/i386/cpu: Remove CPUX86State::enable_l3_cache field
Quoted 24 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:43 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 20/27] target/i386/cpu: Remove
CPUX86State::enable_l3_cachefield
X-Mailer: git-send-email 2.47.1The
CPUX86State::enable_l3_cacheboolean was only disabled for the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Being now always %true, we can remove it and simplifycpu_x86_cpuid()andencode_cache_cpuid80000006().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 6 ------ target/i386/cpu.c | 39 +++++++++++++-------------------------- 2 files changed, 13 insertions(+), 32 deletions(-)target/i386/cpu.h +0
-0@@ -2219,12 +2219,6 @@ struct ArchCPU {*/ bool enable_lmce;
target/i386/cpu.h struct ArchCPU { · line 2224
Quoted 10 lines
target/i386/cpu.h +0
-6-/* Compatibility bits for old machine types. -* If true present virtual l3 cache for VM, the vcpus in the same virtual -* socket share an virtual l3 cache. -*/ -bool enable_l3_cache; -/* Compatibility bits for old machine types. * If true present L1 cache as per-thread, not per-core. */
I realize this is another special case.
There is no support for hybrid x86 CPUs in QEMU, but it's also true that there are some actual modern x86 Client CPUs without l3 cache, such as Intel MTL's low power E core (and it has vmx support, i.e., support KVM).
So I think we can keep this property as well, to have some more configuration options for users' emulation.
Re: [PATCH v4 20/27] target/i386/cpu: Remove CPUX86State::enable_l3_cache field
Quoted 38 lines · On Fri, 9 May 2025 17:11:13 +0800 Zhao Liu <[email protected]> wrote:
Quoted 24 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:43 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 20/27] target/i386/cpu: Remove
CPUX86State::enable_l3_cachefield
X-Mailer: git-send-email 2.47.1The
CPUX86State::enable_l3_cacheboolean was only disabled for the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Being now always %true, we can remove it and simplifycpu_x86_cpuid()andencode_cache_cpuid80000006().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 6 ------ target/i386/cpu.c | 39 +++++++++++++-------------------------- 2 files changed, 13 insertions(+), 32 deletions(-)target/i386/cpu.h +0
-0@@ -2219,12 +2219,6 @@ struct ArchCPU {*/ bool enable_lmce;target/i386/cpu.h struct ArchCPU { · line 2224
Quoted 10 lines
target/i386/cpu.h +0
-6-/* Compatibility bits for old machine types. -* If true present virtual l3 cache for VM, the vcpus in the same virtual -* socket share an virtual l3 cache. -*/ -bool enable_l3_cache; -/* Compatibility bits for old machine types. * If true present L1 cache as per-thread, not per-core. */ I realize this is another special case.
Quoted 6 lines
There is no support for hybrid x86 CPUs in QEMU, but it's also true that there are some actual modern x86 Client CPUs without l3 cache, such as Intel MTL's low power E core (and it has vmx support, i.e., support KVM).
So I think we can keep this property as well, to have some more configuration options for users' emulation.
it also seems that libvirt uses it.
PATCH v4 21/27 hw/audio/pcspk: Remove PCSpkState::migrate field
In reply to Philippe Mathieu-DaudéThe PCSpkState::migrate boolean was only set in the pc_compat_2_7[] array, via the 'migrate=off' property. We removed all machines using that array, lets remove that property, simplifying vmstate_spk[].
--- hw/audio/pcspk.c | 10 ---------- 1 file changed, 10 deletions(-)
hw/audio/pcspk.c +0 -10
@@ -56,7 +56,6 @@ struct PCSpkState {unsigned int play_pos;uint8_t data_on;uint8_t dummy_refresh_clock; -bool migrate; };static const char *s_spk ="pcspk" ;
@@ -196,18 +195,10 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp) pcspk_state = s; } -static bool migrate_needed (void *opaque) -{ -PCSpkState *s = opaque; - -return s->migrate; -} -static const VMStateDescription vmstate_spk = { .name ="pcspk" , .version_id =1 , .minimum_version_id =1 , - .needed = migrate_needed, .fields = (const VMStateField []) {VMSTATE_UINT8 (data_on, PCSpkState),VMSTATE_UINT8 (dummy_refresh_clock, PCSpkState),
@@ -218,7 +209,6 @@ static const VMStateDescription vmstate_spk = {static const Property pcspk_properties[] = {DEFINE_AUDIO_PROPERTIES (PCSpkState, card),DEFINE_PROP_UINT32 ("iobase" , PCSpkState, iobase,0x61 ), -DEFINE_PROP_BOOL ("migrate" , PCSpkState, migrate, true), };static void pcspk_class_initfn (ObjectClass *klass,const void *data)
Signature · 1 line
2.47.1
Re: [PATCH v4 21/27] hw/audio/pcspk: Remove PCSpkState::migrate field
Quoted 10 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:44 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 21/27] hw/audio/pcspk: RemovePCSpkState::migratefield
X-Mailer: git-send-email 2.47.1The
PCSpkState::migrateboolean was only set in the pc_compat_2_7[] array, via the 'migrate=off' property. We removed all machines using that array, lets remove that property, simplifying vmstate_spk[].
Quoted 6 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- hw/audio/pcspk.c | 10 ---------- 1 file changed, 10 deletions(-)
Re: [PATCH v4 21/27] hw/audio/pcspk: Remove PCSpkState::migrate field
In reply to Philippe Mathieu-DaudéQuoted 4 lines · On Thu, 8 May 2025 15:35:44 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
PCSpkState::migrateboolean was only set in the pc_compat_2_7[] array, via the 'migrate=off' property. We removed all machines using that array, lets remove that property, simplifying vmstate_spk[].
same as 14/27, it should be safe to remove without deprecation
Quoted 47 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- hw/audio/pcspk.c | 10 ---------- 1 file changed, 10 deletions(-)hw/audio/pcspk.c +0
-10@@ -56,7 +56,6 @@ struct PCSpkState {unsigned int play_pos;uint8_t data_on;uint8_t dummy_refresh_clock; -bool migrate; };static const char *s_spk ="pcspk" ;@@ -196,18 +195,10 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp) pcspk_state = s; } -static bool migrate_needed (void *opaque) -{ -PCSpkState *s = opaque; - -return s->migrate; -} -static const VMStateDescription vmstate_spk = { .name ="pcspk" , .version_id =1 , .minimum_version_id =1 , - .needed = migrate_needed, .fields = (const VMStateField []) {VMSTATE_UINT8 (data_on, PCSpkState),VMSTATE_UINT8 (dummy_refresh_clock, PCSpkState),@@ -218,7 +209,6 @@ static const VMStateDescription vmstate_spk = {static const Property pcspk_properties[] = {DEFINE_AUDIO_PROPERTIES (PCSpkState, card),DEFINE_PROP_UINT32 ("iobase" , PCSpkState, iobase,0x61 ), -DEFINE_PROP_BOOL ("migrate" , PCSpkState, migrate, true), };static void pcspk_class_initfn (ObjectClass *klass,const void *data)
PATCH v4 22/27 hw/core/machine: Remove hw_compat_2_7[] array
In reply to Philippe Mathieu-DaudéThe hw_compat_2_7[] array was only used by the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Remove it.
--- include/hw/boards.h | 3 --- hw/core/machine.c | 9 --------- 2 files changed, 12 deletions(-)
include/hw/boards.h +0 -3
@@ -838,7 +838,4 @@ extern const size_t hw_compat_2_9_len;extern GlobalProperty hw_compat_2_8[];extern const size_t hw_compat_2_8_len; -extern GlobalProperty hw_compat_2_7[]; -extern const size_t hw_compat_2_7_len; -#endif
hw/core/machine.c +0 -9
@@ -266,15 +266,6 @@ GlobalProperty hw_compat_2_8[] = { };const size_t hw_compat_2_8_len =G_N_ELEMENTS (hw_compat_2_8); -GlobalProperty hw_compat_2_7[] = { - {"virtio-pci" ,"page-per-vq" ,"on" }, - {"virtio-serial-device" ,"emergency-write" ,"off" }, - {"ioapic" ,"version" ,"0x11" }, - {"intel-iommu" ,"x-buggy-eim" ,"true" }, - {"virtio-pci" ,"x-ignore-backend-features" ,"on" }, -}; -const size_t hw_compat_2_7_len =G_N_ELEMENTS (hw_compat_2_7); -MachineState *current_machine;static char *machine_get_kernel (Object *obj,Error **errp)
Signature · 1 line
2.47.1
Re: [PATCH v4 22/27] hw/core/machine: Remove hw_compat_2_7[] array
Quoted 8 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:45 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 22/27] hw/core/machine: Remove hw_compat_2_7[] array
X-Mailer: git-send-email 2.47.1The hw_compat_2_7[] array was only used by the pc-q35-2.7 and pc-i440fx-2.7 machines, which got removed. Remove it.
Quoted 6 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>--- include/hw/boards.h | 3 --- hw/core/machine.c | 9 --------- 2 files changed, 12 deletions(-)
PATCH v4 23/27 hw/i386/intel_iommu: Remove IntelIOMMUState::buggy_eim field
In reply to Philippe Mathieu-DaudéThe IntelIOMMUState::buggy_eim boolean was only set in the hw_compat_2_7[] array, via the 'x-buggy-eim=true' property. We removed all machines using that array, lets remove that property, simplifying vtd_decide_config().
--- include/hw/i386/intel_iommu.h | 1 - hw/i386/intel_iommu.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-)
include/hw/i386/intel_iommu.h +0 -1
@@ -303,7 +303,6 @@ struct IntelIOMMUState {uint32_t intr_size;/* Number of IR table entries */ bool intr_eime;/* Extended interrupt mode enabled */ OnOffAuto intr_eim;/* Toggle for EIM cabability */ -bool buggy_eim;/* Force buggy EIM unless eim=off */ uint8_t aw_bits;/* Host/IOVA address width (in bits) */ bool dma_drain;/* Whether DMA r/w draining enabled */ bool dma_translation;/* Whether DMA translation supported */
hw/i386/intel_iommu.c +2 -3
@@ -3823,7 +3823,6 @@ static const Property vtd_properties[] = {DEFINE_PROP_UINT32 ("version" , IntelIOMMUState, version,0 ),DEFINE_PROP_ON_OFF_AUTO ("eim" , IntelIOMMUState, intr_eim,ON_OFF_AUTO_AUTO ), -DEFINE_PROP_BOOL ("x-buggy-eim" , IntelIOMMUState, buggy_eim, false),DEFINE_PROP_UINT8 ("aw-bits" , IntelIOMMUState, aw_bits,VTD_HOST_ADDRESS_WIDTH ), DEFINE_PROP_BOOL("caching-mode", IntelIOMMUState, caching_mode, FALSE),
@@ -4731,11 +4730,11 @@ static bool vtd_decide_config(IntelIOMMUState *s, Error **errp) }if (s->intr_eim ==ON_OFF_AUTO_AUTO ) { - s->intr_eim = (kvm_irqchip_in_kernel () || s->buggy_eim) + s->intr_eim =kvm_irqchip_in_kernel () &&x86_iommu_ir_supported (x86_iommu) ?ON_OFF_AUTO_ON :ON_OFF_AUTO_OFF ; } -if (s->intr_eim ==ON_OFF_AUTO_ON && !s->buggy_eim) { +if (s->intr_eim ==ON_OFF_AUTO_ON ) {if (kvm_irqchip_is_split () && !kvm_enable_x2apic ()) {error_setg (errp,"eim=on requires support on the KVM side" "(X2APIC_API, first shipped in v4.7)" );
Signature · 1 line
2.47.1
Re: [PATCH v4 23/27] hw/i386/intel_iommu: Remove IntelIOMMUState::buggy_eim field
Quoted 11 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:46 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 23/27] hw/i386/intel_iommu: Remove
IntelIOMMUState::buggy_eimfield
X-Mailer: git-send-email 2.47.1The
IntelIOMMUState::buggy_eimboolean was only set in the hw_compat_2_7[] array, via the 'x-buggy-eim=true' property. We removed all machines using that array, lets remove that property, simplifyingvtd_decide_config().
Quoted 6 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>--- include/hw/i386/intel_iommu.h | 1 - hw/i386/intel_iommu.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-)
This property has a good name :-)
Re: [PATCH v4 23/27] hw/i386/intel_iommu: Remove IntelIOMMUState::buggy_eim field
In reply to Philippe Mathieu-DaudéQuoted 7 lines · On Thu, 8 May 2025 15:35:46 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
IntelIOMMUState::buggy_eimboolean was only set in the hw_compat_2_7[] array, via the 'x-buggy-eim=true' property. We removed all machines using that array, lets remove that property, simplifyingvtd_decide_config().Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>
Quoted 43 lines
--- include/hw/i386/intel_iommu.h | 1 - hw/i386/intel_iommu.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-)include/hw/i386/intel_iommu.h +0
-1@@ -303,7 +303,6 @@ struct IntelIOMMUState {uint32_t intr_size;/* Number of IR table entries */ bool intr_eime;/* Extended interrupt mode enabled */ OnOffAuto intr_eim;/* Toggle for EIM cabability */ -bool buggy_eim;/* Force buggy EIM unless eim=off */ uint8_t aw_bits;/* Host/IOVA address width (in bits) */ bool dma_drain;/* Whether DMA r/w draining enabled */ bool dma_translation;/* Whether DMA translation supported */ hw/i386/intel_iommu.c +2
-3@@ -3823,7 +3823,6 @@ static const Property vtd_properties[] = {DEFINE_PROP_UINT32 ("version" , IntelIOMMUState, version,0 ),DEFINE_PROP_ON_OFF_AUTO ("eim" , IntelIOMMUState, intr_eim,ON_OFF_AUTO_AUTO ), -DEFINE_PROP_BOOL ("x-buggy-eim" , IntelIOMMUState, buggy_eim, false),DEFINE_PROP_UINT8 ("aw-bits" , IntelIOMMUState, aw_bits,VTD_HOST_ADDRESS_WIDTH ), DEFINE_PROP_BOOL("caching-mode", IntelIOMMUState, caching_mode, FALSE),@@ -4731,11 +4730,11 @@ static bool vtd_decide_config(IntelIOMMUState *s, Error **errp) }if (s->intr_eim ==ON_OFF_AUTO_AUTO ) { - s->intr_eim = (kvm_irqchip_in_kernel () || s->buggy_eim) + s->intr_eim =kvm_irqchip_in_kernel () &&x86_iommu_ir_supported (x86_iommu) ?ON_OFF_AUTO_ON :ON_OFF_AUTO_OFF ; } -if (s->intr_eim ==ON_OFF_AUTO_ON && !s->buggy_eim) { +if (s->intr_eim ==ON_OFF_AUTO_ON ) {if (kvm_irqchip_is_split () && !kvm_enable_x2apic ()) {error_setg (errp,"eim=on requires support on the KVM side" "(X2APIC_API, first shipped in v4.7)" );
PATCH v4 24/27 hw/intc/ioapic: Remove IOAPICCommonState::version field
In reply to Philippe Mathieu-DaudéThe IOAPICCommonState::version integer was only set in the hw_compat_2_7[] array, via the 'version=0x11' property. We removed all machines using that array, lets remove that property, simplify by only using the default version (defined as IOAPIC_VER_DEF).
For the record, this field was introduced in commit 20fd4b7b6d9 ("x86: ioapic: add support for explicit EOI"):
Quoted 14 lines
Some old Linux kernels (upstream before v4.0), or any released RHEL kernels has problem in sending APIC EOI when IR is enabled. Meanwhile, many of them only support explicit EOI for IOAPIC, which is only introduced in IOAPIC version
0x20. This patch provide a way to boost QEMU IOAPIC to version0x20, in order for QEMU to correctly receive EOI messages.Without boosting IOAPIC version to
0x20, kernels before commit d32932d ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces") will have trouble enabling both IR and level-triggered interrupt devices (like e1000).To upgrade IOAPIC to version
0x20, we need to specify:
Quoted 8 lines
-global ioapic.version=0x20To be compatible with old systems,
0x11will still be the default IOAPIC version. Here0x11and0x20are the only versions to be supported.One thing to mention: this patch only applies to emulated IOAPIC. It does not affect kernel IOAPIC behavior.
--- hw/intc/ioapic_internal.h | 3 +-- hw/intc/ioapic.c | 18 ++---------------- hw/intc/ioapic_common.c | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-)
hw/intc/ioapic_internal.h +1 -2
@@ -82,7 +82,7 @@#define IOAPIC_ID_MASK 0xf#define IOAPIC_VER_ENTRIES_SHIFT 16 - +#define IOAPIC_VER_DEF 0x20#define TYPE_IOAPIC_COMMON "ioapic-common"OBJECT_DECLARE_TYPE (IOAPICCommonState, IOAPICCommonClass,IOAPIC_COMMON )
@@ -104,7 +104,6 @@ struct IOAPICCommonState {uint32_t irr;uint64_t ioredtbl[IOAPIC_NUM_PINS ];Notifier machine_done; -uint8_t version;uint64_t irq_count[IOAPIC_NUM_PINS ];int irq_level[IOAPIC_NUM_PINS ];int irq_eoi[IOAPIC_NUM_PINS ];
hw/intc/ioapic.c +2 -16
@@ -315,7 +315,7 @@ ioapic_mem_read(void *opaque, hwaddr addr, unsigned int size) val = s->id <<IOAPIC_ID_SHIFT ;break ;case IOAPIC_REG_VER : - val = s->version | + val =IOAPIC_VER_DEF | ((IOAPIC_NUM_PINS -1 ) <<IOAPIC_VER_ENTRIES_SHIFT );break ;default :
@@ -411,8 +411,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val, }break ;case IOAPIC_EOI : -/* Explicit EOI is only supported for IOAPIC version 0x20 */ -if (size !=4 || s->version !=0x20 ) { +if (size !=4 ) {break ; }ioapic_eoi_broadcast (val);
@@ -444,18 +443,10 @@ static void ioapic_machine_done_notify(Notifier *notifier, void *data)#endif } -#define IOAPIC_VER_DEF 0x20 -static void ioapic_realize (DeviceState *dev,Error **errp) {IOAPICCommonState *s =IOAPIC_COMMON (dev); -if (s->version !=0x11 && s->version !=0x20 ) { -error_setg (errp,"IOAPIC only supports version 0x11 or 0x20 " -"(default: 0x%x)." ,IOAPIC_VER_DEF ); -return ; - } -memory_region_init_io (&s->io_memory,OBJECT (s), &ioapic_io_ops, s,"ioapic" ,0x1000 );
@@ -476,10 +467,6 @@ static void ioapic_unrealize(DeviceState *dev)timer_free (s->delayed_ioapic_service_timer); } -static const Property ioapic_properties[] = { -DEFINE_PROP_UINT8 ("version" , IOAPICCommonState, version,IOAPIC_VER_DEF ), -}; -static void ioapic_class_init (ObjectClass *klass,const void *data) {IOAPICCommonClass *k =IOAPIC_COMMON_CLASS (klass);
@@ -493,7 +480,6 @@ static void ioapic_class_init(ObjectClass *klass, const void *data)*/ k->post_load = ioapic_update_kvm_routes;device_class_set_legacy_reset (dc, ioapic_reset_common); -device_class_set_props (dc, ioapic_properties); }static const TypeInfo ioapic_info = {
hw/intc/ioapic_common.c +1 -1
@@ -83,7 +83,7 @@ static void ioapic_print_redtbl(GString *buf, IOAPICCommonState *s)int i;g_string_append_printf (buf,"ioapic0: ver=0x%x id=0x%02x sel=0x%02x" , - s->version, s->id, s->ioregsel); +IOAPIC_VER_DEF , s->id, s->ioregsel);if (s->ioregsel) {g_string_append_printf (buf," (redir[%u])\n" , (s->ioregsel -IOAPIC_REG_REDTBL_BASE ) >>1 );
Signature · 1 line
2.47.1
Re: [PATCH v4 24/27] hw/intc/ioapic: Remove IOAPICCommonState::version field
Quoted 38 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:47 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 24/27] hw/intc/ioapic: RemoveIOAPICCommonState::version
field
X-Mailer: git-send-email 2.47.1The
IOAPICCommonState::versioninteger was only set in the hw_compat_2_7[] array, via the 'version=0x11' property. We removed all machines using that array, lets remove that property, simplify by only using the default version (defined asIOAPIC_VER_DEF).For the record, this field was introduced in commit
20fd4b7b6d9("x86: ioapic: add support for explicit EOI"):Quoted 14 lines
Some old Linux kernels (upstream before v4.0), or any released RHEL kernels has problem in sending APIC EOI when IR is enabled. Meanwhile, many of them only support explicit EOI for IOAPIC, which is only introduced in IOAPIC version
0x20. This patch provide a way to boost QEMU IOAPIC to version0x20, in order for QEMU to correctly receive EOI messages.Without boosting IOAPIC version to
0x20, kernels before commit d32932d ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces") will have trouble enabling both IR and level-triggered interrupt devices (like e1000).To upgrade IOAPIC to version
0x20, we need to specify:Quoted 8 lines
-global ioapic.version=0x20To be compatible with old systems,
0x11will still be the default IOAPIC version. Here0x11and0x20are the only versions to be supported.One thing to mention: this patch only applies to emulated IOAPIC. It does not affect kernel IOAPIC behavior.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>--- hw/intc/ioapic_internal.h | 3 +-- hw/intc/ioapic.c | 18 ++---------------- hw/intc/ioapic_common.c | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-)
Re: [PATCH v4 24/27] hw/intc/ioapic: Remove IOAPICCommonState::version field
In reply to Philippe Mathieu-DaudéQuoted 6 lines · On Thu, 8 May 2025 15:35:47 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
IOAPICCommonState::versioninteger was only set in the hw_compat_2_7[] array, via the 'version=0x11' property. We removed all machines using that array, lets remove that property, simplify by only using the default version (defined asIOAPIC_VER_DEF).
Quoted 19 lines
For the record, this field was introduced in commit
20fd4b7b6d9("x86: ioapic: add support for explicit EOI"):Quoted 16 lines
Some old Linux kernels (upstream before v4.0), or any released RHEL kernels has problem in sending APIC EOI when IR is enabled. Meanwhile, many of them only support explicit EOI for IOAPIC, which is only introduced in IOAPIC version
0x20. This patch provide a way to boost QEMU IOAPIC to version0x20, in order for QEMU to correctly receive EOI messages.Without boosting IOAPIC version to
0x20, kernels before commit d32932d ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces") will have trouble enabling both IR and level-triggered interrupt devices (like e1000).To upgrade IOAPIC to version
0x20, we need to specify:-global ioapic.version=0x20
that crutch might be in-use by external users, and even if they use 0x20, removing property will break CLI.
I'd deprecate it first and then remove.
Quoted 3 lines
Quoted 3 lines
To be compatible with old systems,
0x11will still be the default IOAPIC version. Here0x11and0x20are the only versions to be supported.
looking at the code removed, default is 0x20 which doesn't match above statement. Have something changed between then and now (missing ref to 0x20 becoming default)?
Quoted 107 lines
Quoted 3 lines
One thing to mention: this patch only applies to emulated IOAPIC. It does not affect kernel IOAPIC behavior.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>--- hw/intc/ioapic_internal.h | 3 +-- hw/intc/ioapic.c | 18 ++---------------- hw/intc/ioapic_common.c | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-)hw/intc/ioapic_internal.h +1
-2@@ -82,7 +82,7 @@#define IOAPIC_ID_MASK 0xf#define IOAPIC_VER_ENTRIES_SHIFT 16 - +#define IOAPIC_VER_DEF 0x20#define TYPE_IOAPIC_COMMON "ioapic-common"OBJECT_DECLARE_TYPE (IOAPICCommonState, IOAPICCommonClass,IOAPIC_COMMON )@@ -104,7 +104,6 @@ struct IOAPICCommonState {uint32_t irr;uint64_t ioredtbl[IOAPIC_NUM_PINS ];Notifier machine_done; -uint8_t version;uint64_t irq_count[IOAPIC_NUM_PINS ];int irq_level[IOAPIC_NUM_PINS ];int irq_eoi[IOAPIC_NUM_PINS ];hw/intc/ioapic.c +2
-16@@ -315,7 +315,7 @@ ioapic_mem_read(void *opaque, hwaddr addr, unsigned int size) val = s->id <<IOAPIC_ID_SHIFT ;break ;case IOAPIC_REG_VER : - val = s->version | + val =IOAPIC_VER_DEF | ((IOAPIC_NUM_PINS -1 ) <<IOAPIC_VER_ENTRIES_SHIFT );break ;default :@@ -411,8 +411,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val, }break ;case IOAPIC_EOI : -/* Explicit EOI is only supported for IOAPIC version 0x20 */ -if (size !=4 || s->version !=0x20 ) { +if (size !=4 ) {break ; }ioapic_eoi_broadcast (val);@@ -444,18 +443,10 @@ static void ioapic_machine_done_notify(Notifier *notifier, void *data)#endif } -#define IOAPIC_VER_DEF 0x20 -static void ioapic_realize (DeviceState *dev,Error **errp) {IOAPICCommonState *s =IOAPIC_COMMON (dev); -if (s->version !=0x11 && s->version !=0x20 ) { -error_setg (errp,"IOAPIC only supports version 0x11 or 0x20 " -"(default: 0x%x)." ,IOAPIC_VER_DEF ); -return ; - } -memory_region_init_io (&s->io_memory,OBJECT (s), &ioapic_io_ops, s,"ioapic" ,0x1000 );@@ -476,10 +467,6 @@ static void ioapic_unrealize(DeviceState *dev)timer_free (s->delayed_ioapic_service_timer); } -static const Property ioapic_properties[] = { -DEFINE_PROP_UINT8 ("version" , IOAPICCommonState, version,IOAPIC_VER_DEF ), -}; -static void ioapic_class_init (ObjectClass *klass,const void *data) {IOAPICCommonClass *k =IOAPIC_COMMON_CLASS (klass);@@ -493,7 +480,6 @@ static void ioapic_class_init(ObjectClass *klass, const void *data)*/ k->post_load = ioapic_update_kvm_routes;device_class_set_legacy_reset (dc, ioapic_reset_common); -device_class_set_props (dc, ioapic_properties); }static const TypeInfo ioapic_info = {hw/intc/ioapic_common.c +1
-1@@ -83,7 +83,7 @@ static void ioapic_print_redtbl(GString *buf, IOAPICCommonState *s)int i;g_string_append_printf (buf,"ioapic0: ver=0x%x id=0x%02x sel=0x%02x" , - s->version, s->id, s->ioregsel); +IOAPIC_VER_DEF , s->id, s->ioregsel);if (s->ioregsel) {g_string_append_printf (buf," (redir[%u])\n" , (s->ioregsel -IOAPIC_REG_REDTBL_BASE ) >>1 );
PATCH v4 25/27 hw/virtio/virtio-pci: Remove VirtIOPCIProxy::ignore_backend_features field
In reply to Philippe Mathieu-DaudéThe VirtIOPCIProxy::ignore_backend_features boolean was only set in the hw_compat_2_7[] array, via the 'x-ignore-backend-features=on' property. We removed all machines using that array, lets remove that property, simplify by only using the default version.
--- include/hw/virtio/virtio-pci.h | 1 - hw/virtio/virtio-pci.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-)
include/hw/virtio/virtio-pci.h +0 -1
@@ -149,7 +149,6 @@ struct VirtIOPCIProxy {int config_cap;uint32_t flags;bool disable_modern; -bool ignore_backend_features;OnOffAuto disable_legacy;/* Transitional device id */ uint16_t trans_devid;
hw/virtio/virtio-pci.c +1 -4
@@ -1965,8 +1965,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)* Virtio capabilities present without * VIRTIO_F_VERSION_1 confuses guests */ -if (!proxy->ignore_backend_features && - !virtio_has_feature (vdev->host_features,VIRTIO_F_VERSION_1 )) { +if (!virtio_has_feature (vdev->host_features,VIRTIO_F_VERSION_1 )) {virtio_pci_disable_modern (proxy);if (!legacy) {
@@ -2351,8 +2350,6 @@ static const Property virtio_pci_properties[] = { VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT, false),DEFINE_PROP_BIT ("page-per-vq" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT , false), -DEFINE_PROP_BOOL ("x-ignore-backend-features" , VirtIOPCIProxy, - ignore_backend_features, false),DEFINE_PROP_BIT ("ats" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_ATS_BIT , false), DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
Signature · 1 line
2.47.1
Re: [PATCH v4 25/27] hw/virtio/virtio-pci: Remove VirtIOPCIProxy::ignore_backend_features field
Quoted 11 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:48 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 25/27] hw/virtio/virtio-pci: Remove
VirtIOPCIProxy::ignore_backend_featuresfield
X-Mailer: git-send-email 2.47.1The
VirtIOPCIProxy::ignore_backend_featuresboolean was only set in the hw_compat_2_7[] array, via the 'x-ignore-backend-features=on' property. We removed all machines using that array, lets remove that property, simplify by only using the default version.
Quoted 6 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>--- include/hw/virtio/virtio-pci.h | 1 - hw/virtio/virtio-pci.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-)
Re: [PATCH v4 25/27] hw/virtio/virtio-pci: Remove VirtIOPCIProxy::ignore_backend_features field
In reply to Philippe Mathieu-DaudéQuoted 7 lines · On Thu, 8 May 2025 15:35:48 +0200 Philippe Mathieu-Daudé <[email protected]>…
The
VirtIOPCIProxy::ignore_backend_featuresboolean was only set in the hw_compat_2_7[] array, via the 'x-ignore-backend-features=on' property. We removed all machines using that array, lets remove that property, simplify by only using the default version.Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>
Quoted 40 lines
--- include/hw/virtio/virtio-pci.h | 1 - hw/virtio/virtio-pci.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-)include/hw/virtio/virtio-pci.h +0
-1@@ -149,7 +149,6 @@ struct VirtIOPCIProxy {int config_cap;uint32_t flags;bool disable_modern; -bool ignore_backend_features;OnOffAuto disable_legacy;/* Transitional device id */ uint16_t trans_devid;hw/virtio/virtio-pci.c +1
-4@@ -1965,8 +1965,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)* Virtio capabilities present without * VIRTIO_F_VERSION_1 confuses guests */ -if (!proxy->ignore_backend_features && - !virtio_has_feature (vdev->host_features,VIRTIO_F_VERSION_1 )) { +if (!virtio_has_feature (vdev->host_features,VIRTIO_F_VERSION_1 )) {virtio_pci_disable_modern (proxy);if (!legacy) {@@ -2351,8 +2350,6 @@ static const Property virtio_pci_properties[] = { VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT, false),DEFINE_PROP_BIT ("page-per-vq" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT , false), -DEFINE_PROP_BOOL ("x-ignore-backend-features" , VirtIOPCIProxy, - ignore_backend_features, false),DEFINE_PROP_BIT ("ats" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_ATS_BIT , false), DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
PATCH v4 26/27 hw/char/virtio-serial: Do not expose the 'emergency-write' property
In reply to Philippe Mathieu-DaudéThe VIRTIO_CONSOLE_F_EMERG_WRITE feature bit was only set in the hw_compat_2_7[] array, via the 'emergency-write=off' property. We removed all machines using that array, lets remove that property. All instances have this feature bit set and it can not be disabled. VirtIOSerial::host_features mask is now unused, remove it.
--- include/hw/virtio/virtio-serial.h | 2 -- hw/char/virtio-serial-bus.c | 9 +++------ 2 files changed, 3 insertions(+), 8 deletions(-)
include/hw/virtio/virtio-serial.h +0 -2
@@ -185,8 +185,6 @@ struct VirtIOSerial {struct VirtIOSerialPostLoad *post_load;virtio_serial_conf serial; - -uint64_t host_features; };/* Interface to the virtio-serial bus */
hw/char/virtio-serial-bus.c +3 -6
@@ -557,7 +557,7 @@ static uint64_t get_features(VirtIODevice *vdev, uint64_t features, vser =VIRTIO_SERIAL (vdev); - features |= vser->host_features; + features |=BIT_ULL (VIRTIO_CONSOLE_F_EMERG_WRITE );if (vser->bus.max_nr_ports >1 ) {virtio_add_feature (&features,VIRTIO_CONSOLE_F_MULTIPORT ); }
@@ -587,8 +587,7 @@ static void set_config(VirtIODevice *vdev, const uint8_t *config_data)VirtIOSerialPortClass *vsc;uint8_t emerg_wr_lo; -if (!virtio_has_feature (vser->host_features, -VIRTIO_CONSOLE_F_EMERG_WRITE ) || !config->emerg_wr) { +if (!config->emerg_wr) {return ; }
@@ -1039,7 +1038,7 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp)return ; } -if (!virtio_has_feature (vser->host_features, +if (!virtio_has_feature (vdev->host_features,VIRTIO_CONSOLE_F_EMERG_WRITE )) { config_size = offsetof(struct virtio_console_config , emerg_wr); }
@@ -1155,8 +1154,6 @@ static const VMStateDescription vmstate_virtio_console = {static const Property virtio_serial_properties[] = {DEFINE_PROP_UINT32 ("max_ports" , VirtIOSerial, serial.max_virtserial_ports,31 ), -DEFINE_PROP_BIT64 ("emergency-write" , VirtIOSerial, host_features, -VIRTIO_CONSOLE_F_EMERG_WRITE , true), };static void virtio_serial_class_init (ObjectClass *klass,const void *data)
Signature · 1 line
2.47.1
Re: [PATCH v4 26/27] hw/char/virtio-serial: Do not expose the 'emergency-write' property
Quoted 59 lines · Philippe Mathieu-Daudé
The
VIRTIO_CONSOLE_F_EMERG_WRITEfeature bit was only set in the hw_compat_2_7[] array, via the 'emergency-write=off' property. We removed all machines using that array, lets remove that property. All instances have this feature bit set and it can not be disabled.VirtIOSerial::host_featuresmask is now unused, remove it.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/virtio/virtio-serial.h | 2 -- hw/char/virtio-serial-bus.c | 9 +++------ 2 files changed, 3 insertions(+), 8 deletions(-)include/hw/virtio/virtio-serial.h +0
-2@@ -185,8 +185,6 @@ struct VirtIOSerial {struct VirtIOSerialPostLoad *post_load;virtio_serial_conf serial; - -uint64_t host_features; };/* Interface to the virtio-serial bus */ hw/char/virtio-serial-bus.c +3
-4@@ -557,7 +557,7 @@ static uint64_t get_features(VirtIODevice *vdev, uint64_t features, vser =VIRTIO_SERIAL (vdev); - features |= vser->host_features; + features |=BIT_ULL (VIRTIO_CONSOLE_F_EMERG_WRITE );if (vser->bus.max_nr_ports >1 ) {virtio_add_feature (&features,VIRTIO_CONSOLE_F_MULTIPORT ); }@@ -587,8 +587,7 @@ static void set_config(VirtIODevice *vdev, const uint8_t *config_data)VirtIOSerialPortClass *vsc;uint8_t emerg_wr_lo; -if (!virtio_has_feature (vser->host_features, -VIRTIO_CONSOLE_F_EMERG_WRITE ) || !config->emerg_wr) { +if (!config->emerg_wr) {return ; }@@ -1039,7 +1038,7 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp)return ; } -if (!virtio_has_feature (vser->host_features, +if (!virtio_has_feature (vdev->host_features,VIRTIO_CONSOLE_F_EMERG_WRITE )) { config_size = offsetof(struct virtio_console_config , emerg_wr); }
hw/char/virtio-serial-bus.c static const VMStateDescription vmstate_virtio_console = { · line 1159
Quoted 8 lines
hw/char/virtio-serial-bus.c +0
-2@@ -1155,8 +1154,6 @@ static const VMStateDescription vmstate_virtio_console = {static const Property virtio_serial_properties[] = {DEFINE_PROP_UINT32 ("max_ports" , VirtIOSerial, serial.max_virtserial_ports,31 ), -DEFINE_PROP_BIT64 ("emergency-write" , VirtIOSerial, host_features, -VIRTIO_CONSOLE_F_EMERG_WRITE , true), };static void virtio_serial_class_init (ObjectClass *klass,const void *data)
LGTM.
ATB,
Mark.
Re: [PATCH v4 26/27] hw/char/virtio-serial: Do not expose the 'emergency-write' property
In reply to Philippe Mathieu-DaudéQuoted 13 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:49 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 26/27] hw/char/virtio-serial: Do not expose the
'emergency-write' property
X-Mailer: git-send-email 2.47.1The
VIRTIO_CONSOLE_F_EMERG_WRITEfeature bit was only set in the hw_compat_2_7[] array, via the 'emergency-write=off' property. We removed all machines using that array, lets remove that property. All instances have this feature bit set and it can not be disabled.VirtIOSerial::host_featuresmask is now unused, remove it.
Quoted 5 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/virtio/virtio-serial.h | 2 -- hw/char/virtio-serial-bus.c | 9 +++------ 2 files changed, 3 insertions(+), 8 deletions(-)
PATCH v4 27/27 hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_PAGE_PER_VQ definition
In reply to Philippe Mathieu-DaudéVIRTIO_PCI_FLAG_PAGE_PER_VQ was only used by the hw_compat_2_7[] array, via the 'page-per-vq=on' property. We removed all machines using that array, lets remove all the code around VIRTIO_PCI_FLAG_PAGE_PER_VQ (see commit 9a4c0e220d8 for similar VIRTIO_PCI_FLAG_* enum removal).
--- include/hw/virtio/virtio-pci.h | 1 - hw/display/virtio-vga.c | 10 ---------- hw/virtio/virtio-pci.c | 7 +------ 3 files changed, 1 insertion(+), 17 deletions(-)
include/hw/virtio/virtio-pci.h +0 -1
@@ -33,7 +33,6 @@ enum {VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT ,VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT ,VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT , -VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT ,VIRTIO_PCI_FLAG_ATS_BIT ,VIRTIO_PCI_FLAG_INIT_DEVERR_BIT , VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,
hw/display/virtio-vga.c +0 -10
@@ -141,16 +141,6 @@ static void virtio_vga_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp) VIRTIO_GPU_SHM_ID_HOST_VISIBLE); } -if (!(vpci_dev->flags &VIRTIO_PCI_FLAG_PAGE_PER_VQ )) { -/* -* with page-per-vq=off there is no padding space we can use -* for the stdvga registers. Make the common and isr regions -* smaller then. -*/ - vpci_dev->common.size /=2 ; - vpci_dev->isr.size /=2 ; - } - offset =memory_region_size (&vpci_dev->modern_bar); offset -= vpci_dev->notify.size; vpci_dev->notify.offset = offset;
hw/virtio/virtio-pci.c +1 -6
@@ -314,12 +314,9 @@ static bool virtio_pci_ioeventfd_enabled(DeviceState *d)return (proxy->flags &VIRTIO_PCI_FLAG_USE_IOEVENTFD ) !=0 ; } -#define QEMU_VIRTIO_PCI_QUEUE_MEM_MULT 0x1000 -static inline int virtio_pci_queue_mem_mult (struct VirtIOPCIProxy *proxy) { -return (proxy->flags &VIRTIO_PCI_FLAG_PAGE_PER_VQ ) ? -QEMU_VIRTIO_PCI_QUEUE_MEM_MULT :4 ; +return 4 ; } static int virtio_pci_ioeventfd_assign(DeviceState *d, EventNotifier *notifier,
@@ -2348,8 +2345,6 @@ static const Property virtio_pci_properties[] = { VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT, false),DEFINE_PROP_BIT ("modern-pio-notify" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT , false), -DEFINE_PROP_BIT ("page-per-vq" , VirtIOPCIProxy, flags, -VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT , false),DEFINE_PROP_BIT ("ats" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_ATS_BIT , false), DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
Signature · 1 line
2.47.1
Re: [PATCH v4 27/27] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_PAGE_PER_VQ definition
Quoted 12 lines · Philippe Mathieu-Daudé
Date: Thu, 8 May 2025 15:35:50 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v4 27/27] hw/virtio/virtio-pci: Remove
VIRTIO_PCI_FLAG_PAGE_PER_VQdefinition
X-Mailer: git-send-email 2.47.1
VIRTIO_PCI_FLAG_PAGE_PER_VQwas only used by the hw_compat_2_7[] array, via the 'page-per-vq=on' property. We removed all machines using that array, lets remove all the code aroundVIRTIO_PCI_FLAG_PAGE_PER_VQ(see commit9a4c0e220d8for similar VIRTIO_PCI_FLAG_* enum removal).
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>--- include/hw/virtio/virtio-pci.h | 1 - hw/display/virtio-vga.c | 10 ---------- hw/virtio/virtio-pci.c | 7 +------ 3 files changed, 1 insertion(+), 17 deletions(-)
Re: [PATCH v4 27/27] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_PAGE_PER_VQ definition
In reply to Philippe Mathieu-DaudéQuoted 19 lines · On Thu, 8 May 2025 15:35:50 +0200 Philippe Mathieu-Daudé <[email protected]>…
VIRTIO_PCI_FLAG_PAGE_PER_VQwas only used by the hw_compat_2_7[] array, via the 'page-per-vq=on' property. We removed all machines using that array, lets remove all the code aroundVIRTIO_PCI_FLAG_PAGE_PER_VQ(see commit9a4c0e220d8for similar VIRTIO_PCI_FLAG_* enum removal).Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>--- include/hw/virtio/virtio-pci.h | 1 - hw/display/virtio-vga.c | 10 ---------- hw/virtio/virtio-pci.c | 7 +------ 3 files changed, 1 insertion(+), 17 deletions(-)include/hw/virtio/virtio-pci.h +0
-0
include/hw/virtio/virtio-pci.h enum { · line 36
Quoted 4 lines
include/hw/virtio/virtio-pci.h +0
-1@@ -33,7 +33,6 @@ enum {VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT ,VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT , VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT, - VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT,
there is also
/* page per vq flag to be used by split drivers within guests */
#define VIRTIO_PCI_FLAG_PAGE_PER_VQ \
(1 << VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT) left behind
nevertheless, I'm not sure if we should remove this at all, it seems that there are external users
https://bugzilla.redhat.com/show_bug.cgi?id=1925363
Quoted 51 lines
include/hw/virtio/virtio-pci.h +0
-0VIRTIO_PCI_FLAG_ATS_BIT ,VIRTIO_PCI_FLAG_INIT_DEVERR_BIT , VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,hw/display/virtio-vga.c +0
-10@@ -141,16 +141,6 @@ static void virtio_vga_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp) VIRTIO_GPU_SHM_ID_HOST_VISIBLE); } -if (!(vpci_dev->flags &VIRTIO_PCI_FLAG_PAGE_PER_VQ )) { -/* -* with page-per-vq=off there is no padding space we can use -* for the stdvga registers. Make the common and isr regions -* smaller then. -*/ - vpci_dev->common.size /=2 ; - vpci_dev->isr.size /=2 ; - } - offset =memory_region_size (&vpci_dev->modern_bar); offset -= vpci_dev->notify.size; vpci_dev->notify.offset = offset;hw/virtio/virtio-pci.c +1
-6@@ -314,12 +314,9 @@ static bool virtio_pci_ioeventfd_enabled(DeviceState *d)return (proxy->flags &VIRTIO_PCI_FLAG_USE_IOEVENTFD ) !=0 ; } -#define QEMU_VIRTIO_PCI_QUEUE_MEM_MULT 0x1000 -static inline int virtio_pci_queue_mem_mult (struct VirtIOPCIProxy *proxy) { -return (proxy->flags &VIRTIO_PCI_FLAG_PAGE_PER_VQ ) ? -QEMU_VIRTIO_PCI_QUEUE_MEM_MULT :4 ; +return 4 ; } static int virtio_pci_ioeventfd_assign(DeviceState *d, EventNotifier *notifier,@@ -2348,8 +2345,6 @@ static const Property virtio_pci_properties[] = { VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT, false),DEFINE_PROP_BIT ("modern-pio-notify" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT , false), -DEFINE_PROP_BIT ("page-per-vq" , VirtIOPCIProxy, flags, -VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT , false),DEFINE_PROP_BIT ("ats" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_ATS_BIT , false), DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
Quoted 10 lines · On Thu, 8 May 2025 15:35:23 +0200 Philippe Mathieu-Daudé <[email protected]>…
Since v3:
- Addressed Thomas and Zhao review comments
- Rename fw_cfg_init_mem_[no]dma() helpers
- Remove unused CPU properties
- Remove {multi,linux}boot.bin
- Added R-b tagsSince v2:
- Addressed Mark review comments and added his R-b tags
Quoted 7 lines
The versioned 'pc' and 'q35' machines up to 2.12 been marked as deprecated two releases ago, and are older than 6 years, so according to our support policy we can remove them.
This series only includes the 2.6 and 2.7 machines removal, as it is a big enough number of LoC removed. Rest will follow.
CCing libvirt folks
series removes some properties that has been used as compat knobs with 2.6/2.7 machine types that are being removed.
However libvirt might still use them,
please check if being removed properties are safe to remove as is | should be deprecated 1st | should be left alone from an immediate user perspective.
Quoted 3 lines
Based-on: <[email protected]>
[...]
Quoted 23 lines · Igor Mammedov
Quoted 10 lines · On Thu, 8 May 2025 15:35:23 +0200 Philippe Mathieu-Daudé <[email protected]>…
Since v3:
- Addressed Thomas and Zhao review comments
- Rename fw_cfg_init_mem_[no]dma() helpers
- Remove unused CPU properties
- Remove {multi,linux}boot.bin
- Added R-b tagsSince v2:
- Addressed Mark review comments and added his R-b tagsQuoted 7 lines
The versioned 'pc' and 'q35' machines up to 2.12 been marked as deprecated two releases ago, and are older than 6 years, so according to our support policy we can remove them.
This series only includes the 2.6 and 2.7 machines removal, as it is a big enough number of LoC removed. Rest will follow.
CCing libvirt folks
Quoted 7 lines
series removes some properties that has been used as compat knobs with 2.6/2.7 machine types that are being removed.
However libvirt might still use them,
please check if being removed properties are safe to remove as is | should be deprecated 1st | should be left alone from an immediate user perspective.
Anyone on libvirt side can confirm please?
Quoted 4 lines
Quoted 3 lines
Based-on: <[email protected]>
[...]
Quoted 27 lines · Michael S. Tsirkin via Devel
Quoted 26 lines · Igor Mammedov
Quoted 10 lines · On Thu, 8 May 2025 15:35:23 +0200 Philippe Mathieu-Daudé <[email protected]>…
Since v3:
- Addressed Thomas and Zhao review comments
- Rename fw_cfg_init_mem_[no]dma() helpers
- Remove unused CPU properties
- Remove {multi,linux}boot.bin
- Added R-b tagsSince v2:
- Addressed Mark review comments and added his R-b tagsQuoted 7 lines
The versioned 'pc' and 'q35' machines up to 2.12 been marked as deprecated two releases ago, and are older than 6 years, so according to our support policy we can remove them.
This series only includes the 2.6 and 2.7 machines removal, as it is a big enough number of LoC removed. Rest will follow.
CCing libvirt folks
series removes some properties that has been used as compat knobs with 2.6/2.7 machine types that are being removed.
Quoted 6 lines
Quoted 4 lines
However libvirt might still use them,
please check if being removed properties are safe to remove as is | should be deprecated 1st | should be left alone from an immediate user perspective.Anyone on libvirt side can confirm please?
Sorry, it was a bit of a chore to go through the patches.
IIUC the following list is to be reviewed:
DEFINE_PROP_BOOL("x-buggy-eim", IntelIOMMUState, buggy_eim, false) DEFINE_PROP_BOOL("x-ignore-backend-features", VirtIOPCIProxy, DEFINE_PROP_BOOL("migrate", PCSpkState, migrate, true), DEFINE_PROP_UINT8("version", IOAPICCommonState, version, IOAPIC_VER_DEF) DEFINE_PROP_BIT64("emergency-write", VirtIOSerial, host_features DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy, DEFINE_PROP_BOOL("legacy-instance-id", APICCommonState, legacy_instance_id,
None of the above are exposed by libvirt to the user nor used by libvirt internally.
DEFINE_PROP_BIT("page-per-vq", VirtIOPCIProxy, flags
This property is exposed to users for all virtio devices as 'page_per_vq' property:a
https://www.libvirt.org/formatdomain.html#virtio-related-options
It is an optional property and not formatted to qemu unless explicitly requested by the user. Removing it thus should be fine without the need to change anything in libvirt
The rest are CPU properties
DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true), DEFINE_PROP_BOOL("fill-mtrr-mask", X86CPU, fill_mtrr_mask, true), DEFINE_PROP_BOOL("full-cpuid-auto-level", X86CPU, full_cpuid_auto_level, true),
which appear in our cpu test data but I'm not 100% sure how they are used. Jirka, can you please comment?
Finally there's
DEFINE_PROP_BOOL("l3-cache", X86CPU, enable_l3_cache, true),
which is exposed to the users via cache mode setting of cpu:
https://www.libvirt.org/formatdomain.html#cpu-model-and-topology
look for 'cache'.
Thus from libvirt's side 'page-per-vq' and 'l3-cache' will likely require deprecation period. The rest except for CPU is fine to remove without anything at least from our PoV.
Jirka will hopefully clarify the Cpu property side.
Quoted 8 lines · Peter Krempa
The rest are CPU properties
DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true),DEFINE_PROP_BOOL("fill-mtrr-mask", X86CPU, fill_mtrr_mask, true),DEFINE_PROP_BOOL("full-cpuid-auto-level", X86CPU, full_cpuid_auto_level, true),which appear in our cpu test data but I'm not 100% sure how they are used. Jirka, can you please comment?
None of these properties is directly used by libvirt for anything. They can be removed anytime.
Jirka
Hi Peter,
Quoted 9 lines
Finally there's
DEFINE_PROP_BOOL("l3-cache", X86CPU, enable_l3_cache, true),which is exposed to the users via cache mode setting of cpu:
https://www.libvirt.org/formatdomain.html#cpu-model-and-topology
look for 'cache'.
I found this link doesn't mention "l3-cache", but it appears in libvirt's src/qemu/qemu_command.c.
Quoted 3 lines
Thus from libvirt's side 'page-per-vq' and 'l3-cache' will likely require deprecation period. The rest except for CPU is fine to remove without anything at least from our PoV.
So I understand that the file qemu_command.c contains all the QEMU commands/properties/options used by libvirt, thereby in the future if one wants to remove other properties, he can just check that file, right?
Thanks,
Zhao
On Thu, 8 May 2025 15:35:23 +0200
Philippe Mathieu-Daudé <[email protected]> wrote:
Are you planning to resping it?
(if yes, I can provide you with a fixed 2/27 patch that removes all legacy cpu hp leftovers)
Quoted 104 lines
Since v3:
- Addressed Thomas and Zhao review comments
- Rename fw_cfg_init_mem_[no]dma() helpers
- Remove unused CPU properties
- Remove {multi,linux}boot.bin
- Added R-b tagsSince v2:
- Addressed Mark review comments and added his R-b tagsThe versioned 'pc' and 'q35' machines up to 2.12 been marked as deprecated two releases ago, and are older than 6 years, so according to our support policy we can remove them.
This series only includes the 2.6 and 2.7 machines removal, as it is a big enough number of LoC removed. Rest will follow.
Based-on: <[email protected]>
Philippe Mathieu-Daudé (27):
hw/i386/pc: Remove deprecated pc-q35-2.6 and pc-i440fx-2.6 machines hw/i386/pc: RemovePCMachineClass::legacy_cpu_hotplugfield hw/nvram/fw_cfg: Renamefw_cfg_init_mem()with '_nodma' suffix hw/mips/loongson3_virt: Prefer usingfw_cfg_init_mem_nodma()hw/nvram/fw_cfg: Factorfw_cfg_init_mem_internal()out hw/nvram/fw_cfg: Renamefw_cfg_init_mem_wide()->fw_cfg_init_mem_dma()hw/i386/x86: Remove
X86MachineClass::fwcfg_dma_enabledfield hw/i386/pc: Remove multiboot.bin
hw/nvram/fw_cfg: Removefw_cfg_io_properties::dma_enabledhw/i386/pc: Remove linuxboot.bin
hw/i386/pc: Remove pc_compat_2_6[] array
target/i386/cpu: RemoveCPUX86State::enable_cpuid_0xbfield target/i386/cpu: RemoveCPUX86State::fill_mtrr_maskfield hw/intc/apic: RemoveAPICCommonState::legacy_instance_idfield hw/core/machine: Remove hw_compat_2_6[] array hw/virtio/virtio-mmio: Remove
VirtIOMMIOProxy::format_transport_addressfield
hw/i386/pc: Remove deprecated pc-q35-2.7 and pc-i440fx-2.7 machines hw/i386/pc: Remove pc_compat_2_7[] array
target/i386/cpu: RemoveCPUX86State::full_cpuid_auto_levelfield target/i386/cpu: RemoveCPUX86State::enable_l3_cachefield hw/audio/pcspk: RemovePCSpkState::migratefield hw/core/machine: Remove hw_compat_2_7[] array hw/i386/intel_iommu: RemoveIntelIOMMUState::buggy_eimfield hw/intc/ioapic: RemoveIOAPICCommonState::versionfield hw/virtio/virtio-pci: RemoveVirtIOPCIProxy::ignore_backend_features
field
hw/char/virtio-serial: Do not expose the 'emergency-write' property hw/virtio/virtio-pci: RemoveVIRTIO_PCI_FLAG_PAGE_PER_VQdefinitionhw/intc/ioapic_internal.h | 3 +- include/hw/acpi/cpu_hotplug.h | 3 - include/hw/boards.h | 6 - include/hw/i386/apic_internal.h | 1 - include/hw/i386/intel_iommu.h | 1 - include/hw/i386/pc.h | 9 -- include/hw/i386/x86.h | 2 - include/hw/nvram/fw_cfg.h | 9 +- include/hw/virtio/virtio-mmio.h | 1 - include/hw/virtio/virtio-pci.h | 2 - include/hw/virtio/virtio-serial.h | 2 - pc-bios/optionrom/optionrom.h | 4 - target/i386/cpu.h | 15 -- hw/acpi/cpu_hotplug.c | 230 --------------------------- hw/arm/virt.c | 2 +- hw/audio/pcspk.c | 10 -- hw/char/virtio-serial-bus.c | 9 +- hw/core/machine.c | 17 -- hw/display/virtio-vga.c | 10 -- hw/hppa/machine.c | 2 +- hw/i386/acpi-build.c | 4 +- hw/i386/fw_cfg.c | 5 +- hw/i386/intel_iommu.c | 5 +- hw/i386/microvm.c | 3 - hw/i386/multiboot.c | 7 +- hw/i386/pc.c | 22 +-- hw/i386/pc_piix.c | 23 --- hw/i386/pc_q35.c | 24 --- hw/i386/x86-common.c | 6 +- hw/i386/x86.c | 2 - hw/intc/apic_common.c | 5 - hw/intc/ioapic.c | 18 +-- hw/intc/ioapic_common.c | 2 +- hw/mips/loongson3_virt.c | 2 +- hw/nvram/fw_cfg.c | 48 +++--- hw/riscv/virt.c | 4 +- hw/virtio/virtio-mmio.c | 15 -- hw/virtio/virtio-pci.c | 12 +- target/i386/cpu.c | 152 ++++++++---------- target/i386/kvm/kvm.c | 10 +- tests/qtest/test-x86-cpuid-compat.c | 11 -- pc-bios/meson.build | 2 - pc-bios/multiboot.bin | Bin 1024 -> 0 bytes pc-bios/optionrom/Makefile | 2 +- pc-bios/optionrom/linuxboot.S | 195 ----------------------- pc-bios/optionrom/multiboot.S | 232 --------------------------- pc-bios/optionrom/multiboot_dma.S | 234 +++++++++++++++++++++++++++- 47 files changed, 349 insertions(+), 1034 deletions(-) delete mode 100644 pc-bios/multiboot.bin delete mode 100644 pc-bios/optionrom/linuxboot.S delete mode 100644 pc-bios/optionrom/multiboot.S
Hi Igor,
Quoted 5 lines · Igor Mammedov
On Thu, 8 May 2025 15:35:23 +0200
Philippe Mathieu-Daudé <[email protected]> wrote:Are you planning to resping it?
(if yes, I can provide you with a fixed 2/27 patch that removes all legacy cpu hp leftovers)
Sorry, no, I already burned all the x86 credits I had for 2025 :S
Zhao kindly offered to help with respin :)
Regards,
Phil.
Hi Igor and Philippe,
Quoted 8 lines · Igor Mammedov
Quoted 5 lines
On Thu, 8 May 2025 15:35:23 +0200
Philippe Mathieu-Daudé <[email protected]> wrote:Are you planning to resping it?
(if yes, I can provide you with a fixed 2/27 patch that removes all legacy cpu hp leftovers)Sorry, no, I already burned all the x86 credits I had for 2025 :S
Don't say that, thanks for your efforts! :-)
Quoted 1 line
Zhao kindly offered to help with respin :)
I haven't forgotten about this. I also plan to help it move forward in the coming weeks.
Thanks,
Zhao
Quoted 9 lines · On Fri, 31 Oct 2025 22:14:03 +0800 Zhao Liu <[email protected]> wrote:
Hi Igor and Philippe,
Quoted 7 lines · Igor Mammedov
Quoted 5 lines
On Thu, 8 May 2025 15:35:23 +0200
Philippe Mathieu-Daudé <[email protected]> wrote:Are you planning to resping it?
(if yes, I can provide you with a fixed 2/27 patch that removes all legacy cpu hp leftovers)
Quoted 8 lines
Quoted 1 line
Sorry, no, I already burned all the x86 credits I had for 2025 :S
Don't say that, thanks for your efforts! :-)
Quoted 1 line
Zhao kindly offered to help with respin :)
I haven't forgotten about this. I also plan to help it move forward in the coming weeks.
in this case, I'll send reworked patch (not really tested) as a reply 2/27 so you could incorporate it on respin.
Quoted 3 lines
Thanks,
Zhao
Quoted 22 lines · Igor Mammedov
Date: Fri, 31 Oct 2025 15:23:45 +0100
From: Igor Mammedov <[email protected]>
Subject: Re: [PATCH v4 00/27] hw/i386/pc: Remove deprecated 2.6 and 2.7 PC
machines
X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-redhat-linux-gnu)Quoted 13 lines · On Fri, 31 Oct 2025 22:14:03 +0800 Zhao Liu <[email protected]> wrote:
Hi Igor and Philippe,
Quoted 8 lines · Igor Mammedov
Quoted 5 lines
On Thu, 8 May 2025 15:35:23 +0200
Philippe Mathieu-Daudé <[email protected]> wrote:Are you planning to resping it?
(if yes, I can provide you with a fixed 2/27 patch that removes all legacy cpu hp leftovers)Sorry, no, I already burned all the x86 credits I had for 2025 :S
Don't say that, thanks for your efforts! :-)
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Zhao kindly offered to help with respin :)
I haven't forgotten about this. I also plan to help it move forward in the coming weeks.
in this case, I'll send reworked patch (not really tested) as a reply 2/27 so you could incorporate it on respin.
Thank Igor! I'll include that patch into v5.
Regards,
Zhao