[PATCH] hw/ppc/spapr_cpu_core: Convert to Resettable interface

Oscar Alejandro Sánchez Lucero posted 1 patch 4 days, 9 hours ago
hw/ppc/spapr_cpu_core.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
[PATCH] hw/ppc/spapr_cpu_core: Convert to Resettable interface
Posted by Oscar Alejandro Sánchez Lucero 4 days, 9 hours ago
Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in spapr_cpu_core_reset_hold().

Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
 hw/ppc/spapr_cpu_core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 9a93519..551b91c 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -212,10 +212,10 @@ static void spapr_unrealize_vcpu(PowerPCCPU *cpu, SpaprCpuCore *sc)
 /*
  * Called when CPUs are hot-plugged.
  */
-static void spapr_cpu_core_reset(DeviceState *dev)
+static void spapr_cpu_core_reset_hold(Object *obj, ResetType type)
 {
-    CPUCore *cc = CPU_CORE(dev);
-    SpaprCpuCore *sc = SPAPR_CPU_CORE(dev);
+    CPUCore *cc = CPU_CORE(obj);
+    SpaprCpuCore *sc = SPAPR_CPU_CORE(obj);
     int i;
 
     for (i = 0; i < cc->nr_threads; i++) {
@@ -228,7 +228,7 @@ static void spapr_cpu_core_reset(DeviceState *dev)
  */
 static void spapr_cpu_core_reset_handler(void *opaque)
 {
-    spapr_cpu_core_reset(opaque);
+    device_cold_reset(DEVICE(opaque));
 }
 
 static void spapr_delete_vcpu(PowerPCCPU *cpu)
@@ -376,11 +376,12 @@ static const Property spapr_cpu_core_properties[] = {
 static void spapr_cpu_core_class_init(ObjectClass *oc, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
+    ResettableClass *rc = RESETTABLE_CLASS(oc);
     SpaprCpuCoreClass *scc = SPAPR_CPU_CORE_CLASS(oc);
 
     dc->realize = spapr_cpu_core_realize;
     dc->unrealize = spapr_cpu_core_unrealize;
-    device_class_set_legacy_reset(dc, spapr_cpu_core_reset);
+    rc->phases.hold = spapr_cpu_core_reset_hold;
     device_class_set_props(dc, spapr_cpu_core_properties);
     scc->cpu_type = data;
 }

---
base-commit: 9751c62358073580cbf330a4df22077a7c6a407c
change-id: 20261202-ppc-spapr-cpu-core-resettable-19cd022694a9

Best regards,
--  
Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>