Skip to contentSkip to conversation

hw/i386/pc: Remove deprecated 2.8 and 2.9 PC machines

PATCH In review Philippe Mathieu-Daudé 4 participants 44 messages May 1, 2025 – Mar 3

lore
Share & tools
lore
#0 lore raw

cover hw/i386/pc: Remove deprecated 2.8 and 2.9 PC machines

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.8 and 2.9 machines removal, as it is a big enough number of LoC removed. Rest will follow.

Based-on: <[email protected]>

Philippe Mathieu-Daudé (18):
hw/i386/pc: Remove deprecated pc-q35-2.8 and pc-i440fx-2.8 machines hw/i386/pc: Remove pc_compat_2_8[] array hw/southbridge/ich9: Remove ICH9_LPC_SMI_F_BROADCAST_BIT definition hw/i386/kvm: Remove KVMClockState::mach_use_reliable_get_clock field hw/core/machine: Remove hw_compat_2_8[] array hw/block/pflash: Remove PFlashCFI01::old_multiple_chip_handling field hw/pci/pcie: Remove QEMU_PCIE_EXTCAP_INIT definition hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_DEVERR definition hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_LNKCTL definition hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_PM definition hw/nvram/fw_cfg: Remove FWCfgState::file_slots field hw/nvram/fw_cfg: Inline fw_cfg_file_slots()
hw/i386/pc: Remove deprecated pc-q35-2.9 and pc-i440fx-2.9 machines hw/i386/pc: Remove pc_compat_2_9[] array
hw/core/machine: Remove hw_compat_2_9[] array hw/net/virtio-net: Remove VirtIONet::mtu_bypass_backend field hw/pci-bridge/gen_pcie_rp: Remove GenPCIERootPort::migrate_msix field hw/i386/x86-iommu: Remove X86IOMMUState::pt_supported field

 include/hw/boards.h                |  6 -----
 include/hw/i386/pc.h               |  6 -----
 include/hw/i386/x86-iommu.h        |  1 -
 include/hw/nvram/fw_cfg.h          |  1 -
 include/hw/pci/pci.h               |  2 --
 include/hw/southbridge/ich9.h      |  1 -
 include/hw/virtio/virtio-net.h     |  1 -
 include/hw/virtio/virtio-pci.h     | 12 ----------
 hw/acpi/ich9.c                     |  6 ++---
 hw/block/pflash_cfi01.c            | 14 +++---------
 hw/core/machine.c                  | 22 -------------------
 hw/i386/amd_iommu.c                | 12 ++--------
 hw/i386/intel_iommu.c              | 13 ++---------
 hw/i386/kvm/clock.c                | 18 ---------------
 hw/i386/pc.c                       | 14 ------------
 hw/i386/pc_piix.c                  | 18 ---------------
 hw/i386/pc_q35.c                   | 18 ---------------
 hw/i386/x86-iommu.c                |  1 -
 hw/isa/lpc_ich9.c                  | 22 +++----------------
 hw/net/virtio-net.c                |  8 ++-----
 hw/nvram/fw_cfg.c                  | 35 ++++--------------------------
 hw/pci-bridge/gen_pcie_root_port.c | 16 ++------------
 hw/pci/pci.c                       |  2 --
 hw/pci/pcie.c                      |  5 -----
 hw/virtio/virtio-pci.c             | 35 ++++++++----------------------
 25 files changed, 29 insertions(+), 260 deletions(-)
Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/18 hw/i386/pc: Remove deprecated pc-q35-2.8 and pc-i440fx-2.8 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 | 9 ---------
 hw/i386/pc_q35.c  | 9 ---------
 2 files changed, 18 deletions(-)
hw/i386/pc_piix.c +0 -9
index 98bd8d0e67b..0d6ad9db627 100644
@@ -746,15 +746,6 @@ static void pc_i440fx_machine_2_9_options(MachineClass *m)
 
 DEFINE_I440FX_MACHINE(2, 9);
 
-static void pc_i440fx_machine_2_8_options(MachineClass *m)
-{
-    pc_i440fx_machine_2_9_options(m);
-    compat_props_add(m->compat_props, hw_compat_2_8, hw_compat_2_8_len);
-    compat_props_add(m->compat_props, pc_compat_2_8, pc_compat_2_8_len);
-}
-
-DEFINE_I440FX_MACHINE(2, 8);
-
 #ifdef CONFIG_ISAPC
 static void isapc_machine_options(MachineClass *m)
 {
hw/i386/pc_q35.c +0 -9
index a1f46cd8f03..54c18100122 100644
@@ -639,12 +639,3 @@ static void pc_q35_machine_2_9_options(MachineClass *m)
 }
 
 DEFINE_Q35_MACHINE(2, 9);
-
-static void pc_q35_machine_2_8_options(MachineClass *m)
-{
-    pc_q35_machine_2_9_options(m);
-    compat_props_add(m->compat_props, hw_compat_2_8, hw_compat_2_8_len);
-    compat_props_add(m->compat_props, pc_compat_2_8, pc_compat_2_8_len);
-}
-
-DEFINE_Q35_MACHINE(2, 8);
Signature · 1 line
2.47.1
Reviewed-by on v1 1/18
#2 lore raw

Re: [PATCH 01/18] hw/i386/pc: Remove deprecated pc-q35-2.8 and pc-i440fx-2.8 machines

Quoted 6 lines · On Thu, 1 May 2025 23:04:39 +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 42 lines
---
 hw/i386/pc_piix.c | 9 ---------
 hw/i386/pc_q35.c  | 9 ---------
 2 files changed, 18 deletions(-)
hw/i386/pc_piix.c +0 -9
index 98bd8d0e67b..0d6ad9db627 100644
@@ -746,15 +746,6 @@ static void pc_i440fx_machine_2_9_options(MachineClass *m)
 
 DEFINE_I440FX_MACHINE(2, 9);
 
-static void pc_i440fx_machine_2_8_options(MachineClass *m)
-{
-    pc_i440fx_machine_2_9_options(m);
-    compat_props_add(m->compat_props, hw_compat_2_8, hw_compat_2_8_len);
-    compat_props_add(m->compat_props, pc_compat_2_8, pc_compat_2_8_len);
-}
-
-DEFINE_I440FX_MACHINE(2, 8);
-
 #ifdef CONFIG_ISAPC
 static void isapc_machine_options(MachineClass *m)
 {
hw/i386/pc_q35.c +0 -9
index a1f46cd8f03..54c18100122 100644
@@ -639,12 +639,3 @@ static void pc_q35_machine_2_9_options(MachineClass *m)
 }
 
 DEFINE_Q35_MACHINE(2, 9);
-
-static void pc_q35_machine_2_8_options(MachineClass *m)
-{
-    pc_q35_machine_2_9_options(m);
-    compat_props_add(m->compat_props, hw_compat_2_8, hw_compat_2_8_len);
-    compat_props_add(m->compat_props, pc_compat_2_8, pc_compat_2_8_len);
-}
-
-DEFINE_Q35_MACHINE(2, 8);
#3 lore raw

PATCH 2/18 hw/i386/pc: Remove pc_compat_2_8[] array

In reply to Philippe Mathieu-Daudé

The pc_compat_2_8[] array was only used by the pc-q35-2.8 and pc-i440fx-2.8 machines, which got removed. Remove it.

---
 include/hw/i386/pc.h | 3 ---
 hw/i386/pc.c         | 9 ---------
 2 files changed, 12 deletions(-)
include/hw/i386/pc.h +0 -3
index 319ec82f709..db02cbc0d65 100644
@@ -286,9 +286,6 @@ extern const size_t pc_compat_2_10_len;
 extern GlobalProperty pc_compat_2_9[];
 extern const size_t pc_compat_2_9_len;
 
-extern GlobalProperty pc_compat_2_8[];
-extern const size_t pc_compat_2_8_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 -9
index ee7095c89a8..5f07a44d447 100644
@@ -232,15 +232,6 @@ GlobalProperty pc_compat_2_9[] = {
 };
 const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9);
 
-GlobalProperty pc_compat_2_8[] = {
-    { TYPE_X86_CPU, "tcg-cpuid", "off" },
-    { "kvmclock", "x-mach-use-reliable-get-clock", "off" },
-    { "ICH9-LPC", "x-smi-broadcast", "off" },
-    { TYPE_X86_CPU, "vmware-cpuid-freq", "off" },
-    { "Haswell-" TYPE_X86_CPU, "stepping", "1" },
-};
-const size_t pc_compat_2_8_len = G_N_ELEMENTS(pc_compat_2_8);
-
 /*
  * @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
Reviewed-by on v1 2/18
#4 lore raw

Re: [PATCH 02/18] hw/i386/pc: Remove pc_compat_2_8[] array

Quoted 4 lines · On Thu, 1 May 2025 23:04:40 +0200 Philippe Mathieu-Daudé <[email protected]>…

The pc_compat_2_8[] array was only used by the pc-q35-2.8 and pc-i440fx-2.8 machines, which got removed. Remove it.

Quoted 39 lines
---
 include/hw/i386/pc.h | 3 ---
 hw/i386/pc.c         | 9 ---------
 2 files changed, 12 deletions(-)
include/hw/i386/pc.h +0 -3
index 319ec82f709..db02cbc0d65 100644
@@ -286,9 +286,6 @@ extern const size_t pc_compat_2_10_len;
 extern GlobalProperty pc_compat_2_9[];
 extern const size_t pc_compat_2_9_len;
 
-extern GlobalProperty pc_compat_2_8[];
-extern const size_t pc_compat_2_8_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 -9
index ee7095c89a8..5f07a44d447 100644
@@ -232,15 +232,6 @@ GlobalProperty pc_compat_2_9[] = {
 };
 const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9);
 
-GlobalProperty pc_compat_2_8[] = {
-    { TYPE_X86_CPU, "tcg-cpuid", "off" },
-    { "kvmclock", "x-mach-use-reliable-get-clock", "off" },
-    { "ICH9-LPC", "x-smi-broadcast", "off" },
-    { TYPE_X86_CPU, "vmware-cpuid-freq", "off" },
-    { "Haswell-" TYPE_X86_CPU, "stepping", "1" },
-};
-const size_t pc_compat_2_8_len = G_N_ELEMENTS(pc_compat_2_8);
-
 /*
  * @PC_FW_DATA:
  * Size of the chunk of memory at the top of RAM for the BIOS ACPI tables
#5 lore raw

PATCH 3/18 hw/southbridge/ich9: Remove ICH9_LPC_SMI_F_BROADCAST_BIT definition

In reply to Philippe Mathieu-Daudé

The ICH9_LPC_SMI_F_BROADCAST_BIT feature bit was only set in the pc_compat_2_8[] array, via the 'x-smi-broadcast=off' property. We removed all machines using that array, lets remove that property and all the code around it.

---
 include/hw/southbridge/ich9.h |  1 -
 hw/acpi/ich9.c                |  6 ++----
 hw/isa/lpc_ich9.c             | 22 +++-------------------
 3 files changed, 5 insertions(+), 24 deletions(-)
include/hw/southbridge/ich9.h +0 -1
index 1e231e89c92..4764c03ac2d 100644
@@ -244,7 +244,6 @@ struct ICH9LPCState {
 #define ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP "x-smi-negotiated-features"
 
 /* bit positions used in fw_cfg SMI feature negotiation */
-#define ICH9_LPC_SMI_F_BROADCAST_BIT            0
 #define ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT          1
 #define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT       2
 
hw/acpi/ich9.c +2 -4
index c7a735bf642..40564605735 100644
@@ -477,8 +477,7 @@ void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
     if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
         uint64_t negotiated = lpc->smi_negotiated_features;
 
-        if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) &&
-            !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
+        if (!(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
             error_setg(errp, "cpu hotplug with SMI wasn't enabled by firmware");
             error_append_hint(errp, "update machine type to newer than 5.1 "
                 "and firmware that suppors CPU hotplug with SMM");
@@ -526,8 +525,7 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
                !lpc->pm.cpu_hotplug_legacy) {
         uint64_t negotiated = lpc->smi_negotiated_features;
 
-        if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) &&
-            !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) {
+        if (!(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) {
             error_setg(errp, "cpu hot-unplug with SMI wasn't enabled "
                              "by firmware");
             error_append_hint(errp, "update machine type to a version having "
hw/isa/lpc_ich9.c +3 -19
index 71afb45b631..c57a06e0dde 100644
@@ -400,15 +400,6 @@ static void smi_features_ok_callback(void *opaque)
     guest_cpu_hotplug_features = guest_features &
                                  (BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT) |
                                   BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT));
-    if (!(guest_features & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT)) &&
-        guest_cpu_hotplug_features) {
-        /*
-         * cpu hot-[un]plug with SMI requires SMI broadcast,
-         * leave @features_ok at zero
-         */
-        return;
-    }
-
     if (guest_cpu_hotplug_features ==
         BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) {
         /* cpu hot-unplug is unsupported without cpu-hotplug */
@@ -470,14 +461,9 @@ static void ich9_apm_ctrl_changed(uint32_t val, void *arg)
 
     /* SMI_EN = PMBASE + 30. SMI control and enable register */
     if (lpc->pm.smi_en & ICH9_PMIO_SMI_EN_APMC_EN) {
-        if (lpc->smi_negotiated_features &
-            (UINT64_C(1) << ICH9_LPC_SMI_F_BROADCAST_BIT)) {
-            CPUState *cs;
-            CPU_FOREACH(cs) {
-                cpu_interrupt(cs, CPU_INTERRUPT_SMI);
-            }
-        } else {
-            cpu_interrupt(current_cpu, CPU_INTERRUPT_SMI);
+        CPUState *cs;
+        CPU_FOREACH(cs) {
+            cpu_interrupt(cs, CPU_INTERRUPT_SMI);
         }
     }
 }
@@ -830,8 +816,6 @@ static const Property ich9_lpc_properties[] = {
     DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, false),
     DEFINE_PROP_BOOL("smm-compat", ICH9LPCState, pm.smm_compat, false),
     DEFINE_PROP_BOOL("smm-enabled", ICH9LPCState, pm.smm_enabled, false),
-    DEFINE_PROP_BIT64("x-smi-broadcast", ICH9LPCState, smi_host_features,
-                      ICH9_LPC_SMI_F_BROADCAST_BIT, true),
     DEFINE_PROP_BIT64("x-smi-cpu-hotplug", ICH9LPCState, smi_host_features,
                       ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT, true),
     DEFINE_PROP_BIT64("x-smi-cpu-hotunplug", ICH9LPCState, smi_host_features,
Signature · 1 line
2.47.1
Reviewed-by on v1 3/18
#6 lore raw

Re: [PATCH 03/18] hw/southbridge/ich9: Remove ICH9_LPC_SMI_F_BROADCAST_BIT definition

Quoted 6 lines · On Thu, 1 May 2025 23:04:41 +0200 Philippe Mathieu-Daudé <[email protected]>…

The ICH9_LPC_SMI_F_BROADCAST_BIT feature bit was only set in the pc_compat_2_8[] array, via the 'x-smi-broadcast=off' property. We removed all machines using that array, lets remove that property and all the code around it.

Quoted 89 lines
---
 include/hw/southbridge/ich9.h |  1 -
 hw/acpi/ich9.c                |  6 ++----
 hw/isa/lpc_ich9.c             | 22 +++-------------------
 3 files changed, 5 insertions(+), 24 deletions(-)
include/hw/southbridge/ich9.h +0 -1
index 1e231e89c92..4764c03ac2d 100644
@@ -244,7 +244,6 @@ struct ICH9LPCState {
 #define ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP "x-smi-negotiated-features"
 
 /* bit positions used in fw_cfg SMI feature negotiation */
-#define ICH9_LPC_SMI_F_BROADCAST_BIT            0
 #define ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT          1
 #define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT       2
 
hw/acpi/ich9.c +2 -4
index c7a735bf642..40564605735 100644
@@ -477,8 +477,7 @@ void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
     if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
         uint64_t negotiated = lpc->smi_negotiated_features;
 
-        if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) &&
-            !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
+        if (!(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
             error_setg(errp, "cpu hotplug with SMI wasn't enabled by firmware");
             error_append_hint(errp, "update machine type to newer than 5.1 "
                 "and firmware that suppors CPU hotplug with SMM");
@@ -526,8 +525,7 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
                !lpc->pm.cpu_hotplug_legacy) {
         uint64_t negotiated = lpc->smi_negotiated_features;
 
-        if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) &&
-            !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) {
+        if (!(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) {
             error_setg(errp, "cpu hot-unplug with SMI wasn't enabled "
                              "by firmware");
             error_append_hint(errp, "update machine type to a version having "
hw/isa/lpc_ich9.c +3 -19
index 71afb45b631..c57a06e0dde 100644
@@ -400,15 +400,6 @@ static void smi_features_ok_callback(void *opaque)
     guest_cpu_hotplug_features = guest_features &
                                  (BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT) |
                                   BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT));
-    if (!(guest_features & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT)) &&
-        guest_cpu_hotplug_features) {
-        /*
-         * cpu hot-[un]plug with SMI requires SMI broadcast,
-         * leave @features_ok at zero
-         */
-        return;
-    }
-
     if (guest_cpu_hotplug_features ==
         BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) {
         /* cpu hot-unplug is unsupported without cpu-hotplug */
@@ -470,14 +461,9 @@ static void ich9_apm_ctrl_changed(uint32_t val, void *arg)
 
     /* SMI_EN = PMBASE + 30. SMI control and enable register */
     if (lpc->pm.smi_en & ICH9_PMIO_SMI_EN_APMC_EN) {
-        if (lpc->smi_negotiated_features &
-            (UINT64_C(1) << ICH9_LPC_SMI_F_BROADCAST_BIT)) {
-            CPUState *cs;
-            CPU_FOREACH(cs) {
-                cpu_interrupt(cs, CPU_INTERRUPT_SMI);
-            }
-        } else {
-            cpu_interrupt(current_cpu, CPU_INTERRUPT_SMI);
+        CPUState *cs;
+        CPU_FOREACH(cs) {
+            cpu_interrupt(cs, CPU_INTERRUPT_SMI);
         }
     }
 }
@@ -830,8 +816,6 @@ static const Property ich9_lpc_properties[] = {
     DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, false),
     DEFINE_PROP_BOOL("smm-compat", ICH9LPCState, pm.smm_compat, false),
     DEFINE_PROP_BOOL("smm-enabled", ICH9LPCState, pm.smm_enabled, false),
-    DEFINE_PROP_BIT64("x-smi-broadcast", ICH9LPCState, smi_host_features,
-                      ICH9_LPC_SMI_F_BROADCAST_BIT, true),
     DEFINE_PROP_BIT64("x-smi-cpu-hotplug", ICH9LPCState, smi_host_features,
                       ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT, true),
     DEFINE_PROP_BIT64("x-smi-cpu-hotunplug", ICH9LPCState, smi_host_features,
Reviewed-by on v1 3/18
#7 lore raw

Re: [PATCH 03/18] hw/southbridge/ich9: Remove ICH9_LPC_SMI_F_BROADCAST_BIT definition

In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

The ICH9_LPC_SMI_F_BROADCAST_BIT feature bit was only set in the pc_compat_2_8[] array, via the 'x-smi-broadcast=off' property. We removed all machines using that array, lets remove that property and all the code around it.

---
  include/hw/southbridge/ich9.h |  1 -
  hw/acpi/ich9.c                |  6 ++----
  hw/isa/lpc_ich9.c             | 22 +++-------------------
  3 files changed, 5 insertions(+), 24 deletions(-)
#8 lore raw

Re: [PATCH 03/18] hw/southbridge/ich9: Remove ICH9_LPC_SMI_F_BROADCAST_BIT definition

In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

The ICH9_LPC_SMI_F_BROADCAST_BIT feature bit was only set in the pc_compat_2_8[] array, via the 'x-smi-broadcast=off' property. We removed all machines using that array, lets remove that property and all the code around it.

---
  include/hw/southbridge/ich9.h |  1 -
  hw/acpi/ich9.c                |  6 ++----
  hw/isa/lpc_ich9.c             | 22 +++-------------------
  3 files changed, 5 insertions(+), 24 deletions(-)

FWIW, this patch seems to break tests/qtest/cpu-plug-test ... I get the error message "cpu hotplug with SMI wasn't enabled by firmware". Sounds like the guest has the enable this feature, too, so I assume we cannot simply assume that it is always available now?

Thomas

Quoted 83 lines
include/hw/southbridge/ich9.h +0 -1
index 1e231e89c92..4764c03ac2d 100644
@@ -244,7 +244,6 @@ struct ICH9LPCState {
  #define ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP "x-smi-negotiated-features"
 
  /* bit positions used in fw_cfg SMI feature negotiation */
-#define ICH9_LPC_SMI_F_BROADCAST_BIT            0
  #define ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT          1
  #define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT       2
 
hw/acpi/ich9.c +2 -4
index c7a735bf642..40564605735 100644
@@ -477,8 +477,7 @@ void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
      if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
          uint64_t negotiated = lpc->smi_negotiated_features;
 
-        if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) &&
-            !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
+        if (!(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
              error_setg(errp, "cpu hotplug with SMI wasn't enabled by firmware");
              error_append_hint(errp, "update machine type to newer than 5.1 "
                  "and firmware that suppors CPU hotplug with SMM");
@@ -526,8 +525,7 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
                 !lpc->pm.cpu_hotplug_legacy) {
          uint64_t negotiated = lpc->smi_negotiated_features;
 
-        if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) &&
-            !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) {
+        if (!(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) {
              error_setg(errp, "cpu hot-unplug with SMI wasn't enabled "
                               "by firmware");
              error_append_hint(errp, "update machine type to a version having "
hw/isa/lpc_ich9.c +3 -19
index 71afb45b631..c57a06e0dde 100644
@@ -400,15 +400,6 @@ static void smi_features_ok_callback(void *opaque)
      guest_cpu_hotplug_features = guest_features &
                                   (BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT) |
                                    BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT));
-    if (!(guest_features & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT)) &&
-        guest_cpu_hotplug_features) {
-        /*
-         * cpu hot-[un]plug with SMI requires SMI broadcast,
-         * leave @features_ok at zero
-         */
-        return;
-    }
-
      if (guest_cpu_hotplug_features ==
          BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) {
          /* cpu hot-unplug is unsupported without cpu-hotplug */
@@ -470,14 +461,9 @@ static void ich9_apm_ctrl_changed(uint32_t val, void *arg)
 
      /* SMI_EN = PMBASE + 30. SMI control and enable register */
      if (lpc->pm.smi_en & ICH9_PMIO_SMI_EN_APMC_EN) {
-        if (lpc->smi_negotiated_features &
-            (UINT64_C(1) << ICH9_LPC_SMI_F_BROADCAST_BIT)) {
-            CPUState *cs;
-            CPU_FOREACH(cs) {
-                cpu_interrupt(cs, CPU_INTERRUPT_SMI);
-            }
-        } else {
-            cpu_interrupt(current_cpu, CPU_INTERRUPT_SMI);
+        CPUState *cs;
+        CPU_FOREACH(cs) {
+            cpu_interrupt(cs, CPU_INTERRUPT_SMI);
          }
      }
  }
@@ -830,8 +816,6 @@ static const Property ich9_lpc_properties[] = {
      DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, false),
      DEFINE_PROP_BOOL("smm-compat", ICH9LPCState, pm.smm_compat, false),
      DEFINE_PROP_BOOL("smm-enabled", ICH9LPCState, pm.smm_enabled, false),
-    DEFINE_PROP_BIT64("x-smi-broadcast", ICH9LPCState, smi_host_features,
-                      ICH9_LPC_SMI_F_BROADCAST_BIT, true),
      DEFINE_PROP_BIT64("x-smi-cpu-hotplug", ICH9LPCState, smi_host_features,
                        ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT, true),
      DEFINE_PROP_BIT64("x-smi-cpu-hotunplug", ICH9LPCState, smi_host_features,
#9 lore raw

Re: [PATCH 03/18] hw/southbridge/ich9: Remove ICH9_LPC_SMI_F_BROADCAST_BIT definition

Quoted 13 lines · On Tue, 24 Feb 2026 16:24:10 +0100 Thomas Huth <[email protected]> wrote:
Quoted 11 lines · Philippe Mathieu-Daudé

The ICH9_LPC_SMI_F_BROADCAST_BIT feature bit was only set in the pc_compat_2_8[] array, via the 'x-smi-broadcast=off' property. We removed all machines using that array, lets remove that property and all the code around it.

---
  include/hw/southbridge/ich9.h |  1 -
  hw/acpi/ich9.c                |  6 ++----
  hw/isa/lpc_ich9.c             | 22 +++-------------------
  3 files changed, 5 insertions(+), 24 deletions(-)  
Quoted 4 lines

FWIW, this patch seems to break tests/qtest/cpu-plug-test ... I get the error message "cpu hotplug with SMI wasn't enabled by firmware". Sounds like the guest has the enable this feature, too, so I assume we cannot simply assume that it is always available now?

I'll post fixed up patch as reply to your latest respin of this series

Quoted 89 lines

Thomas

Quoted 83 lines
include/hw/southbridge/ich9.h +0 -1
index 1e231e89c92..4764c03ac2d 100644
@@ -244,7 +244,6 @@ struct ICH9LPCState {
  #define ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP "x-smi-negotiated-features"
 
  /* bit positions used in fw_cfg SMI feature negotiation */
-#define ICH9_LPC_SMI_F_BROADCAST_BIT            0
  #define ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT          1
  #define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT       2
 
hw/acpi/ich9.c +2 -4
index c7a735bf642..40564605735 100644
@@ -477,8 +477,7 @@ void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
      if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
          uint64_t negotiated = lpc->smi_negotiated_features;
 
-        if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) &&
-            !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
+        if (!(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
              error_setg(errp, "cpu hotplug with SMI wasn't enabled by firmware");
              error_append_hint(errp, "update machine type to newer than 5.1 "
                  "and firmware that suppors CPU hotplug with SMM");
@@ -526,8 +525,7 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
                 !lpc->pm.cpu_hotplug_legacy) {
          uint64_t negotiated = lpc->smi_negotiated_features;
 
-        if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) &&
-            !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) {
+        if (!(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) {
              error_setg(errp, "cpu hot-unplug with SMI wasn't enabled "
                               "by firmware");
              error_append_hint(errp, "update machine type to a version having "
hw/isa/lpc_ich9.c +3 -19
index 71afb45b631..c57a06e0dde 100644
@@ -400,15 +400,6 @@ static void smi_features_ok_callback(void *opaque)
      guest_cpu_hotplug_features = guest_features &
                                   (BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT) |
                                    BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT));
-    if (!(guest_features & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT)) &&
-        guest_cpu_hotplug_features) {
-        /*
-         * cpu hot-[un]plug with SMI requires SMI broadcast,
-         * leave @features_ok at zero
-         */
-        return;
-    }
-
      if (guest_cpu_hotplug_features ==
          BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) {
          /* cpu hot-unplug is unsupported without cpu-hotplug */
@@ -470,14 +461,9 @@ static void ich9_apm_ctrl_changed(uint32_t val, void *arg)
 
      /* SMI_EN = PMBASE + 30. SMI control and enable register */
      if (lpc->pm.smi_en & ICH9_PMIO_SMI_EN_APMC_EN) {
-        if (lpc->smi_negotiated_features &
-            (UINT64_C(1) << ICH9_LPC_SMI_F_BROADCAST_BIT)) {
-            CPUState *cs;
-            CPU_FOREACH(cs) {
-                cpu_interrupt(cs, CPU_INTERRUPT_SMI);
-            }
-        } else {
-            cpu_interrupt(current_cpu, CPU_INTERRUPT_SMI);
+        CPUState *cs;
+        CPU_FOREACH(cs) {
+            cpu_interrupt(cs, CPU_INTERRUPT_SMI);
          }
      }
  }
@@ -830,8 +816,6 @@ static const Property ich9_lpc_properties[] = {
      DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, false),
      DEFINE_PROP_BOOL("smm-compat", ICH9LPCState, pm.smm_compat, false),
      DEFINE_PROP_BOOL("smm-enabled", ICH9LPCState, pm.smm_enabled, false),
-    DEFINE_PROP_BIT64("x-smi-broadcast", ICH9LPCState, smi_host_features,
-                      ICH9_LPC_SMI_F_BROADCAST_BIT, true),
      DEFINE_PROP_BIT64("x-smi-cpu-hotplug", ICH9LPCState, smi_host_features,
                        ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT, true),
      DEFINE_PROP_BIT64("x-smi-cpu-hotunplug", ICH9LPCState, smi_host_features,  
#10 lore raw

PATCH 4/18 hw/i386/kvm: Remove KVMClockState::mach_use_reliable_get_clock field

In reply to Philippe Mathieu-Daudé

The KVMClockState::mach_use_reliable_get_clock boolean was only used by the pc-q35-2.8 and pc-i440fx-2.8 machines, which got removed. Remove it, along with the 'x-mach-use-reliable-get-clock' property.

---
 hw/i386/kvm/clock.c | 18 ------------------
 1 file changed, 18 deletions(-)
hw/i386/kvm/clock.c +0 -18
index f56382717f7..726ebfcb0cb 100644
@@ -23,7 +23,6 @@
 #include "migration/vmstate.h"
 #include "hw/sysbus.h"
 #include "hw/i386/kvm/clock.h"
-#include "hw/qdev-properties.h"
 #include "qapi/error.h"
 
 #include <linux/kvm.h>
@@ -43,9 +42,6 @@ struct KVMClockState {
     /* whether the 'clock' value was obtained in the 'paused' state */
     bool runstate_paused;
 
-    /* whether machine type supports reliable KVM_GET_CLOCK */
-    bool mach_use_reliable_get_clock;
-
     /* whether the 'clock' value was obtained in a host with
      * reliable KVM_GET_CLOCK */
     bool clock_is_reliable;
@@ -232,18 +228,10 @@ static void kvmclock_realize(DeviceState *dev, Error **errp)
     qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
 }
 
-static bool kvmclock_clock_is_reliable_needed(void *opaque)
-{
-    KVMClockState *s = opaque;
-
-    return s->mach_use_reliable_get_clock;
-}
-
 static const VMStateDescription kvmclock_reliable_get_clock = {
     .name = "kvmclock/clock_is_reliable",
     .version_id = 1,
     .minimum_version_id = 1,
-    .needed = kvmclock_clock_is_reliable_needed,
     .fields = (const VMStateField[]) {
         VMSTATE_BOOL(clock_is_reliable, KVMClockState),
         VMSTATE_END_OF_LIST()
@@ -304,18 +292,12 @@ static const VMStateDescription kvmclock_vmsd = {
     }
 };
 
-static const Property kvmclock_properties[] = {
-    DEFINE_PROP_BOOL("x-mach-use-reliable-get-clock", KVMClockState,
-                      mach_use_reliable_get_clock, true),
-};
-
 static void kvmclock_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = kvmclock_realize;
     dc->vmsd = &kvmclock_vmsd;
-    device_class_set_props(dc, kvmclock_properties);
 }
 
 static const TypeInfo kvmclock_info = {
Signature · 1 line
2.47.1
Reviewed-by on v1 4/18
#11 lore raw

Re: [PATCH 04/18] hw/i386/kvm: Remove KVMClockState::mach_use_reliable_get_clock field

Quoted 5 lines · On Thu, 1 May 2025 23:04:42 +0200 Philippe Mathieu-Daudé <[email protected]>…

The KVMClockState::mach_use_reliable_get_clock boolean was only used by the pc-q35-2.8 and pc-i440fx-2.8 machines, which got removed. Remove it, along with the 'x-mach-use-reliable-get-clock' property.

Quoted 64 lines
---
 hw/i386/kvm/clock.c | 18 ------------------
 1 file changed, 18 deletions(-)
hw/i386/kvm/clock.c +0 -18
index f56382717f7..726ebfcb0cb 100644
@@ -23,7 +23,6 @@
 #include "migration/vmstate.h"
 #include "hw/sysbus.h"
 #include "hw/i386/kvm/clock.h"
-#include "hw/qdev-properties.h"
 #include "qapi/error.h"
 
 #include <linux/kvm.h>
@@ -43,9 +42,6 @@ struct KVMClockState {
     /* whether the 'clock' value was obtained in the 'paused' state */
     bool runstate_paused;
 
-    /* whether machine type supports reliable KVM_GET_CLOCK */
-    bool mach_use_reliable_get_clock;
-
     /* whether the 'clock' value was obtained in a host with
      * reliable KVM_GET_CLOCK */
     bool clock_is_reliable;
@@ -232,18 +228,10 @@ static void kvmclock_realize(DeviceState *dev, Error **errp)
     qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
 }
 
-static bool kvmclock_clock_is_reliable_needed(void *opaque)
-{
-    KVMClockState *s = opaque;
-
-    return s->mach_use_reliable_get_clock;
-}
-
 static const VMStateDescription kvmclock_reliable_get_clock = {
     .name = "kvmclock/clock_is_reliable",
     .version_id = 1,
     .minimum_version_id = 1,
-    .needed = kvmclock_clock_is_reliable_needed,
     .fields = (const VMStateField[]) {
         VMSTATE_BOOL(clock_is_reliable, KVMClockState),
         VMSTATE_END_OF_LIST()
@@ -304,18 +292,12 @@ static const VMStateDescription kvmclock_vmsd = {
     }
 };
 
-static const Property kvmclock_properties[] = {
-    DEFINE_PROP_BOOL("x-mach-use-reliable-get-clock", KVMClockState,
-                      mach_use_reliable_get_clock, true),
-};
-
 static void kvmclock_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = kvmclock_realize;
     dc->vmsd = &kvmclock_vmsd;
-    device_class_set_props(dc, kvmclock_properties);
 }
 
 static const TypeInfo kvmclock_info = {
#12 lore raw

PATCH 5/18 hw/core/machine: Remove hw_compat_2_8[] array

In reply to Philippe Mathieu-Daudé

The hw_compat_2_8[] array was only used by the pc-q35-2.8 and pc-i440fx-2.8 machines, which got removed. Remove it.

---
 include/hw/boards.h |  3 ---
 hw/core/machine.c   | 14 --------------
 2 files changed, 17 deletions(-)
include/hw/boards.h +0 -3
index 77707c4376a..84bd3735c42 100644
@@ -835,7 +835,4 @@ extern const size_t hw_compat_2_10_len;
 extern GlobalProperty hw_compat_2_9[];
 extern const size_t hw_compat_2_9_len;
 
-extern GlobalProperty hw_compat_2_8[];
-extern const size_t hw_compat_2_8_len;
-
 #endif
hw/core/machine.c +0 -14
index bde19a2ff67..bc0606cf740 100644
@@ -252,20 +252,6 @@ GlobalProperty hw_compat_2_9[] = {
 };
 const size_t hw_compat_2_9_len = G_N_ELEMENTS(hw_compat_2_9);
 
-GlobalProperty hw_compat_2_8[] = {
-    { "fw_cfg_mem", "x-file-slots", "0x10" },
-    { "fw_cfg_io", "x-file-slots", "0x10" },
-    { "pflash_cfi01", "old-multiple-chip-handling", "on" },
-    { "pci-bridge", "shpc", "on" },
-    { TYPE_PCI_DEVICE, "x-pcie-extcap-init", "off" },
-    { "virtio-pci", "x-pcie-deverr-init", "off" },
-    { "virtio-pci", "x-pcie-lnkctl-init", "off" },
-    { "virtio-pci", "x-pcie-pm-init", "off" },
-    { "cirrus-vga", "vgamem_mb", "8" },
-    { "isa-cirrus-vga", "vgamem_mb", "8" },
-};
-const size_t hw_compat_2_8_len = G_N_ELEMENTS(hw_compat_2_8);
-
 MachineState *current_machine;
 
 static char *machine_get_kernel(Object *obj, Error **errp)
Signature · 1 line
2.47.1
Reviewed-by on v1 5/18
#13 lore raw

Re: [PATCH 05/18] hw/core/machine: Remove hw_compat_2_8[] array

Quoted 4 lines · On Thu, 1 May 2025 23:04:43 +0200 Philippe Mathieu-Daudé <[email protected]>…

The hw_compat_2_8[] array was only used by the pc-q35-2.8 and pc-i440fx-2.8 machines, which got removed. Remove it.

Quoted 42 lines
---
 include/hw/boards.h |  3 ---
 hw/core/machine.c   | 14 --------------
 2 files changed, 17 deletions(-)
include/hw/boards.h +0 -3
index 77707c4376a..84bd3735c42 100644
@@ -835,7 +835,4 @@ extern const size_t hw_compat_2_10_len;
 extern GlobalProperty hw_compat_2_9[];
 extern const size_t hw_compat_2_9_len;
 
-extern GlobalProperty hw_compat_2_8[];
-extern const size_t hw_compat_2_8_len;
-
 #endif
hw/core/machine.c +0 -14
index bde19a2ff67..bc0606cf740 100644
@@ -252,20 +252,6 @@ GlobalProperty hw_compat_2_9[] = {
 };
 const size_t hw_compat_2_9_len = G_N_ELEMENTS(hw_compat_2_9);
 
-GlobalProperty hw_compat_2_8[] = {
-    { "fw_cfg_mem", "x-file-slots", "0x10" },
-    { "fw_cfg_io", "x-file-slots", "0x10" },
-    { "pflash_cfi01", "old-multiple-chip-handling", "on" },
-    { "pci-bridge", "shpc", "on" },
-    { TYPE_PCI_DEVICE, "x-pcie-extcap-init", "off" },
-    { "virtio-pci", "x-pcie-deverr-init", "off" },
-    { "virtio-pci", "x-pcie-lnkctl-init", "off" },
-    { "virtio-pci", "x-pcie-pm-init", "off" },
-    { "cirrus-vga", "vgamem_mb", "8" },
-    { "isa-cirrus-vga", "vgamem_mb", "8" },
-};
-const size_t hw_compat_2_8_len = G_N_ELEMENTS(hw_compat_2_8);
-
 MachineState *current_machine;
 
 static char *machine_get_kernel(Object *obj, Error **errp)
#14 lore raw

PATCH 6/18 hw/block/pflash: Remove PFlashCFI01::old_multiple_chip_handling field

In reply to Philippe Mathieu-Daudé

The PFlashCFI01::old_multiple_chip_handling boolean was only set in the hw_compat_2_8[] array, via the 'old-multiple-chip-handling=on' property. We removed all machines using that array, lets remove that property and all the code around it.

---
 hw/block/pflash_cfi01.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
hw/block/pflash_cfi01.c +3 -11
index 168101d8dfe..bba099a0c9e 100644
@@ -84,7 +84,6 @@ struct PFlashCFI01 {
     char *name;
     void *storage;
     VMChangeStateEntry *vmstate;
-    bool old_multiple_chip_handling;
 
     /* block update buffer */
     unsigned char *blk_bytes;
@@ -703,13 +702,8 @@ static void pflash_cfi01_fill_cfi_table(PFlashCFI01 *pfl)
      * in the cfi_table[].
      */
     num_devices = pfl->device_width ? (pfl->bank_width / pfl->device_width) : 1;
-    if (pfl->old_multiple_chip_handling) {
-        blocks_per_device = pfl->nb_blocs / num_devices;
-        sector_len_per_device = pfl->sector_len;
-    } else {
-        blocks_per_device = pfl->nb_blocs;
-        sector_len_per_device = pfl->sector_len / num_devices;
-    }
+    blocks_per_device = pfl->nb_blocs;
+    sector_len_per_device = pfl->sector_len / num_devices;
     device_len = sector_len_per_device * blocks_per_device;
 
     /* Hardcoded CFI table */
@@ -765,7 +759,7 @@ static void pflash_cfi01_fill_cfi_table(PFlashCFI01 *pfl)
         pfl->cfi_table[0x2A] = 0x0B;
     }
     pfl->writeblock_size = 1 << pfl->cfi_table[0x2A];
-    if (!pfl->old_multiple_chip_handling && num_devices > 1) {
+    if (num_devices > 1) {
         pfl->writeblock_size *= num_devices;
     }
 
@@ -930,8 +924,6 @@ static const Property pflash_cfi01_properties[] = {
     DEFINE_PROP_UINT16("id2", PFlashCFI01, ident2, 0),
     DEFINE_PROP_UINT16("id3", PFlashCFI01, ident3, 0),
     DEFINE_PROP_STRING("name", PFlashCFI01, name),
-    DEFINE_PROP_BOOL("old-multiple-chip-handling", PFlashCFI01,
-                     old_multiple_chip_handling, false),
 };
 
 static void pflash_cfi01_class_init(ObjectClass *klass, const void *data)
Signature · 1 line
2.47.1
Reviewed-by on v1 6/18
#15 lore raw

Re: [PATCH 06/18] hw/block/pflash: Remove PFlashCFI01::old_multiple_chip_handling field

Quoted 6 lines · On Thu, 1 May 2025 23:04:44 +0200 Philippe Mathieu-Daudé <[email protected]>…

The PFlashCFI01::old_multiple_chip_handling boolean was only set in the hw_compat_2_8[] array, via the 'old-multiple-chip-handling=on' property. We removed all machines using that array, lets remove that property and all the code around it.

Quoted 50 lines
---
 hw/block/pflash_cfi01.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
hw/block/pflash_cfi01.c +3 -11
index 168101d8dfe..bba099a0c9e 100644
@@ -84,7 +84,6 @@ struct PFlashCFI01 {
     char *name;
     void *storage;
     VMChangeStateEntry *vmstate;
-    bool old_multiple_chip_handling;
 
     /* block update buffer */
     unsigned char *blk_bytes;
@@ -703,13 +702,8 @@ static void pflash_cfi01_fill_cfi_table(PFlashCFI01 *pfl)
      * in the cfi_table[].
      */
     num_devices = pfl->device_width ? (pfl->bank_width / pfl->device_width) : 1;
-    if (pfl->old_multiple_chip_handling) {
-        blocks_per_device = pfl->nb_blocs / num_devices;
-        sector_len_per_device = pfl->sector_len;
-    } else {
-        blocks_per_device = pfl->nb_blocs;
-        sector_len_per_device = pfl->sector_len / num_devices;
-    }
+    blocks_per_device = pfl->nb_blocs;
+    sector_len_per_device = pfl->sector_len / num_devices;
     device_len = sector_len_per_device * blocks_per_device;
 
     /* Hardcoded CFI table */
@@ -765,7 +759,7 @@ static void pflash_cfi01_fill_cfi_table(PFlashCFI01 *pfl)
         pfl->cfi_table[0x2A] = 0x0B;
     }
     pfl->writeblock_size = 1 << pfl->cfi_table[0x2A];
-    if (!pfl->old_multiple_chip_handling && num_devices > 1) {
+    if (num_devices > 1) {
         pfl->writeblock_size *= num_devices;
     }
 
@@ -930,8 +924,6 @@ static const Property pflash_cfi01_properties[] = {
     DEFINE_PROP_UINT16("id2", PFlashCFI01, ident2, 0),
     DEFINE_PROP_UINT16("id3", PFlashCFI01, ident3, 0),
     DEFINE_PROP_STRING("name", PFlashCFI01, name),
-    DEFINE_PROP_BOOL("old-multiple-chip-handling", PFlashCFI01,
-                     old_multiple_chip_handling, false),
 };
 
 static void pflash_cfi01_class_init(ObjectClass *klass, const void *data)
Reviewed-by on v1 6/18
#16 lore raw

Re: [PATCH 06/18] hw/block/pflash: Remove PFlashCFI01::old_multiple_chip_handling field

In reply to Philippe Mathieu-Daudé
Quoted 3 lines · Philippe Mathieu-Daudé

The PFlashCFI01::old_multiple_chip_handling boolean was only set in the hw_compat_2_8[] array, via the 'old-multiple-chip-handling=on' property. We removed all machines using that array, lets remove that

Nit: s/lets/let's/

Apart from that:

Quoted 53 lines

property and all the code around it.

---
  hw/block/pflash_cfi01.c | 14 +++-----------
  1 file changed, 3 insertions(+), 11 deletions(-)
hw/block/pflash_cfi01.c +3 -11
index 168101d8dfe..bba099a0c9e 100644
@@ -84,7 +84,6 @@ struct PFlashCFI01 {
      char *name;
      void *storage;
      VMChangeStateEntry *vmstate;
-    bool old_multiple_chip_handling;
 
      /* block update buffer */
      unsigned char *blk_bytes;
@@ -703,13 +702,8 @@ static void pflash_cfi01_fill_cfi_table(PFlashCFI01 *pfl)
       * in the cfi_table[].
       */
      num_devices = pfl->device_width ? (pfl->bank_width / pfl->device_width) : 1;
-    if (pfl->old_multiple_chip_handling) {
-        blocks_per_device = pfl->nb_blocs / num_devices;
-        sector_len_per_device = pfl->sector_len;
-    } else {
-        blocks_per_device = pfl->nb_blocs;
-        sector_len_per_device = pfl->sector_len / num_devices;
-    }
+    blocks_per_device = pfl->nb_blocs;
+    sector_len_per_device = pfl->sector_len / num_devices;
      device_len = sector_len_per_device * blocks_per_device;
 
      /* Hardcoded CFI table */
@@ -765,7 +759,7 @@ static void pflash_cfi01_fill_cfi_table(PFlashCFI01 *pfl)
          pfl->cfi_table[0x2A] = 0x0B;
      }
      pfl->writeblock_size = 1 << pfl->cfi_table[0x2A];
-    if (!pfl->old_multiple_chip_handling && num_devices > 1) {
+    if (num_devices > 1) {
          pfl->writeblock_size *= num_devices;
      }
 
@@ -930,8 +924,6 @@ static const Property pflash_cfi01_properties[] = {
      DEFINE_PROP_UINT16("id2", PFlashCFI01, ident2, 0),
      DEFINE_PROP_UINT16("id3", PFlashCFI01, ident3, 0),
      DEFINE_PROP_STRING("name", PFlashCFI01, name),
-    DEFINE_PROP_BOOL("old-multiple-chip-handling", PFlashCFI01,
-                     old_multiple_chip_handling, false),
  };
 
  static void pflash_cfi01_class_init(ObjectClass *klass, const void *data)
#17 lore raw

PATCH 7/18 hw/pci/pcie: Remove QEMU_PCIE_EXTCAP_INIT definition

In reply to Philippe Mathieu-Daudé

QEMU_PCIE_EXTCAP_INIT was only used by the hw_compat_2_8[] array, via the 'x-pcie-extcap-init=off' property. We removed all machines using that array, lets remove all the code around QEMU_PCIE_EXTCAP_INIT.

---
 include/hw/pci/pci.h | 2 --
 hw/pci/pci.c         | 2 --
 hw/pci/pcie.c        | 5 -----
 3 files changed, 9 deletions(-)
include/hw/pci/pci.h +0 -2
index c2fe6caa2c6..6c72a61c4b6 100644
@@ -210,8 +210,6 @@ enum {
     /* Link active status in endpoint capability is always set */
 #define QEMU_PCIE_LNKSTA_DLLLA_BITNR 8
     QEMU_PCIE_LNKSTA_DLLLA = (1 << QEMU_PCIE_LNKSTA_DLLLA_BITNR),
-#define QEMU_PCIE_EXTCAP_INIT_BITNR 9
-    QEMU_PCIE_EXTCAP_INIT = (1 << QEMU_PCIE_EXTCAP_INIT_BITNR),
 #define QEMU_PCIE_CXL_BITNR 10
     QEMU_PCIE_CAP_CXL = (1 << QEMU_PCIE_CXL_BITNR),
 #define QEMU_PCIE_ERR_UNC_MASK_BITNR 11
hw/pci/pci.c +0 -2
index fe38c4c0287..36206c77b7c 100644
@@ -90,8 +90,6 @@ static const Property pci_props[] = {
                     QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false),
     DEFINE_PROP_BIT("x-pcie-lnksta-dllla", PCIDevice, cap_present,
                     QEMU_PCIE_LNKSTA_DLLLA_BITNR, true),
-    DEFINE_PROP_BIT("x-pcie-extcap-init", PCIDevice, cap_present,
-                    QEMU_PCIE_EXTCAP_INIT_BITNR, true),
     DEFINE_PROP_STRING("failover_pair_id", PCIDevice,
                        failover_pair_id),
     DEFINE_PROP_UINT32("acpi-index",  PCIDevice, acpi_index, 0),
hw/pci/pcie.c +0 -5
index 1b12db6fa29..a3969423bd3 100644
@@ -245,11 +245,6 @@ int pcie_cap_init(PCIDevice *dev, uint8_t offset,
 
     pci_set_word(dev->wmask + pos + PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_EETLPPB);
 
-    if (dev->cap_present & QEMU_PCIE_EXTCAP_INIT) {
-        /* read-only to behave like a 'NULL' Extended Capability Header */
-        pci_set_long(dev->wmask + PCI_CONFIG_SPACE_SIZE, 0);
-    }
-
     return pos;
 }
 
Signature · 1 line
2.47.1
#18 lore raw

Re: [PATCH 07/18] hw/pci/pcie: Remove QEMU_PCIE_EXTCAP_INIT definition

Quoted 43 lines · On Thu, 1 May 2025 23:04:45 +0200 Philippe Mathieu-Daudé <[email protected]>…

QEMU_PCIE_EXTCAP_INIT was only used by the hw_compat_2_8[] array, via the 'x-pcie-extcap-init=off' property. We removed all machines using that array, lets remove all the code around QEMU_PCIE_EXTCAP_INIT.

---
 include/hw/pci/pci.h | 2 --
 hw/pci/pci.c         | 2 --
 hw/pci/pcie.c        | 5 -----
 3 files changed, 9 deletions(-)
include/hw/pci/pci.h +0 -2
index c2fe6caa2c6..6c72a61c4b6 100644
@@ -210,8 +210,6 @@ enum {
     /* Link active status in endpoint capability is always set */
 #define QEMU_PCIE_LNKSTA_DLLLA_BITNR 8
     QEMU_PCIE_LNKSTA_DLLLA = (1 << QEMU_PCIE_LNKSTA_DLLLA_BITNR),
-#define QEMU_PCIE_EXTCAP_INIT_BITNR 9
-    QEMU_PCIE_EXTCAP_INIT = (1 << QEMU_PCIE_EXTCAP_INIT_BITNR),
 #define QEMU_PCIE_CXL_BITNR 10
     QEMU_PCIE_CAP_CXL = (1 << QEMU_PCIE_CXL_BITNR),
 #define QEMU_PCIE_ERR_UNC_MASK_BITNR 11
hw/pci/pci.c +0 -2
index fe38c4c0287..36206c77b7c 100644
@@ -90,8 +90,6 @@ static const Property pci_props[] = {
                     QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false),
     DEFINE_PROP_BIT("x-pcie-lnksta-dllla", PCIDevice, cap_present,
                     QEMU_PCIE_LNKSTA_DLLLA_BITNR, true),
-    DEFINE_PROP_BIT("x-pcie-extcap-init", PCIDevice, cap_present,
-                    QEMU_PCIE_EXTCAP_INIT_BITNR, true),
     DEFINE_PROP_STRING("failover_pair_id", PCIDevice,
                        failover_pair_id),
     DEFINE_PROP_UINT32("acpi-index",  PCIDevice, acpi_index, 0),
hw/pci/pcie.c +0 -0
index 1b12db6fa29..a3969423bd3 100644

hw/pci/pcie.c int pcie_cap_init(PCIDevice *dev, uint8_t offset, · line 248

Quoted 4 lines
hw/pci/pcie.c +0 -1
@@ -245,11 +245,6 @@ int pcie_cap_init(PCIDevice *dev, uint8_t offset,
 
     pci_set_word(dev->wmask + pos + PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_EETLPPB);
 
-    if (dev->cap_present & QEMU_PCIE_EXTCAP_INIT) {

so this one is true by default, and with knob removed
anything inside block should be called unconditionally (i.e. not like diff below), aren't it?

Quoted 7 lines
hw/pci/pcie.c +0 -4
-        /* read-only to behave like a 'NULL' Extended Capability Header */
-        pci_set_long(dev->wmask + PCI_CONFIG_SPACE_SIZE, 0);
-    }
-
     return pos;
 }
 
#19 lore raw

PATCH 8/18 hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_DEVERR definition

In reply to Philippe Mathieu-Daudé

VIRTIO_PCI_FLAG_INIT_DEVERR was only used by the hw_compat_2_8[] array, via the 'x-pcie-deverr-init=off' property. We removed all machines using that array, lets remove all the code around VIRTIO_PCI_FLAG_INIT_DEVERR (see commit 9a4c0e220d8 for similar VIRTIO_PCI_FLAG_* enum removal).

---
 include/hw/virtio/virtio-pci.h | 4 ----
 hw/virtio/virtio-pci.c         | 8 ++------
 2 files changed, 2 insertions(+), 10 deletions(-)
include/hw/virtio/virtio-pci.h +0 -4
index 8abc5f8f20d..ed142932f7b 100644
@@ -34,7 +34,6 @@ enum {
     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
     VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
     VIRTIO_PCI_FLAG_ATS_BIT,
-    VIRTIO_PCI_FLAG_INIT_DEVERR_BIT,
     VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,
     VIRTIO_PCI_FLAG_INIT_PM_BIT,
     VIRTIO_PCI_FLAG_INIT_FLR_BIT,
@@ -62,9 +61,6 @@ enum {
 /* address space translation service */
 #define VIRTIO_PCI_FLAG_ATS (1 << VIRTIO_PCI_FLAG_ATS_BIT)
 
-/* Init error enabling flags */
-#define VIRTIO_PCI_FLAG_INIT_DEVERR (1 << VIRTIO_PCI_FLAG_INIT_DEVERR_BIT)
-
 /* Init Link Control register */
 #define VIRTIO_PCI_FLAG_INIT_LNKCTL (1 << VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT)
 
hw/virtio/virtio-pci.c +2 -6
index 4e0d4bda6ed..0075ae590db 100644
@@ -2215,10 +2215,8 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
             last_pcie_cap_offset += PCI_ERR_SIZEOF;
         }
 
-        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_DEVERR) {
-            /* Init error enabling flags */
-            pcie_cap_deverr_init(pci_dev);
-        }
+        /* Init error enabling flags */
+        pcie_cap_deverr_init(pci_dev);
 
         if (proxy->flags & VIRTIO_PCI_FLAG_INIT_LNKCTL) {
             /* Init Link Control Register */
@@ -2349,8 +2347,6 @@ static const Property virtio_pci_properties[] = {
                     VIRTIO_PCI_FLAG_ATS_BIT, false),
     DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT, true),
-    DEFINE_PROP_BIT("x-pcie-deverr-init", VirtIOPCIProxy, flags,
-                    VIRTIO_PCI_FLAG_INIT_DEVERR_BIT, true),
     DEFINE_PROP_BIT("x-pcie-lnkctl-init", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true),
     DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags,
Signature · 1 line
2.47.1
Reviewed-by on v1 8/18
#20 lore raw

Re: [PATCH 08/18] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_DEVERR definition

Quoted 7 lines · On Thu, 1 May 2025 23:04:46 +0200 Philippe Mathieu-Daudé <[email protected]>…

VIRTIO_PCI_FLAG_INIT_DEVERR was only used by the hw_compat_2_8[] array, via the 'x-pcie-deverr-init=off' property. We removed all machines using that array, lets remove all the code around VIRTIO_PCI_FLAG_INIT_DEVERR (see commit 9a4c0e220d8 for similar VIRTIO_PCI_FLAG_* enum removal).

Quoted 53 lines
---
 include/hw/virtio/virtio-pci.h | 4 ----
 hw/virtio/virtio-pci.c         | 8 ++------
 2 files changed, 2 insertions(+), 10 deletions(-)
include/hw/virtio/virtio-pci.h +0 -4
index 8abc5f8f20d..ed142932f7b 100644
@@ -34,7 +34,6 @@ enum {
     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
     VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
     VIRTIO_PCI_FLAG_ATS_BIT,
-    VIRTIO_PCI_FLAG_INIT_DEVERR_BIT,
     VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,
     VIRTIO_PCI_FLAG_INIT_PM_BIT,
     VIRTIO_PCI_FLAG_INIT_FLR_BIT,
@@ -62,9 +61,6 @@ enum {
 /* address space translation service */
 #define VIRTIO_PCI_FLAG_ATS (1 << VIRTIO_PCI_FLAG_ATS_BIT)
 
-/* Init error enabling flags */
-#define VIRTIO_PCI_FLAG_INIT_DEVERR (1 << VIRTIO_PCI_FLAG_INIT_DEVERR_BIT)
-
 /* Init Link Control register */
 #define VIRTIO_PCI_FLAG_INIT_LNKCTL (1 << VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT)
 
hw/virtio/virtio-pci.c +2 -6
index 4e0d4bda6ed..0075ae590db 100644
@@ -2215,10 +2215,8 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
             last_pcie_cap_offset += PCI_ERR_SIZEOF;
         }
 
-        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_DEVERR) {
-            /* Init error enabling flags */
-            pcie_cap_deverr_init(pci_dev);
-        }
+        /* Init error enabling flags */
+        pcie_cap_deverr_init(pci_dev);
 
         if (proxy->flags & VIRTIO_PCI_FLAG_INIT_LNKCTL) {
             /* Init Link Control Register */
@@ -2349,8 +2347,6 @@ static const Property virtio_pci_properties[] = {
                     VIRTIO_PCI_FLAG_ATS_BIT, false),
     DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT, true),
-    DEFINE_PROP_BIT("x-pcie-deverr-init", VirtIOPCIProxy, flags,
-                    VIRTIO_PCI_FLAG_INIT_DEVERR_BIT, true),
     DEFINE_PROP_BIT("x-pcie-lnkctl-init", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true),
     DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags,
#21 lore raw

PATCH 9/18 hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_LNKCTL definition

In reply to Philippe Mathieu-Daudé

VIRTIO_PCI_FLAG_INIT_LNKCTL was only used by the hw_compat_2_8[] array, via the 'x-pcie-lnkctl-init=off' property. We removed all machines using that array, lets remove all the code around VIRTIO_PCI_FLAG_INIT_LNKCTL (see commit 9a4c0e220d8 for similar VIRTIO_PCI_FLAG_* enum removal).

---
 include/hw/virtio/virtio-pci.h | 4 ----
 hw/virtio/virtio-pci.c         | 8 ++------
 2 files changed, 2 insertions(+), 10 deletions(-)
include/hw/virtio/virtio-pci.h +0 -4
index ed142932f7b..a8dd613ffbc 100644
@@ -34,7 +34,6 @@ enum {
     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
     VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
     VIRTIO_PCI_FLAG_ATS_BIT,
-    VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,
     VIRTIO_PCI_FLAG_INIT_PM_BIT,
     VIRTIO_PCI_FLAG_INIT_FLR_BIT,
     VIRTIO_PCI_FLAG_AER_BIT,
@@ -61,9 +60,6 @@ enum {
 /* address space translation service */
 #define VIRTIO_PCI_FLAG_ATS (1 << VIRTIO_PCI_FLAG_ATS_BIT)
 
-/* Init Link Control register */
-#define VIRTIO_PCI_FLAG_INIT_LNKCTL (1 << VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT)
-
 /* Init Power Management */
 #define VIRTIO_PCI_FLAG_INIT_PM (1 << VIRTIO_PCI_FLAG_INIT_PM_BIT)
 
hw/virtio/virtio-pci.c +2 -6
index 0075ae590db..5b86a9a447c 100644
@@ -2218,10 +2218,8 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
         /* Init error enabling flags */
         pcie_cap_deverr_init(pci_dev);
 
-        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_LNKCTL) {
-            /* Init Link Control Register */
-            pcie_cap_lnkctl_init(pci_dev);
-        }
+        /* Init Link Control Register */
+        pcie_cap_lnkctl_init(pci_dev);
 
         if (proxy->flags & VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET) {
             pci_set_word(pci_dev->config + pos + PCI_PM_CTRL,
@@ -2347,8 +2345,6 @@ static const Property virtio_pci_properties[] = {
                     VIRTIO_PCI_FLAG_ATS_BIT, false),
     DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT, true),
-    DEFINE_PROP_BIT("x-pcie-lnkctl-init", VirtIOPCIProxy, flags,
-                    VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true),
     DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_INIT_PM_BIT, true),
     DEFINE_PROP_BIT("x-pcie-pm-no-soft-reset", VirtIOPCIProxy, flags,
Signature · 1 line
2.47.1
Reviewed-by on v1 9/18
#22 lore raw

Re: [PATCH 09/18] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_LNKCTL definition

Quoted 7 lines · On Thu, 1 May 2025 23:04:47 +0200 Philippe Mathieu-Daudé <[email protected]>…

VIRTIO_PCI_FLAG_INIT_LNKCTL was only used by the hw_compat_2_8[] array, via the 'x-pcie-lnkctl-init=off' property. We removed all machines using that array, lets remove all the code around VIRTIO_PCI_FLAG_INIT_LNKCTL (see commit 9a4c0e220d8 for similar VIRTIO_PCI_FLAG_* enum removal).

Quoted 53 lines
---
 include/hw/virtio/virtio-pci.h | 4 ----
 hw/virtio/virtio-pci.c         | 8 ++------
 2 files changed, 2 insertions(+), 10 deletions(-)
include/hw/virtio/virtio-pci.h +0 -4
index ed142932f7b..a8dd613ffbc 100644
@@ -34,7 +34,6 @@ enum {
     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
     VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
     VIRTIO_PCI_FLAG_ATS_BIT,
-    VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,
     VIRTIO_PCI_FLAG_INIT_PM_BIT,
     VIRTIO_PCI_FLAG_INIT_FLR_BIT,
     VIRTIO_PCI_FLAG_AER_BIT,
@@ -61,9 +60,6 @@ enum {
 /* address space translation service */
 #define VIRTIO_PCI_FLAG_ATS (1 << VIRTIO_PCI_FLAG_ATS_BIT)
 
-/* Init Link Control register */
-#define VIRTIO_PCI_FLAG_INIT_LNKCTL (1 << VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT)
-
 /* Init Power Management */
 #define VIRTIO_PCI_FLAG_INIT_PM (1 << VIRTIO_PCI_FLAG_INIT_PM_BIT)
 
hw/virtio/virtio-pci.c +2 -6
index 0075ae590db..5b86a9a447c 100644
@@ -2218,10 +2218,8 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
         /* Init error enabling flags */
         pcie_cap_deverr_init(pci_dev);
 
-        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_LNKCTL) {
-            /* Init Link Control Register */
-            pcie_cap_lnkctl_init(pci_dev);
-        }
+        /* Init Link Control Register */
+        pcie_cap_lnkctl_init(pci_dev);
 
         if (proxy->flags & VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET) {
             pci_set_word(pci_dev->config + pos + PCI_PM_CTRL,
@@ -2347,8 +2345,6 @@ static const Property virtio_pci_properties[] = {
                     VIRTIO_PCI_FLAG_ATS_BIT, false),
     DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT, true),
-    DEFINE_PROP_BIT("x-pcie-lnkctl-init", VirtIOPCIProxy, flags,
-                    VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true),
     DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_INIT_PM_BIT, true),
     DEFINE_PROP_BIT("x-pcie-pm-no-soft-reset", VirtIOPCIProxy, flags,
#23 lore raw

PATCH 10/18 hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_PM definition

In reply to Philippe Mathieu-Daudé

VIRTIO_PCI_FLAG_INIT_PM was only used by the hw_compat_2_8[] array, via the 'x-pcie-pm-init=off' property. We removed all machines using that array, lets remove all the code around VIRTIO_PCI_FLAG_INIT_PM (see commit 9a4c0e220d8 for similar VIRTIO_PCI_FLAG_* enum removal).

---
 include/hw/virtio/virtio-pci.h |  4 ----
 hw/virtio/virtio-pci.c         | 19 +++++--------------
 2 files changed, 5 insertions(+), 18 deletions(-)
include/hw/virtio/virtio-pci.h +0 -4
index a8dd613ffbc..d1f7403cbdf 100644
@@ -34,7 +34,6 @@ enum {
     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
     VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
     VIRTIO_PCI_FLAG_ATS_BIT,
-    VIRTIO_PCI_FLAG_INIT_PM_BIT,
     VIRTIO_PCI_FLAG_INIT_FLR_BIT,
     VIRTIO_PCI_FLAG_AER_BIT,
     VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT,
@@ -60,9 +59,6 @@ enum {
 /* address space translation service */
 #define VIRTIO_PCI_FLAG_ATS (1 << VIRTIO_PCI_FLAG_ATS_BIT)
 
-/* Init Power Management */
-#define VIRTIO_PCI_FLAG_INIT_PM (1 << VIRTIO_PCI_FLAG_INIT_PM_BIT)
-
 /* Init The No_Soft_Reset bit of Power Management */
 #define VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET \
   (1 << VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT)
hw/virtio/virtio-pci.c +5 -14
index 5b86a9a447c..9ec92d5a736 100644
@@ -2226,11 +2226,9 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
                          PCI_PM_CTRL_NO_SOFT_RESET);
         }
 
-        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_PM) {
-            /* Init Power Management Control Register */
-            pci_set_word(pci_dev->wmask + pos + PCI_PM_CTRL,
-                         PCI_PM_CTRL_STATE_MASK);
-        }
+        /* Init Power Management Control Register */
+        pci_set_word(pci_dev->wmask + pos + PCI_PM_CTRL,
+                     PCI_PM_CTRL_STATE_MASK);
 
         if (proxy->flags & VIRTIO_PCI_FLAG_ATS) {
             pcie_ats_init(pci_dev, last_pcie_cap_offset,
@@ -2323,16 +2321,11 @@ static void virtio_pci_bus_reset_hold(Object *obj, ResetType type)
     virtio_pci_reset(qdev);
 
     if (pci_is_express(dev)) {
-        VirtIOPCIProxy *proxy = VIRTIO_PCI(dev);
-
         pcie_cap_deverr_reset(dev);
         pcie_cap_lnkctl_reset(dev);
 
-        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_PM) {
-            pci_word_test_and_clear_mask(
-                dev->config + dev->pm_cap + PCI_PM_CTRL,
-                PCI_PM_CTRL_STATE_MASK);
-        }
+        pci_word_test_and_clear_mask(dev->config + dev->pm_cap + PCI_PM_CTRL,
+                                     PCI_PM_CTRL_STATE_MASK);
     }
 }
 
@@ -2345,8 +2338,6 @@ static const Property virtio_pci_properties[] = {
                     VIRTIO_PCI_FLAG_ATS_BIT, false),
     DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT, true),
-    DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags,
-                    VIRTIO_PCI_FLAG_INIT_PM_BIT, true),
     DEFINE_PROP_BIT("x-pcie-pm-no-soft-reset", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT, false),
     DEFINE_PROP_BIT("x-pcie-flr-init", VirtIOPCIProxy, flags,
Signature · 1 line
2.47.1
Reviewed-by on v1 10/18
#24 lore raw

Re: [PATCH 10/18] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_PM definition

Quoted 7 lines · On Thu, 1 May 2025 23:04:48 +0200 Philippe Mathieu-Daudé <[email protected]>…

VIRTIO_PCI_FLAG_INIT_PM was only used by the hw_compat_2_8[] array, via the 'x-pcie-pm-init=off' property. We removed all machines using that array, lets remove all the code around VIRTIO_PCI_FLAG_INIT_PM (see commit 9a4c0e220d8 for similar VIRTIO_PCI_FLAG_* enum removal).

Quoted 74 lines
---
 include/hw/virtio/virtio-pci.h |  4 ----
 hw/virtio/virtio-pci.c         | 19 +++++--------------
 2 files changed, 5 insertions(+), 18 deletions(-)
include/hw/virtio/virtio-pci.h +0 -4
index a8dd613ffbc..d1f7403cbdf 100644
@@ -34,7 +34,6 @@ enum {
     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
     VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
     VIRTIO_PCI_FLAG_ATS_BIT,
-    VIRTIO_PCI_FLAG_INIT_PM_BIT,
     VIRTIO_PCI_FLAG_INIT_FLR_BIT,
     VIRTIO_PCI_FLAG_AER_BIT,
     VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT,
@@ -60,9 +59,6 @@ enum {
 /* address space translation service */
 #define VIRTIO_PCI_FLAG_ATS (1 << VIRTIO_PCI_FLAG_ATS_BIT)
 
-/* Init Power Management */
-#define VIRTIO_PCI_FLAG_INIT_PM (1 << VIRTIO_PCI_FLAG_INIT_PM_BIT)
-
 /* Init The No_Soft_Reset bit of Power Management */
 #define VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET \
   (1 << VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT)
hw/virtio/virtio-pci.c +5 -14
index 5b86a9a447c..9ec92d5a736 100644
@@ -2226,11 +2226,9 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
                          PCI_PM_CTRL_NO_SOFT_RESET);
         }
 
-        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_PM) {
-            /* Init Power Management Control Register */
-            pci_set_word(pci_dev->wmask + pos + PCI_PM_CTRL,
-                         PCI_PM_CTRL_STATE_MASK);
-        }
+        /* Init Power Management Control Register */
+        pci_set_word(pci_dev->wmask + pos + PCI_PM_CTRL,
+                     PCI_PM_CTRL_STATE_MASK);
 
         if (proxy->flags & VIRTIO_PCI_FLAG_ATS) {
             pcie_ats_init(pci_dev, last_pcie_cap_offset,
@@ -2323,16 +2321,11 @@ static void virtio_pci_bus_reset_hold(Object *obj, ResetType type)
     virtio_pci_reset(qdev);
 
     if (pci_is_express(dev)) {
-        VirtIOPCIProxy *proxy = VIRTIO_PCI(dev);
-
         pcie_cap_deverr_reset(dev);
         pcie_cap_lnkctl_reset(dev);
 
-        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_PM) {
-            pci_word_test_and_clear_mask(
-                dev->config + dev->pm_cap + PCI_PM_CTRL,
-                PCI_PM_CTRL_STATE_MASK);
-        }
+        pci_word_test_and_clear_mask(dev->config + dev->pm_cap + PCI_PM_CTRL,
+                                     PCI_PM_CTRL_STATE_MASK);
     }
 }
 
@@ -2345,8 +2338,6 @@ static const Property virtio_pci_properties[] = {
                     VIRTIO_PCI_FLAG_ATS_BIT, false),
     DEFINE_PROP_BIT("x-ats-page-aligned", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT, true),
-    DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags,
-                    VIRTIO_PCI_FLAG_INIT_PM_BIT, true),
     DEFINE_PROP_BIT("x-pcie-pm-no-soft-reset", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT, false),
     DEFINE_PROP_BIT("x-pcie-flr-init", VirtIOPCIProxy, flags,
#25 lore raw

PATCH 11/18 hw/nvram/fw_cfg: Remove FWCfgState::file_slots field

In reply to Philippe Mathieu-Daudé

The FWCfgState::file_slots integer was only set in the hw_compat_2_8[] array, via the 'x-file-slots=0x10' property. We removed all machines using that array, lets remove that property and all the code around it. The number of slots is always FW_CFG_FILE_SLOTS_DFLT (32).

---
 include/hw/nvram/fw_cfg.h |  1 -
 hw/nvram/fw_cfg.c         | 24 +-----------------------
 2 files changed, 1 insertion(+), 24 deletions(-)
include/hw/nvram/fw_cfg.h +0 -1
index d41b9328fd1..07a31d214db 100644
@@ -59,7 +59,6 @@ struct FWCfgState {
     SysBusDevice parent_obj;
     /*< public >*/
 
-    uint16_t file_slots;
     FWCfgEntry *entries[2];
     int *entry_order;
     FWCfgFiles *files;
hw/nvram/fw_cfg.c +1 -23
index 54cfa07d3f5..71c41c979d7 100644
@@ -257,7 +257,7 @@ static void fw_cfg_write(FWCfgState *s, uint8_t value)
 
 static inline uint16_t fw_cfg_file_slots(const FWCfgState *s)
 {
-    return s->file_slots;
+    return FW_CFG_FILE_SLOTS_DFLT;
 }
 
 /* Note: this function returns an exclusive limit. */
@@ -1153,24 +1153,6 @@ static const TypeInfo fw_cfg_info = {
 
 static void fw_cfg_file_slots_allocate(FWCfgState *s, Error **errp)
 {
-    uint16_t file_slots_max;
-
-    if (fw_cfg_file_slots(s) < FW_CFG_FILE_SLOTS_MIN) {
-        error_setg(errp, "\"file_slots\" must be at least 0x%x",
-                   FW_CFG_FILE_SLOTS_MIN);
-        return;
-    }
-
-    /* (UINT16_MAX & FW_CFG_ENTRY_MASK) is the highest inclusive selector value
-     * that we permit. The actual (exclusive) value coming from the
-     * configuration is (FW_CFG_FILE_FIRST + fw_cfg_file_slots(s)). */
-    file_slots_max = (UINT16_MAX & FW_CFG_ENTRY_MASK) - FW_CFG_FILE_FIRST + 1;
-    if (fw_cfg_file_slots(s) > file_slots_max) {
-        error_setg(errp, "\"file_slots\" must not exceed 0x%" PRIx16,
-                   file_slots_max);
-        return;
-    }
-
     s->entries[0] = g_new0(FWCfgEntry, fw_cfg_max_entry(s));
     s->entries[1] = g_new0(FWCfgEntry, fw_cfg_max_entry(s));
     s->entry_order = g_new0(int, fw_cfg_max_entry(s));
@@ -1179,8 +1161,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),
 };
 
 static void fw_cfg_io_realize(DeviceState *dev, Error **errp)
@@ -1228,8 +1208,6 @@ static const Property fw_cfg_mem_properties[] = {
     DEFINE_PROP_UINT32("data_width", FWCfgMemState, data_width, -1),
     DEFINE_PROP_BOOL("dma_enabled", FWCfgMemState, parent_obj.dma_enabled,
                      true),
-    DEFINE_PROP_UINT16("x-file-slots", FWCfgMemState, parent_obj.file_slots,
-                       FW_CFG_FILE_SLOTS_DFLT),
 };
 
 static void fw_cfg_mem_realize(DeviceState *dev, Error **errp)
Signature · 1 line
2.47.1
#26 lore raw

Re: [PATCH 11/18] hw/nvram/fw_cfg: Remove FWCfgState::file_slots field

Quoted 7 lines · On Thu, 1 May 2025 23:04:49 +0200 Philippe Mathieu-Daudé <[email protected]>…

The FWCfgState::file_slots integer was only set in the hw_compat_2_8[] array, via the 'x-file-slots=0x10' property. We removed all machines using that array, lets remove that property and all the code around it. The number of slots is always FW_CFG_FILE_SLOTS_DFLT (32).

I'd keep this one,
alternatively if we decide to nuke it in favor of a constant,
I'd get rid of fw_cfg_file_slots() and simplify fw_cfg_file_slots_allocate() at the same time

Gerd,
WDYT?

Quoted 74 lines
---
 include/hw/nvram/fw_cfg.h |  1 -
 hw/nvram/fw_cfg.c         | 24 +-----------------------
 2 files changed, 1 insertion(+), 24 deletions(-)
include/hw/nvram/fw_cfg.h +0 -1
index d41b9328fd1..07a31d214db 100644
@@ -59,7 +59,6 @@ struct FWCfgState {
     SysBusDevice parent_obj;
     /*< public >*/
 
-    uint16_t file_slots;
     FWCfgEntry *entries[2];
     int *entry_order;
     FWCfgFiles *files;
hw/nvram/fw_cfg.c +1 -1
index 54cfa07d3f5..71c41c979d7 100644
@@ -257,7 +257,7 @@ static void fw_cfg_write(FWCfgState *s, uint8_t value)
 
 static inline uint16_t fw_cfg_file_slots(const FWCfgState *s)
 {
-    return s->file_slots;
+    return FW_CFG_FILE_SLOTS_DFLT;
 }
 
 

/* Note: this function returns an exclusive limit. */

hw/nvram/fw_cfg.c +0 -22
@@ -1153,24 +1153,6 @@ static const TypeInfo fw_cfg_info = {
 
 static void fw_cfg_file_slots_allocate(FWCfgState *s, Error **errp)
 {
-    uint16_t file_slots_max;
-
-    if (fw_cfg_file_slots(s) < FW_CFG_FILE_SLOTS_MIN) {
-        error_setg(errp, "\"file_slots\" must be at least 0x%x",
-                   FW_CFG_FILE_SLOTS_MIN);
-        return;
-    }
-
-    /* (UINT16_MAX & FW_CFG_ENTRY_MASK) is the highest inclusive selector value
-     * that we permit. The actual (exclusive) value coming from the
-     * configuration is (FW_CFG_FILE_FIRST + fw_cfg_file_slots(s)). */
-    file_slots_max = (UINT16_MAX & FW_CFG_ENTRY_MASK) - FW_CFG_FILE_FIRST + 1;
-    if (fw_cfg_file_slots(s) > file_slots_max) {
-        error_setg(errp, "\"file_slots\" must not exceed 0x%" PRIx16,
-                   file_slots_max);
-        return;
-    }
-
     s->entries[0] = g_new0(FWCfgEntry, fw_cfg_max_entry(s));
     s->entries[1] = g_new0(FWCfgEntry, fw_cfg_max_entry(s));
     s->entry_order = g_new0(int, fw_cfg_max_entry(s));
@@ -1179,8 +1161,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),
 };
 
 static void fw_cfg_io_realize(DeviceState *dev, Error **errp)
@@ -1228,8 +1208,6 @@ static const Property fw_cfg_mem_properties[] = {
     DEFINE_PROP_UINT32("data_width", FWCfgMemState, data_width, -1),
     DEFINE_PROP_BOOL("dma_enabled", FWCfgMemState, parent_obj.dma_enabled,
                      true),
-    DEFINE_PROP_UINT16("x-file-slots", FWCfgMemState, parent_obj.file_slots,
-                       FW_CFG_FILE_SLOTS_DFLT),
 };
 
 static void fw_cfg_mem_realize(DeviceState *dev, Error **errp)
#27 lore raw

PATCH 12/18 hw/nvram/fw_cfg: Inline fw_cfg_file_slots()

In reply to Philippe Mathieu-Daudé

Now than fw_cfg_file_slots() only returns
FW_CFG_FILE_SLOTS_DFLT, we can inline it.

---
 hw/nvram/fw_cfg.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
hw/nvram/fw_cfg.c +4 -9
index 71c41c979d7..de65ee8342e 100644
@@ -255,15 +255,10 @@ static void fw_cfg_write(FWCfgState *s, uint8_t value)
     /* nothing, write support removed in QEMU v2.4+ */
 }
 
-static inline uint16_t fw_cfg_file_slots(const FWCfgState *s)
-{
-    return FW_CFG_FILE_SLOTS_DFLT;
-}
-
 /* Note: this function returns an exclusive limit. */
 static inline uint32_t fw_cfg_max_entry(const FWCfgState *s)
 {
-    return FW_CFG_FILE_FIRST + fw_cfg_file_slots(s);
+    return FW_CFG_FILE_FIRST + FW_CFG_FILE_SLOTS_DFLT;
 }
 
 static int fw_cfg_select(FWCfgState *s, uint16_t key)
@@ -845,13 +840,13 @@ void fw_cfg_add_file_callback(FWCfgState *s,  const char *filename,
     int order = 0;
 
     if (!s->files) {
-        dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * fw_cfg_file_slots(s);
+        dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS_DFLT;
         s->files = g_malloc0(dsize);
         fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, s->files, dsize);
     }
 
     count = be32_to_cpu(s->files->count);
-    assert(count < fw_cfg_file_slots(s));
+    assert(count < FW_CFG_FILE_SLOTS_DFLT);
 
     /* Find the insertion point, sorting by file name. */
     for (index = count;
@@ -926,7 +921,7 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename,
         }
     }
 
-    assert(index < fw_cfg_file_slots(s));
+    assert(index < FW_CFG_FILE_SLOTS_DFLT);
 
     /* add new one */
     fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);
Signature · 1 line
2.47.1
#28 lore raw

Re: [PATCH 12/18] hw/nvram/fw_cfg: Inline fw_cfg_file_slots()

Quoted 4 lines · On Thu, 1 May 2025 23:04:50 +0200 Philippe Mathieu-Daudé <[email protected]>…

Now than fw_cfg_file_slots() only returns
FW_CFG_FILE_SLOTS_DFLT, we can inline it.

does this even compile?
I see more usages of fw_cfg_file_slots(), then being removed here.

git grep "fw_cfg_file_slots("
hw/nvram/fw_cfg.c:static inline uint16_t fw_cfg_file_slots(const FWCfgState *s)

hw/nvram/fw_cfg.c:    return FW_CFG_FILE_FIRST + fw_cfg_file_slots(s);
hw/nvram/fw_cfg.c:        dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * fw_cfg_file_slots(s);
hw/nvram/fw_cfg.c:    assert(count < fw_cfg_file_slots(s));
hw/nvram/fw_cfg.c:    assert(index < fw_cfg_file_slots(s));
hw/nvram/fw_cfg.c:    if (fw_cfg_file_slots(s) < FW_CFG_FILE_SLOTS_MIN) {
hw/nvram/fw_cfg.c:     * configuration is (FW_CFG_FILE_FIRST + fw_cfg_file_slots(s)). */
hw/nvram/fw_cfg.c:    if (fw_cfg_file_slots(s) > file_slots_max) {

if we decide to remove x-file-slots, this patch probably needs some fixing

Quoted 50 lines
---
 hw/nvram/fw_cfg.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
hw/nvram/fw_cfg.c +4 -9
index 71c41c979d7..de65ee8342e 100644
@@ -255,15 +255,10 @@ static void fw_cfg_write(FWCfgState *s, uint8_t value)
     /* nothing, write support removed in QEMU v2.4+ */
 }
 
-static inline uint16_t fw_cfg_file_slots(const FWCfgState *s)
-{
-    return FW_CFG_FILE_SLOTS_DFLT;
-}
-
 /* Note: this function returns an exclusive limit. */
 static inline uint32_t fw_cfg_max_entry(const FWCfgState *s)
 {
-    return FW_CFG_FILE_FIRST + fw_cfg_file_slots(s);
+    return FW_CFG_FILE_FIRST + FW_CFG_FILE_SLOTS_DFLT;
 }
 
 static int fw_cfg_select(FWCfgState *s, uint16_t key)
@@ -845,13 +840,13 @@ void fw_cfg_add_file_callback(FWCfgState *s,  const char *filename,
     int order = 0;
 
     if (!s->files) {
-        dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * fw_cfg_file_slots(s);
+        dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS_DFLT;
         s->files = g_malloc0(dsize);
         fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, s->files, dsize);
     }
 
     count = be32_to_cpu(s->files->count);
-    assert(count < fw_cfg_file_slots(s));
+    assert(count < FW_CFG_FILE_SLOTS_DFLT);
 
     /* Find the insertion point, sorting by file name. */
     for (index = count;
@@ -926,7 +921,7 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename,
         }
     }
 
-    assert(index < fw_cfg_file_slots(s));
+    assert(index < FW_CFG_FILE_SLOTS_DFLT);
 
     /* add new one */
     fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);
#29 lore raw

Re: [PATCH 12/18] hw/nvram/fw_cfg: Inline fw_cfg_file_slots()

Hi Igor,

Quoted 13 lines · Igor Mammedov
Quoted 4 lines · On Thu, 1 May 2025 23:04:50 +0200 Philippe Mathieu-Daudé <[email protected]>…

Now than fw_cfg_file_slots() only returns
FW_CFG_FILE_SLOTS_DFLT, we can inline it.

does this even compile?
I see more usages of fw_cfg_file_slots(), then being removed here.

git grep "fw_cfg_file_slots("
hw/nvram/fw_cfg.c:static inline uint16_t fw_cfg_file_slots(const FWCfgState *s)

Quoted 7 lines
hw/nvram/fw_cfg.c:    return FW_CFG_FILE_FIRST + fw_cfg_file_slots(s);
hw/nvram/fw_cfg.c:        dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * fw_cfg_file_slots(s);
hw/nvram/fw_cfg.c:    assert(count < fw_cfg_file_slots(s));
hw/nvram/fw_cfg.c:    assert(index < fw_cfg_file_slots(s));
hw/nvram/fw_cfg.c:    if (fw_cfg_file_slots(s) < FW_CFG_FILE_SLOTS_MIN) {
hw/nvram/fw_cfg.c:     * configuration is (FW_CFG_FILE_FIRST + fw_cfg_file_slots(s)). */
hw/nvram/fw_cfg.c:    if (fw_cfg_file_slots(s) > file_slots_max) {

No problem in the branch I posted, commit from April (and yes, it does compile fine):

$ git grep "fw_cfg_file_slots(" 09deca844303fde6761
$

I'm OK to rebase/respin once the prerequisite series are merged.

Regards,

Phil.

Quoted 5 lines

if we decide to remove x-file-slots, this patch probably needs some fixing

Quoted 3 lines
---
  hw/nvram/fw_cfg.c | 13 ++++---------
  1 file changed, 4 insertions(+), 9 deletions(-)
#30 lore raw

Re: [PATCH 12/18] hw/nvram/fw_cfg: Inline fw_cfg_file_slots()

Quoted 24 lines · Philippe Mathieu-Daudé

Hi Igor,

Quoted 11 lines · Igor Mammedov
Quoted 4 lines · On Thu,  1 May 2025 23:04:50 +0200 Philippe Mathieu-Daudé <[email protected]>…

Now than fw_cfg_file_slots() only returns
FW_CFG_FILE_SLOTS_DFLT, we can inline it.

does this even compile?
I see more usages of fw_cfg_file_slots(), then being removed here.

Quoted 9 lines

git grep "fw_cfg_file_slots("
hw/nvram/fw_cfg.c:static inline uint16_t fw_cfg_file_slots(const FWCfgState *s) hw/nvram/fw_cfg.c:    return FW_CFG_FILE_FIRST + fw_cfg_file_slots(s); hw/nvram/fw_cfg.c:        dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * fw_cfg_file_slots(s); hw/nvram/fw_cfg.c:    assert(count < fw_cfg_file_slots(s));
hw/nvram/fw_cfg.c:    assert(index < fw_cfg_file_slots(s));
hw/nvram/fw_cfg.c:    if (fw_cfg_file_slots(s) < FW_CFG_FILE_SLOTS_MIN) { hw/nvram/fw_cfg.c:     * configuration is (FW_CFG_FILE_FIRST + fw_cfg_file_slots(s)). */ hw/nvram/fw_cfg.c:    if (fw_cfg_file_slots(s) > file_slots_max) {

Quoted 7 lines

No problem in the branch I posted, commit from April (and yes, it does compile fine):

$ git grep "fw_cfg_file_slots(" 09deca844303fde6761
$

I'm OK to rebase/respin once the prerequisite series are merged.

Looks like the series that removes the earlier machines has finally been removed ... could you now please respin this series?

Thanks,
Thomas

#31 lore raw

PATCH 13/18 hw/i386/pc: Remove deprecated pc-q35-2.9 and pc-i440fx-2.9 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.

---
 hw/i386/pc_piix.c | 9 ---------
 hw/i386/pc_q35.c  | 9 ---------
 2 files changed, 18 deletions(-)
hw/i386/pc_piix.c +0 -9
index 0d6ad9db627..5c7d0c50f8e 100644
@@ -737,15 +737,6 @@ static void pc_i440fx_machine_2_10_options(MachineClass *m)
 
 DEFINE_I440FX_MACHINE(2, 10);
 
-static void pc_i440fx_machine_2_9_options(MachineClass *m)
-{
-    pc_i440fx_machine_2_10_options(m);
-    compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
-    compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
-}
-
-DEFINE_I440FX_MACHINE(2, 9);
-
 #ifdef CONFIG_ISAPC
 static void isapc_machine_options(MachineClass *m)
 {
hw/i386/pc_q35.c +0 -9
index 54c18100122..d66d64b3b62 100644
@@ -630,12 +630,3 @@ static void pc_q35_machine_2_10_options(MachineClass *m)
 }
 
 DEFINE_Q35_MACHINE(2, 10);
-
-static void pc_q35_machine_2_9_options(MachineClass *m)
-{
-    pc_q35_machine_2_10_options(m);
-    compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
-    compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
-}
-
-DEFINE_Q35_MACHINE(2, 9);
Signature · 1 line
2.47.1
Reviewed-by on v1 13/18
#32 lore raw

Re: [PATCH 13/18] hw/i386/pc: Remove deprecated pc-q35-2.9 and pc-i440fx-2.9 machines

Quoted 6 lines · On Thu, 1 May 2025 23:04:51 +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 41 lines
 hw/i386/pc_piix.c | 9 ---------
 hw/i386/pc_q35.c  | 9 ---------
 2 files changed, 18 deletions(-)
hw/i386/pc_piix.c +0 -9
index 0d6ad9db627..5c7d0c50f8e 100644
@@ -737,15 +737,6 @@ static void pc_i440fx_machine_2_10_options(MachineClass *m)
 
 DEFINE_I440FX_MACHINE(2, 10);
 
-static void pc_i440fx_machine_2_9_options(MachineClass *m)
-{
-    pc_i440fx_machine_2_10_options(m);
-    compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
-    compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
-}
-
-DEFINE_I440FX_MACHINE(2, 9);
-
 #ifdef CONFIG_ISAPC
 static void isapc_machine_options(MachineClass *m)
 {
hw/i386/pc_q35.c +0 -9
index 54c18100122..d66d64b3b62 100644
@@ -630,12 +630,3 @@ static void pc_q35_machine_2_10_options(MachineClass *m)
 }
 
 DEFINE_Q35_MACHINE(2, 10);
-
-static void pc_q35_machine_2_9_options(MachineClass *m)
-{
-    pc_q35_machine_2_10_options(m);
-    compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
-    compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
-}
-
-DEFINE_Q35_MACHINE(2, 9);
#33 lore raw

PATCH 14/18 hw/i386/pc: Remove pc_compat_2_9[] array

In reply to Philippe Mathieu-Daudé

The pc_compat_2_9[] array was only used by the pc-q35-2.9 and pc-i440fx-2.9 machines, which got removed. Remove it.

---
 include/hw/i386/pc.h | 3 ---
 hw/i386/pc.c         | 5 -----
 2 files changed, 8 deletions(-)
include/hw/i386/pc.h +0 -3
index db02cbc0d65..455b869cce9 100644
@@ -283,9 +283,6 @@ extern const size_t pc_compat_2_11_len;
 extern GlobalProperty pc_compat_2_10[];
 extern const size_t pc_compat_2_10_len;
 
-extern GlobalProperty pc_compat_2_9[];
-extern const size_t pc_compat_2_9_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 -5
index 5f07a44d447..298091932ab 100644
@@ -227,11 +227,6 @@ GlobalProperty pc_compat_2_10[] = {
 };
 const size_t pc_compat_2_10_len = G_N_ELEMENTS(pc_compat_2_10);
 
-GlobalProperty pc_compat_2_9[] = {
-    { "mch", "extended-tseg-mbytes", "0" },
-};
-const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9);
-
 /*
  * @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
Reviewed-by on v1 14/18
#34 lore raw

Re: [PATCH 14/18] hw/i386/pc: Remove pc_compat_2_9[] array

Quoted 4 lines · On Thu, 1 May 2025 23:04:52 +0200 Philippe Mathieu-Daudé <[email protected]>…

The pc_compat_2_9[] array was only used by the pc-q35-2.9 and pc-i440fx-2.9 machines, which got removed. Remove it.

Quoted 35 lines
---
 include/hw/i386/pc.h | 3 ---
 hw/i386/pc.c         | 5 -----
 2 files changed, 8 deletions(-)
include/hw/i386/pc.h +0 -3
index db02cbc0d65..455b869cce9 100644
@@ -283,9 +283,6 @@ extern const size_t pc_compat_2_11_len;
 extern GlobalProperty pc_compat_2_10[];
 extern const size_t pc_compat_2_10_len;
 
-extern GlobalProperty pc_compat_2_9[];
-extern const size_t pc_compat_2_9_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 -5
index 5f07a44d447..298091932ab 100644
@@ -227,11 +227,6 @@ GlobalProperty pc_compat_2_10[] = {
 };
 const size_t pc_compat_2_10_len = G_N_ELEMENTS(pc_compat_2_10);
 
-GlobalProperty pc_compat_2_9[] = {
-    { "mch", "extended-tseg-mbytes", "0" },
-};
-const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9);
-
 /*
  * @PC_FW_DATA:
  * Size of the chunk of memory at the top of RAM for the BIOS ACPI tables
#35 lore raw

PATCH 15/18 hw/core/machine: Remove hw_compat_2_9[] array

In reply to Philippe Mathieu-Daudé

The hw_compat_2_9[] array was only used by the pc-q35-2.9 and pc-i440fx-2.9 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
index 84bd3735c42..513eb2a54fd 100644
@@ -832,7 +832,4 @@ extern const size_t hw_compat_2_11_len;
 extern GlobalProperty hw_compat_2_10[];
 extern const size_t hw_compat_2_10_len;
 
-extern GlobalProperty hw_compat_2_9[];
-extern const size_t hw_compat_2_9_len;
-
 #endif
hw/core/machine.c +0 -8
index bc0606cf740..486d1adb4b9 100644
@@ -244,14 +244,6 @@ GlobalProperty hw_compat_2_10[] = {
 };
 const size_t hw_compat_2_10_len = G_N_ELEMENTS(hw_compat_2_10);
 
-GlobalProperty hw_compat_2_9[] = {
-    { "pci-bridge", "shpc", "off" },
-    { "intel-iommu", "pt", "off" },
-    { "virtio-net-device", "x-mtu-bypass-backend", "off" },
-    { "pcie-root-port", "x-migrate-msix", "false" },
-};
-const size_t hw_compat_2_9_len = G_N_ELEMENTS(hw_compat_2_9);
-
 MachineState *current_machine;
 
 static char *machine_get_kernel(Object *obj, Error **errp)
Signature · 1 line
2.47.1
Reviewed-by on v1 15/18
#36 lore raw

Re: [PATCH 15/18] hw/core/machine: Remove hw_compat_2_9[] array

Quoted 4 lines · On Thu, 1 May 2025 23:04:53 +0200 Philippe Mathieu-Daudé <[email protected]>…

The hw_compat_2_9[] array was only used by the pc-q35-2.9 and pc-i440fx-2.9 machines, which got removed. Remove it.

Quoted 36 lines
---
 include/hw/boards.h | 3 ---
 hw/core/machine.c   | 8 --------
 2 files changed, 11 deletions(-)
include/hw/boards.h +0 -3
index 84bd3735c42..513eb2a54fd 100644
@@ -832,7 +832,4 @@ extern const size_t hw_compat_2_11_len;
 extern GlobalProperty hw_compat_2_10[];
 extern const size_t hw_compat_2_10_len;
 
-extern GlobalProperty hw_compat_2_9[];
-extern const size_t hw_compat_2_9_len;
-
 #endif
hw/core/machine.c +0 -8
index bc0606cf740..486d1adb4b9 100644
@@ -244,14 +244,6 @@ GlobalProperty hw_compat_2_10[] = {
 };
 const size_t hw_compat_2_10_len = G_N_ELEMENTS(hw_compat_2_10);
 
-GlobalProperty hw_compat_2_9[] = {
-    { "pci-bridge", "shpc", "off" },
-    { "intel-iommu", "pt", "off" },
-    { "virtio-net-device", "x-mtu-bypass-backend", "off" },
-    { "pcie-root-port", "x-migrate-msix", "false" },
-};
-const size_t hw_compat_2_9_len = G_N_ELEMENTS(hw_compat_2_9);
-
 MachineState *current_machine;
 
 static char *machine_get_kernel(Object *obj, Error **errp)
#37 lore raw

PATCH 16/18 hw/net/virtio-net: Remove VirtIONet::mtu_bypass_backend field

In reply to Philippe Mathieu-Daudé

The VirtIONet::mtu_bypass_backend boolean was only set in the hw_compat_2_9[] array, via the 'x-mtu-bypass-backend=off' property. We removed all machines using that array, lets remove that property and all the code around it.

---
 include/hw/virtio/virtio-net.h | 1 -
 hw/net/virtio-net.c            | 8 ++------
 2 files changed, 2 insertions(+), 7 deletions(-)
include/hw/virtio/virtio-net.h +0 -1
index b9ea9e824e3..353e872f677 100644
@@ -214,7 +214,6 @@ struct VirtIONet {
     uint64_t saved_guest_offloads;
     AnnounceTimer announce_timer;
     bool needs_vnet_hdr_swap;
-    bool mtu_bypass_backend;
     /* primary failover device is hidden*/
     bool failover_primary_hidden;
     bool failover;
hw/net/virtio-net.c +2 -6
index 2de037c2736..a8a43ffa242 100644
@@ -801,8 +801,7 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
     features = vhost_net_get_features(get_vhost_net(nc->peer), features);
     vdev->backend_features = features;
 
-    if (n->mtu_bypass_backend &&
-            (n->host_features & 1ULL << VIRTIO_NET_F_MTU)) {
+    if (n->host_features & (1ULL << VIRTIO_NET_F_MTU)) {
         features |= (1ULL << VIRTIO_NET_F_MTU);
     }
 
@@ -953,8 +952,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)
     Error *err = NULL;
     int i;
 
-    if (n->mtu_bypass_backend &&
-            !virtio_has_feature(vdev->backend_features, VIRTIO_NET_F_MTU)) {
+    if (!virtio_has_feature(vdev->backend_features, VIRTIO_NET_F_MTU)) {
         features &= ~(1ULL << VIRTIO_NET_F_MTU);
     }
 
@@ -4121,8 +4119,6 @@ static const Property virtio_net_properties[] = {
     DEFINE_PROP_UINT16("tx_queue_size", VirtIONet, net_conf.tx_queue_size,
                        VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE),
     DEFINE_PROP_UINT16("host_mtu", VirtIONet, net_conf.mtu, 0),
-    DEFINE_PROP_BOOL("x-mtu-bypass-backend", VirtIONet, mtu_bypass_backend,
-                     true),
     DEFINE_PROP_INT32("speed", VirtIONet, net_conf.speed, SPEED_UNKNOWN),
     DEFINE_PROP_STRING("duplex", VirtIONet, net_conf.duplex_str),
     DEFINE_PROP_BOOL("failover", VirtIONet, failover, false),
Signature · 1 line
2.47.1
Reviewed-by on v1 16/18
#38 lore raw

Re: [PATCH 16/18] hw/net/virtio-net: Remove VirtIONet::mtu_bypass_backend field

Quoted 6 lines · On Thu, 1 May 2025 23:04:54 +0200 Philippe Mathieu-Daudé <[email protected]>…

The VirtIONet::mtu_bypass_backend boolean was only set in the hw_compat_2_9[] array, via the 'x-mtu-bypass-backend=off' property. We removed all machines using that array, lets remove that property and all the code around it.

Quoted 49 lines
 include/hw/virtio/virtio-net.h | 1 -
 hw/net/virtio-net.c            | 8 ++------
 2 files changed, 2 insertions(+), 7 deletions(-)
include/hw/virtio/virtio-net.h +0 -1
index b9ea9e824e3..353e872f677 100644
@@ -214,7 +214,6 @@ struct VirtIONet {
     uint64_t saved_guest_offloads;
     AnnounceTimer announce_timer;
     bool needs_vnet_hdr_swap;
-    bool mtu_bypass_backend;
     /* primary failover device is hidden*/
     bool failover_primary_hidden;
     bool failover;
hw/net/virtio-net.c +2 -6
index 2de037c2736..a8a43ffa242 100644
@@ -801,8 +801,7 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
     features = vhost_net_get_features(get_vhost_net(nc->peer), features);
     vdev->backend_features = features;
 
-    if (n->mtu_bypass_backend &&
-            (n->host_features & 1ULL << VIRTIO_NET_F_MTU)) {
+    if (n->host_features & (1ULL << VIRTIO_NET_F_MTU)) {
         features |= (1ULL << VIRTIO_NET_F_MTU);
     }
 
@@ -953,8 +952,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)
     Error *err = NULL;
     int i;
 
-    if (n->mtu_bypass_backend &&
-            !virtio_has_feature(vdev->backend_features, VIRTIO_NET_F_MTU)) {
+    if (!virtio_has_feature(vdev->backend_features, VIRTIO_NET_F_MTU)) {
         features &= ~(1ULL << VIRTIO_NET_F_MTU);
     }
 
@@ -4121,8 +4119,6 @@ static const Property virtio_net_properties[] = {
     DEFINE_PROP_UINT16("tx_queue_size", VirtIONet, net_conf.tx_queue_size,
                        VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE),
     DEFINE_PROP_UINT16("host_mtu", VirtIONet, net_conf.mtu, 0),
-    DEFINE_PROP_BOOL("x-mtu-bypass-backend", VirtIONet, mtu_bypass_backend,
-                     true),
     DEFINE_PROP_INT32("speed", VirtIONet, net_conf.speed, SPEED_UNKNOWN),
     DEFINE_PROP_STRING("duplex", VirtIONet, net_conf.duplex_str),
     DEFINE_PROP_BOOL("failover", VirtIONet, failover, false),
#39 lore raw

PATCH 17/18 hw/pci-bridge/gen_pcie_rp: Remove GenPCIERootPort::migrate_msix field

In reply to Philippe Mathieu-Daudé

The GenPCIERootPort::migrate_msix boolean was only set in the hw_compat_2_9[] array, via the 'x-migrate-msix=false' property. We removed all machines using that array, lets remove that property and all the code around it.

---
 hw/pci-bridge/gen_pcie_root_port.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
hw/pci-bridge/gen_pcie_root_port.c +2 -14
index d9078e783bf..831d21225e9 100644
@@ -35,8 +35,6 @@ struct GenPCIERootPort {
     PCIESlot parent_obj;
     /*< public >*/
 
-    bool migrate_msix;
-
     /* additional resources to reserve */
     PCIResReserve res_reserve;
 };
@@ -66,13 +64,6 @@ static void gen_rp_interrupts_uninit(PCIDevice *d)
     msix_uninit_exclusive_bar(d);
 }
 
-static bool gen_rp_test_migrate_msix(void *opaque, int version_id)
-{
-    GenPCIERootPort *rp = opaque;
-
-    return rp->migrate_msix;
-}
-
 static void gen_rp_realize(DeviceState *dev, Error **errp)
 {
     PCIDevice *d = PCI_DEVICE(dev);
@@ -121,16 +112,13 @@ static const VMStateDescription vmstate_rp_dev = {
         VMSTATE_PCI_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
         VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log,
                        PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog),
-        VMSTATE_MSIX_TEST(parent_obj.parent_obj.parent_obj.parent_obj,
-                          GenPCIERootPort,
-                          gen_rp_test_migrate_msix),
+        VMSTATE_MSIX(parent_obj.parent_obj.parent_obj.parent_obj,
+                     GenPCIERootPort),
         VMSTATE_END_OF_LIST()
     }
 };
 
 static const Property gen_rp_props[] = {
-    DEFINE_PROP_BOOL("x-migrate-msix", GenPCIERootPort,
-                     migrate_msix, true),
     DEFINE_PROP_UINT32("bus-reserve", GenPCIERootPort,
                        res_reserve.bus, -1),
     DEFINE_PROP_SIZE("io-reserve", GenPCIERootPort,
Signature · 1 line
2.47.1
Reviewed-by on v1 17/18
#40 lore raw

Re: [PATCH 17/18] hw/pci-bridge/gen_pcie_rp: Remove GenPCIERootPort::migrate_msix field

Quoted 6 lines · On Thu, 1 May 2025 23:04:55 +0200 Philippe Mathieu-Daudé <[email protected]>…

The GenPCIERootPort::migrate_msix boolean was only set in the hw_compat_2_9[] array, via the 'x-migrate-msix=false' property. We removed all machines using that array, lets remove that property and all the code around it.

Quoted 50 lines
---
 hw/pci-bridge/gen_pcie_root_port.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
hw/pci-bridge/gen_pcie_root_port.c +2 -14
index d9078e783bf..831d21225e9 100644
@@ -35,8 +35,6 @@ struct GenPCIERootPort {
     PCIESlot parent_obj;
     /*< public >*/
 
-    bool migrate_msix;
-
     /* additional resources to reserve */
     PCIResReserve res_reserve;
 };
@@ -66,13 +64,6 @@ static void gen_rp_interrupts_uninit(PCIDevice *d)
     msix_uninit_exclusive_bar(d);
 }
 
-static bool gen_rp_test_migrate_msix(void *opaque, int version_id)
-{
-    GenPCIERootPort *rp = opaque;
-
-    return rp->migrate_msix;
-}
-
 static void gen_rp_realize(DeviceState *dev, Error **errp)
 {
     PCIDevice *d = PCI_DEVICE(dev);
@@ -121,16 +112,13 @@ static const VMStateDescription vmstate_rp_dev = {
         VMSTATE_PCI_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
         VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log,
                        PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog),
-        VMSTATE_MSIX_TEST(parent_obj.parent_obj.parent_obj.parent_obj,
-                          GenPCIERootPort,
-                          gen_rp_test_migrate_msix),
+        VMSTATE_MSIX(parent_obj.parent_obj.parent_obj.parent_obj,
+                     GenPCIERootPort),
         VMSTATE_END_OF_LIST()
     }
 };
 
 static const Property gen_rp_props[] = {
-    DEFINE_PROP_BOOL("x-migrate-msix", GenPCIERootPort,
-                     migrate_msix, true),
     DEFINE_PROP_UINT32("bus-reserve", GenPCIERootPort,
                        res_reserve.bus, -1),
     DEFINE_PROP_SIZE("io-reserve", GenPCIERootPort,
#41 lore raw

PATCH 18/18 hw/i386/x86-iommu: Remove X86IOMMUState::pt_supported field

In reply to Philippe Mathieu-Daudé

The X86IOMMUState::pt_supported boolean was only set in the hw_compat_2_9[] array, via the 'pt=off' property. We removed all machines using that array, lets remove that property and all the code around it, always setting the VTD_ECAP_PT capability.

---
 include/hw/i386/x86-iommu.h |  1 -
 hw/i386/amd_iommu.c         | 12 ++----------
 hw/i386/intel_iommu.c       | 13 ++-----------
 hw/i386/x86-iommu.c         |  1 -
 4 files changed, 4 insertions(+), 23 deletions(-)
include/hw/i386/x86-iommu.h +0 -1
index bfd21649d08..d6e52b1eb6b 100644
@@ -63,7 +63,6 @@ struct X86IOMMUState {
     SysBusDevice busdev;
     OnOffAuto intr_supported;   /* Whether vIOMMU supports IR */
     bool dt_supported;          /* Whether vIOMMU supports DT */
-    bool pt_supported;          /* Whether vIOMMU supports pass-through */
     QLIST_HEAD(, IEC_Notifier) iec_notifiers; /* IEC notify list */
 };
 
hw/i386/amd_iommu.c +2 -10
index 2cf7e24a21d..516e231bf13 100644
@@ -1426,7 +1426,6 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
     AMDVIState *s = opaque;
     AMDVIAddressSpace **iommu_as, *amdvi_dev_as;
     int bus_num = pci_bus_num(bus);
-    X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s);
 
     iommu_as = s->address_spaces[bus_num];
 
@@ -1486,15 +1485,8 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
                                             AMDVI_INT_ADDR_FIRST,
                                             &amdvi_dev_as->iommu_ir, 1);
 
-        if (!x86_iommu->pt_supported) {
-            memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false);
-            memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu),
-                                      true);
-        } else {
-            memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu),
-                                      false);
-            memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, true);
-        }
+        memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false);
+        memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu), true);
     }
     return &iommu_as[devfn]->as;
 }
hw/i386/intel_iommu.c +2 -11
index c980cecb4ee..cc08dc41441 100644
@@ -1066,6 +1066,7 @@ static inline bool vtd_ce_type_check(X86IOMMUState *x86_iommu,
 {
     switch (vtd_ce_get_type(ce)) {
     case VTD_CONTEXT_TT_MULTI_LEVEL:
+    case VTD_CONTEXT_TT_PASS_THROUGH:
         /* Always supported */
         break;
     case VTD_CONTEXT_TT_DEV_IOTLB:
@@ -1074,12 +1075,6 @@ static inline bool vtd_ce_type_check(X86IOMMUState *x86_iommu,
             return false;
         }
         break;
-    case VTD_CONTEXT_TT_PASS_THROUGH:
-        if (!x86_iommu->pt_supported) {
-            error_report_once("%s: PT specified but not supported", __func__);
-            return false;
-        }
-        break;
     default:
         /* Unknown type */
         error_report_once("%s: unknown ce type: %"PRIu32, __func__,
@@ -4520,7 +4515,7 @@ static void vtd_cap_init(IntelIOMMUState *s)
 {
     X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s);
 
-    s->cap = VTD_CAP_FRO | VTD_CAP_NFR | VTD_CAP_ND |
+    s->cap = VTD_CAP_FRO | VTD_CAP_NFR | VTD_CAP_ND | VTD_ECAP_PT |
              VTD_CAP_MAMV | VTD_CAP_PSI | VTD_CAP_SLLPS |
              VTD_CAP_MGAW(s->aw_bits);
     if (s->dma_drain) {
@@ -4548,10 +4543,6 @@ static void vtd_cap_init(IntelIOMMUState *s)
         s->ecap |= VTD_ECAP_DT;
     }
 
-    if (x86_iommu->pt_supported) {
-        s->ecap |= VTD_ECAP_PT;
-    }
-
     if (s->caching_mode) {
         s->cap |= VTD_CAP_CM;
     }
hw/i386/x86-iommu.c +0 -1
index d34a6849f4a..ca7cd953e98 100644
@@ -129,7 +129,6 @@ static const Property x86_iommu_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO("intremap", X86IOMMUState,
                             intr_supported, ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BOOL("device-iotlb", X86IOMMUState, dt_supported, false),
-    DEFINE_PROP_BOOL("pt", X86IOMMUState, pt_supported, true),
 };
 
 static void x86_iommu_class_init(ObjectClass *klass, const void *data)
Signature · 1 line
2.47.1
#42 lore raw

Re: [PATCH 18/18] hw/i386/x86-iommu: Remove X86IOMMUState::pt_supported field

Quoted 43 lines · On Thu, 1 May 2025 23:04:56 +0200 Philippe Mathieu-Daudé <[email protected]>…

The X86IOMMUState::pt_supported boolean was only set in the hw_compat_2_9[] array, via the 'pt=off' property. We removed all machines using that array, lets remove that property and all the code around it, always setting the VTD_ECAP_PT capability.

---
 include/hw/i386/x86-iommu.h |  1 -
 hw/i386/amd_iommu.c         | 12 ++----------
 hw/i386/intel_iommu.c       | 13 ++-----------
 hw/i386/x86-iommu.c         |  1 -
 4 files changed, 4 insertions(+), 23 deletions(-)
include/hw/i386/x86-iommu.h +0 -1
index bfd21649d08..d6e52b1eb6b 100644
@@ -63,7 +63,6 @@ struct X86IOMMUState {
     SysBusDevice busdev;
     OnOffAuto intr_supported;   /* Whether vIOMMU supports IR */
     bool dt_supported;          /* Whether vIOMMU supports DT */
-    bool pt_supported;          /* Whether vIOMMU supports pass-through */
     QLIST_HEAD(, IEC_Notifier) iec_notifiers; /* IEC notify list */
 };
 
hw/i386/amd_iommu.c +0 -2
index 2cf7e24a21d..516e231bf13 100644
@@ -1426,7 +1426,6 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
     AMDVIState *s = opaque;
     AMDVIAddressSpace **iommu_as, *amdvi_dev_as;
     int bus_num = pci_bus_num(bus);
-    X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s);
 
     iommu_as = s->address_spaces[bus_num];
 
@@ -1486,15 +1485,8 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
                                             AMDVI_INT_ADDR_FIRST,
                                             &amdvi_dev_as->iommu_ir, 1);
 
-        if (!x86_iommu->pt_supported) {

hw/i386/amd_iommu.c static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn) · line 1489

Quoted 10 lines
hw/i386/amd_iommu.c +2 -8
-            memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false);
-            memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu),
-                                      true);
-        } else {
-            memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu),
-                                      false);
-            memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, true);
-        }
+        memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false);
+        memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu), true);

given default is 'true', this hunk seems to be backwards, shouldn't it be 'else' branch code

Quoted 60 lines
hw/i386/amd_iommu.c +0 -0
     }
     return &iommu_as[devfn]->as;
 }
hw/i386/intel_iommu.c +2 -11
index c980cecb4ee..cc08dc41441 100644
@@ -1066,6 +1066,7 @@ static inline bool vtd_ce_type_check(X86IOMMUState *x86_iommu,
 {
     switch (vtd_ce_get_type(ce)) {
     case VTD_CONTEXT_TT_MULTI_LEVEL:
+    case VTD_CONTEXT_TT_PASS_THROUGH:
         /* Always supported */
         break;
     case VTD_CONTEXT_TT_DEV_IOTLB:
@@ -1074,12 +1075,6 @@ static inline bool vtd_ce_type_check(X86IOMMUState *x86_iommu,
             return false;
         }
         break;
-    case VTD_CONTEXT_TT_PASS_THROUGH:
-        if (!x86_iommu->pt_supported) {
-            error_report_once("%s: PT specified but not supported", __func__);
-            return false;
-        }
-        break;
     default:
         /* Unknown type */
         error_report_once("%s: unknown ce type: %"PRIu32, __func__,
@@ -4520,7 +4515,7 @@ static void vtd_cap_init(IntelIOMMUState *s)
 {
     X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s);
 
-    s->cap = VTD_CAP_FRO | VTD_CAP_NFR | VTD_CAP_ND |
+    s->cap = VTD_CAP_FRO | VTD_CAP_NFR | VTD_CAP_ND | VTD_ECAP_PT |
              VTD_CAP_MAMV | VTD_CAP_PSI | VTD_CAP_SLLPS |
              VTD_CAP_MGAW(s->aw_bits);
     if (s->dma_drain) {
@@ -4548,10 +4543,6 @@ static void vtd_cap_init(IntelIOMMUState *s)
         s->ecap |= VTD_ECAP_DT;
     }
 
-    if (x86_iommu->pt_supported) {
-        s->ecap |= VTD_ECAP_PT;
-    }
-
     if (s->caching_mode) {
         s->cap |= VTD_CAP_CM;
     }
hw/i386/x86-iommu.c +0 -1
index d34a6849f4a..ca7cd953e98 100644
@@ -129,7 +129,6 @@ static const Property x86_iommu_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO("intremap", X86IOMMUState,
                             intr_supported, ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BOOL("device-iotlb", X86IOMMUState, dt_supported, false),
-    DEFINE_PROP_BOOL("pt", X86IOMMUState, pt_supported, true),
 };
 
 static void x86_iommu_class_init(ObjectClass *klass, const void *data)
#43 lore raw

Re: [PATCH 18/18] hw/i386/x86-iommu: Remove X86IOMMUState::pt_supported field

Quoted 7 lines · Igor Mammedov
Quoted 4 lines · On Thu, 1 May 2025 23:04:56 +0200 Philippe Mathieu-Daudé <[email protected]>…
hw/i386/amd_iommu.c +0 -0
@@ -1486,15 +1485,8 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
                                              AMDVI_INT_ADDR_FIRST,
                                              &amdvi_dev_as->iommu_ir, 1);
 
Quoted 15 lines

hw/i386/amd_iommu.c static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn) · line 1489

Quoted 11 lines
hw/i386/amd_iommu.c +2 -9
-        if (!x86_iommu->pt_supported) {
-            memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false);
-            memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu),
-                                      true);
-        } else {
-            memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu),
-                                      false);
-            memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, true);
-        }
+        memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false);
+        memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu), true);

given default is 'true', this hunk seems to be backwards, shouldn't it be 'else' branch code

I believe this is trying to preserve the change recently introduced in:
31753d5a336f ("hw/i386/amd_iommu: Fix device setup failure when PT is on.")

However, that doesn't explain the logic of enabling those specific memory regions, which I think is also prone to cause confusion. I tried to explain the "trick" and argued against it here[0].

I am ultimately rewriting that code in a series to add DMA remap support[1], which hopefully makes it easier to follow which memory regions are active under specific configurations.

Thank you,
Alejandro

[0] https://lore.kernel.org/qemu-devel/[email protected]/

[1] https://lore.kernel.org/qemu-devel/[email protected]/

Quoted 63 lines
Quoted 61 lines
hw/i386/amd_iommu.c +0 -0
      }
      return &iommu_as[devfn]->as;
  }
hw/i386/intel_iommu.c +2 -11
index c980cecb4ee..cc08dc41441 100644
@@ -1066,6 +1066,7 @@ static inline bool vtd_ce_type_check(X86IOMMUState *x86_iommu,
  {
      switch (vtd_ce_get_type(ce)) {
      case VTD_CONTEXT_TT_MULTI_LEVEL:
+    case VTD_CONTEXT_TT_PASS_THROUGH:
          /* Always supported */
          break;
      case VTD_CONTEXT_TT_DEV_IOTLB:
@@ -1074,12 +1075,6 @@ static inline bool vtd_ce_type_check(X86IOMMUState *x86_iommu,
              return false;
          }
          break;
-    case VTD_CONTEXT_TT_PASS_THROUGH:
-        if (!x86_iommu->pt_supported) {
-            error_report_once("%s: PT specified but not supported", __func__);
-            return false;
-        }
-        break;
      default:
          /* Unknown type */
          error_report_once("%s: unknown ce type: %"PRIu32, __func__,
@@ -4520,7 +4515,7 @@ static void vtd_cap_init(IntelIOMMUState *s)
  {
      X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s);
 
-    s->cap = VTD_CAP_FRO | VTD_CAP_NFR | VTD_CAP_ND |
+    s->cap = VTD_CAP_FRO | VTD_CAP_NFR | VTD_CAP_ND | VTD_ECAP_PT |
               VTD_CAP_MAMV | VTD_CAP_PSI | VTD_CAP_SLLPS |
               VTD_CAP_MGAW(s->aw_bits);
      if (s->dma_drain) {
@@ -4548,10 +4543,6 @@ static void vtd_cap_init(IntelIOMMUState *s)
          s->ecap |= VTD_ECAP_DT;
      }
 
-    if (x86_iommu->pt_supported) {
-        s->ecap |= VTD_ECAP_PT;
-    }
-
      if (s->caching_mode) {
          s->cap |= VTD_CAP_CM;
      }
hw/i386/x86-iommu.c +0 -1
index d34a6849f4a..ca7cd953e98 100644
@@ -129,7 +129,6 @@ static const Property x86_iommu_properties[] = {
      DEFINE_PROP_ON_OFF_AUTO("intremap", X86IOMMUState,
                              intr_supported, ON_OFF_AUTO_AUTO),
      DEFINE_PROP_BOOL("device-iotlb", X86IOMMUState, dt_supported, false),
-    DEFINE_PROP_BOOL("pt", X86IOMMUState, pt_supported, true),
  };
 
  static void x86_iommu_class_init(ObjectClass *klass, const void *data)