Skip to contentSkip to conversation

hw/core: Remove hw_compat[] array for 2.10, 2.11 and 2.12 machines

PATCH In review Philippe Mathieu-Daudé 3 participants 21 messages May 1, 2025 – Mar 5 Rust

lore
Share & tools
lore
#0 lore raw

cover hw/core: Remove hw_compat[] array for 2.10, 2.11 and 2.12 machines

Include Thomas s390x patches from [1], with the other x86 machines removal in [2], 3 hw_compat[] arrays end unused. Remove them, including unused properties.

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

Based-on: <[email protected]>

Philippe Mathieu-Daudé (8):
hw/core/machine: Remove hw_compat_2_10[] array hw/input/virtio-input: Remove VirtIOInputHID::wheel_axis field hw/core/machine: Remove hw_compat_2_11[] array hw/timer/hpet: Remove HPETState::hpet_offset_saved field hw/net/e1000: Remove unused E1000_FLAG_TSO flag hw/core/machine: Remove hw_compat_2_12[] array hw/audio/hda-codec: Remove HDAAudioState::use_timer field hw/display/vga-pci: Do not expose the 'global-vmstate' property

Thomas Huth (2):
hw/s390x/s390-virtio-ccw: Remove the deprecated 2.10 and 2.11 machine
types
hw/s390x/s390-virtio-ccw: Remove the deprecated 2.12 machine type

 include/hw/boards.h              |   9 ---
 include/hw/virtio/virtio-input.h |   1 -
 hw/audio/hda-codec.c             |  91 ++++-----------------------
 hw/core/machine.c                |  23 -------
 hw/display/cirrus_vga.c          |   2 -
 hw/display/qxl.c                 |   1 -
 hw/display/vga-pci.c             |   1 -
 hw/display/vmware_vga.c          |   2 -
 hw/input/virtio-input-hid.c      | 102 ++-----------------------------
 hw/net/e1000.c                   |  58 +++---------------
 hw/s390x/s390-virtio-ccw.c       |  51 ----------------
 hw/timer/hpet.c                  |   9 +--
 rust/hw/timer/hpet/src/hpet.rs   |   9 ---
 13 files changed, 27 insertions(+), 332 deletions(-)
Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/10 hw/s390x/s390-virtio-ccw: Remove the deprecated 2.10 and 2.11 machine types

From: Thomas Huth <[email protected]>

They are older than 6 years, so according to our machine support policy, they can be removed now.

There was not anything special in the 2.10 machine type, so just remove it together with the 2.11 machine type. The 2.11 machine type switched some configuration that needs additional cleanups in the following patches.

Message-ID: <[email protected]>

---
 hw/s390x/s390-virtio-ccw.c | 37 -------------------------------------
 1 file changed, 37 deletions(-)
hw/s390x/s390-virtio-ccw.c +0 -37
index 94edd42dd25..2c90702d834 100644
@@ -1250,43 +1250,6 @@ static void ccw_machine_2_12_class_options(MachineClass *mc)
 }
 DEFINE_CCW_MACHINE(2, 12);
 
-#ifdef CONFIG_S390X_LEGACY_CPUS
-
-static void ccw_machine_2_11_instance_options(MachineState *machine)
-{
-    static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V2_11 };
-    ccw_machine_2_12_instance_options(machine);
-
-    /* before 2.12 we emulated the very first z900 */
-    s390_set_qemu_cpu_model(0x2064, 7, 1, qemu_cpu_feat);
-}
-
-static void ccw_machine_2_11_class_options(MachineClass *mc)
-{
-    static GlobalProperty compat[] = {
-        { TYPE_SCLP_EVENT_FACILITY, "allow_all_mask_sizes", "off", },
-    };
-
-    ccw_machine_2_12_class_options(mc);
-    compat_props_add(mc->compat_props, hw_compat_2_11, hw_compat_2_11_len);
-    compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
-}
-DEFINE_CCW_MACHINE(2, 11);
-
-static void ccw_machine_2_10_instance_options(MachineState *machine)
-{
-    ccw_machine_2_11_instance_options(machine);
-}
-
-static void ccw_machine_2_10_class_options(MachineClass *mc)
-{
-    ccw_machine_2_11_class_options(mc);
-    compat_props_add(mc->compat_props, hw_compat_2_10, hw_compat_2_10_len);
-}
-DEFINE_CCW_MACHINE(2, 10);
-
-#endif
-
 static void ccw_machine_register_types(void)
 {
     type_register_static(&ccw_machine_info);
Signature · 1 line
2.47.1
#2 lore raw

PATCH 2/10 hw/core/machine: Remove hw_compat_2_10[] array

In reply to Philippe Mathieu-Daudé

The hw_compat_2_10[] array was only used by the pc-q35-2.10, pc-i440fx-2.10 and s390-ccw-virtio-2.10 machines, which got removed. Remove it.

---
 include/hw/boards.h | 3 ---
 hw/core/machine.c   | 6 ------
 2 files changed, 9 deletions(-)
include/hw/boards.h +0 -3
index 513eb2a54fd..f2f58ec4ed8 100644
@@ -829,7 +829,4 @@ extern const size_t hw_compat_2_12_len;
 extern GlobalProperty hw_compat_2_11[];
 extern const size_t hw_compat_2_11_len;
 
-extern GlobalProperty hw_compat_2_10[];
-extern const size_t hw_compat_2_10_len;
-
 #endif
hw/core/machine.c +0 -6
index 486d1adb4b9..816d503b2a1 100644
@@ -238,12 +238,6 @@ GlobalProperty hw_compat_2_11[] = {
 };
 const size_t hw_compat_2_11_len = G_N_ELEMENTS(hw_compat_2_11);
 
-GlobalProperty hw_compat_2_10[] = {
-    { "virtio-mouse-device", "wheel-axis", "false" },
-    { "virtio-tablet-device", "wheel-axis", "false" },
-};
-const size_t hw_compat_2_10_len = G_N_ELEMENTS(hw_compat_2_10);
-
 MachineState *current_machine;
 
 static char *machine_get_kernel(Object *obj, Error **errp)
Signature · 1 line
2.47.1
Reviewed-by on v1 2/10
#3 lore raw

Re: [PATCH 02/10] hw/core/machine: Remove hw_compat_2_10[] array

Quoted 29 lines · Philippe Mathieu-Daudé

The hw_compat_2_10[] array was only used by the pc-q35-2.10, pc-i440fx-2.10 and s390-ccw-virtio-2.10 machines, which got removed. Remove it.

---
  include/hw/boards.h | 3 ---
  hw/core/machine.c   | 6 ------
  2 files changed, 9 deletions(-)
include/hw/boards.h +0 -3
index 513eb2a54fd..f2f58ec4ed8 100644
@@ -829,7 +829,4 @@ extern const size_t hw_compat_2_12_len;
  extern GlobalProperty hw_compat_2_11[];
  extern const size_t hw_compat_2_11_len;
 
-extern GlobalProperty hw_compat_2_10[];
-extern const size_t hw_compat_2_10_len;
-
  #endif
hw/core/machine.c +0 -0
index 486d1adb4b9..816d503b2a1 100644
@@ -238,12 +238,6 @@ GlobalProperty hw_compat_2_11[] = {
  };
  const size_t hw_compat_2_11_len = G_N_ELEMENTS(hw_compat_2_11);

hw/core/machine.c GlobalProperty hw_compat_2_11[] = { · line 243

Quoted 10 lines
hw/core/machine.c +0 -6
 
-GlobalProperty hw_compat_2_10[] = {
-    { "virtio-mouse-device", "wheel-axis", "false" },
-    { "virtio-tablet-device", "wheel-axis", "false" },
-};
-const size_t hw_compat_2_10_len = G_N_ELEMENTS(hw_compat_2_10);
-
  MachineState *current_machine;
 
  static char *machine_get_kernel(Object *obj, Error **errp)
#4 lore raw

PATCH 3/10 hw/input/virtio-input: Remove VirtIOInputHID::wheel_axis field

In reply to Philippe Mathieu-Daudé

The VirtIOInputHID::wheel_axis boolean was only set in the hw_compat_2_10[] array, via the 'wheel-axis=false' property. We removed all machines using that array, lets remove that property and all the code around it. There is only one virtio_input_config[] version for each device, rename it removing the '_v2' suffix.

---
 include/hw/virtio/virtio-input.h |   1 -
 hw/input/virtio-input-hid.c      | 102 ++-----------------------------
 2 files changed, 5 insertions(+), 98 deletions(-)
include/hw/virtio/virtio-input.h +0 -1
index e097b0b5217..1e94f8a03db 100644
@@ -89,7 +89,6 @@ struct VirtIOInputHID {
     const QemuInputHandler            *handler;
     QemuInputHandlerState             *hs;
     int                               ledstate;
-    bool                              wheel_axis;
 };
 
 struct VirtIOInputHost {
hw/input/virtio-input-hid.c +5 -97

162 lines not on this page · raw message

Signature · 1 line
2.47.1
Reviewed-by on v1 3/10
#5 lore raw

Re: [PATCH 03/10] hw/input/virtio-input: Remove VirtIOInputHID::wheel_axis field

Quoted 192 lines · Philippe Mathieu-Daudé

The VirtIOInputHID::wheel_axis boolean was only set in the hw_compat_2_10[] array, via the 'wheel-axis=false' property. We removed all machines using that array, lets remove that property and all the code around it. There is only one virtio_input_config[] version for each device, rename it removing the '_v2' suffix.

---
  include/hw/virtio/virtio-input.h |   1 -
  hw/input/virtio-input-hid.c      | 102 ++-----------------------------
  2 files changed, 5 insertions(+), 98 deletions(-)
include/hw/virtio/virtio-input.h +0 -1
index e097b0b5217..1e94f8a03db 100644
@@ -89,7 +89,6 @@ struct VirtIOInputHID {
      const QemuInputHandler            *handler;
      QemuInputHandlerState             *hs;
      int                               ledstate;
-    bool                              wheel_axis;
  };
 
  struct VirtIOInputHost {
hw/input/virtio-input-hid.c +5 -96
index d986c3c16e3..a89a5b10c63 100644
@@ -81,7 +81,6 @@ static void virtio_input_extend_config(VirtIOInput *vinput,
  static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
                                        InputEvent *evt)
  {
-    VirtIOInputHID *vhid = VIRTIO_INPUT_HID(dev);
      VirtIOInput *vinput = VIRTIO_INPUT(dev);
      virtio_input_event event;
      int qcode;
@@ -109,8 +108,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
          break;
      case INPUT_EVENT_KIND_BTN:
          btn = evt->u.btn.data;
-        if (vhid->wheel_axis &&
-            (btn->button == INPUT_BUTTON_WHEEL_UP ||
+        if ((btn->button == INPUT_BUTTON_WHEEL_UP ||
               btn->button == INPUT_BUTTON_WHEEL_DOWN) &&
              btn->down) {
              event.type  = cpu_to_le16(EV_REL);
@@ -328,32 +326,7 @@ static const QemuInputHandler virtio_mouse_handler = {
      .sync  = virtio_input_handle_sync,
  };
 
-static struct virtio_input_config virtio_mouse_config_v1[] = {
-    {
-        .select    = VIRTIO_INPUT_CFG_ID_NAME,
-        .size      = sizeof(VIRTIO_ID_NAME_MOUSE),
-        .u.string  = VIRTIO_ID_NAME_MOUSE,
-    },{
-        .select    = VIRTIO_INPUT_CFG_ID_DEVIDS,
-        .size      = sizeof(struct virtio_input_devids),
-        .u.ids     = {
-            .bustype = const_le16(BUS_VIRTUAL),
-            .vendor  = const_le16(0x0627), /* same we use for usb hid devices */
-            .product = const_le16(0x0002),
-            .version = const_le16(0x0001),
-        },
-    },{
-        .select    = VIRTIO_INPUT_CFG_EV_BITS,
-        .subsel    = EV_REL,
-        .size      = 1,
-        .u.bitmap  = {
-            (1 << REL_X) | (1 << REL_Y),
-        },
-    },
-    { /* end of list */ },
-};
-
-static struct virtio_input_config virtio_mouse_config_v2[] = {
+static struct virtio_input_config virtio_mouse_config[] = {
      {
          .select    = VIRTIO_INPUT_CFG_ID_NAME,
          .size      = sizeof(VIRTIO_ID_NAME_MOUSE),
@@ -379,26 +352,13 @@ static struct virtio_input_config virtio_mouse_config_v2[] = {
      { /* end of list */ },
  };
 
-static const Property virtio_mouse_properties[] = {
-    DEFINE_PROP_BOOL("wheel-axis", VirtIOInputHID, wheel_axis, true),
-};
-
-static void virtio_mouse_class_init(ObjectClass *klass, const void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-
-    device_class_set_props(dc, virtio_mouse_properties);
-}
-
  static void virtio_mouse_init(Object *obj)
  {
      VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj);
      VirtIOInput *vinput = VIRTIO_INPUT(obj);
 
      vhid->handler = &virtio_mouse_handler;
-    virtio_input_init_config(vinput, vhid->wheel_axis
-                             ? virtio_mouse_config_v2
-                             : virtio_mouse_config_v1);
+    virtio_input_init_config(vinput, virtio_mouse_config);
      virtio_input_extend_config(vinput, keymap_button,
                                 ARRAY_SIZE(keymap_button),
                                 VIRTIO_INPUT_CFG_EV_BITS, EV_KEY);
@@ -409,7 +369,6 @@ static const TypeInfo virtio_mouse_info = {
      .parent        = TYPE_VIRTIO_INPUT_HID,
      .instance_size = sizeof(VirtIOInputHID),
      .instance_init = virtio_mouse_init,
-    .class_init    = virtio_mouse_class_init,
  };
 
  /* ----------------------------------------------------------------- */
@@ -421,44 +380,7 @@ static const QemuInputHandler virtio_tablet_handler = {
      .sync  = virtio_input_handle_sync,
  };
 
-static struct virtio_input_config virtio_tablet_config_v1[] = {
-    {
-        .select    = VIRTIO_INPUT_CFG_ID_NAME,
-        .size      = sizeof(VIRTIO_ID_NAME_TABLET),
-        .u.string  = VIRTIO_ID_NAME_TABLET,
-    },{
-        .select    = VIRTIO_INPUT_CFG_ID_DEVIDS,
-        .size      = sizeof(struct virtio_input_devids),
-        .u.ids     = {
-            .bustype = const_le16(BUS_VIRTUAL),
-            .vendor  = const_le16(0x0627), /* same we use for usb hid devices */
-            .product = const_le16(0x0003),
-            .version = const_le16(0x0001),
-        },
-    },{
-        .select    = VIRTIO_INPUT_CFG_EV_BITS,
-        .subsel    = EV_ABS,
-        .size      = 1,
-        .u.bitmap  = {
-            (1 << ABS_X) | (1 << ABS_Y),
-        },
-    },{
-        .select    = VIRTIO_INPUT_CFG_ABS_INFO,
-        .subsel    = ABS_X,
-        .size      = sizeof(virtio_input_absinfo),
-        .u.abs.min = const_le32(INPUT_EVENT_ABS_MIN),
-        .u.abs.max = const_le32(INPUT_EVENT_ABS_MAX),
-    },{
-        .select    = VIRTIO_INPUT_CFG_ABS_INFO,
-        .subsel    = ABS_Y,
-        .size      = sizeof(virtio_input_absinfo),
-        .u.abs.min = const_le32(INPUT_EVENT_ABS_MIN),
-        .u.abs.max = const_le32(INPUT_EVENT_ABS_MAX),
-    },
-    { /* end of list */ },
-};
-
-static struct virtio_input_config virtio_tablet_config_v2[] = {
+static struct virtio_input_config virtio_tablet_config[] = {
      {
          .select    = VIRTIO_INPUT_CFG_ID_NAME,
          .size      = sizeof(VIRTIO_ID_NAME_TABLET),
@@ -503,26 +425,13 @@ static struct virtio_input_config virtio_tablet_config_v2[] = {
      { /* end of list */ },
  };
 
-static const Property virtio_tablet_properties[] = {
-    DEFINE_PROP_BOOL("wheel-axis", VirtIOInputHID, wheel_axis, true),
-};
-
-static void virtio_tablet_class_init(ObjectClass *klass, const void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-
-    device_class_set_props(dc, virtio_tablet_properties);
-}
-
  static void virtio_tablet_init(Object *obj)
  {
      VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj);
      VirtIOInput *vinput = VIRTIO_INPUT(obj);
 
      vhid->handler = &virtio_tablet_handler;
-    virtio_input_init_config(vinput, vhid->wheel_axis
-                             ? virtio_tablet_config_v2
-                             : virtio_tablet_config_v1);
+    virtio_input_init_config(vinput, virtio_tablet_config);
      virtio_input_extend_config(vinput, keymap_button,
                                 ARRAY_SIZE(keymap_button),
                                 VIRTIO_INPUT_CFG_EV_BITS, EV_KEY);

hw/input/virtio-input-hid.c static const TypeInfo virtio_tablet_info = { · line 445

Quoted 5 lines
hw/input/virtio-input-hid.c +0 -1
@@ -533,7 +442,6 @@ static const TypeInfo virtio_tablet_info = {
      .parent        = TYPE_VIRTIO_INPUT_HID,
      .instance_size = sizeof(VirtIOInputHID),
      .instance_init = virtio_tablet_init,
-    .class_init    = virtio_tablet_class_init,
  };
#6 lore raw

PATCH 4/10 hw/core/machine: Remove hw_compat_2_11[] array

In reply to Philippe Mathieu-Daudé

The hw_compat_2_11[] array was only used by the pc-q35-2.11, pc-i440fx-2.11 and s390-ccw-virtio-2.11 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 f2f58ec4ed8..16cef33beae 100644
@@ -826,7 +826,4 @@ extern const size_t hw_compat_3_0_len;
 extern GlobalProperty hw_compat_2_12[];
 extern const size_t hw_compat_2_12_len;
 
-extern GlobalProperty hw_compat_2_11[];
-extern const size_t hw_compat_2_11_len;
-
 #endif
hw/core/machine.c +0 -8
index 816d503b2a1..8f1b44b70f7 100644
@@ -230,14 +230,6 @@ GlobalProperty hw_compat_2_12[] = {
 };
 const size_t hw_compat_2_12_len = G_N_ELEMENTS(hw_compat_2_12);
 
-GlobalProperty hw_compat_2_11[] = {
-    { "hpet", "hpet-offset-saved", "false" },
-    { "virtio-blk-pci", "vectors", "2" },
-    { "vhost-user-blk-pci", "vectors", "2" },
-    { "e1000", "migrate_tso_props", "off" },
-};
-const size_t hw_compat_2_11_len = G_N_ELEMENTS(hw_compat_2_11);
-
 MachineState *current_machine;
 
 static char *machine_get_kernel(Object *obj, Error **errp)
Signature · 1 line
2.47.1
Reviewed-by on v1 4/10
#7 lore raw

Re: [PATCH 04/10] hw/core/machine: Remove hw_compat_2_11[] array

Quoted 31 lines · Philippe Mathieu-Daudé

The hw_compat_2_11[] array was only used by the pc-q35-2.11, pc-i440fx-2.11 and s390-ccw-virtio-2.11 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 f2f58ec4ed8..16cef33beae 100644
@@ -826,7 +826,4 @@ extern const size_t hw_compat_3_0_len;
  extern GlobalProperty hw_compat_2_12[];
  extern const size_t hw_compat_2_12_len;
 
-extern GlobalProperty hw_compat_2_11[];
-extern const size_t hw_compat_2_11_len;
-
  #endif
hw/core/machine.c +0 -1
index 816d503b2a1..8f1b44b70f7 100644
@@ -230,14 +230,6 @@ GlobalProperty hw_compat_2_12[] = {
  };
  const size_t hw_compat_2_12_len = G_N_ELEMENTS(hw_compat_2_12);
 
-GlobalProperty hw_compat_2_11[] = {

hw/core/machine.c GlobalProperty hw_compat_2_12[] = { · line 235

Quoted 10 lines
hw/core/machine.c +0 -7
-    { "hpet", "hpet-offset-saved", "false" },
-    { "virtio-blk-pci", "vectors", "2" },
-    { "vhost-user-blk-pci", "vectors", "2" },
-    { "e1000", "migrate_tso_props", "off" },
-};
-const size_t hw_compat_2_11_len = G_N_ELEMENTS(hw_compat_2_11);
-
  MachineState *current_machine;
 
  static char *machine_get_kernel(Object *obj, Error **errp)
#8 lore raw

PATCH 5/10 hw/timer/hpet: Remove HPETState::hpet_offset_saved field

In reply to Philippe Mathieu-Daudé

The HPETState::hpet_offset_saved boolean was only set in the hw_compat_2_11[] array, via the 'hpet-offset-saved=false' property. We removed all machines using that array, lets remove that property and all the code around it.

---
 hw/timer/hpet.c                | 9 +--------
 rust/hw/timer/hpet/src/hpet.rs | 9 ---------
 2 files changed, 1 insertion(+), 17 deletions(-)
hw/timer/hpet.c +1 -8
index d1b7bc52b7b..47b8fc0d880 100644
@@ -71,7 +71,6 @@ struct HPETState {
 
     MemoryRegion iomem;
     uint64_t hpet_offset;
-    bool hpet_offset_saved;
     qemu_irq irqs[HPET_NUM_IRQ_ROUTES];
     uint32_t flags;
     uint8_t rtc_irq_level;
@@ -264,11 +263,6 @@ static int hpet_post_load(void *opaque, int version_id)
         t->cmp64 = hpet_calculate_cmp64(t, s->hpet_counter, t->cmp);
         t->last = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - NANOSECONDS_PER_SECOND;
     }
-    /* Recalculate the offset between the main counter and guest time */
-    if (!s->hpet_offset_saved) {
-        s->hpet_offset = ticks_to_ns(s->hpet_counter)
-                        - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
-    }
 
     return 0;
 }
@@ -277,7 +271,7 @@ static bool hpet_offset_needed(void *opaque)
 {
     HPETState *s = opaque;
 
-    return hpet_enabled(s) && s->hpet_offset_saved;
+    return hpet_enabled(s);
 }
 
 static bool hpet_rtc_irq_level_needed(void *opaque)
@@ -733,7 +727,6 @@ static const Property hpet_device_properties[] = {
     DEFINE_PROP_UINT8("timers", HPETState, num_timers, HPET_MIN_TIMERS),
     DEFINE_PROP_BIT("msi", HPETState, flags, HPET_MSI_SUPPORT, false),
     DEFINE_PROP_UINT32(HPET_INTCAP, HPETState, intcap, 0),
-    DEFINE_PROP_BOOL("hpet-offset-saved", HPETState, hpet_offset_saved, true),
 };
 
 static void hpet_device_class_init(ObjectClass *klass, const void *data)
rust/hw/timer/hpet/src/hpet.rs +0 -9
index cbd2ed4f6bf..9e681391176 100644
@@ -544,7 +544,6 @@ pub struct HPETState {
 
     /// Offset of main counter relative to qemu clock.
     hpet_offset: BqlCell<u64>,
-    hpet_offset_saved: bool,
 
     irqs: [InterruptSource; HPET_NUM_IRQ_ROUTES],
     rtc_irq_level: BqlCell<u32>,
@@ -885,14 +884,6 @@ impl ObjectImpl for HPETState {
         u32,
         default = 0
     ),
-    qemu_api::define_property!(
-        c_str!("hpet-offset-saved"),
-        HPETState,
-        hpet_offset_saved,
-        unsafe { &qdev_prop_bool },
-        bool,
-        default = true
-    ),
 }
 
 impl DeviceImpl for HPETState {
Signature · 1 line
2.47.1
Reviewed-by on v1 5/10
#9 lore raw

Re: [PATCH 05/10] hw/timer/hpet: Remove HPETState::hpet_offset_saved field

Quoted 69 lines · Philippe Mathieu-Daudé

The HPETState::hpet_offset_saved boolean was only set in the hw_compat_2_11[] array, via the 'hpet-offset-saved=false' property. We removed all machines using that array, lets remove that property and all the code around it.

---
  hw/timer/hpet.c                | 9 +--------
  rust/hw/timer/hpet/src/hpet.rs | 9 ---------
  2 files changed, 1 insertion(+), 17 deletions(-)
hw/timer/hpet.c +1 -8
index d1b7bc52b7b..47b8fc0d880 100644
@@ -71,7 +71,6 @@ struct HPETState {
 
      MemoryRegion iomem;
      uint64_t hpet_offset;
-    bool hpet_offset_saved;
      qemu_irq irqs[HPET_NUM_IRQ_ROUTES];
      uint32_t flags;
      uint8_t rtc_irq_level;
@@ -264,11 +263,6 @@ static int hpet_post_load(void *opaque, int version_id)
          t->cmp64 = hpet_calculate_cmp64(t, s->hpet_counter, t->cmp);
          t->last = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - NANOSECONDS_PER_SECOND;
      }
-    /* Recalculate the offset between the main counter and guest time */
-    if (!s->hpet_offset_saved) {
-        s->hpet_offset = ticks_to_ns(s->hpet_counter)
-                        - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
-    }
 
      return 0;
  }
@@ -277,7 +271,7 @@ static bool hpet_offset_needed(void *opaque)
  {
      HPETState *s = opaque;
 
-    return hpet_enabled(s) && s->hpet_offset_saved;
+    return hpet_enabled(s);
  }
 
  static bool hpet_rtc_irq_level_needed(void *opaque)
@@ -733,7 +727,6 @@ static const Property hpet_device_properties[] = {
      DEFINE_PROP_UINT8("timers", HPETState, num_timers, HPET_MIN_TIMERS),
      DEFINE_PROP_BIT("msi", HPETState, flags, HPET_MSI_SUPPORT, false),
      DEFINE_PROP_UINT32(HPET_INTCAP, HPETState, intcap, 0),
-    DEFINE_PROP_BOOL("hpet-offset-saved", HPETState, hpet_offset_saved, true),
  };
 
  static void hpet_device_class_init(ObjectClass *klass, const void *data)
rust/hw/timer/hpet/src/hpet.rs +0 -2
index cbd2ed4f6bf..9e681391176 100644
@@ -544,7 +544,6 @@ pub struct HPETState {
 
      /// Offset of main counter relative to qemu clock.
      hpet_offset: BqlCell<u64>,
-    hpet_offset_saved: bool,
 
      irqs: [InterruptSource; HPET_NUM_IRQ_ROUTES],
      rtc_irq_level: BqlCell<u32>,
@@ -885,14 +884,6 @@ impl ObjectImpl for HPETState {
          u32,
          default = 0
      ),
-    qemu_api::define_property!(

rust/hw/timer/hpet/src/hpet.rs impl ObjectImpl for HPETState { · line 889

Quoted 10 lines
rust/hw/timer/hpet/src/hpet.rs +0 -7
-        c_str!("hpet-offset-saved"),
-        HPETState,
-        hpet_offset_saved,
-        unsafe { &qdev_prop_bool },
-        bool,
-        default = true
-    ),
  }
 
  impl DeviceImpl for HPETState {
#10 lore raw

PATCH 6/10 hw/net/e1000: Remove unused E1000_FLAG_TSO flag

In reply to Philippe Mathieu-Daudé

E1000_FLAG_TSO was only used by the hw_compat_2_11[] array, via the 'migrate_tso_props=off' property. We removed all machines using that array, lets remove all the code around E1000_FLAG_TSO, including the vmstate_e1000_tx_tso_state subsection.

---
Is it OK to remove migration subsection like that?

---
 hw/net/e1000.c | 58 +++++++-------------------------------------------
 1 file changed, 8 insertions(+), 50 deletions(-)
hw/net/e1000.c +8 -50
index e0310aef872..c68645684b6 100644
@@ -127,13 +127,10 @@ struct E1000State_st {
     QEMUTimer *flush_queue_timer;
 
 /* Compatibility flags for migration to/from qemu 1.3.0 and older */
-#define E1000_FLAG_TSO_BIT 3
 #define E1000_FLAG_VET_BIT 4
-#define E1000_FLAG_TSO (1 << E1000_FLAG_TSO_BIT)
 #define E1000_FLAG_VET (1 << E1000_FLAG_VET_BIT)
 
     uint32_t compat_flags;
-    bool received_tx_tso;
     bool use_tso_for_migration;
     e1000x_txd_props mig_props;
 };
@@ -1331,7 +1328,7 @@ static int e1000_pre_save(void *opaque)
     }
 
     /* Decide which set of props to migrate in the main structure */
-    if (chkflag(TSO) || !s->use_tso_for_migration) {
+    if (!s->use_tso_for_migration) {
         /* Either we're migrating with the extra subsection, in which
          * case the mig_props is always 'props' OR
          * we've not got the subsection, but 'props' was the last
@@ -1368,30 +1365,16 @@ static int e1000_post_load(void *opaque, int version_id)
     }
 
     s->tx.props = s->mig_props;
-    if (!s->received_tx_tso) {
-        /* We received only one set of offload data (tx.props)
-         * and haven't got tx.tso_props.  The best we can do
-         * is dupe the data.
-         */
-        s->tx.tso_props = s->mig_props;
-    }
+
+    /* We received only one set of offload data (tx.props)
+     * and haven't got tx.tso_props.  The best we can do
+     * is dupe the data.
+     */
+    s->tx.tso_props = s->mig_props;
+
     return 0;
 }
 
-static int e1000_tx_tso_post_load(void *opaque, int version_id)
-{
-    E1000State *s = opaque;
-    s->received_tx_tso = true;
-    return 0;
-}
-
-static bool e1000_tso_state_needed(void *opaque)
-{
-    E1000State *s = opaque;
-
-    return chkflag(TSO);
-}
-
 static const VMStateDescription vmstate_e1000_mit_state = {
     .name = "e1000/mit_state",
     .version_id = 1,
@@ -1416,28 +1399,6 @@ static const VMStateDescription vmstate_e1000_full_mac_state = {
     }
 };
 
-static const VMStateDescription vmstate_e1000_tx_tso_state = {
-    .name = "e1000/tx_tso_state",
-    .version_id = 1,
-    .minimum_version_id = 1,
-    .needed = e1000_tso_state_needed,
-    .post_load = e1000_tx_tso_post_load,
-    .fields = (const VMStateField[]) {
-        VMSTATE_UINT8(tx.tso_props.ipcss, E1000State),
-        VMSTATE_UINT8(tx.tso_props.ipcso, E1000State),
-        VMSTATE_UINT16(tx.tso_props.ipcse, E1000State),
-        VMSTATE_UINT8(tx.tso_props.tucss, E1000State),
-        VMSTATE_UINT8(tx.tso_props.tucso, E1000State),
-        VMSTATE_UINT16(tx.tso_props.tucse, E1000State),
-        VMSTATE_UINT32(tx.tso_props.paylen, E1000State),
-        VMSTATE_UINT8(tx.tso_props.hdr_len, E1000State),
-        VMSTATE_UINT16(tx.tso_props.mss, E1000State),
-        VMSTATE_INT8(tx.tso_props.ip, E1000State),
-        VMSTATE_INT8(tx.tso_props.tcp, E1000State),
-        VMSTATE_END_OF_LIST()
-    }
-};
-
 static const VMStateDescription vmstate_e1000 = {
     .name = "e1000",
     .version_id = 2,
@@ -1519,7 +1480,6 @@ static const VMStateDescription vmstate_e1000 = {
     .subsections = (const VMStateDescription * const []) {
         &vmstate_e1000_mit_state,
         &vmstate_e1000_full_mac_state,
-        &vmstate_e1000_tx_tso_state,
         NULL
     }
 };
@@ -1637,8 +1597,6 @@ static void pci_e1000_realize(PCIDevice *pci_dev, Error **errp)
 
 static const Property e1000_properties[] = {
     DEFINE_NIC_PROPERTIES(E1000State, conf),
-    DEFINE_PROP_BIT("migrate_tso_props", E1000State,
-                    compat_flags, E1000_FLAG_TSO_BIT, true),
     DEFINE_PROP_BIT("init-vet", E1000State,
                     compat_flags, E1000_FLAG_VET_BIT, true),
 };
Signature · 1 line
2.47.1
#11 lore raw

Re: [PATCH 06/10] hw/net/e1000: Remove unused E1000_FLAG_TSO flag

Quoted 108 lines · Philippe Mathieu-Daudé

E1000_FLAG_TSO was only used by the hw_compat_2_11[] array, via the 'migrate_tso_props=off' property. We removed all machines using that array, lets remove all the code around E1000_FLAG_TSO, including the vmstate_e1000_tx_tso_state subsection.

---
Is it OK to remove migration subsection like that?

---
  hw/net/e1000.c | 58 +++++++-------------------------------------------
  1 file changed, 8 insertions(+), 50 deletions(-)
hw/net/e1000.c +8 -47
index e0310aef872..c68645684b6 100644
@@ -127,13 +127,10 @@ struct E1000State_st {
      QEMUTimer *flush_queue_timer;
 
  /* Compatibility flags for migration to/from qemu 1.3.0 and older */
-#define E1000_FLAG_TSO_BIT 3
  #define E1000_FLAG_VET_BIT 4
-#define E1000_FLAG_TSO (1 << E1000_FLAG_TSO_BIT)
  #define E1000_FLAG_VET (1 << E1000_FLAG_VET_BIT)
 
      uint32_t compat_flags;
-    bool received_tx_tso;
      bool use_tso_for_migration;
      e1000x_txd_props mig_props;
  };
@@ -1331,7 +1328,7 @@ static int e1000_pre_save(void *opaque)
      }
 
      /* Decide which set of props to migrate in the main structure */
-    if (chkflag(TSO) || !s->use_tso_for_migration) {
+    if (!s->use_tso_for_migration) {
          /* Either we're migrating with the extra subsection, in which
           * case the mig_props is always 'props' OR
           * we've not got the subsection, but 'props' was the last
@@ -1368,30 +1365,16 @@ static int e1000_post_load(void *opaque, int version_id)
      }
 
      s->tx.props = s->mig_props;
-    if (!s->received_tx_tso) {
-        /* We received only one set of offload data (tx.props)
-         * and haven't got tx.tso_props.  The best we can do
-         * is dupe the data.
-         */
-        s->tx.tso_props = s->mig_props;
-    }
+
+    /* We received only one set of offload data (tx.props)
+     * and haven't got tx.tso_props.  The best we can do
+     * is dupe the data.
+     */
+    s->tx.tso_props = s->mig_props;
+
      return 0;
  }
 
-static int e1000_tx_tso_post_load(void *opaque, int version_id)
-{
-    E1000State *s = opaque;
-    s->received_tx_tso = true;
-    return 0;
-}
-
-static bool e1000_tso_state_needed(void *opaque)
-{
-    E1000State *s = opaque;
-
-    return chkflag(TSO);
-}
-
  static const VMStateDescription vmstate_e1000_mit_state = {
      .name = "e1000/mit_state",
      .version_id = 1,
@@ -1416,28 +1399,6 @@ static const VMStateDescription vmstate_e1000_full_mac_state = {
      }
  };
 
-static const VMStateDescription vmstate_e1000_tx_tso_state = {
-    .name = "e1000/tx_tso_state",
-    .version_id = 1,
-    .minimum_version_id = 1,
-    .needed = e1000_tso_state_needed,
-    .post_load = e1000_tx_tso_post_load,
-    .fields = (const VMStateField[]) {
-        VMSTATE_UINT8(tx.tso_props.ipcss, E1000State),
-        VMSTATE_UINT8(tx.tso_props.ipcso, E1000State),
-        VMSTATE_UINT16(tx.tso_props.ipcse, E1000State),
-        VMSTATE_UINT8(tx.tso_props.tucss, E1000State),
-        VMSTATE_UINT8(tx.tso_props.tucso, E1000State),
-        VMSTATE_UINT16(tx.tso_props.tucse, E1000State),
-        VMSTATE_UINT32(tx.tso_props.paylen, E1000State),
-        VMSTATE_UINT8(tx.tso_props.hdr_len, E1000State),
-        VMSTATE_UINT16(tx.tso_props.mss, E1000State),
-        VMSTATE_INT8(tx.tso_props.ip, E1000State),
-        VMSTATE_INT8(tx.tso_props.tcp, E1000State),
-        VMSTATE_END_OF_LIST()
-    }
-};
-
  static const VMStateDescription vmstate_e1000 = {
      .name = "e1000",
      .version_id = 2,

hw/net/e1000.c static const VMStateDescription vmstate_e1000 = { · line 1522

Quoted 4 lines
hw/net/e1000.c +0 -1
@@ -1519,7 +1480,6 @@ static const VMStateDescription vmstate_e1000 = {
      .subsections = (const VMStateDescription * const []) {
          &vmstate_e1000_mit_state,
          &vmstate_e1000_full_mac_state,
-        &vmstate_e1000_tx_tso_state,

Uh, this looks wrong? The bit is enabled by default, so shouldn't the subsection be always used unconditionally now instead?

Thomas

Quoted 12 lines
hw/net/e1000.c +0 -2
          NULL
      }
  };
@@ -1637,8 +1597,6 @@ static void pci_e1000_realize(PCIDevice *pci_dev, Error **errp)
 
  static const Property e1000_properties[] = {
      DEFINE_NIC_PROPERTIES(E1000State, conf),
-    DEFINE_PROP_BIT("migrate_tso_props", E1000State,
-                    compat_flags, E1000_FLAG_TSO_BIT, true),
      DEFINE_PROP_BIT("init-vet", E1000State,
                      compat_flags, E1000_FLAG_VET_BIT, true),
  };
#12 lore raw

PATCH 7/10 hw/s390x/s390-virtio-ccw: Remove the deprecated 2.12 machine type

In reply to Philippe Mathieu-Daudé

From: Thomas Huth <[email protected]>

The s390-ccw-virtio-2.12 machine is older than 6 years, so according to our machine support policy, it can be removed now.

Message-ID: <[email protected]>

---
 hw/s390x/s390-virtio-ccw.c | 14 --------------
 1 file changed, 14 deletions(-)
hw/s390x/s390-virtio-ccw.c +0 -14
index 2c90702d834..e612030bc18 100644
@@ -1236,20 +1236,6 @@ static void ccw_machine_3_0_class_options(MachineClass *mc)
 }
 DEFINE_CCW_MACHINE(3, 0);
 
-static void ccw_machine_2_12_instance_options(MachineState *machine)
-{
-    ccw_machine_3_0_instance_options(machine);
-    s390_cpudef_featoff_greater(11, 1, S390_FEAT_PPA15);
-    s390_cpudef_featoff_greater(11, 1, S390_FEAT_BPB);
-}
-
-static void ccw_machine_2_12_class_options(MachineClass *mc)
-{
-    ccw_machine_3_0_class_options(mc);
-    compat_props_add(mc->compat_props, hw_compat_2_12, hw_compat_2_12_len);
-}
-DEFINE_CCW_MACHINE(2, 12);
-
 static void ccw_machine_register_types(void)
 {
     type_register_static(&ccw_machine_info);
Signature · 1 line
2.47.1
#13 lore raw

PATCH 8/10 hw/core/machine: Remove hw_compat_2_12[] array

In reply to Philippe Mathieu-Daudé

The hw_compat_2_12[] array was only used by the pc-q35-2.12, pc-i440fx-2.12 and s390-ccw-virtio-2.12 machines, which got removed. Remove it.

---
 include/hw/boards.h | 3 ---
 hw/core/machine.c   | 9 ---------
 2 files changed, 12 deletions(-)
include/hw/boards.h +0 -3
index 16cef33beae..7b3f7878625 100644
@@ -823,7 +823,4 @@ extern const size_t hw_compat_3_1_len;
 extern GlobalProperty hw_compat_3_0[];
 extern const size_t hw_compat_3_0_len;
 
-extern GlobalProperty hw_compat_2_12[];
-extern const size_t hw_compat_2_12_len;
-
 #endif
hw/core/machine.c +0 -9
index 8f1b44b70f7..4ebefaab819 100644
@@ -221,15 +221,6 @@ const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1);
 GlobalProperty hw_compat_3_0[] = {};
 const size_t hw_compat_3_0_len = G_N_ELEMENTS(hw_compat_3_0);
 
-GlobalProperty hw_compat_2_12[] = {
-    { "hda-audio", "use-timer", "false" },
-    { "cirrus-vga", "global-vmstate", "true" },
-    { "VGA", "global-vmstate", "true" },
-    { "vmware-svga", "global-vmstate", "true" },
-    { "qxl-vga", "global-vmstate", "true" },
-};
-const size_t hw_compat_2_12_len = G_N_ELEMENTS(hw_compat_2_12);
-
 MachineState *current_machine;
 
 static char *machine_get_kernel(Object *obj, Error **errp)
Signature · 1 line
2.47.1
Reviewed-by on v1 8/10
#14 lore raw

Re: [PATCH 08/10] hw/core/machine: Remove hw_compat_2_12[] array

Quoted 32 lines · Philippe Mathieu-Daudé

The hw_compat_2_12[] array was only used by the pc-q35-2.12, pc-i440fx-2.12 and s390-ccw-virtio-2.12 machines, which got removed. Remove it.

---
  include/hw/boards.h | 3 ---
  hw/core/machine.c   | 9 ---------
  2 files changed, 12 deletions(-)
include/hw/boards.h +0 -3
index 16cef33beae..7b3f7878625 100644
@@ -823,7 +823,4 @@ extern const size_t hw_compat_3_1_len;
  extern GlobalProperty hw_compat_3_0[];
  extern const size_t hw_compat_3_0_len;
 
-extern GlobalProperty hw_compat_2_12[];
-extern const size_t hw_compat_2_12_len;
-
  #endif
hw/core/machine.c +0 -2
index 8f1b44b70f7..4ebefaab819 100644
@@ -221,15 +221,6 @@ const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1);
  GlobalProperty hw_compat_3_0[] = {};
  const size_t hw_compat_3_0_len = G_N_ELEMENTS(hw_compat_3_0);
 
-GlobalProperty hw_compat_2_12[] = {
-    { "hda-audio", "use-timer", "false" },

hw/core/machine.c const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1); · line 226

Quoted 10 lines
hw/core/machine.c +0 -7
-    { "cirrus-vga", "global-vmstate", "true" },
-    { "VGA", "global-vmstate", "true" },
-    { "vmware-svga", "global-vmstate", "true" },
-    { "qxl-vga", "global-vmstate", "true" },
-};
-const size_t hw_compat_2_12_len = G_N_ELEMENTS(hw_compat_2_12);
-
  MachineState *current_machine;
 
  static char *machine_get_kernel(Object *obj, Error **errp)
#15 lore raw

PATCH 9/10 hw/audio/hda-codec: Remove HDAAudioState::use_timer field

In reply to Philippe Mathieu-Daudé

The HDAAudioState::use_timer boolean was only set in the hw_compat_2_12[] array, via the 'use-timer=false' property. We removed all machines using that array, lets remove that property and all the code around it, like the compatibility callbacks.

---
 hw/audio/hda-codec.c | 91 +++++++-------------------------------------
 1 file changed, 13 insertions(+), 78 deletions(-)
hw/audio/hda-codec.c +13 -78
index 66edad280f2..92e1fe65827 100644
@@ -187,7 +187,6 @@ struct HDAAudioState {
     /* properties */
     uint32_t debug;
     bool     mixer;
-    bool     use_timer;
 };
 
 static inline uint32_t hda_bytes_per_second(HDAAudioStream *st)
@@ -366,58 +365,6 @@ static void hda_audio_output_cb(void *opaque, int avail)
     hda_timer_sync_adjust(st, (wpos - rpos) - (B_SIZE >> 1));
 }
 
-static void hda_audio_compat_input_cb(void *opaque, int avail)
-{
-    HDAAudioStream *st = opaque;
-    int recv = 0;
-    int len;
-    bool rc;
-
-    while (avail - recv >= sizeof(st->compat_buf)) {
-        if (st->compat_bpos != sizeof(st->compat_buf)) {
-            len = AUD_read(st->voice.in, st->compat_buf + st->compat_bpos,
-                           sizeof(st->compat_buf) - st->compat_bpos);
-            st->compat_bpos += len;
-            recv += len;
-            if (st->compat_bpos != sizeof(st->compat_buf)) {
-                break;
-            }
-        }
-        rc = hda_codec_xfer(&st->state->hda, st->stream, false,
-                            st->compat_buf, sizeof(st->compat_buf));
-        if (!rc) {
-            break;
-        }
-        st->compat_bpos = 0;
-    }
-}
-
-static void hda_audio_compat_output_cb(void *opaque, int avail)
-{
-    HDAAudioStream *st = opaque;
-    int sent = 0;
-    int len;
-    bool rc;
-
-    while (avail - sent >= sizeof(st->compat_buf)) {
-        if (st->compat_bpos == sizeof(st->compat_buf)) {
-            rc = hda_codec_xfer(&st->state->hda, st->stream, true,
-                                st->compat_buf, sizeof(st->compat_buf));
-            if (!rc) {
-                break;
-            }
-            st->compat_bpos = 0;
-        }
-        len = AUD_write(st->voice.out, st->compat_buf + st->compat_bpos,
-                        sizeof(st->compat_buf) - st->compat_bpos);
-        st->compat_bpos += len;
-        sent += len;
-        if (st->compat_bpos != sizeof(st->compat_buf)) {
-            break;
-        }
-    }
-}
-
 static void hda_audio_set_running(HDAAudioStream *st, bool running)
 {
     if (st->node == NULL) {
@@ -428,16 +375,14 @@ static void hda_audio_set_running(HDAAudioStream *st, bool running)
     }
     st->running = running;
     trace_hda_audio_running(st->node->name, st->stream, st->running);
-    if (st->state->use_timer) {
-        if (running) {
-            int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
-            st->rpos = 0;
-            st->wpos = 0;
-            st->buft_start = now;
-            timer_mod_anticipate_ns(st->buft, now + HDA_TIMER_TICKS);
-        } else {
-            timer_del(st->buft);
-        }
+    if (running) {
+        int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+        st->rpos = 0;
+        st->wpos = 0;
+        st->buft_start = now;
+        timer_mod_anticipate_ns(st->buft, now + HDA_TIMER_TICKS);
+    } else {
+        timer_del(st->buft);
     }
     if (st->output) {
         AUD_set_active_out(st->voice.out, st->running);
@@ -474,7 +419,6 @@ static void hda_audio_set_amp(HDAAudioStream *st)
 
 static void hda_audio_setup(HDAAudioStream *st)
 {
-    bool use_timer = st->state->use_timer;
     audio_callback_fn cb;
 
     if (st->node == NULL) {
@@ -485,21 +429,13 @@ static void hda_audio_setup(HDAAudioStream *st)
                            fmt2name[st->as.fmt], st->as.freq);
 
     if (st->output) {
-        if (use_timer) {
-            cb = hda_audio_output_cb;
-            timer_del(st->buft);
-        } else {
-            cb = hda_audio_compat_output_cb;
-        }
+        cb = hda_audio_output_cb;
+        timer_del(st->buft);
         st->voice.out = AUD_open_out(&st->state->card, st->voice.out,
                                      st->node->name, st, cb, &st->as);
     } else {
-        if (use_timer) {
-            cb = hda_audio_input_cb;
-            timer_del(st->buft);
-        } else {
-            cb = hda_audio_compat_input_cb;
-        }
+        cb = hda_audio_input_cb;
+        timer_del(st->buft);
         st->voice.in = AUD_open_in(&st->state->card, st->voice.in,
                                    st->node->name, st, cb, &st->as);
     }
@@ -805,7 +741,7 @@ static void hda_audio_reset(DeviceState *dev)
 static bool vmstate_hda_audio_stream_buf_needed(void *opaque)
 {
     HDAAudioStream *st = opaque;
-    return st->state && st->state->use_timer;
+    return st->state;
 }
 
 static const VMStateDescription vmstate_hda_audio_stream_buf = {
@@ -861,7 +797,6 @@ static const Property hda_audio_properties[] = {
     DEFINE_AUDIO_PROPERTIES(HDAAudioState, card),
     DEFINE_PROP_UINT32("debug", HDAAudioState, debug,   0),
     DEFINE_PROP_BOOL("mixer", HDAAudioState, mixer,  true),
-    DEFINE_PROP_BOOL("use-timer", HDAAudioState, use_timer,  true),
 };
 
 static void hda_audio_init_output(HDACodecDevice *hda, Error **errp)
Signature · 1 line
2.47.1
Reviewed-by on v1 9/10
#16 lore raw

Re: [PATCH 09/10] hw/audio/hda-codec: Remove HDAAudioState::use_timer field

Quoted 151 lines · Philippe Mathieu-Daudé

The HDAAudioState::use_timer boolean was only set in the hw_compat_2_12[] array, via the 'use-timer=false' property. We removed all machines using that array, lets remove that property and all the code around it, like the compatibility callbacks.

---
  hw/audio/hda-codec.c | 91 +++++++-------------------------------------
  1 file changed, 13 insertions(+), 78 deletions(-)
hw/audio/hda-codec.c +13 -77
index 66edad280f2..92e1fe65827 100644
@@ -187,7 +187,6 @@ struct HDAAudioState {
      /* properties */
      uint32_t debug;
      bool     mixer;
-    bool     use_timer;
  };
 
  static inline uint32_t hda_bytes_per_second(HDAAudioStream *st)
@@ -366,58 +365,6 @@ static void hda_audio_output_cb(void *opaque, int avail)
      hda_timer_sync_adjust(st, (wpos - rpos) - (B_SIZE >> 1));
  }
 
-static void hda_audio_compat_input_cb(void *opaque, int avail)
-{
-    HDAAudioStream *st = opaque;
-    int recv = 0;
-    int len;
-    bool rc;
-
-    while (avail - recv >= sizeof(st->compat_buf)) {
-        if (st->compat_bpos != sizeof(st->compat_buf)) {
-            len = AUD_read(st->voice.in, st->compat_buf + st->compat_bpos,
-                           sizeof(st->compat_buf) - st->compat_bpos);
-            st->compat_bpos += len;
-            recv += len;
-            if (st->compat_bpos != sizeof(st->compat_buf)) {
-                break;
-            }
-        }
-        rc = hda_codec_xfer(&st->state->hda, st->stream, false,
-                            st->compat_buf, sizeof(st->compat_buf));
-        if (!rc) {
-            break;
-        }
-        st->compat_bpos = 0;
-    }
-}
-
-static void hda_audio_compat_output_cb(void *opaque, int avail)
-{
-    HDAAudioStream *st = opaque;
-    int sent = 0;
-    int len;
-    bool rc;
-
-    while (avail - sent >= sizeof(st->compat_buf)) {
-        if (st->compat_bpos == sizeof(st->compat_buf)) {
-            rc = hda_codec_xfer(&st->state->hda, st->stream, true,
-                                st->compat_buf, sizeof(st->compat_buf));
-            if (!rc) {
-                break;
-            }
-            st->compat_bpos = 0;
-        }
-        len = AUD_write(st->voice.out, st->compat_buf + st->compat_bpos,
-                        sizeof(st->compat_buf) - st->compat_bpos);
-        st->compat_bpos += len;
-        sent += len;
-        if (st->compat_bpos != sizeof(st->compat_buf)) {
-            break;
-        }
-    }
-}
-
  static void hda_audio_set_running(HDAAudioStream *st, bool running)
  {
      if (st->node == NULL) {
@@ -428,16 +375,14 @@ static void hda_audio_set_running(HDAAudioStream *st, bool running)
      }
      st->running = running;
      trace_hda_audio_running(st->node->name, st->stream, st->running);
-    if (st->state->use_timer) {
-        if (running) {
-            int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
-            st->rpos = 0;
-            st->wpos = 0;
-            st->buft_start = now;
-            timer_mod_anticipate_ns(st->buft, now + HDA_TIMER_TICKS);
-        } else {
-            timer_del(st->buft);
-        }
+    if (running) {
+        int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+        st->rpos = 0;
+        st->wpos = 0;
+        st->buft_start = now;
+        timer_mod_anticipate_ns(st->buft, now + HDA_TIMER_TICKS);
+    } else {
+        timer_del(st->buft);
      }
      if (st->output) {
          AUD_set_active_out(st->voice.out, st->running);
@@ -474,7 +419,6 @@ static void hda_audio_set_amp(HDAAudioStream *st)
 
  static void hda_audio_setup(HDAAudioStream *st)
  {
-    bool use_timer = st->state->use_timer;
      audio_callback_fn cb;
 
      if (st->node == NULL) {
@@ -485,21 +429,13 @@ static void hda_audio_setup(HDAAudioStream *st)
                             fmt2name[st->as.fmt], st->as.freq);
 
      if (st->output) {
-        if (use_timer) {
-            cb = hda_audio_output_cb;
-            timer_del(st->buft);
-        } else {
-            cb = hda_audio_compat_output_cb;
-        }
+        cb = hda_audio_output_cb;
+        timer_del(st->buft);
          st->voice.out = AUD_open_out(&st->state->card, st->voice.out,
                                       st->node->name, st, cb, &st->as);
      } else {
-        if (use_timer) {
-            cb = hda_audio_input_cb;
-            timer_del(st->buft);
-        } else {
-            cb = hda_audio_compat_input_cb;
-        }
+        cb = hda_audio_input_cb;
+        timer_del(st->buft);
          st->voice.in = AUD_open_in(&st->state->card, st->voice.in,
                                     st->node->name, st, cb, &st->as);
      }
@@ -805,7 +741,7 @@ static void hda_audio_reset(DeviceState *dev)
  static bool vmstate_hda_audio_stream_buf_needed(void *opaque)
  {
      HDAAudioStream *st = opaque;
-    return st->state && st->state->use_timer;
+    return st->state;
  }
 
  static const VMStateDescription vmstate_hda_audio_stream_buf = {

hw/audio/hda-codec.c static const Property hda_audio_properties[] = { · line 802

Quoted 7 lines
hw/audio/hda-codec.c +0 -1
@@ -861,7 +797,6 @@ static const Property hda_audio_properties[] = {
      DEFINE_AUDIO_PROPERTIES(HDAAudioState, card),
      DEFINE_PROP_UINT32("debug", HDAAudioState, debug,   0),
      DEFINE_PROP_BOOL("mixer", HDAAudioState, mixer,  true),
-    DEFINE_PROP_BOOL("use-timer", HDAAudioState, use_timer,  true),
  };
 
  static void hda_audio_init_output(HDACodecDevice *hda, Error **errp)
#17 lore raw

PATCH 10/10 hw/display/vga-pci: Do not expose the 'global-vmstate' property

In reply to Philippe Mathieu-Daudé

The "global-vmstate" property is 'false' by default, and was only set to 'true' in the hw_compat_2_12[] array. We removed all machines using that array. Stop exposing that property on the PCI devices.

---
 hw/display/cirrus_vga.c | 2 --
 hw/display/qxl.c        | 1 -
 hw/display/vga-pci.c    | 1 -
 hw/display/vmware_vga.c | 2 --
 4 files changed, 6 deletions(-)
hw/display/cirrus_vga.c +0 -2
index ef08694626d..f9f704ab440 100644
@@ -2987,8 +2987,6 @@ static const Property pci_vga_cirrus_properties[] = {
                        cirrus_vga.vga.vram_size_mb, 4),
     DEFINE_PROP_BOOL("blitter", struct PCICirrusVGAState,
                      cirrus_vga.enable_blitter, true),
-    DEFINE_PROP_BOOL("global-vmstate", struct PCICirrusVGAState,
-                     cirrus_vga.vga.global_vmstate, false),
 };
 
 static void cirrus_vga_class_init(ObjectClass *klass, const void *data)
hw/display/qxl.c +0 -1
index 18f482ca7f7..32329a499d7 100644
@@ -2495,7 +2495,6 @@ static const Property qxl_properties[] = {
         DEFINE_PROP_UINT16("max_outputs", PCIQXLDevice, max_outputs, 0),
         DEFINE_PROP_UINT32("xres", PCIQXLDevice, xres, 0),
         DEFINE_PROP_UINT32("yres", PCIQXLDevice, yres, 0),
-        DEFINE_PROP_BOOL("global-vmstate", PCIQXLDevice, vga.global_vmstate, false),
 };
 
 static void qxl_pci_class_init(ObjectClass *klass, const void *data)
hw/display/vga-pci.c +0 -1
index b81f7fd2d0f..562cf526db4 100644
@@ -338,7 +338,6 @@ static const Property vga_pci_properties[] = {
     DEFINE_PROP_BIT("edid",
                     PCIVGAState, flags, PCI_VGA_FLAG_ENABLE_EDID, true),
     DEFINE_EDID_PROPERTIES(PCIVGAState, edid_info),
-    DEFINE_PROP_BOOL("global-vmstate", PCIVGAState, vga.global_vmstate, false),
 };
 
 static const Property secondary_pci_properties[] = {
hw/display/vmware_vga.c +0 -2
index 544bb65320b..c43026bd9c5 100644
@@ -1335,8 +1335,6 @@ static void pci_vmsvga_realize(PCIDevice *dev, Error **errp)
 static const Property vga_vmware_properties[] = {
     DEFINE_PROP_UINT32("vgamem_mb", struct pci_vmsvga_state_s,
                        chip.vga.vram_size_mb, 16),
-    DEFINE_PROP_BOOL("global-vmstate", struct pci_vmsvga_state_s,
-                     chip.vga.global_vmstate, false),
 };
 
 static void vmsvga_class_init(ObjectClass *klass, const void *data)
Signature · 1 line
2.47.1
Reviewed-by on v1 10/10
#18 lore raw

Re: [PATCH 10/10] hw/display/vga-pci: Do not expose the 'global-vmstate' property

Quoted 54 lines · Philippe Mathieu-Daudé

The "global-vmstate" property is 'false' by default, and was only set to 'true' in the hw_compat_2_12[] array. We removed all machines using that array. Stop exposing that property on the PCI devices.

---
  hw/display/cirrus_vga.c | 2 --
  hw/display/qxl.c        | 1 -
  hw/display/vga-pci.c    | 1 -
  hw/display/vmware_vga.c | 2 --
  4 files changed, 6 deletions(-)
hw/display/cirrus_vga.c +0 -2
index ef08694626d..f9f704ab440 100644
@@ -2987,8 +2987,6 @@ static const Property pci_vga_cirrus_properties[] = {
                         cirrus_vga.vga.vram_size_mb, 4),
      DEFINE_PROP_BOOL("blitter", struct PCICirrusVGAState,
                       cirrus_vga.enable_blitter, true),
-    DEFINE_PROP_BOOL("global-vmstate", struct PCICirrusVGAState,
-                     cirrus_vga.vga.global_vmstate, false),
  };
 
  static void cirrus_vga_class_init(ObjectClass *klass, const void *data)
hw/display/qxl.c +0 -1
index 18f482ca7f7..32329a499d7 100644
@@ -2495,7 +2495,6 @@ static const Property qxl_properties[] = {
          DEFINE_PROP_UINT16("max_outputs", PCIQXLDevice, max_outputs, 0),
          DEFINE_PROP_UINT32("xres", PCIQXLDevice, xres, 0),
          DEFINE_PROP_UINT32("yres", PCIQXLDevice, yres, 0),
-        DEFINE_PROP_BOOL("global-vmstate", PCIQXLDevice, vga.global_vmstate, false),
  };
 
  static void qxl_pci_class_init(ObjectClass *klass, const void *data)
hw/display/vga-pci.c +0 -1
index b81f7fd2d0f..562cf526db4 100644
@@ -338,7 +338,6 @@ static const Property vga_pci_properties[] = {
      DEFINE_PROP_BIT("edid",
                      PCIVGAState, flags, PCI_VGA_FLAG_ENABLE_EDID, true),
      DEFINE_EDID_PROPERTIES(PCIVGAState, edid_info),
-    DEFINE_PROP_BOOL("global-vmstate", PCIVGAState, vga.global_vmstate, false),
  };
 
  static const Property secondary_pci_properties[] = {
hw/display/vmware_vga.c +0 -0
index 544bb65320b..c43026bd9c5 100644

hw/display/vmware_vga.c static void pci_vmsvga_realize(PCIDevice *dev, Error **errp) · line 1340

Quoted 8 lines
hw/display/vmware_vga.c +0 -2
@@ -1335,8 +1335,6 @@ static void pci_vmsvga_realize(PCIDevice *dev, Error **errp)
  static const Property vga_vmware_properties[] = {
      DEFINE_PROP_UINT32("vgamem_mb", struct pci_vmsvga_state_s,
                         chip.vga.vram_size_mb, 16),
-    DEFINE_PROP_BOOL("global-vmstate", struct pci_vmsvga_state_s,
-                     chip.vga.global_vmstate, false),
  };
 
  static void vmsvga_class_init(ObjectClass *klass, const void *data)

... and we can't remove the remaining global_vmstate stuff since it's still used by vga-isa.c and vga-mmio.c ...

#19 lore raw

Re: [PATCH 10/10] hw/display/vga-pci: Do not expose the 'global-vmstate' property

Quoted 3 lines · Thomas Huth

... and we can't remove the remaining global_vmstate stuff since it's still used by vga-isa.c and vga-mmio.c ...

Unfortunate in hindsight that we didn't tie this to versioning for all uses.

TYPE_VGA_MMIO is used only be the MIPS Jazz board, which is not versioned, so we can break migration compat there and switch it to not-global.

But TYPE_ISA_VGA and TYPE_CIRRUS_ISA_VGA are both pluggable ISA devices -- since you can plug those into a versioned PC machine, I assume we can't break migration compat there ?

thanks
-- PMM

#20 lore raw

Re: [PATCH 10/10] hw/display/vga-pci: Do not expose the 'global-vmstate' property

Quoted 8 lines · Peter Maydell
Quoted 3 lines · Thomas Huth

... and we can't remove the remaining global_vmstate stuff since it's still used by vga-isa.c and vga-mmio.c ...

Unfortunate in hindsight that we didn't tie this to versioning for all uses.

Quoted 7 lines

TYPE_VGA_MMIO is used only be the MIPS Jazz board, which is not versioned, so we can break migration compat there and switch it to not-global.

But TYPE_ISA_VGA and TYPE_CIRRUS_ISA_VGA are both pluggable ISA devices -- since you can plug those into a versioned PC machine, I assume we can't break migration compat there ?

I guess so, yes.

Shall we maybe start setting global_vmstate = false for the latest machine types, so that we can at least remove this kludge in a couple of years?

Thomas