[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/36] target/sparc: Convert to 3-phase reset
From: |
Peter Maydell |
Subject: |
[PULL 27/36] target/sparc: Convert to 3-phase reset |
Date: |
Fri, 16 Dec 2022 21:42:35 +0000 |
Convert the sparc CPU class to use 3-phase reset, so it doesn't
need to use device_class_set_parent_reset() any more.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-id: 20221124115023.2437291-18-peter.maydell@linaro.org
---
target/sparc/cpu-qom.h | 4 ++--
target/sparc/cpu.c | 12 ++++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/target/sparc/cpu-qom.h b/target/sparc/cpu-qom.h
index 86ed37d9333..78bf00b9a23 100644
--- a/target/sparc/cpu-qom.h
+++ b/target/sparc/cpu-qom.h
@@ -35,7 +35,7 @@ typedef struct sparc_def_t sparc_def_t;
/**
* SPARCCPUClass:
* @parent_realize: The parent class' realize handler.
- * @parent_reset: The parent class' reset handler.
+ * @parent_phases: The parent class' reset phase handlers.
*
* A SPARC CPU model.
*/
@@ -45,7 +45,7 @@ struct SPARCCPUClass {
/*< public >*/
DeviceRealize parent_realize;
- DeviceReset parent_reset;
+ ResettablePhases parent_phases;
sparc_def_t *cpu_def;
};
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 4c3d08a8751..1734ef8dc6b 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -28,14 +28,16 @@
//#define DEBUG_FEATURES
-static void sparc_cpu_reset(DeviceState *dev)
+static void sparc_cpu_reset_hold(Object *obj)
{
- CPUState *s = CPU(dev);
+ CPUState *s = CPU(obj);
SPARCCPU *cpu = SPARC_CPU(s);
SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(cpu);
CPUSPARCState *env = &cpu->env;
- scc->parent_reset(dev);
+ if (scc->parent_phases.hold) {
+ scc->parent_phases.hold(obj);
+ }
memset(env, 0, offsetof(CPUSPARCState, end_reset_fields));
env->cwp = 0;
@@ -889,12 +891,14 @@ static void sparc_cpu_class_init(ObjectClass *oc, void
*data)
SPARCCPUClass *scc = SPARC_CPU_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
DeviceClass *dc = DEVICE_CLASS(oc);
+ ResettableClass *rc = RESETTABLE_CLASS(oc);
device_class_set_parent_realize(dc, sparc_cpu_realizefn,
&scc->parent_realize);
device_class_set_props(dc, sparc_cpu_properties);
- device_class_set_parent_reset(dc, sparc_cpu_reset, &scc->parent_reset);
+ resettable_class_set_parent_phases(rc, NULL, sparc_cpu_reset_hold, NULL,
+ &scc->parent_phases);
cc->class_by_name = sparc_cpu_class_by_name;
cc->parse_features = sparc_cpu_parse_features;
--
2.25.1
- [PULL 16/36] target/i386: Convert to 3-phase reset, (continued)
- [PULL 16/36] target/i386: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 17/36] target/loongarch: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 18/36] target/m68k: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 21/36] target/nios2: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 25/36] target/rx: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 24/36] target/riscv: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 26/36] target/sh4: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 32/36] pci: Convert TYPE_PCIE_ROOT_PORT to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 33/36] pci: Convert child classes of TYPE_PCIE_ROOT_PORT to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 23/36] target/ppc: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 27/36] target/sparc: Convert to 3-phase reset,
Peter Maydell <=
- [PULL 29/36] target/xtensa: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 35/36] hw/intc/xics: Convert TYPE_ICS to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 30/36] hw/virtio: Convert TYPE_VIRTIO_PCI to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 28/36] target/tricore: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 31/36] hw/display/virtio-vga: Convert TYPE_VIRTIO_VGA_BASE to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 34/36] hw/intc/xics: Reset TYPE_ICS objects with device_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 36/36] hw/pci-host/pnv_phb3_msi: Convert TYPE_PHB3_MSI to 3-phase reset, Peter Maydell, 2022/12/16
- Re: [PULL 00/36] reset refactoring patches, Peter Maydell, 2022/12/17