Skip to contentSkip to conversation

ppc/spapr: remove deprecated machines till pseries-4.0

PATCH Superseded Harsh Prateek Bora 3 participants 9 messages May 7, 2025 – Oct 9, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/3 ppc/spapr: remove deprecated machine pseries-3.0

In reply to Harsh Prateek Bora

pseries-3.0 had been deprecated and due for removal now as per policy. Also remove legacy irq support which existed for pre pseries-3.1 machines.

---
 include/hw/ppc/spapr.h     |  1 -
 include/hw/ppc/spapr_irq.h |  1 -
 hw/ppc/spapr.c             | 27 +--------------------------
 hw/ppc/spapr_events.c      |  8 --------
 hw/ppc/spapr_irq.c         | 16 +---------------
 hw/ppc/spapr_pci.c         | 32 ++++----------------------------
 hw/ppc/spapr_vio.c         |  9 ---------
 7 files changed, 6 insertions(+), 88 deletions(-)
include/hw/ppc/spapr.h +0 -1
index 39bd5bd5ed..0c1e5132de 100644
@@ -145,7 +145,6 @@ struct SpaprMachineClass {
     /*< public >*/
     bool dr_phb_enabled;       /* enable dynamic-reconfig/hotplug of PHBs */
     bool update_dt_enabled;    /* enable KVMPPC_H_UPDATE_DT */
-    bool legacy_irq_allocation;
     uint32_t nr_xirqs;
     bool broken_host_serial_model; /* present real host info to the guest */
     bool pre_4_1_migration; /* don't migrate hpt-max-page-size */
include/hw/ppc/spapr_irq.h +0 -1
index cb9a85f657..5ddd1107c3 100644
@@ -100,7 +100,6 @@ typedef struct SpaprIrq {
 } SpaprIrq;
 
 extern SpaprIrq spapr_irq_xics;
-extern SpaprIrq spapr_irq_xics_legacy;
 extern SpaprIrq spapr_irq_xive;
 extern SpaprIrq spapr_irq_dual;
 
hw/ppc/spapr.c +1 -26
index 702f774cda..6d17f4b808 100644
@@ -3345,9 +3345,7 @@ static char *spapr_get_ic_mode(Object *obj, Error **errp)
 {
     SpaprMachineState *spapr = SPAPR_MACHINE(obj);
 
-    if (spapr->irq == &spapr_irq_xics_legacy) {
-        return g_strdup("legacy");
-    } else if (spapr->irq == &spapr_irq_xics) {
+    if (spapr->irq == &spapr_irq_xics) {
         return g_strdup("xics");
     } else if (spapr->irq == &spapr_irq_xive) {
         return g_strdup("xive");
@@ -3361,11 +3359,6 @@ static void spapr_set_ic_mode(Object *obj, const char *value, Error **errp)
 {
     SpaprMachineState *spapr = SPAPR_MACHINE(obj);
 
-    if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
-        error_setg(errp, "This machine only uses the legacy XICS backend, don't pass ic-mode");
-        return;
-    }
-
     /* The legacy IRQ backend can not be set */
     if (strcmp(value, "xics") == 0) {
         spapr->irq = &spapr_irq_xics;
@@ -5054,24 +5047,6 @@ static void spapr_machine_3_1_class_options(MachineClass *mc)
 
 DEFINE_SPAPR_MACHINE(3, 1);
 
-/*
- * pseries-3.0
- */
-
-static void spapr_machine_3_0_class_options(MachineClass *mc)
-{
-    SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
-
-    spapr_machine_3_1_class_options(mc);
-    compat_props_add(mc->compat_props, hw_compat_3_0, hw_compat_3_0_len);
-
-    smc->legacy_irq_allocation = true;
-    smc->nr_xirqs = 0x400;
-    smc->irq = &spapr_irq_xics_legacy;
-}
-
-DEFINE_SPAPR_MACHINE(3, 0);
-
 static void spapr_machine_register_types(void)
 {
     type_register_static(&spapr_machine_info);
hw/ppc/spapr_events.c +0 -8
index 832b0212f3..548a190ce8 100644
@@ -1043,10 +1043,6 @@ void spapr_events_init(SpaprMachineState *spapr)
 {
     int epow_irq = SPAPR_IRQ_EPOW;
 
-    if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
-        epow_irq = spapr_irq_findone(spapr, &error_fatal);
-    }
-
     spapr_irq_claim(spapr, epow_irq, false, &error_fatal);
 
     QTAILQ_INIT(&spapr->pending_events);
@@ -1067,10 +1063,6 @@ void spapr_events_init(SpaprMachineState *spapr)
     if (spapr->use_hotplug_event_source) {
         int hp_irq = SPAPR_IRQ_HOTPLUG;
 
-        if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
-            hp_irq = spapr_irq_findone(spapr, &error_fatal);
-        }
-
         spapr_irq_claim(spapr, hp_irq, false, &error_fatal);
 
         spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_HOT_PLUG,
hw/ppc/spapr_irq.c +1 -15
index d6d368dd08..317d57a380 100644
@@ -33,11 +33,6 @@ static const TypeInfo spapr_intc_info = {
 
 static void spapr_irq_msi_init(SpaprMachineState *spapr)
 {
-    if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
-        /* Legacy mode doesn't use this allocator */
-        return;
-    }
-
     spapr->irq_map_nr = spapr_irq_nr_msis(spapr);
     spapr->irq_map = bitmap_new(spapr->irq_map_nr);
 }
@@ -286,11 +281,7 @@ uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr)
 {
     SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
 
-    if (smc->legacy_irq_allocation) {
-        return smc->nr_xirqs;
-    } else {
-        return SPAPR_XIRQ_BASE + smc->nr_xirqs - SPAPR_IRQ_MSI;
-    }
+    return SPAPR_XIRQ_BASE + smc->nr_xirqs - SPAPR_IRQ_MSI;
 }
 
 void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
@@ -588,11 +579,6 @@ int spapr_irq_find(SpaprMachineState *spapr, int num, bool align, Error **errp)
     return first + ics->offset;
 }
 
-SpaprIrq spapr_irq_xics_legacy = {
-    .xics        = true,
-    .xive        = false,
-};
-
 static void spapr_irq_register_types(void)
 {
     type_register_static(&spapr_intc_info);
hw/ppc/spapr_pci.c +4 -28
index 1ac1185825..1ac47bca34 100644
@@ -269,7 +269,6 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, SpaprMachineState *spapr,
                                 target_ulong args, uint32_t nret,
                                 target_ulong rets)
 {
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
     uint32_t config_addr = rtas_ld(args, 0);
     uint64_t buid = rtas_ldq(args, 1);
     unsigned int func = rtas_ld(args, 3);
@@ -374,13 +373,8 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, SpaprMachineState *spapr,
     }
 
     /* Allocate MSIs */
-    if (smc->legacy_irq_allocation) {
-        irq = spapr_irq_find(spapr, req_num, ret_intr_type == RTAS_TYPE_MSI,
-                             &err);
-    } else {
-        irq = spapr_irq_msi_alloc(spapr, req_num,
-                                  ret_intr_type == RTAS_TYPE_MSI, &err);
-    }
+    irq = spapr_irq_msi_alloc(spapr, req_num,
+                              ret_intr_type == RTAS_TYPE_MSI, &err);
     if (err) {
         error_reportf_err(err, "Can't allocate MSIs for device %x: ",
                           config_addr);
@@ -394,9 +388,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, SpaprMachineState *spapr,
             if (i) {
                 spapr_irq_free(spapr, irq, i);
             }
-            if (!smc->legacy_irq_allocation) {
-                spapr_irq_msi_free(spapr, irq, req_num);
-            }
+            spapr_irq_msi_free(spapr, irq, req_num);
             error_reportf_err(err, "Can't allocate MSIs for device %x: ",
                               config_addr);
             rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
@@ -1790,12 +1782,9 @@ static void spapr_phb_unrealize(DeviceState *dev)
 static void spapr_phb_destroy_msi(gpointer opaque)
 {
     SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
     SpaprPciMsi *msi = opaque;
 
-    if (!smc->legacy_irq_allocation) {
-        spapr_irq_msi_free(spapr, msi->first_irq, msi->num);
-    }
+    spapr_irq_msi_free(spapr, msi->first_irq, msi->num);
     spapr_irq_free(spapr, msi->first_irq, msi->num);
     g_free(msi);
 }
@@ -1809,7 +1798,6 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
     SpaprMachineState *spapr =
         (SpaprMachineState *) object_dynamic_cast(qdev_get_machine(),
                                                   TYPE_SPAPR_MACHINE);
-    SpaprMachineClass *smc = spapr ? SPAPR_MACHINE_GET_CLASS(spapr) : NULL;
     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
     SpaprPhbState *sphb = SPAPR_PCI_HOST_BRIDGE(sbd);
     PCIHostState *phb = PCI_HOST_BRIDGE(sbd);
@@ -1957,18 +1945,6 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
     for (i = 0; i < PCI_NUM_PINS; i++) {
         int irq = SPAPR_IRQ_PCI_LSI + sphb->index * PCI_NUM_PINS + i;
 
-        if (smc->legacy_irq_allocation) {
-            irq = spapr_irq_findone(spapr, errp);
-            if (irq < 0) {
-                error_prepend(errp, "can't allocate LSIs: ");
-                /*
-                 * Older machines will never support PHB hotplug, ie, this is an
-                 * init only path and QEMU will terminate. No need to rollback.
-                 */
-                return;
-            }
-        }
-
         if (spapr_irq_claim(spapr, irq, true, errp) < 0) {
             error_prepend(errp, "can't allocate LSIs: ");
             goto unrealize;
hw/ppc/spapr_vio.c +0 -9
index 7759436a4f..c21a2a3274 100644
@@ -507,15 +507,6 @@ static void spapr_vio_busdev_realize(DeviceState *qdev, Error **errp)
 
     dev->irq = spapr_vio_reg_to_irq(dev->reg);
 
-    if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
-        int irq = spapr_irq_findone(spapr, errp);
-
-        if (irq < 0) {
-            return;
-        }
-        dev->irq = irq;
-    }
-
     if (spapr_irq_claim(spapr, dev->irq, false, errp) < 0) {
         return;
     }
Signature · 1 line
2.49.0
#5 lore raw

PATCH 3/3 ppc/spapr: remove deprecated machine pseries-4.0

In reply to Harsh Prateek Bora

pseries-4.0 had been deprecated and due for removal now as per policy. Also remove pre-4.1 migration hacks which were introduced for backward compatibility.

---
 include/hw/ppc/spapr.h |  1 -
 hw/ppc/spapr.c         | 27 ---------------------------
 hw/ppc/spapr_caps.c    | 12 +-----------
 3 files changed, 1 insertion(+), 39 deletions(-)
include/hw/ppc/spapr.h +0 -1
index 02b66f7ffa..328681a585 100644
@@ -144,7 +144,6 @@ struct SpaprMachineClass {
 
     /*< public >*/
     uint32_t nr_xirqs;
-    bool pre_4_1_migration; /* don't migrate hpt-max-page-size */
     bool linux_pci_probe;
     bool smp_threads_vsmt; /* set VSMT to smp_threads by default */
     hwaddr rma_limit;          /* clamp the RMA to this size */
hw/ppc/spapr.c +0 -27
index 44b9fc3ab6..a11e18ff74 100644
@@ -4968,33 +4968,6 @@ static void spapr_machine_4_1_class_options(MachineClass *mc)
 
 DEFINE_SPAPR_MACHINE(4, 1);
 
-/*
- * pseries-4.0
- */
-static bool phb_placement_4_0(SpaprMachineState *spapr, uint32_t index,
-                              uint64_t *buid, hwaddr *pio,
-                              hwaddr *mmio32, hwaddr *mmio64,
-                              unsigned n_dma, uint32_t *liobns, Error **errp)
-{
-    if (!spapr_phb_placement(spapr, index, buid, pio, mmio32, mmio64, n_dma,
-                             liobns, errp)) {
-        return false;
-    }
-    return true;
-}
-static void spapr_machine_4_0_class_options(MachineClass *mc)
-{
-    SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
-
-    spapr_machine_4_1_class_options(mc);
-    compat_props_add(mc->compat_props, hw_compat_4_0, hw_compat_4_0_len);
-    smc->phb_placement = phb_placement_4_0;
-    smc->irq = &spapr_irq_xics;
-    smc->pre_4_1_migration = true;
-}
-
-DEFINE_SPAPR_MACHINE(4, 0);
-
 static void spapr_machine_register_types(void)
 {
     type_register_static(&spapr_machine_info);
hw/ppc/spapr_caps.c +1 -11
index f2f5722d8a..d643591e25 100644
@@ -67,7 +67,6 @@ typedef struct SpaprCapabilityInfo {
     void (*apply)(SpaprMachineState *spapr, uint8_t val, Error **errp);
     void (*cpu_apply)(SpaprMachineState *spapr, PowerPCCPU *cpu,
                       uint8_t val, Error **errp);
-    bool (*migrate_needed)(void *opaque);
 } SpaprCapabilityInfo;
 
 static void spapr_cap_get_bool(Object *obj, Visitor *v, const char *name,
@@ -337,11 +336,6 @@ static void cap_hpt_maxpagesize_apply(SpaprMachineState *spapr,
     spapr_check_pagesize(spapr, qemu_minrampagesize(), errp);
 }
 
-static bool cap_hpt_maxpagesize_migrate_needed(void *opaque)
-{
-    return !SPAPR_MACHINE_GET_CLASS(opaque)->pre_4_1_migration;
-}
-
 static bool spapr_pagesize_cb(void *opaque, uint32_t seg_pshift,
                               uint32_t pshift)
 {
@@ -794,7 +788,6 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = {
         .type = "int",
         .apply = cap_hpt_maxpagesize_apply,
         .cpu_apply = cap_hpt_maxpagesize_cpu_apply,
-        .migrate_needed = cap_hpt_maxpagesize_migrate_needed,
     },
     [SPAPR_CAP_NESTED_KVM_HV] = {
         .name = "nested-hv",
@@ -983,11 +976,8 @@ int spapr_caps_post_migration(SpaprMachineState *spapr)
 static bool spapr_cap_##sname##_needed(void *opaque)    \
 {                                                       \
     SpaprMachineState *spapr = opaque;                  \
-    bool (*needed)(void *opaque) =                      \
-        capability_table[cap].migrate_needed;           \
                                                         \
-    return needed ? needed(opaque) : true &&            \
-           spapr->cmd_line_caps[cap] &&                 \
+    return spapr->cmd_line_caps[cap] &&                 \
            (spapr->eff.caps[cap] !=                     \
             spapr->def.caps[cap]);                      \
 }                                                       \
Signature · 1 line
2.49.0
#0 lore raw

cover ppc/spapr: remove deprecated machines till pseries-4.0

pseries-3.0, 3.1 and 4.0 had been deprecated and due for removal now. Also removing pre-4.1 backward compatibility hacks that aren't needed anymore.

Harsh Prateek Bora (3):
ppc/spapr: remove deprecated machine pseries-3.0 ppc/spapr: remove deprecated machine pseries-3.1 ppc/spapr: remove deprecated machine pseries-4.0

 include/hw/ppc/spapr.h     |   5 --
 include/hw/ppc/spapr_irq.h |   1 -
 hw/ppc/spapr.c             | 118 +++----------------------------------
 hw/ppc/spapr_caps.c        |  12 +---
 hw/ppc/spapr_events.c      |   8 ---
 hw/ppc/spapr_hcall.c       |   5 --
 hw/ppc/spapr_irq.c         |  16 +----
 hw/ppc/spapr_pci.c         |  32 ++--------
 hw/ppc/spapr_vio.c         |   9 ---
 9 files changed, 13 insertions(+), 193 deletions(-)
Signature · 1 line
2.49.0
#3 lore raw

PATCH 2/3 ppc/spapr: remove deprecated machine pseries-3.1

pseries-3.1 had been deprecated and due for removal now as per policy. Also remove backward compatibility flags and related code introduced for pre pseries-4.0 machines.

---
 include/hw/ppc/spapr.h |  3 --
 hw/ppc/spapr.c         | 64 ++++--------------------------------------
 hw/ppc/spapr_hcall.c   |  5 ----
 3 files changed, 6 insertions(+), 66 deletions(-)
include/hw/ppc/spapr.h +0 -3
index 0c1e5132de..02b66f7ffa 100644
@@ -143,10 +143,7 @@ struct SpaprMachineClass {
     MachineClass parent_class;
 
     /*< public >*/
-    bool dr_phb_enabled;       /* enable dynamic-reconfig/hotplug of PHBs */
-    bool update_dt_enabled;    /* enable KVMPPC_H_UPDATE_DT */
     uint32_t nr_xirqs;
-    bool broken_host_serial_model; /* present real host info to the guest */
     bool pre_4_1_migration; /* don't migrate hpt-max-page-size */
     bool linux_pci_probe;
     bool smp_threads_vsmt; /* set VSMT to smp_threads by default */
hw/ppc/spapr.c +6 -58

144 lines not on this page · raw message

hw/ppc/spapr_hcall.c +0 -5
index 1e936f35e4..cf92a74251 100644
@@ -1476,16 +1476,11 @@ static target_ulong h_update_dt(PowerPCCPU *cpu, SpaprMachineState *spapr,
     target_ulong dt = ppc64_phys_to_real(args[0]);
     struct fdt_header hdr = { 0 };
     unsigned cb;
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
     void *fdt;
 
     cpu_physical_memory_read(dt, &hdr, sizeof(hdr));
     cb = fdt32_to_cpu(hdr.totalsize);
 
-    if (!smc->update_dt_enabled) {
-        return H_SUCCESS;
-    }
-
     /* Check that the fdt did not grow out of proportion */
     if (cb > spapr->fdt_initial_size * 2) {
         trace_spapr_update_dt_failed_size(spapr->fdt_initial_size, cb,
Signature · 1 line
2.49.0
Reviewed-by on the v1 series
#8 lore raw
In reply to Harsh Prateek Bora
Quoted 9 lines · Harsh Prateek Bora

pseries-3.0, 3.1 and 4.0 had been deprecated and due for removal now. Also removing pre-4.1 backward compatibility hacks that aren't needed anymore.

Harsh Prateek Bora (3):
ppc/spapr: remove deprecated machine pseries-3.0 ppc/spapr: remove deprecated machine pseries-3.1 ppc/spapr: remove deprecated machine pseries-4.0

Quoted 11 lines
  include/hw/ppc/spapr.h     |   5 --
  include/hw/ppc/spapr_irq.h |   1 -
  hw/ppc/spapr.c             | 118 +++----------------------------------
  hw/ppc/spapr_caps.c        |  12 +---
  hw/ppc/spapr_events.c      |   8 ---
  hw/ppc/spapr_hcall.c       |   5 --
  hw/ppc/spapr_irq.c         |  16 +----
  hw/ppc/spapr_pci.c         |  32 ++--------
  hw/ppc/spapr_vio.c         |   9 ---
  9 files changed, 13 insertions(+), 193 deletions(-)

Thanks,

C.

#2 lore raw

Re: [PATCH 1/3] ppc/spapr: remove deprecated machine pseries-3.0

In reply to Harsh Prateek Bora

Hi Harsh,

Quoted 2 lines · Harsh Prateek Bora

pseries-3.0 had been deprecated and due for removal now as per policy. Also remove legacy irq support which existed for pre pseries-3.1 machines.

"Also" suggests this patch could be split in 2 distinct changes, easier to review / bisect / backport.

Quoted 12 lines
---
  include/hw/ppc/spapr.h     |  1 -
  include/hw/ppc/spapr_irq.h |  1 -
  hw/ppc/spapr.c             | 27 +--------------------------
  hw/ppc/spapr_events.c      |  8 --------
  hw/ppc/spapr_irq.c         | 16 +---------------
  hw/ppc/spapr_pci.c         | 32 ++++----------------------------
  hw/ppc/spapr_vio.c         |  9 ---------
  7 files changed, 6 insertions(+), 88 deletions(-)
#4 lore raw

Re: [PATCH 2/3] ppc/spapr: remove deprecated machine pseries-3.1

In reply to Harsh Prateek Bora
Quoted 1 line · Harsh Prateek Bora

pseries-3.1 had been deprecated and due for removal now as per policy.

Please consider splitting.

Quoted 10 lines

Also remove backward compatibility flags and related code introduced for pre pseries-4.0 machines.

---
  include/hw/ppc/spapr.h |  3 --
  hw/ppc/spapr.c         | 64 ++++--------------------------------------
  hw/ppc/spapr_hcall.c   |  5 ----
  3 files changed, 6 insertions(+), 66 deletions(-)
#6 lore raw

Re: [PATCH 3/3] ppc/spapr: remove deprecated machine pseries-4.0

In reply to Harsh Prateek Bora
Quoted 1 line · Harsh Prateek Bora

pseries-4.0 had been deprecated and due for removal now as per policy.

Please consider splitting, but up to the maintainer.

Quoted 10 lines

Also remove pre-4.1 migration hacks which were introduced for backward compatibility.

---
  include/hw/ppc/spapr.h |  1 -
  hw/ppc/spapr.c         | 27 ---------------------------
  hw/ppc/spapr_caps.c    | 12 +-----------
  3 files changed, 1 insertion(+), 39 deletions(-)
#7 lore raw

Re: [PATCH 3/3] ppc/spapr: remove deprecated machine pseries-4.0

Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 1 line · Harsh Prateek Bora

pseries-4.0 had been deprecated and due for removal now as per policy.

Please consider splitting, but up to the maintainer.

Hi Philippe,
Thanks for your reviews on this patchset.
I am revisiting this patchset to include 4.1 and 4.2 also.
I usually prefer to split patches wherever appropriate, however, in this case, I think related hacks are better removed along as there remains no other consumer of those hacks and can cause build breaks in some cases.

I will send a v2 including removal of 4.1 and 4.2 though.

Thanks
Harsh

Quoted 12 lines
Quoted 11 lines

Also remove pre-4.1 migration hacks which were introduced for backward compatibility.

---
  include/hw/ppc/spapr.h |  1 -
  hw/ppc/spapr.c         | 27 --------------------------- hw/ppc/spapr_caps.c    | 12 +-----------

  3 files changed, 1 insertion(+), 39 deletions(-)