qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines
@ 2025-10-21  8:43 Philippe Mathieu-Daudé
  2025-10-21  8:43 ` [PATCH v2 01/11] ppc/spapr: remove deprecated machine pseries-3.0 Philippe Mathieu-Daudé
                   ` (12 more replies)
  0 siblings, 13 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater,
	Philippe Mathieu-Daudé

v2: Rebased on https://lore.kernel.org/qemu-devel/20251009184057.19973-1-harshpb@linux.ibm.com/

Remove the deprecated pseries-3.0 up to pseries-4.2 machines,
which are older than 6 years. Remove resulting dead code.

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

Philippe Mathieu-Daudé (6):
  hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field
  hw/ppc/spapr: Inline spapr_dtb_needed()
  hw/ppc/spapr: Inline few SPAPR_IRQ_* uses
  target/ppc/kvm: Remove kvmppc_get_host_serial() as unused
  target/ppc/kvm: Remove kvmppc_get_host_model() as unused
  hw/ppc/spapr: Remove SpaprMachineClass::phb_placement callback

 include/hw/ppc/spapr.h     |  16 --
 include/hw/ppc/spapr_irq.h |   1 -
 target/ppc/kvm_ppc.h       |  12 --
 hw/ppc/spapr.c             | 299 ++++++++-----------------------------
 hw/ppc/spapr_caps.c        |  12 +-
 hw/ppc/spapr_events.c      |  20 +--
 hw/ppc/spapr_hcall.c       |   5 -
 hw/ppc/spapr_irq.c         |  36 +----
 hw/ppc/spapr_pci.c         |  32 +---
 hw/ppc/spapr_vio.c         |   9 --
 target/ppc/kvm.c           |  11 --
 11 files changed, 77 insertions(+), 376 deletions(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH v2 01/11] ppc/spapr: remove deprecated machine pseries-3.0
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21  8:43 ` [PATCH v2 02/11] hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater, Cédric Le Goater,
	Philippe Mathieu-Daudé

From: Harsh Prateek Bora <harshpb@linux.ibm.com>

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.

Suggested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 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(-)

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 39bd5bd5ed3..0c1e5132de2 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -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 */
diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
index cb9a85f6575..5ddd1107c39 100644
--- a/include/hw/ppc/spapr_irq.h
+++ b/include/hw/ppc/spapr_irq.h
@@ -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;
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 97ab6bebd25..426a778d3e8 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3347,9 +3347,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");
@@ -3363,11 +3361,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;
@@ -5062,24 +5055,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);
diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index 832b0212f31..548a190ce89 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -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,
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index d6d368dd08c..317d57a3802 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -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);
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index f9095552e86..bdec8f0728d 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -268,7 +268,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);
@@ -373,13 +372,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);
@@ -393,9 +387,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);
@@ -1789,12 +1781,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);
 }
@@ -1808,7 +1797,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);
@@ -1956,18 +1944,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;
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index 7759436a4f5..c21a2a3274e 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -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;
     }
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 02/11] hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
  2025-10-21  8:43 ` [PATCH v2 01/11] ppc/spapr: remove deprecated machine pseries-3.0 Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21 10:35   ` Chinmay Rath
  2025-10-21  8:43 ` [PATCH v2 03/11] ppc/spapr: remove deprecated machine pseries-3.1 Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater,
	Philippe Mathieu-Daudé

The SpaprMachineClass::nr_xirqs field was only used by the
pseries-3.0 machine, which got removed. Remove it as now unused.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/spapr.h |  1 -
 hw/ppc/spapr.c         |  1 -
 hw/ppc/spapr_irq.c     | 22 +++++++---------------
 3 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 0c1e5132de2..494367fb99a 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -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 */
-    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;
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 426a778d3e8..b5d20bc1756 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4691,7 +4691,6 @@ static void spapr_machine_class_init(ObjectClass *oc, const void *data)
     smc->dr_phb_enabled = true;
     smc->linux_pci_probe = true;
     smc->smp_threads_vsmt = true;
-    smc->nr_xirqs = SPAPR_NR_XIRQS;
     xfc->match_nvt = spapr_match_nvt;
     vmc->client_architecture_support = spapr_vof_client_architecture_support;
     vmc->quiesce = spapr_vof_quiesce;
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index 317d57a3802..2ce323457be 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -279,15 +279,11 @@ void spapr_irq_dt(SpaprMachineState *spapr, uint32_t nr_servers,
 
 uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr)
 {
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
-
-    return SPAPR_XIRQ_BASE + smc->nr_xirqs - SPAPR_IRQ_MSI;
+    return SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE - SPAPR_IRQ_MSI;
 }
 
 void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
 {
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
-
     if (kvm_enabled() && kvm_kernel_irqchip_split()) {
         error_setg(errp, "kernel_irqchip split mode not supported on pseries");
         return;
@@ -308,7 +304,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
         object_property_add_child(OBJECT(spapr), "ics", obj);
         object_property_set_link(obj, ICS_PROP_XICS, OBJECT(spapr),
                                  &error_abort);
-        object_property_set_int(obj, "nr-irqs", smc->nr_xirqs, &error_abort);
+        object_property_set_int(obj, "nr-irqs", SPAPR_NR_XIRQS, &error_abort);
         if (!qdev_realize(DEVICE(obj), NULL, errp)) {
             return;
         }
@@ -322,7 +318,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
         int i;
 
         dev = qdev_new(TYPE_SPAPR_XIVE);
-        qdev_prop_set_uint32(dev, "nr-irqs", smc->nr_xirqs + SPAPR_IRQ_NR_IPIS);
+        qdev_prop_set_uint32(dev, "nr-irqs", SPAPR_NR_XIRQS + SPAPR_IRQ_NR_IPIS);
         /*
          * 8 XIVE END structures per CPU. One for each available
          * priority
@@ -349,7 +345,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
     }
 
     spapr->qirqs = qemu_allocate_irqs(spapr_set_irq, spapr,
-                                      smc->nr_xirqs + SPAPR_IRQ_NR_IPIS);
+                                      SPAPR_NR_XIRQS + SPAPR_IRQ_NR_IPIS);
 
     /*
      * Mostly we don't actually need this until reset, except that not
@@ -364,11 +360,10 @@ int spapr_irq_claim(SpaprMachineState *spapr, int irq, bool lsi, Error **errp)
 {
     SpaprInterruptController *intcs[] = ALL_INTCS(spapr);
     int i;
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
     int rc;
 
     assert(irq >= SPAPR_XIRQ_BASE);
-    assert(irq < (smc->nr_xirqs + SPAPR_XIRQ_BASE));
+    assert(irq < (SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE));
 
     for (i = 0; i < ARRAY_SIZE(intcs); i++) {
         SpaprInterruptController *intc = intcs[i];
@@ -388,10 +383,9 @@ void spapr_irq_free(SpaprMachineState *spapr, int irq, int num)
 {
     SpaprInterruptController *intcs[] = ALL_INTCS(spapr);
     int i, j;
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
 
     assert(irq >= SPAPR_XIRQ_BASE);
-    assert((irq + num) <= (smc->nr_xirqs + SPAPR_XIRQ_BASE));
+    assert((irq + num) <= (SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE));
 
     for (i = irq; i < (irq + num); i++) {
         for (j = 0; j < ARRAY_SIZE(intcs); j++) {
@@ -408,8 +402,6 @@ void spapr_irq_free(SpaprMachineState *spapr, int irq, int num)
 
 qemu_irq spapr_qirq(SpaprMachineState *spapr, int irq)
 {
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
-
     /*
      * This interface is basically for VIO and PHB devices to find the
      * right qemu_irq to manipulate, so we only allow access to the
@@ -418,7 +410,7 @@ qemu_irq spapr_qirq(SpaprMachineState *spapr, int irq)
      * interfaces, we can change this if we need to in future.
      */
     assert(irq >= SPAPR_XIRQ_BASE);
-    assert(irq < (smc->nr_xirqs + SPAPR_XIRQ_BASE));
+    assert(irq < (SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE));
 
     if (spapr->ics) {
         assert(ics_valid_irq(spapr->ics, irq));
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 03/11] ppc/spapr: remove deprecated machine pseries-3.1
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
  2025-10-21  8:43 ` [PATCH v2 01/11] ppc/spapr: remove deprecated machine pseries-3.0 Philippe Mathieu-Daudé
  2025-10-21  8:43 ` [PATCH v2 02/11] hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21  8:43 ` [PATCH v2 04/11] hw/ppc/spapr: Inline spapr_dtb_needed() Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater, Cédric Le Goater,
	Philippe Mathieu-Daudé

From: Harsh Prateek Bora <harshpb@linux.ibm.com>

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.

Suggested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/spapr.h |  3 --
 hw/ppc/spapr.c         | 62 ++++--------------------------------------
 hw/ppc/spapr_hcall.c   |  5 ----
 3 files changed, 5 insertions(+), 65 deletions(-)

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 494367fb99a..1db67784de8 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -143,9 +143,6 @@ 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 */
-    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 */
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index b5d20bc1756..458d1c29b4d 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1182,7 +1182,6 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool reset, size_t space)
 {
     MachineState *machine = MACHINE(spapr);
     MachineClass *mc = MACHINE_GET_CLASS(machine);
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
     uint32_t root_drc_type_mask = 0;
     int ret;
     void *fdt;
@@ -1213,16 +1212,10 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool reset, size_t space)
     /* Host Model & Serial Number */
     if (spapr->host_model) {
         _FDT(fdt_setprop_string(fdt, 0, "host-model", spapr->host_model));
-    } else if (smc->broken_host_serial_model && kvmppc_get_host_model(&buf)) {
-        _FDT(fdt_setprop_string(fdt, 0, "host-model", buf));
-        g_free(buf);
     }
 
     if (spapr->host_serial) {
         _FDT(fdt_setprop_string(fdt, 0, "host-serial", spapr->host_serial));
-    } else if (smc->broken_host_serial_model && kvmppc_get_host_serial(&buf)) {
-        _FDT(fdt_setprop_string(fdt, 0, "host-serial", buf));
-        g_free(buf);
     }
 
     _FDT(fdt_setprop_cell(fdt, 0, "#address-cells", 2));
@@ -1260,9 +1253,8 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool reset, size_t space)
 
     /* ibm,drc-indexes and friends */
     root_drc_type_mask |= SPAPR_DR_CONNECTOR_TYPE_LMB;
-    if (smc->dr_phb_enabled) {
-        root_drc_type_mask |= SPAPR_DR_CONNECTOR_TYPE_PHB;
-    }
+    root_drc_type_mask |= SPAPR_DR_CONNECTOR_TYPE_PHB;
+
     if (mc->nvdimm_supported) {
         root_drc_type_mask |= SPAPR_DR_CONNECTOR_TYPE_PMEM;
     }
@@ -2063,9 +2055,7 @@ static const VMStateDescription vmstate_spapr_irq_map = {
 
 static bool spapr_dtb_needed(void *opaque)
 {
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(opaque);
-
-    return smc->update_dt_enabled;
+    return true; /* backward migration compat */
 }
 
 static int spapr_dtb_pre_load(void *opaque)
@@ -3009,10 +2999,8 @@ static void spapr_machine_init(MachineState *machine)
      * connectors for a PHBs PCI slots) are added as needed during their
      * parent's realization.
      */
-    if (smc->dr_phb_enabled) {
-        for (i = 0; i < SPAPR_MAX_PHBS; i++) {
-            spapr_dr_connector_new(OBJECT(machine), TYPE_SPAPR_DRC_PHB, i);
-        }
+    for (i = 0; i < SPAPR_MAX_PHBS; i++) {
+        spapr_dr_connector_new(OBJECT(machine), TYPE_SPAPR_DRC_PHB, i);
     }
 
     /* Set up PCI */
@@ -4095,11 +4083,6 @@ static bool spapr_phb_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
     const unsigned windows_supported = spapr_phb_windows_supported(sphb);
     SpaprDrc *drc;
 
-    if (dev->hotplugged && !smc->dr_phb_enabled) {
-        error_setg(errp, "PHB hotplug not supported for this machine");
-        return false;
-    }
-
     if (sphb->index == (uint32_t)-1) {
         error_setg(errp, "\"index\" for PAPR PHB is mandatory");
         return false;
@@ -4125,16 +4108,10 @@ static bool spapr_phb_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
 
 static void spapr_phb_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
 {
-    SpaprMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
     SpaprPhbState *sphb = SPAPR_PCI_HOST_BRIDGE(dev);
     SpaprDrc *drc;
     bool hotplugged = spapr_drc_hotplugged(dev);
 
-    if (!smc->dr_phb_enabled) {
-        return;
-    }
-
     drc = spapr_drc_by_id(TYPE_SPAPR_DRC_PHB, sphb->index);
     /* hotplug hooks should check it's enabled before getting this far */
     assert(drc);
@@ -4260,7 +4237,6 @@ static void spapr_machine_device_unplug_request(HotplugHandler *hotplug_dev,
 {
     SpaprMachineState *sms = SPAPR_MACHINE(OBJECT(hotplug_dev));
     MachineClass *mc = MACHINE_GET_CLASS(sms);
-    SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
 
     if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
         if (spapr_memory_hot_unplug_supported(sms)) {
@@ -4275,10 +4251,6 @@ static void spapr_machine_device_unplug_request(HotplugHandler *hotplug_dev,
         }
         spapr_core_unplug_request(hotplug_dev, dev, errp);
     } else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_PCI_HOST_BRIDGE)) {
-        if (!smc->dr_phb_enabled) {
-            error_setg(errp, "PHB hot unplug not supported on this machine");
-            return;
-        }
         spapr_phb_unplug_request(hotplug_dev, dev, errp);
     } else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_TPM_PROXY)) {
         spapr_tpm_proxy_unplug(hotplug_dev, dev);
@@ -4634,7 +4606,6 @@ static void spapr_machine_class_init(ObjectClass *oc, const void *data)
     hc->unplug_request = spapr_machine_device_unplug_request;
     hc->unplug = spapr_machine_device_unplug;
 
-    smc->update_dt_enabled = true;
     mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");
     mc->has_hotpluggable_cpus = true;
     mc->nvdimm_supported = true;
@@ -4688,7 +4659,6 @@ static void spapr_machine_class_init(ObjectClass *oc, const void *data)
     smc->default_caps.caps[SPAPR_CAP_AIL_MODE_3] = SPAPR_CAP_ON;
     spapr_caps_add_properties(smc);
     smc->irq = &spapr_irq_dual;
-    smc->dr_phb_enabled = true;
     smc->linux_pci_probe = true;
     smc->smp_threads_vsmt = true;
     xfc->match_nvt = spapr_match_nvt;
@@ -5032,28 +5002,6 @@ static void spapr_machine_4_0_class_options(MachineClass *mc)
 
 DEFINE_SPAPR_MACHINE(4, 0);
 
-/*
- * pseries-3.1
- */
-static void spapr_machine_3_1_class_options(MachineClass *mc)
-{
-    SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
-
-    spapr_machine_4_0_class_options(mc);
-    compat_props_add(mc->compat_props, hw_compat_3_1, hw_compat_3_1_len);
-
-    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0");
-    smc->update_dt_enabled = false;
-    smc->dr_phb_enabled = false;
-    smc->broken_host_serial_model = true;
-    smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_BROKEN;
-    smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_BROKEN;
-    smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_BROKEN;
-    smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER] = SPAPR_CAP_OFF;
-}
-
-DEFINE_SPAPR_MACHINE(3, 1);
-
 static void spapr_machine_register_types(void)
 {
     type_register_static(&spapr_machine_info);
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 8c1e0a4817b..8f03b3e7764 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1475,16 +1475,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,
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 04/11] hw/ppc/spapr: Inline spapr_dtb_needed()
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2025-10-21  8:43 ` [PATCH v2 03/11] ppc/spapr: remove deprecated machine pseries-3.1 Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21 13:25   ` Chinmay Rath
  2025-10-21  8:43 ` [PATCH v2 05/11] hw/ppc/spapr: Inline few SPAPR_IRQ_* uses Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater,
	Philippe Mathieu-Daudé

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/spapr.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 458d1c29b4d..ad9fc61c299 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2053,11 +2053,6 @@ static const VMStateDescription vmstate_spapr_irq_map = {
     },
 };
 
-static bool spapr_dtb_needed(void *opaque)
-{
-    return true; /* backward migration compat */
-}
-
 static int spapr_dtb_pre_load(void *opaque)
 {
     SpaprMachineState *spapr = (SpaprMachineState *)opaque;
@@ -2073,7 +2068,6 @@ static const VMStateDescription vmstate_spapr_dtb = {
     .name = "spapr_dtb",
     .version_id = 1,
     .minimum_version_id = 1,
-    .needed = spapr_dtb_needed,
     .pre_load = spapr_dtb_pre_load,
     .fields = (const VMStateField[]) {
         VMSTATE_UINT32(fdt_initial_size, SpaprMachineState),
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 05/11] hw/ppc/spapr: Inline few SPAPR_IRQ_* uses
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2025-10-21  8:43 ` [PATCH v2 04/11] hw/ppc/spapr: Inline spapr_dtb_needed() Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21 11:27   ` Chinmay Rath
  2025-10-21  8:43 ` [PATCH v2 06/11] target/ppc/kvm: Remove kvmppc_get_host_serial() as unused Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater,
	Philippe Mathieu-Daudé

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/spapr_events.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index 548a190ce89..892ddc7f8f7 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -1041,16 +1041,14 @@ void spapr_clear_pending_hotplug_events(SpaprMachineState *spapr)
 
 void spapr_events_init(SpaprMachineState *spapr)
 {
-    int epow_irq = SPAPR_IRQ_EPOW;
-
-    spapr_irq_claim(spapr, epow_irq, false, &error_fatal);
+    spapr_irq_claim(spapr, SPAPR_IRQ_EPOW, false, &error_fatal);
 
     QTAILQ_INIT(&spapr->pending_events);
 
     spapr->event_sources = spapr_event_sources_new();
 
     spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_EPOW,
-                                 epow_irq);
+                                 SPAPR_IRQ_EPOW);
 
     /* NOTE: if machine supports modern/dedicated hotplug event source,
      * we add it to the device-tree unconditionally. This means we may
@@ -1061,12 +1059,10 @@ void spapr_events_init(SpaprMachineState *spapr)
      * checking that it's enabled.
      */
     if (spapr->use_hotplug_event_source) {
-        int hp_irq = SPAPR_IRQ_HOTPLUG;
-
-        spapr_irq_claim(spapr, hp_irq, false, &error_fatal);
+        spapr_irq_claim(spapr, SPAPR_IRQ_HOTPLUG, false, &error_fatal);
 
         spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_HOT_PLUG,
-                                     hp_irq);
+                                     SPAPR_IRQ_HOTPLUG);
     }
 
     spapr->epow_notifier.notify = spapr_powerdown_req;
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 06/11] target/ppc/kvm: Remove kvmppc_get_host_serial() as unused
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2025-10-21  8:43 ` [PATCH v2 05/11] hw/ppc/spapr: Inline few SPAPR_IRQ_* uses Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21 11:36   ` Chinmay Rath
  2025-10-21  8:43 ` [PATCH v2 07/11] target/ppc/kvm: Remove kvmppc_get_host_model() " Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater,
	Philippe Mathieu-Daudé

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/ppc/kvm_ppc.h | 6 ------
 target/ppc/kvm.c     | 6 ------
 2 files changed, 12 deletions(-)

diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
index a1d9ce9f9aa..f24cc4de3c2 100644
--- a/target/ppc/kvm_ppc.h
+++ b/target/ppc/kvm_ppc.h
@@ -22,7 +22,6 @@
 uint32_t kvmppc_get_tbfreq(void);
 uint64_t kvmppc_get_clockfreq(void);
 bool kvmppc_get_host_model(char **buf);
-bool kvmppc_get_host_serial(char **buf);
 int kvmppc_get_hasidle(CPUPPCState *env);
 int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
 int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
@@ -134,11 +133,6 @@ static inline bool kvmppc_get_host_model(char **buf)
     return false;
 }
 
-static inline bool kvmppc_get_host_serial(char **buf)
-{
-    return false;
-}
-
 static inline uint64_t kvmppc_get_clockfreq(void)
 {
     return 0;
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index cd60893a17d..cb61e99f9d4 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1864,12 +1864,6 @@ uint32_t kvmppc_get_tbfreq(void)
     return cached_tbfreq;
 }
 
-bool kvmppc_get_host_serial(char **value)
-{
-    return g_file_get_contents("/proc/device-tree/system-id", value, NULL,
-                               NULL);
-}
-
 bool kvmppc_get_host_model(char **value)
 {
     return g_file_get_contents("/proc/device-tree/model", value, NULL, NULL);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 07/11] target/ppc/kvm: Remove kvmppc_get_host_model() as unused
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2025-10-21  8:43 ` [PATCH v2 06/11] target/ppc/kvm: Remove kvmppc_get_host_serial() as unused Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21 11:39   ` Chinmay Rath
  2025-10-21  8:43 ` [PATCH v2 08/11] ppc/spapr: remove deprecated machine pseries-4.0 Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater,
	Philippe Mathieu-Daudé

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/ppc/kvm_ppc.h | 6 ------
 target/ppc/kvm.c     | 5 -----
 2 files changed, 11 deletions(-)

diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
index f24cc4de3c2..742881231e1 100644
--- a/target/ppc/kvm_ppc.h
+++ b/target/ppc/kvm_ppc.h
@@ -21,7 +21,6 @@
 
 uint32_t kvmppc_get_tbfreq(void);
 uint64_t kvmppc_get_clockfreq(void);
-bool kvmppc_get_host_model(char **buf);
 int kvmppc_get_hasidle(CPUPPCState *env);
 int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
 int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
@@ -128,11 +127,6 @@ static inline uint32_t kvmppc_get_tbfreq(void)
     return 0;
 }
 
-static inline bool kvmppc_get_host_model(char **buf)
-{
-    return false;
-}
-
 static inline uint64_t kvmppc_get_clockfreq(void)
 {
     return 0;
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index cb61e99f9d4..43124bf1c78 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1864,11 +1864,6 @@ uint32_t kvmppc_get_tbfreq(void)
     return cached_tbfreq;
 }
 
-bool kvmppc_get_host_model(char **value)
-{
-    return g_file_get_contents("/proc/device-tree/model", value, NULL, NULL);
-}
-
 /* Try to find a device tree node for a CPU with clock-frequency property */
 static int kvmppc_find_cpu_dt(char *buf, int buf_len)
 {
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 08/11] ppc/spapr: remove deprecated machine pseries-4.0
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2025-10-21  8:43 ` [PATCH v2 07/11] target/ppc/kvm: Remove kvmppc_get_host_model() " Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21  8:43 ` [PATCH v2 09/11] hw/ppc/spapr: Remove SpaprMachineClass::phb_placement callback Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater, Cédric Le Goater,
	Philippe Mathieu-Daudé

From: Harsh Prateek Bora <harshpb@linux.ibm.com>

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.

Suggested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
[PMD: Remove SpaprMachineClass::pre_4_1_migration field]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/spapr.h |  3 ---
 hw/ppc/spapr.c         | 27 ---------------------------
 hw/ppc/spapr_caps.c    | 12 +-----------
 3 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 1db67784de8..58d31b096cd 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -139,11 +139,8 @@ struct SpaprCapabilities {
  * SpaprMachineClass:
  */
 struct SpaprMachineClass {
-    /*< private >*/
     MachineClass parent_class;
 
-    /*< public >*/
-    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 */
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index ad9fc61c299..deab613e070 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4969,33 +4969,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);
diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
index 0f94c192fd4..170795ad6ad 100644
--- a/hw/ppc/spapr_caps.c
+++ b/hw/ppc/spapr_caps.c
@@ -66,7 +66,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,
@@ -336,11 +335,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)
 {
@@ -793,7 +787,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",
@@ -982,11 +975,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]);                      \
 }                                                       \
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 09/11] hw/ppc/spapr: Remove SpaprMachineClass::phb_placement callback
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2025-10-21  8:43 ` [PATCH v2 08/11] ppc/spapr: remove deprecated machine pseries-4.0 Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21 11:48   ` Chinmay Rath
  2025-10-21  8:43 ` [PATCH v2 10/11] ppc/spapr: remove deprecated machine pseries-4.1 Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater,
	Philippe Mathieu-Daudé

The SpaprMachineClass::phb_placement callback was only used by
the pseries-4.0 machine, which got removed. Remove it as now
unused, directly calling spapr_phb_placement().
Move spapr_phb_placement() definition to avoid forward declaration.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/spapr.h |   5 --
 hw/ppc/spapr.c         | 114 ++++++++++++++++++++---------------------
 2 files changed, 55 insertions(+), 64 deletions(-)

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 58d31b096cd..bd783e92e15 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -147,11 +147,6 @@ struct SpaprMachineClass {
     bool pre_5_1_assoc_refpoints;
     bool pre_5_2_numa_associativity;
     bool pre_6_2_numa_affinity;
-
-    bool (*phb_placement)(SpaprMachineState *spapr, uint32_t index,
-                          uint64_t *buid, hwaddr *pio,
-                          hwaddr *mmio32, hwaddr *mmio64,
-                          unsigned n_dma, uint32_t *liobns, Error **errp);
     SpaprResizeHpt resize_hpt_default;
     SpaprCapabilities default_caps;
     SpaprIrq *irq;
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index deab613e070..97736bba5a1 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4068,12 +4068,62 @@ int spapr_phb_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr,
     return 0;
 }
 
+static bool spapr_phb_placement(SpaprMachineState *spapr, uint32_t index,
+                                uint64_t *buid, hwaddr *pio,
+                                hwaddr *mmio32, hwaddr *mmio64,
+                                unsigned n_dma, uint32_t *liobns, Error **errp)
+{
+    /*
+     * New-style PHB window placement.
+     *
+     * Goals: Gives large (1TiB), naturally aligned 64-bit MMIO window
+     * for each PHB, in addition to 2GiB 32-bit MMIO and 64kiB PIO
+     * windows.
+     *
+     * Some guest kernels can't work with MMIO windows above 1<<46
+     * (64TiB), so we place up to 31 PHBs in the area 32TiB..64TiB
+     *
+     * 32TiB..(33TiB+1984kiB) contains the 64kiB PIO windows for each
+     * PHB stacked together.  (32TiB+2GiB)..(32TiB+64GiB) contains the
+     * 2GiB 32-bit MMIO windows for each PHB.  Then 33..64TiB has the
+     * 1TiB 64-bit MMIO windows for each PHB.
+     */
+    const uint64_t base_buid = 0x800000020000000ULL;
+    int i;
+
+    /* Sanity check natural alignments */
+    QEMU_BUILD_BUG_ON((SPAPR_PCI_BASE % SPAPR_PCI_MEM64_WIN_SIZE) != 0);
+    QEMU_BUILD_BUG_ON((SPAPR_PCI_LIMIT % SPAPR_PCI_MEM64_WIN_SIZE) != 0);
+    QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM64_WIN_SIZE % SPAPR_PCI_MEM32_WIN_SIZE) != 0);
+    QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM32_WIN_SIZE % SPAPR_PCI_IO_WIN_SIZE) != 0);
+    /* Sanity check bounds */
+    QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_IO_WIN_SIZE) >
+                      SPAPR_PCI_MEM32_WIN_SIZE);
+    QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_MEM32_WIN_SIZE) >
+                      SPAPR_PCI_MEM64_WIN_SIZE);
+
+    if (index >= SPAPR_MAX_PHBS) {
+        error_setg(errp, "\"index\" for PAPR PHB is too large (max %llu)",
+                   SPAPR_MAX_PHBS - 1);
+        return false;
+    }
+
+    *buid = base_buid + index;
+    for (i = 0; i < n_dma; ++i) {
+        liobns[i] = SPAPR_PCI_LIOBN(index, i);
+    }
+
+    *pio = SPAPR_PCI_BASE + index * SPAPR_PCI_IO_WIN_SIZE;
+    *mmio32 = SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM32_WIN_SIZE;
+    *mmio64 = SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM64_WIN_SIZE;
+    return true;
+}
+
 static bool spapr_phb_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
                                Error **errp)
 {
     SpaprMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
     SpaprPhbState *sphb = SPAPR_PCI_HOST_BRIDGE(dev);
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
     const unsigned windows_supported = spapr_phb_windows_supported(sphb);
     SpaprDrc *drc;
 
@@ -4092,12 +4142,10 @@ static bool spapr_phb_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
      * This will check that sphb->index doesn't exceed the maximum number of
      * PHBs for the current machine type.
      */
-    return
-        smc->phb_placement(spapr, sphb->index,
-                           &sphb->buid, &sphb->io_win_addr,
-                           &sphb->mem_win_addr, &sphb->mem64_win_addr,
-                           windows_supported, sphb->dma_liobn,
-                           errp);
+    return spapr_phb_placement(spapr, sphb->index,
+                               &sphb->buid, &sphb->io_win_addr,
+                               &sphb->mem_win_addr, &sphb->mem64_win_addr,
+                               windows_supported, sphb->dma_liobn, errp);
 }
 
 static void spapr_phb_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
@@ -4345,57 +4393,6 @@ static const CPUArchIdList *spapr_possible_cpu_arch_ids(MachineState *machine)
     return machine->possible_cpus;
 }
 
-static bool spapr_phb_placement(SpaprMachineState *spapr, uint32_t index,
-                                uint64_t *buid, hwaddr *pio,
-                                hwaddr *mmio32, hwaddr *mmio64,
-                                unsigned n_dma, uint32_t *liobns, Error **errp)
-{
-    /*
-     * New-style PHB window placement.
-     *
-     * Goals: Gives large (1TiB), naturally aligned 64-bit MMIO window
-     * for each PHB, in addition to 2GiB 32-bit MMIO and 64kiB PIO
-     * windows.
-     *
-     * Some guest kernels can't work with MMIO windows above 1<<46
-     * (64TiB), so we place up to 31 PHBs in the area 32TiB..64TiB
-     *
-     * 32TiB..(33TiB+1984kiB) contains the 64kiB PIO windows for each
-     * PHB stacked together.  (32TiB+2GiB)..(32TiB+64GiB) contains the
-     * 2GiB 32-bit MMIO windows for each PHB.  Then 33..64TiB has the
-     * 1TiB 64-bit MMIO windows for each PHB.
-     */
-    const uint64_t base_buid = 0x800000020000000ULL;
-    int i;
-
-    /* Sanity check natural alignments */
-    QEMU_BUILD_BUG_ON((SPAPR_PCI_BASE % SPAPR_PCI_MEM64_WIN_SIZE) != 0);
-    QEMU_BUILD_BUG_ON((SPAPR_PCI_LIMIT % SPAPR_PCI_MEM64_WIN_SIZE) != 0);
-    QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM64_WIN_SIZE % SPAPR_PCI_MEM32_WIN_SIZE) != 0);
-    QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM32_WIN_SIZE % SPAPR_PCI_IO_WIN_SIZE) != 0);
-    /* Sanity check bounds */
-    QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_IO_WIN_SIZE) >
-                      SPAPR_PCI_MEM32_WIN_SIZE);
-    QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_MEM32_WIN_SIZE) >
-                      SPAPR_PCI_MEM64_WIN_SIZE);
-
-    if (index >= SPAPR_MAX_PHBS) {
-        error_setg(errp, "\"index\" for PAPR PHB is too large (max %llu)",
-                   SPAPR_MAX_PHBS - 1);
-        return false;
-    }
-
-    *buid = base_buid + index;
-    for (i = 0; i < n_dma; ++i) {
-        liobns[i] = SPAPR_PCI_LIOBN(index, i);
-    }
-
-    *pio = SPAPR_PCI_BASE + index * SPAPR_PCI_IO_WIN_SIZE;
-    *mmio32 = SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM32_WIN_SIZE;
-    *mmio64 = SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM64_WIN_SIZE;
-    return true;
-}
-
 static ICSState *spapr_ics_get(XICSFabric *dev, int irq)
 {
     SpaprMachineState *spapr = SPAPR_MACHINE(dev);
@@ -4606,7 +4603,6 @@ static void spapr_machine_class_init(ObjectClass *oc, const void *data)
     smc->resize_hpt_default = SPAPR_RESIZE_HPT_ENABLED;
     fwc->get_dev_path = spapr_get_fw_dev_path;
     nc->nmi_monitor_handler = spapr_nmi;
-    smc->phb_placement = spapr_phb_placement;
     vhc->cpu_in_nested = spapr_cpu_in_nested;
     vhc->deliver_hv_excp = spapr_exit_nested;
     vhc->hypercall = emulate_spapr_hypercall;
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 10/11] ppc/spapr: remove deprecated machine pseries-4.1
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2025-10-21  8:43 ` [PATCH v2 09/11] hw/ppc/spapr: Remove SpaprMachineClass::phb_placement callback Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21  8:43 ` [PATCH v2 11/11] ppc/spapr: remove deprecated machine pseries-4.2 Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater, Cédric Le Goater,
	Philippe Mathieu-Daudé

From: Harsh Prateek Bora <harshpb@linux.ibm.com>

Remove the pseries-4.1 machine specific logic as had been deprecated and
due for removal now as per policy.

Suggested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/spapr.h |  2 --
 hw/ppc/spapr.c         | 37 +------------------------------------
 2 files changed, 1 insertion(+), 38 deletions(-)

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index bd783e92e15..60d9a8a0377 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -141,8 +141,6 @@ struct SpaprCapabilities {
 struct SpaprMachineClass {
     MachineClass parent_class;
 
-    bool linux_pci_probe;
-    bool smp_threads_vsmt; /* set VSMT to smp_threads by default */
     hwaddr rma_limit;          /* clamp the RMA to this size */
     bool pre_5_1_assoc_refpoints;
     bool pre_5_2_numa_associativity;
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 97736bba5a1..a06392beff1 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1072,7 +1072,6 @@ static void spapr_dt_ov5_platform_support(SpaprMachineState *spapr, void *fdt,
 static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
 {
     MachineState *machine = MACHINE(spapr);
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
     int chosen;
 
     _FDT(chosen = fdt_add_subnode(fdt, 0, "chosen"));
@@ -1143,9 +1142,7 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
          * We can deal with BAR reallocation just fine, advertise it
          * to the guest
          */
-        if (smc->linux_pci_probe) {
-            _FDT(fdt_setprop_cell(fdt, chosen, "linux,pci-probe-only", 0));
-        }
+        _FDT(fdt_setprop_cell(fdt, chosen, "linux,pci-probe-only", 0));
 
         spapr_dt_ov5_platform_support(spapr, fdt, chosen);
     }
@@ -2589,7 +2586,6 @@ static CPUArchId *spapr_find_cpu_slot(MachineState *ms, uint32_t id, int *idx)
 static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
 {
     MachineState *ms = MACHINE(spapr);
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
     Error *local_err = NULL;
     bool vsmt_user = !!spapr->vsmt;
     int kvm_smt = kvmppc_smt_threads();
@@ -2625,15 +2621,6 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
             return;
         }
         /* In this case, spapr->vsmt has been set by the command line */
-    } else if (!smc->smp_threads_vsmt) {
-        /*
-         * Default VSMT value is tricky, because we need it to be as
-         * consistent as possible (for migration), but this requires
-         * changing it for at least some existing cases.  We pick 8 as
-         * the value that we'd get with KVM on POWER8, the
-         * overwhelmingly common case in production systems.
-         */
-        spapr->vsmt = MAX(8, smp_threads);
     } else {
         spapr->vsmt = smp_threads;
     }
@@ -4649,8 +4636,6 @@ static void spapr_machine_class_init(ObjectClass *oc, const void *data)
     smc->default_caps.caps[SPAPR_CAP_AIL_MODE_3] = SPAPR_CAP_ON;
     spapr_caps_add_properties(smc);
     smc->irq = &spapr_irq_dual;
-    smc->linux_pci_probe = true;
-    smc->smp_threads_vsmt = true;
     xfc->match_nvt = spapr_match_nvt;
     vmc->client_architecture_support = spapr_vof_client_architecture_support;
     vmc->quiesce = spapr_vof_quiesce;
@@ -4945,26 +4930,6 @@ static void spapr_machine_4_2_class_options(MachineClass *mc)
 
 DEFINE_SPAPR_MACHINE(4, 2);
 
-/*
- * pseries-4.1
- */
-static void spapr_machine_4_1_class_options(MachineClass *mc)
-{
-    SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
-    static GlobalProperty compat[] = {
-        /* Only allow 4kiB and 64kiB IOMMU pagesizes */
-        { TYPE_SPAPR_PCI_HOST_BRIDGE, "pgsz", "0x11000" },
-    };
-
-    spapr_machine_4_2_class_options(mc);
-    smc->linux_pci_probe = false;
-    smc->smp_threads_vsmt = false;
-    compat_props_add(mc->compat_props, hw_compat_4_1, hw_compat_4_1_len);
-    compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
-}
-
-DEFINE_SPAPR_MACHINE(4, 1);
-
 static void spapr_machine_register_types(void)
 {
     type_register_static(&spapr_machine_info);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 11/11] ppc/spapr: remove deprecated machine pseries-4.2
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2025-10-21  8:43 ` [PATCH v2 10/11] ppc/spapr: remove deprecated machine pseries-4.1 Philippe Mathieu-Daudé
@ 2025-10-21  8:43 ` Philippe Mathieu-Daudé
  2025-10-21 11:07 ` [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Michal Suchánek
  2025-10-23 11:47 ` Harsh Prateek Bora
  12 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Harsh Prateek Bora, Cédric Le Goater, Cédric Le Goater,
	Philippe Mathieu-Daudé

From: Harsh Prateek Bora <harshpb@linux.ibm.com>

Remove the pseries-4.2 machine specific logic as had been deprecated and
due for removal now as per policy.

Suggested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/spapr.h |  1 -
 hw/ppc/spapr.c         | 27 ---------------------------
 2 files changed, 28 deletions(-)

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 60d9a8a0377..b9d884745fe 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -141,7 +141,6 @@ struct SpaprCapabilities {
 struct SpaprMachineClass {
     MachineClass parent_class;
 
-    hwaddr rma_limit;          /* clamp the RMA to this size */
     bool pre_5_1_assoc_refpoints;
     bool pre_5_2_numa_associativity;
     bool pre_6_2_numa_affinity;
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index a06392beff1..b6f151d7468 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2729,7 +2729,6 @@ static PCIHostState *spapr_create_default_phb(void)
 static hwaddr spapr_rma_size(SpaprMachineState *spapr, Error **errp)
 {
     MachineState *machine = MACHINE(spapr);
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
     hwaddr rma_size = machine->ram_size;
     hwaddr node0_size = spapr_node0_size(machine);
 
@@ -2742,15 +2741,6 @@ static hwaddr spapr_rma_size(SpaprMachineState *spapr, Error **errp)
      */
     rma_size = MIN(rma_size, 1 * TiB);
 
-    /*
-     * Clamp the RMA size based on machine type.  This is for
-     * migration compatibility with older qemu versions, which limited
-     * the RMA size for complicated and mostly bad reasons.
-     */
-    if (smc->rma_limit) {
-        rma_size = MIN(rma_size, smc->rma_limit);
-    }
-
     if (rma_size < MIN_RMA_SLOF) {
         error_setg(errp,
                    "pSeries SLOF firmware requires >= %" HWADDR_PRIx
@@ -4913,23 +4903,6 @@ static void spapr_machine_5_0_class_options(MachineClass *mc)
 
 DEFINE_SPAPR_MACHINE(5, 0);
 
-/*
- * pseries-4.2
- */
-static void spapr_machine_4_2_class_options(MachineClass *mc)
-{
-    SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
-
-    spapr_machine_5_0_class_options(mc);
-    compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len);
-    smc->default_caps.caps[SPAPR_CAP_CCF_ASSIST] = SPAPR_CAP_OFF;
-    smc->default_caps.caps[SPAPR_CAP_FWNMI] = SPAPR_CAP_OFF;
-    smc->rma_limit = 16 * GiB;
-    mc->nvdimm_supported = false;
-}
-
-DEFINE_SPAPR_MACHINE(4, 2);
-
 static void spapr_machine_register_types(void)
 {
     type_register_static(&spapr_machine_info);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 02/11] hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field
  2025-10-21  8:43 ` [PATCH v2 02/11] hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field Philippe Mathieu-Daudé
@ 2025-10-21 10:35   ` Chinmay Rath
  2025-10-22  7:17     ` Chinmay Rath
  0 siblings, 1 reply; 25+ messages in thread
From: Chinmay Rath @ 2025-10-21 10:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater


On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
> The SpaprMachineClass::nr_xirqs field was only used by the
> pseries-3.0 machine, which got removed. Remove it as now unused.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/ppc/spapr.h |  1 -
>   hw/ppc/spapr.c         |  1 -
>   hw/ppc/spapr_irq.c     | 22 +++++++---------------
>   3 files changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 0c1e5132de2..494367fb99a 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -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 */
> -    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;
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 426a778d3e8..b5d20bc1756 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4691,7 +4691,6 @@ static void spapr_machine_class_init(ObjectClass *oc, const void *data)
>       smc->dr_phb_enabled = true;
>       smc->linux_pci_probe = true;
>       smc->smp_threads_vsmt = true;
> -    smc->nr_xirqs = SPAPR_NR_XIRQS;
>       xfc->match_nvt = spapr_match_nvt;
>       vmc->client_architecture_support = spapr_vof_client_architecture_support;
>       vmc->quiesce = spapr_vof_quiesce;
> diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
> index 317d57a3802..2ce323457be 100644
> --- a/hw/ppc/spapr_irq.c
> +++ b/hw/ppc/spapr_irq.c
> @@ -279,15 +279,11 @@ void spapr_irq_dt(SpaprMachineState *spapr, uint32_t nr_servers,
>   
>   uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr)
>   {
> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
> -
> -    return SPAPR_XIRQ_BASE + smc->nr_xirqs - SPAPR_IRQ_MSI;
> +    return SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE - SPAPR_IRQ_MSI;
>   }
Hey,
With this cleanup, I think we can get rid of the SpaprMachineState 
argument passed to spapr_irq_nr_msis function since it is not used 
anymore ^.

Regards,
Chinmay
>   
>   void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
>   {
> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
> -
>       if (kvm_enabled() && kvm_kernel_irqchip_split()) {
>           error_setg(errp, "kernel_irqchip split mode not supported on pseries");
>           return;
> @@ -308,7 +304,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
>           object_property_add_child(OBJECT(spapr), "ics", obj);
>           object_property_set_link(obj, ICS_PROP_XICS, OBJECT(spapr),
>                                    &error_abort);
> -        object_property_set_int(obj, "nr-irqs", smc->nr_xirqs, &error_abort);
> +        object_property_set_int(obj, "nr-irqs", SPAPR_NR_XIRQS, &error_abort);
>           if (!qdev_realize(DEVICE(obj), NULL, errp)) {
>               return;
>           }
> @@ -322,7 +318,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
>           int i;
>   
>           dev = qdev_new(TYPE_SPAPR_XIVE);
> -        qdev_prop_set_uint32(dev, "nr-irqs", smc->nr_xirqs + SPAPR_IRQ_NR_IPIS);
> +        qdev_prop_set_uint32(dev, "nr-irqs", SPAPR_NR_XIRQS + SPAPR_IRQ_NR_IPIS);
>           /*
>            * 8 XIVE END structures per CPU. One for each available
>            * priority
> @@ -349,7 +345,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
>       }
>   
>       spapr->qirqs = qemu_allocate_irqs(spapr_set_irq, spapr,
> -                                      smc->nr_xirqs + SPAPR_IRQ_NR_IPIS);
> +                                      SPAPR_NR_XIRQS + SPAPR_IRQ_NR_IPIS);
>   
>       /*
>        * Mostly we don't actually need this until reset, except that not
> @@ -364,11 +360,10 @@ int spapr_irq_claim(SpaprMachineState *spapr, int irq, bool lsi, Error **errp)
>   {
>       SpaprInterruptController *intcs[] = ALL_INTCS(spapr);
>       int i;
> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
>       int rc;
>   
>       assert(irq >= SPAPR_XIRQ_BASE);
> -    assert(irq < (smc->nr_xirqs + SPAPR_XIRQ_BASE));
> +    assert(irq < (SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE));
>   
>       for (i = 0; i < ARRAY_SIZE(intcs); i++) {
>           SpaprInterruptController *intc = intcs[i];
> @@ -388,10 +383,9 @@ void spapr_irq_free(SpaprMachineState *spapr, int irq, int num)
>   {
>       SpaprInterruptController *intcs[] = ALL_INTCS(spapr);
>       int i, j;
> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
>   
>       assert(irq >= SPAPR_XIRQ_BASE);
> -    assert((irq + num) <= (smc->nr_xirqs + SPAPR_XIRQ_BASE));
> +    assert((irq + num) <= (SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE));
>   
>       for (i = irq; i < (irq + num); i++) {
>           for (j = 0; j < ARRAY_SIZE(intcs); j++) {
> @@ -408,8 +402,6 @@ void spapr_irq_free(SpaprMachineState *spapr, int irq, int num)
>   
>   qemu_irq spapr_qirq(SpaprMachineState *spapr, int irq)
>   {
> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
> -
>       /*
>        * This interface is basically for VIO and PHB devices to find the
>        * right qemu_irq to manipulate, so we only allow access to the
> @@ -418,7 +410,7 @@ qemu_irq spapr_qirq(SpaprMachineState *spapr, int irq)
>        * interfaces, we can change this if we need to in future.
>        */
>       assert(irq >= SPAPR_XIRQ_BASE);
> -    assert(irq < (smc->nr_xirqs + SPAPR_XIRQ_BASE));
> +    assert(irq < (SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE));
>   
>       if (spapr->ics) {
>           assert(ics_valid_irq(spapr->ics, irq));


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2025-10-21  8:43 ` [PATCH v2 11/11] ppc/spapr: remove deprecated machine pseries-4.2 Philippe Mathieu-Daudé
@ 2025-10-21 11:07 ` Michal Suchánek
  2025-10-29 17:30   ` Shivaprasad G Bhat
  2025-10-23 11:47 ` Harsh Prateek Bora
  12 siblings, 1 reply; 25+ messages in thread
From: Michal Suchánek @ 2025-10-21 11:07 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm,
	Paolo Bonzini, Harsh Prateek Bora, Cédric Le Goater

Hello,

I noticed removal of old pSeries revisions.

FTR to boot Linux 3.0 I need pSeries-2.7 (already removed earlier).

The thing that broke booting linux 3.0 for me is
357d1e3bc7d2d80e5271bc4f3ac8537e30dc8046 spapr: Improved placement of
PCI host bridges in guest memory map

I do not use Linux 3.0 anymore which is the reason I did not notice this
breakage due to old platform revision removal.

At the same time quemu is sometimes touted as a way to run old OS
revisions. That does not work very well for pSeries.

Thanks

Michal

On Tue, Oct 21, 2025 at 10:43:34AM +0200, Philippe Mathieu-Daudé wrote:
> v2: Rebased on https://lore.kernel.org/qemu-devel/20251009184057.19973-1-harshpb@linux.ibm.com/
> 
> Remove the deprecated pseries-3.0 up to pseries-4.2 machines,
> which are older than 6 years. Remove resulting dead code.
> 
> Harsh Prateek Bora (5):
>   ppc/spapr: remove deprecated machine pseries-3.0
>   ppc/spapr: remove deprecated machine pseries-3.1
>   ppc/spapr: remove deprecated machine pseries-4.0
>   ppc/spapr: remove deprecated machine pseries-4.1
>   ppc/spapr: remove deprecated machine pseries-4.2
> 
> Philippe Mathieu-Daudé (6):
>   hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field
>   hw/ppc/spapr: Inline spapr_dtb_needed()
>   hw/ppc/spapr: Inline few SPAPR_IRQ_* uses
>   target/ppc/kvm: Remove kvmppc_get_host_serial() as unused
>   target/ppc/kvm: Remove kvmppc_get_host_model() as unused
>   hw/ppc/spapr: Remove SpaprMachineClass::phb_placement callback
> 
>  include/hw/ppc/spapr.h     |  16 --
>  include/hw/ppc/spapr_irq.h |   1 -
>  target/ppc/kvm_ppc.h       |  12 --
>  hw/ppc/spapr.c             | 299 ++++++++-----------------------------
>  hw/ppc/spapr_caps.c        |  12 +-
>  hw/ppc/spapr_events.c      |  20 +--
>  hw/ppc/spapr_hcall.c       |   5 -
>  hw/ppc/spapr_irq.c         |  36 +----
>  hw/ppc/spapr_pci.c         |  32 +---
>  hw/ppc/spapr_vio.c         |   9 --
>  target/ppc/kvm.c           |  11 --
>  11 files changed, 77 insertions(+), 376 deletions(-)
> 
> -- 
> 2.51.0
> 
> 


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 05/11] hw/ppc/spapr: Inline few SPAPR_IRQ_* uses
  2025-10-21  8:43 ` [PATCH v2 05/11] hw/ppc/spapr: Inline few SPAPR_IRQ_* uses Philippe Mathieu-Daudé
@ 2025-10-21 11:27   ` Chinmay Rath
  0 siblings, 0 replies; 25+ messages in thread
From: Chinmay Rath @ 2025-10-21 11:27 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater


On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/ppc/spapr_events.c | 12 ++++--------
>   1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
> index 548a190ce89..892ddc7f8f7 100644
> --- a/hw/ppc/spapr_events.c
> +++ b/hw/ppc/spapr_events.c
> @@ -1041,16 +1041,14 @@ void spapr_clear_pending_hotplug_events(SpaprMachineState *spapr)
>   
>   void spapr_events_init(SpaprMachineState *spapr)
>   {
> -    int epow_irq = SPAPR_IRQ_EPOW;
> -
> -    spapr_irq_claim(spapr, epow_irq, false, &error_fatal);
> +    spapr_irq_claim(spapr, SPAPR_IRQ_EPOW, false, &error_fatal);
>   
>       QTAILQ_INIT(&spapr->pending_events);
>   
>       spapr->event_sources = spapr_event_sources_new();
>   
>       spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_EPOW,
> -                                 epow_irq);
> +                                 SPAPR_IRQ_EPOW);
>   
>       /* NOTE: if machine supports modern/dedicated hotplug event source,
>        * we add it to the device-tree unconditionally. This means we may
> @@ -1061,12 +1059,10 @@ void spapr_events_init(SpaprMachineState *spapr)
>        * checking that it's enabled.
>        */
>       if (spapr->use_hotplug_event_source) {
> -        int hp_irq = SPAPR_IRQ_HOTPLUG;
> -
> -        spapr_irq_claim(spapr, hp_irq, false, &error_fatal);
> +        spapr_irq_claim(spapr, SPAPR_IRQ_HOTPLUG, false, &error_fatal);
>   
>           spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_HOT_PLUG,
> -                                     hp_irq);
> +                                     SPAPR_IRQ_HOTPLUG);
>       }
>   
>       spapr->epow_notifier.notify = spapr_powerdown_req;
Reviewed-by: Chinmay Rath <rathc@linux.ibm.com>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 06/11] target/ppc/kvm: Remove kvmppc_get_host_serial() as unused
  2025-10-21  8:43 ` [PATCH v2 06/11] target/ppc/kvm: Remove kvmppc_get_host_serial() as unused Philippe Mathieu-Daudé
@ 2025-10-21 11:36   ` Chinmay Rath
  0 siblings, 0 replies; 25+ messages in thread
From: Chinmay Rath @ 2025-10-21 11:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater


On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/ppc/kvm_ppc.h | 6 ------
>   target/ppc/kvm.c     | 6 ------
>   2 files changed, 12 deletions(-)
>
> diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
> index a1d9ce9f9aa..f24cc4de3c2 100644
> --- a/target/ppc/kvm_ppc.h
> +++ b/target/ppc/kvm_ppc.h
> @@ -22,7 +22,6 @@
>   uint32_t kvmppc_get_tbfreq(void);
>   uint64_t kvmppc_get_clockfreq(void);
>   bool kvmppc_get_host_model(char **buf);
> -bool kvmppc_get_host_serial(char **buf);
>   int kvmppc_get_hasidle(CPUPPCState *env);
>   int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
>   int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
> @@ -134,11 +133,6 @@ static inline bool kvmppc_get_host_model(char **buf)
>       return false;
>   }
>   
> -static inline bool kvmppc_get_host_serial(char **buf)
> -{
> -    return false;
> -}
> -
>   static inline uint64_t kvmppc_get_clockfreq(void)
>   {
>       return 0;
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index cd60893a17d..cb61e99f9d4 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -1864,12 +1864,6 @@ uint32_t kvmppc_get_tbfreq(void)
>       return cached_tbfreq;
>   }
>   
> -bool kvmppc_get_host_serial(char **value)
> -{
> -    return g_file_get_contents("/proc/device-tree/system-id", value, NULL,
> -                               NULL);
> -}
> -
>   bool kvmppc_get_host_model(char **value)
>   {
>       return g_file_get_contents("/proc/device-tree/model", value, NULL, NULL);
Reviewed-by: Chinmay Rath <rathc@linux.ibm.com>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 07/11] target/ppc/kvm: Remove kvmppc_get_host_model() as unused
  2025-10-21  8:43 ` [PATCH v2 07/11] target/ppc/kvm: Remove kvmppc_get_host_model() " Philippe Mathieu-Daudé
@ 2025-10-21 11:39   ` Chinmay Rath
  0 siblings, 0 replies; 25+ messages in thread
From: Chinmay Rath @ 2025-10-21 11:39 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater


On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/ppc/kvm_ppc.h | 6 ------
>   target/ppc/kvm.c     | 5 -----
>   2 files changed, 11 deletions(-)
>
> diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
> index f24cc4de3c2..742881231e1 100644
> --- a/target/ppc/kvm_ppc.h
> +++ b/target/ppc/kvm_ppc.h
> @@ -21,7 +21,6 @@
>   
>   uint32_t kvmppc_get_tbfreq(void);
>   uint64_t kvmppc_get_clockfreq(void);
> -bool kvmppc_get_host_model(char **buf);
>   int kvmppc_get_hasidle(CPUPPCState *env);
>   int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
>   int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
> @@ -128,11 +127,6 @@ static inline uint32_t kvmppc_get_tbfreq(void)
>       return 0;
>   }
>   
> -static inline bool kvmppc_get_host_model(char **buf)
> -{
> -    return false;
> -}
> -
>   static inline uint64_t kvmppc_get_clockfreq(void)
>   {
>       return 0;
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index cb61e99f9d4..43124bf1c78 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -1864,11 +1864,6 @@ uint32_t kvmppc_get_tbfreq(void)
>       return cached_tbfreq;
>   }
>   
> -bool kvmppc_get_host_model(char **value)
> -{
> -    return g_file_get_contents("/proc/device-tree/model", value, NULL, NULL);
> -}
> -
>   /* Try to find a device tree node for a CPU with clock-frequency property */
>   static int kvmppc_find_cpu_dt(char *buf, int buf_len)
>   {
Reviewed-by: Chinmay Rath <rathc@linux.ibm.com>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 09/11] hw/ppc/spapr: Remove SpaprMachineClass::phb_placement callback
  2025-10-21  8:43 ` [PATCH v2 09/11] hw/ppc/spapr: Remove SpaprMachineClass::phb_placement callback Philippe Mathieu-Daudé
@ 2025-10-21 11:48   ` Chinmay Rath
  0 siblings, 0 replies; 25+ messages in thread
From: Chinmay Rath @ 2025-10-21 11:48 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater


On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
> The SpaprMachineClass::phb_placement callback was only used by
> the pseries-4.0 machine, which got removed. Remove it as now
> unused, directly calling spapr_phb_placement().
> Move spapr_phb_placement() definition to avoid forward declaration.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
Reviewed-by: Chinmay Rath <rathc@linux.ibm.com>
>   include/hw/ppc/spapr.h |   5 --
>   hw/ppc/spapr.c         | 114 ++++++++++++++++++++---------------------
>   2 files changed, 55 insertions(+), 64 deletions(-)
>
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 58d31b096cd..bd783e92e15 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -147,11 +147,6 @@ struct SpaprMachineClass {
>       bool pre_5_1_assoc_refpoints;
>       bool pre_5_2_numa_associativity;
>       bool pre_6_2_numa_affinity;
> -
> -    bool (*phb_placement)(SpaprMachineState *spapr, uint32_t index,
> -                          uint64_t *buid, hwaddr *pio,
> -                          hwaddr *mmio32, hwaddr *mmio64,
> -                          unsigned n_dma, uint32_t *liobns, Error **errp);
>       SpaprResizeHpt resize_hpt_default;
>       SpaprCapabilities default_caps;
>       SpaprIrq *irq;
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index deab613e070..97736bba5a1 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4068,12 +4068,62 @@ int spapr_phb_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr,
>       return 0;
>   }
>   
> +static bool spapr_phb_placement(SpaprMachineState *spapr, uint32_t index,
> +                                uint64_t *buid, hwaddr *pio,
> +                                hwaddr *mmio32, hwaddr *mmio64,
> +                                unsigned n_dma, uint32_t *liobns, Error **errp)
> +{
> +    /*
> +     * New-style PHB window placement.
> +     *
> +     * Goals: Gives large (1TiB), naturally aligned 64-bit MMIO window
> +     * for each PHB, in addition to 2GiB 32-bit MMIO and 64kiB PIO
> +     * windows.
> +     *
> +     * Some guest kernels can't work with MMIO windows above 1<<46
> +     * (64TiB), so we place up to 31 PHBs in the area 32TiB..64TiB
> +     *
> +     * 32TiB..(33TiB+1984kiB) contains the 64kiB PIO windows for each
> +     * PHB stacked together.  (32TiB+2GiB)..(32TiB+64GiB) contains the
> +     * 2GiB 32-bit MMIO windows for each PHB.  Then 33..64TiB has the
> +     * 1TiB 64-bit MMIO windows for each PHB.
> +     */
> +    const uint64_t base_buid = 0x800000020000000ULL;
> +    int i;
> +
> +    /* Sanity check natural alignments */
> +    QEMU_BUILD_BUG_ON((SPAPR_PCI_BASE % SPAPR_PCI_MEM64_WIN_SIZE) != 0);
> +    QEMU_BUILD_BUG_ON((SPAPR_PCI_LIMIT % SPAPR_PCI_MEM64_WIN_SIZE) != 0);
> +    QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM64_WIN_SIZE % SPAPR_PCI_MEM32_WIN_SIZE) != 0);
> +    QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM32_WIN_SIZE % SPAPR_PCI_IO_WIN_SIZE) != 0);
> +    /* Sanity check bounds */
> +    QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_IO_WIN_SIZE) >
> +                      SPAPR_PCI_MEM32_WIN_SIZE);
> +    QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_MEM32_WIN_SIZE) >
> +                      SPAPR_PCI_MEM64_WIN_SIZE);
> +
> +    if (index >= SPAPR_MAX_PHBS) {
> +        error_setg(errp, "\"index\" for PAPR PHB is too large (max %llu)",
> +                   SPAPR_MAX_PHBS - 1);
> +        return false;
> +    }
> +
> +    *buid = base_buid + index;
> +    for (i = 0; i < n_dma; ++i) {
> +        liobns[i] = SPAPR_PCI_LIOBN(index, i);
> +    }
> +
> +    *pio = SPAPR_PCI_BASE + index * SPAPR_PCI_IO_WIN_SIZE;
> +    *mmio32 = SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM32_WIN_SIZE;
> +    *mmio64 = SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM64_WIN_SIZE;
> +    return true;
> +}
> +
>   static bool spapr_phb_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
>                                  Error **errp)
>   {
>       SpaprMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
>       SpaprPhbState *sphb = SPAPR_PCI_HOST_BRIDGE(dev);
> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
>       const unsigned windows_supported = spapr_phb_windows_supported(sphb);
>       SpaprDrc *drc;
>   
> @@ -4092,12 +4142,10 @@ static bool spapr_phb_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
>        * This will check that sphb->index doesn't exceed the maximum number of
>        * PHBs for the current machine type.
>        */
> -    return
> -        smc->phb_placement(spapr, sphb->index,
> -                           &sphb->buid, &sphb->io_win_addr,
> -                           &sphb->mem_win_addr, &sphb->mem64_win_addr,
> -                           windows_supported, sphb->dma_liobn,
> -                           errp);
> +    return spapr_phb_placement(spapr, sphb->index,
> +                               &sphb->buid, &sphb->io_win_addr,
> +                               &sphb->mem_win_addr, &sphb->mem64_win_addr,
> +                               windows_supported, sphb->dma_liobn, errp);
>   }
>   
>   static void spapr_phb_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
> @@ -4345,57 +4393,6 @@ static const CPUArchIdList *spapr_possible_cpu_arch_ids(MachineState *machine)
>       return machine->possible_cpus;
>   }
>   
> -static bool spapr_phb_placement(SpaprMachineState *spapr, uint32_t index,
> -                                uint64_t *buid, hwaddr *pio,
> -                                hwaddr *mmio32, hwaddr *mmio64,
> -                                unsigned n_dma, uint32_t *liobns, Error **errp)
> -{
> -    /*
> -     * New-style PHB window placement.
> -     *
> -     * Goals: Gives large (1TiB), naturally aligned 64-bit MMIO window
> -     * for each PHB, in addition to 2GiB 32-bit MMIO and 64kiB PIO
> -     * windows.
> -     *
> -     * Some guest kernels can't work with MMIO windows above 1<<46
> -     * (64TiB), so we place up to 31 PHBs in the area 32TiB..64TiB
> -     *
> -     * 32TiB..(33TiB+1984kiB) contains the 64kiB PIO windows for each
> -     * PHB stacked together.  (32TiB+2GiB)..(32TiB+64GiB) contains the
> -     * 2GiB 32-bit MMIO windows for each PHB.  Then 33..64TiB has the
> -     * 1TiB 64-bit MMIO windows for each PHB.
> -     */
> -    const uint64_t base_buid = 0x800000020000000ULL;
> -    int i;
> -
> -    /* Sanity check natural alignments */
> -    QEMU_BUILD_BUG_ON((SPAPR_PCI_BASE % SPAPR_PCI_MEM64_WIN_SIZE) != 0);
> -    QEMU_BUILD_BUG_ON((SPAPR_PCI_LIMIT % SPAPR_PCI_MEM64_WIN_SIZE) != 0);
> -    QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM64_WIN_SIZE % SPAPR_PCI_MEM32_WIN_SIZE) != 0);
> -    QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM32_WIN_SIZE % SPAPR_PCI_IO_WIN_SIZE) != 0);
> -    /* Sanity check bounds */
> -    QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_IO_WIN_SIZE) >
> -                      SPAPR_PCI_MEM32_WIN_SIZE);
> -    QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_MEM32_WIN_SIZE) >
> -                      SPAPR_PCI_MEM64_WIN_SIZE);
> -
> -    if (index >= SPAPR_MAX_PHBS) {
> -        error_setg(errp, "\"index\" for PAPR PHB is too large (max %llu)",
> -                   SPAPR_MAX_PHBS - 1);
> -        return false;
> -    }
> -
> -    *buid = base_buid + index;
> -    for (i = 0; i < n_dma; ++i) {
> -        liobns[i] = SPAPR_PCI_LIOBN(index, i);
> -    }
> -
> -    *pio = SPAPR_PCI_BASE + index * SPAPR_PCI_IO_WIN_SIZE;
> -    *mmio32 = SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM32_WIN_SIZE;
> -    *mmio64 = SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM64_WIN_SIZE;
> -    return true;
> -}
> -
>   static ICSState *spapr_ics_get(XICSFabric *dev, int irq)
>   {
>       SpaprMachineState *spapr = SPAPR_MACHINE(dev);
> @@ -4606,7 +4603,6 @@ static void spapr_machine_class_init(ObjectClass *oc, const void *data)
>       smc->resize_hpt_default = SPAPR_RESIZE_HPT_ENABLED;
>       fwc->get_dev_path = spapr_get_fw_dev_path;
>       nc->nmi_monitor_handler = spapr_nmi;
> -    smc->phb_placement = spapr_phb_placement;
>       vhc->cpu_in_nested = spapr_cpu_in_nested;
>       vhc->deliver_hv_excp = spapr_exit_nested;
>       vhc->hypercall = emulate_spapr_hypercall;


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 04/11] hw/ppc/spapr: Inline spapr_dtb_needed()
  2025-10-21  8:43 ` [PATCH v2 04/11] hw/ppc/spapr: Inline spapr_dtb_needed() Philippe Mathieu-Daudé
@ 2025-10-21 13:25   ` Chinmay Rath
  2025-10-21 14:21     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 25+ messages in thread
From: Chinmay Rath @ 2025-10-21 13:25 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater

Hey Philippe,
The commit message says that this commit is inline-ing 
spapr_dtb_needed(), but it is actually removing it. I think it's better 
to convey that in the commit message.
Or did I miss something ?

On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/ppc/spapr.c | 6 ------
>   1 file changed, 6 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 458d1c29b4d..ad9fc61c299 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2053,11 +2053,6 @@ static const VMStateDescription vmstate_spapr_irq_map = {
>       },
>   };
>   
> -static bool spapr_dtb_needed(void *opaque)
> -{
> -    return true; /* backward migration compat */
> -}
> -
>   static int spapr_dtb_pre_load(void *opaque)
>   {
>       SpaprMachineState *spapr = (SpaprMachineState *)opaque;
> @@ -2073,7 +2068,6 @@ static const VMStateDescription vmstate_spapr_dtb = {
>       .name = "spapr_dtb",
>       .version_id = 1,

Does this version number need to be incremented ?

Regards,
Chinmay

>       .minimum_version_id = 1,
> -    .needed = spapr_dtb_needed,
>       .pre_load = spapr_dtb_pre_load,
>       .fields = (const VMStateField[]) {
>           VMSTATE_UINT32(fdt_initial_size, SpaprMachineState),


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 04/11] hw/ppc/spapr: Inline spapr_dtb_needed()
  2025-10-21 13:25   ` Chinmay Rath
@ 2025-10-21 14:21     ` Philippe Mathieu-Daudé
  2025-10-22  7:03       ` Chinmay Rath
  0 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21 14:21 UTC (permalink / raw)
  To: Chinmay Rath, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater

On 21/10/25 15:25, Chinmay Rath wrote:
> Hey Philippe,
> The commit message says that this commit is inline-ing 
> spapr_dtb_needed(), but it is actually removing it. I think it's better 
> to convey that in the commit message.
> Or did I miss something ?
> 
> On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   hw/ppc/spapr.c | 6 ------
>>   1 file changed, 6 deletions(-)
>>
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index 458d1c29b4d..ad9fc61c299 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -2053,11 +2053,6 @@ static const VMStateDescription 
>> vmstate_spapr_irq_map = {
>>       },
>>   };
>> -static bool spapr_dtb_needed(void *opaque)
>> -{
>> -    return true; /* backward migration compat */
>> -}
>> -
>>   static int spapr_dtb_pre_load(void *opaque)
>>   {
>>       SpaprMachineState *spapr = (SpaprMachineState *)opaque;
>> @@ -2073,7 +2068,6 @@ static const VMStateDescription 
>> vmstate_spapr_dtb = {
>>       .name = "spapr_dtb",
>>       .version_id = 1,
> 
> Does this version number need to be incremented ?

No, this is a no-op.

> 
> Regards,
> Chinmay
> 
>>       .minimum_version_id = 1,
>> -    .needed = spapr_dtb_needed,

Here is the inlining, as '.needed = true' is the default.

Would "Inline and remove spapr_dtb_needed()" be clearer?

>>       .pre_load = spapr_dtb_pre_load,
>>       .fields = (const VMStateField[]) {
>>           VMSTATE_UINT32(fdt_initial_size, SpaprMachineState),



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 04/11] hw/ppc/spapr: Inline spapr_dtb_needed()
  2025-10-21 14:21     ` Philippe Mathieu-Daudé
@ 2025-10-22  7:03       ` Chinmay Rath
  0 siblings, 0 replies; 25+ messages in thread
From: Chinmay Rath @ 2025-10-22  7:03 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater


On 10/21/25 19:51, Philippe Mathieu-Daudé wrote:
> On 21/10/25 15:25, Chinmay Rath wrote:
>> Hey Philippe,
>> The commit message says that this commit is inline-ing 
>> spapr_dtb_needed(), but it is actually removing it. I think it's 
>> better to convey that in the commit message.
>> Or did I miss something ?
>>
>> On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> ---
>>>   hw/ppc/spapr.c | 6 ------
>>>   1 file changed, 6 deletions(-)
>>>
>>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>>> index 458d1c29b4d..ad9fc61c299 100644
>>> --- a/hw/ppc/spapr.c
>>> +++ b/hw/ppc/spapr.c
>>> @@ -2053,11 +2053,6 @@ static const VMStateDescription 
>>> vmstate_spapr_irq_map = {
>>>       },
>>>   };
>>> -static bool spapr_dtb_needed(void *opaque)
>>> -{
>>> -    return true; /* backward migration compat */
>>> -}
>>> -
>>>   static int spapr_dtb_pre_load(void *opaque)
>>>   {
>>>       SpaprMachineState *spapr = (SpaprMachineState *)opaque;
>>> @@ -2073,7 +2068,6 @@ static const VMStateDescription 
>>> vmstate_spapr_dtb = {
>>>       .name = "spapr_dtb",
>>>       .version_id = 1,
>>
>> Does this version number need to be incremented ?
>
> No, this is a no-op.
>
>>
>> Regards,
>> Chinmay
>>
>>>       .minimum_version_id = 1,
>>> -    .needed = spapr_dtb_needed,
>
> Here is the inlining, as '.needed = true' is the default.
Ahh I see.
> Would "Inline and remove spapr_dtb_needed()" be clearer?
Yeah that'd be nice.

Thanks,
Chinmay
>
>>>       .pre_load = spapr_dtb_pre_load,
>>>       .fields = (const VMStateField[]) {
>>>           VMSTATE_UINT32(fdt_initial_size, SpaprMachineState),
>
>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 02/11] hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field
  2025-10-21 10:35   ` Chinmay Rath
@ 2025-10-22  7:17     ` Chinmay Rath
  0 siblings, 0 replies; 25+ messages in thread
From: Chinmay Rath @ 2025-10-22  7:17 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater


On 10/21/25 16:05, Chinmay Rath wrote:
>
> On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
>> The SpaprMachineClass::nr_xirqs field was only used by the
>> pseries-3.0 machine, which got removed. Remove it as now unused.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   include/hw/ppc/spapr.h |  1 -
>>   hw/ppc/spapr.c         |  1 -
>>   hw/ppc/spapr_irq.c     | 22 +++++++---------------
>>   3 files changed, 7 insertions(+), 17 deletions(-)
>>
>> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
>> index 0c1e5132de2..494367fb99a 100644
>> --- a/include/hw/ppc/spapr.h
>> +++ b/include/hw/ppc/spapr.h
>> @@ -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 */
>> -    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;
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index 426a778d3e8..b5d20bc1756 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -4691,7 +4691,6 @@ static void 
>> spapr_machine_class_init(ObjectClass *oc, const void *data)
>>       smc->dr_phb_enabled = true;
>>       smc->linux_pci_probe = true;
>>       smc->smp_threads_vsmt = true;
>> -    smc->nr_xirqs = SPAPR_NR_XIRQS;
>>       xfc->match_nvt = spapr_match_nvt;
>>       vmc->client_architecture_support = 
>> spapr_vof_client_architecture_support;
>>       vmc->quiesce = spapr_vof_quiesce;
>> diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
>> index 317d57a3802..2ce323457be 100644
>> --- a/hw/ppc/spapr_irq.c
>> +++ b/hw/ppc/spapr_irq.c
>> @@ -279,15 +279,11 @@ void spapr_irq_dt(SpaprMachineState *spapr, 
>> uint32_t nr_servers,
>>     uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr)
>>   {
>> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
>> -
>> -    return SPAPR_XIRQ_BASE + smc->nr_xirqs - SPAPR_IRQ_MSI;
>> +    return SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE - SPAPR_IRQ_MSI;
>>   }
> Hey,
> With this cleanup, I think we can get rid of the SpaprMachineState 
> argument passed to spapr_irq_nr_msis function since it is not used 
> anymore ^.
>
> Regards,
> Chinmay
On second thoughts, since the functions is just returning a constant 
value now, would it make sense to get rid of the functions all together 
and replace the calls with the respective constant ?

Regards,
Chinmay

>>     void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
>>   {
>> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
>> -
>>       if (kvm_enabled() && kvm_kernel_irqchip_split()) {
>>           error_setg(errp, "kernel_irqchip split mode not supported 
>> on pseries");
>>           return;
>> @@ -308,7 +304,7 @@ void spapr_irq_init(SpaprMachineState *spapr, 
>> Error **errp)
>>           object_property_add_child(OBJECT(spapr), "ics", obj);
>>           object_property_set_link(obj, ICS_PROP_XICS, OBJECT(spapr),
>>                                    &error_abort);
>> -        object_property_set_int(obj, "nr-irqs", smc->nr_xirqs, 
>> &error_abort);
>> +        object_property_set_int(obj, "nr-irqs", SPAPR_NR_XIRQS, 
>> &error_abort);
>>           if (!qdev_realize(DEVICE(obj), NULL, errp)) {
>>               return;
>>           }
>> @@ -322,7 +318,7 @@ void spapr_irq_init(SpaprMachineState *spapr, 
>> Error **errp)
>>           int i;
>>             dev = qdev_new(TYPE_SPAPR_XIVE);
>> -        qdev_prop_set_uint32(dev, "nr-irqs", smc->nr_xirqs + 
>> SPAPR_IRQ_NR_IPIS);
>> +        qdev_prop_set_uint32(dev, "nr-irqs", SPAPR_NR_XIRQS + 
>> SPAPR_IRQ_NR_IPIS);
>>           /*
>>            * 8 XIVE END structures per CPU. One for each available
>>            * priority
>> @@ -349,7 +345,7 @@ void spapr_irq_init(SpaprMachineState *spapr, 
>> Error **errp)
>>       }
>>         spapr->qirqs = qemu_allocate_irqs(spapr_set_irq, spapr,
>> -                                      smc->nr_xirqs + 
>> SPAPR_IRQ_NR_IPIS);
>> +                                      SPAPR_NR_XIRQS + 
>> SPAPR_IRQ_NR_IPIS);
>>         /*
>>        * Mostly we don't actually need this until reset, except that not
>> @@ -364,11 +360,10 @@ int spapr_irq_claim(SpaprMachineState *spapr, 
>> int irq, bool lsi, Error **errp)
>>   {
>>       SpaprInterruptController *intcs[] = ALL_INTCS(spapr);
>>       int i;
>> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
>>       int rc;
>>         assert(irq >= SPAPR_XIRQ_BASE);
>> -    assert(irq < (smc->nr_xirqs + SPAPR_XIRQ_BASE));
>> +    assert(irq < (SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE));
>>         for (i = 0; i < ARRAY_SIZE(intcs); i++) {
>>           SpaprInterruptController *intc = intcs[i];
>> @@ -388,10 +383,9 @@ void spapr_irq_free(SpaprMachineState *spapr, 
>> int irq, int num)
>>   {
>>       SpaprInterruptController *intcs[] = ALL_INTCS(spapr);
>>       int i, j;
>> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
>>         assert(irq >= SPAPR_XIRQ_BASE);
>> -    assert((irq + num) <= (smc->nr_xirqs + SPAPR_XIRQ_BASE));
>> +    assert((irq + num) <= (SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE));
>>         for (i = irq; i < (irq + num); i++) {
>>           for (j = 0; j < ARRAY_SIZE(intcs); j++) {
>> @@ -408,8 +402,6 @@ void spapr_irq_free(SpaprMachineState *spapr, int 
>> irq, int num)
>>     qemu_irq spapr_qirq(SpaprMachineState *spapr, int irq)
>>   {
>> -    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
>> -
>>       /*
>>        * This interface is basically for VIO and PHB devices to find the
>>        * right qemu_irq to manipulate, so we only allow access to the
>> @@ -418,7 +410,7 @@ qemu_irq spapr_qirq(SpaprMachineState *spapr, int 
>> irq)
>>        * interfaces, we can change this if we need to in future.
>>        */
>>       assert(irq >= SPAPR_XIRQ_BASE);
>> -    assert(irq < (smc->nr_xirqs + SPAPR_XIRQ_BASE));
>> +    assert(irq < (SPAPR_NR_XIRQS + SPAPR_XIRQ_BASE));
>>         if (spapr->ics) {
>>           assert(ics_valid_irq(spapr->ics, irq));
>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines
  2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2025-10-21 11:07 ` [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Michal Suchánek
@ 2025-10-23 11:47 ` Harsh Prateek Bora
  12 siblings, 0 replies; 25+ messages in thread
From: Harsh Prateek Bora @ 2025-10-23 11:47 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm, Paolo Bonzini,
	Cédric Le Goater



On 10/21/25 14:13, Philippe Mathieu-Daudé wrote:
> v2: Rebased on https://lore.kernel.org/qemu-devel/20251009184057.19973-1-harshpb@linux.ibm.com/
> 
> Remove the deprecated pseries-3.0 up to pseries-4.2 machines,
> which are older than 6 years. Remove resulting dead code.
> 
> Harsh Prateek Bora (5):
>    ppc/spapr: remove deprecated machine pseries-3.0
>    ppc/spapr: remove deprecated machine pseries-3.1
>    ppc/spapr: remove deprecated machine pseries-4.0
>    ppc/spapr: remove deprecated machine pseries-4.1
>    ppc/spapr: remove deprecated machine pseries-4.2
> 
> Philippe Mathieu-Daudé (6):
>    hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field
>    hw/ppc/spapr: Inline spapr_dtb_needed()
>    hw/ppc/spapr: Inline few SPAPR_IRQ_* uses
>    target/ppc/kvm: Remove kvmppc_get_host_serial() as unused
>    target/ppc/kvm: Remove kvmppc_get_host_model() as unused
>    hw/ppc/spapr: Remove SpaprMachineClass::phb_placement callback

Queued and posted PR.
Additional cleanup suggestions on patch 2 can be taken up as a 
follow-up. Thanks.

regards,
Harsh


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines
  2025-10-21 11:07 ` [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Michal Suchánek
@ 2025-10-29 17:30   ` Shivaprasad G Bhat
  2025-10-29 19:53     ` Michal Suchánek
  0 siblings, 1 reply; 25+ messages in thread
From: Shivaprasad G Bhat @ 2025-10-29 17:30 UTC (permalink / raw)
  To: Michal Suchánek, Philippe Mathieu-Daudé
  Cc: qemu-devel, Chinmay Rath, qemu-ppc, Nicholas Piggin, kvm,
	Paolo Bonzini, Harsh Prateek Bora, Cédric Le Goater

Hi Michal,


On 10/21/25 4:37 PM, Michal Suchánek wrote:
> Hello,
>
> I noticed removal of old pSeries revisions.
>
> FTR to boot Linux 3.0 I need pSeries-2.7 (already removed earlier).
>
> The thing that broke booting linux 3.0 for me is
> 357d1e3bc7d2d80e5271bc4f3ac8537e30dc8046 spapr: Improved placement of
> PCI host bridges in guest memory map
>
> I do not use Linux 3.0 anymore which is the reason I did not notice this
> breakage due to old platform revision removal.

I tried booting linux kernel 3.13.0-170-generic from ubuntu 14.04.6 LTS 
with the oldest supported machine pseries-5.0 as of now.

It worked fine.


qemu-system-ppc64 -machine pseries-5.0 -accel tcg -nographic -m size=12G 
-cpu power8 -smp 1 -drive 
file=/root/images/ubuntu16.04.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 
-device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-disk0 -serial 
mon:stdio -kernel /root/images/vmlinux-3.13.0-170-generic -initrd 
/root/images/initrd.img-3.13.0-170-generic -append 
"BOOT_IMAGE=/boot/vmlinux-4.4.0-142-generic 
root=UUID=94fba90c-dbb0-4f8d-bc3e-acd5f2e54749 ro vt.handoff=7"


shiva@ubuntu:~$ uname -a
Linux ubuntu 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:44:25 UTC 
2019 ppc64le ppc64le ppc64le GNU/Linux
shiva@ubuntu:~$ cat /proc/cpuinfo
processor    : 0
cpu        : POWER8 (architected), altivec supported
clock        : 1000.000000MHz
revision    : 2.0 (pvr 004d 0200)

timebase    : 512000000
platform    : pSeries
model        : IBM pSeries (emulated by qemu)
machine        : CHRP IBM pSeries (emulated by qemu)


Hope that helps.


Thanks,

Shivaprasad




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines
  2025-10-29 17:30   ` Shivaprasad G Bhat
@ 2025-10-29 19:53     ` Michal Suchánek
  0 siblings, 0 replies; 25+ messages in thread
From: Michal Suchánek @ 2025-10-29 19:53 UTC (permalink / raw)
  To: Shivaprasad G Bhat
  Cc: Philippe Mathieu-Daudé, qemu-devel, Chinmay Rath, qemu-ppc,
	Nicholas Piggin, kvm, Paolo Bonzini, Harsh Prateek Bora,
	Cédric Le Goater

On Wed, Oct 29, 2025 at 11:00:18PM +0530, Shivaprasad G Bhat wrote:
> Hi Michal,
> 
> On 10/21/25 4:37 PM, Michal Suchánek wrote:
> > Hello,
> > 
> > I noticed removal of old pSeries revisions.
> > 
> > FTR to boot Linux 3.0 I need pSeries-2.7 (already removed earlier).
> > 
> > The thing that broke booting linux 3.0 for me is
> > 357d1e3bc7d2d80e5271bc4f3ac8537e30dc8046 spapr: Improved placement of
> > PCI host bridges in guest memory map
> > 
> > I do not use Linux 3.0 anymore which is the reason I did not notice this
> > breakage due to old platform revision removal.
> 
> I tried booting linux kernel 3.13.0-170-generic from ubuntu 14.04.6 LTS with
> the oldest supported machine pseries-5.0 as of now.
> 
> It worked fine.
> 
> 
> qemu-system-ppc64 -machine pseries-5.0 -accel tcg -nographic -m size=12G
> -cpu power8 -smp 1 -drive file=/root/images/ubuntu16.04.qcow2,format=qcow2,if=none,id=drive-virtio-disk0
> -device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-disk0 -serial
> mon:stdio -kernel /root/images/vmlinux-3.13.0-170-generic -initrd
> /root/images/initrd.img-3.13.0-170-generic -append
> "BOOT_IMAGE=/boot/vmlinux-4.4.0-142-generic
> root=UUID=94fba90c-dbb0-4f8d-bc3e-acd5f2e54749 ro vt.handoff=7"
> 
> 
> shiva@ubuntu:~$ uname -a
> Linux ubuntu 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:44:25 UTC 2019
> ppc64le ppc64le ppc64le GNU/Linux
> shiva@ubuntu:~$ cat /proc/cpuinfo
> processor    : 0
> cpu        : POWER8 (architected), altivec supported
> clock        : 1000.000000MHz
> revision    : 2.0 (pvr 004d 0200)
> 
> timebase    : 512000000
> platform    : pSeries
> model        : IBM pSeries (emulated by qemu)
> machine        : CHRP IBM pSeries (emulated by qemu)
> 
> 
> Hope that helps.

How does that help?

Of course newer kernels do work.

However, distributions using Linux 3.0 don't anymore, at least that
particular Linux 3.0 build.

I am not particularly concerned, only noting that the qemu pSeries
emulation is not suitable for running very old distributions because
they are not compatible with newer qemu.

It can be a bug in the old kernel but it's not triggered by actual
hardware nor older qemu. Or it may bee a bug with that new qemu PCI bus
organization that is not triggered by newer kernel. I don't know and
since nobody cared enough to diagnose it so far we will probably never
know.

Thanks

Michal


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2025-10-29 19:56 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21  8:43 [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Philippe Mathieu-Daudé
2025-10-21  8:43 ` [PATCH v2 01/11] ppc/spapr: remove deprecated machine pseries-3.0 Philippe Mathieu-Daudé
2025-10-21  8:43 ` [PATCH v2 02/11] hw/ppc/spapr: Remove SpaprMachineClass::nr_xirqs field Philippe Mathieu-Daudé
2025-10-21 10:35   ` Chinmay Rath
2025-10-22  7:17     ` Chinmay Rath
2025-10-21  8:43 ` [PATCH v2 03/11] ppc/spapr: remove deprecated machine pseries-3.1 Philippe Mathieu-Daudé
2025-10-21  8:43 ` [PATCH v2 04/11] hw/ppc/spapr: Inline spapr_dtb_needed() Philippe Mathieu-Daudé
2025-10-21 13:25   ` Chinmay Rath
2025-10-21 14:21     ` Philippe Mathieu-Daudé
2025-10-22  7:03       ` Chinmay Rath
2025-10-21  8:43 ` [PATCH v2 05/11] hw/ppc/spapr: Inline few SPAPR_IRQ_* uses Philippe Mathieu-Daudé
2025-10-21 11:27   ` Chinmay Rath
2025-10-21  8:43 ` [PATCH v2 06/11] target/ppc/kvm: Remove kvmppc_get_host_serial() as unused Philippe Mathieu-Daudé
2025-10-21 11:36   ` Chinmay Rath
2025-10-21  8:43 ` [PATCH v2 07/11] target/ppc/kvm: Remove kvmppc_get_host_model() " Philippe Mathieu-Daudé
2025-10-21 11:39   ` Chinmay Rath
2025-10-21  8:43 ` [PATCH v2 08/11] ppc/spapr: remove deprecated machine pseries-4.0 Philippe Mathieu-Daudé
2025-10-21  8:43 ` [PATCH v2 09/11] hw/ppc/spapr: Remove SpaprMachineClass::phb_placement callback Philippe Mathieu-Daudé
2025-10-21 11:48   ` Chinmay Rath
2025-10-21  8:43 ` [PATCH v2 10/11] ppc/spapr: remove deprecated machine pseries-4.1 Philippe Mathieu-Daudé
2025-10-21  8:43 ` [PATCH v2 11/11] ppc/spapr: remove deprecated machine pseries-4.2 Philippe Mathieu-Daudé
2025-10-21 11:07 ` [PATCH v2 00/11] hw/ppc/spapr: Remove deprecated pseries-3.0 -> pseries-4.2 machines Michal Suchánek
2025-10-29 17:30   ` Shivaprasad G Bhat
2025-10-29 19:53     ` Michal Suchánek
2025-10-23 11:47 ` Harsh Prateek Bora

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).