[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/36] target/tricore: Convert to 3-phase reset
From: |
Peter Maydell |
Subject: |
[PULL 28/36] target/tricore: Convert to 3-phase reset |
Date: |
Fri, 16 Dec 2022 21:42:36 +0000 |
Convert the tricore 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-19-peter.maydell@linaro.org
---
target/tricore/cpu-qom.h | 2 +-
target/tricore/cpu.c | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/target/tricore/cpu-qom.h b/target/tricore/cpu-qom.h
index ee24e9fa76a..612731daa09 100644
--- a/target/tricore/cpu-qom.h
+++ b/target/tricore/cpu-qom.h
@@ -32,7 +32,7 @@ struct TriCoreCPUClass {
/*< public >*/
DeviceRealize parent_realize;
- DeviceReset parent_reset;
+ ResettablePhases parent_phases;
};
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
index 2c54a2825f8..594cd1efd5e 100644
--- a/target/tricore/cpu.c
+++ b/target/tricore/cpu.c
@@ -68,14 +68,16 @@ static void tricore_restore_state_to_opc(CPUState *cs,
env->PC = data[0];
}
-static void tricore_cpu_reset(DeviceState *dev)
+static void tricore_cpu_reset_hold(Object *obj)
{
- CPUState *s = CPU(dev);
+ CPUState *s = CPU(obj);
TriCoreCPU *cpu = TRICORE_CPU(s);
TriCoreCPUClass *tcc = TRICORE_CPU_GET_CLASS(cpu);
CPUTriCoreState *env = &cpu->env;
- tcc->parent_reset(dev);
+ if (tcc->parent_phases.hold) {
+ tcc->parent_phases.hold(obj);
+ }
cpu_state_reset(env);
}
@@ -180,11 +182,13 @@ static void tricore_cpu_class_init(ObjectClass *c, void
*data)
TriCoreCPUClass *mcc = TRICORE_CPU_CLASS(c);
CPUClass *cc = CPU_CLASS(c);
DeviceClass *dc = DEVICE_CLASS(c);
+ ResettableClass *rc = RESETTABLE_CLASS(c);
device_class_set_parent_realize(dc, tricore_cpu_realizefn,
&mcc->parent_realize);
- device_class_set_parent_reset(dc, tricore_cpu_reset, &mcc->parent_reset);
+ resettable_class_set_parent_phases(rc, NULL, tricore_cpu_reset_hold, NULL,
+ &mcc->parent_phases);
cc->class_by_name = tricore_cpu_class_by_name;
cc->has_work = tricore_cpu_has_work;
--
2.25.1
- [PULL 25/36] target/rx: Convert to 3-phase reset, (continued)
- [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, 2022/12/16
- [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 <=
- [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