[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/36] target/arm: Convert to 3-phase reset
From: |
Peter Maydell |
Subject: |
[PULL 12/36] target/arm: Convert to 3-phase reset |
Date: |
Fri, 16 Dec 2022 21:42:20 +0000 |
Convert the Arm 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>
Message-id: 20221124115023.2437291-3-peter.maydell@linaro.org
---
target/arm/cpu-qom.h | 4 ++--
target/arm/cpu.c | 13 +++++++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
index 64c44cef2dd..514c22ced9b 100644
--- a/target/arm/cpu-qom.h
+++ b/target/arm/cpu-qom.h
@@ -43,7 +43,7 @@ void aarch64_cpu_register(const ARMCPUInfo *info);
/**
* ARMCPUClass:
* @parent_realize: The parent class' realize handler.
- * @parent_reset: The parent class' reset handler.
+ * @parent_phases: The parent class' reset phase handlers.
*
* An ARM CPU model.
*/
@@ -54,7 +54,7 @@ struct ARMCPUClass {
const ARMCPUInfo *info;
DeviceRealize parent_realize;
- DeviceReset parent_reset;
+ ResettablePhases parent_phases;
};
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 0f55004d7e7..2fa022f62ba 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -202,14 +202,16 @@ static void cp_reg_check_reset(gpointer key, gpointer
value, gpointer opaque)
assert(oldvalue == newvalue);
}
-static void arm_cpu_reset(DeviceState *dev)
+static void arm_cpu_reset_hold(Object *obj)
{
- CPUState *s = CPU(dev);
+ CPUState *s = CPU(obj);
ARMCPU *cpu = ARM_CPU(s);
ARMCPUClass *acc = ARM_CPU_GET_CLASS(cpu);
CPUARMState *env = &cpu->env;
- acc->parent_reset(dev);
+ if (acc->parent_phases.hold) {
+ acc->parent_phases.hold(obj);
+ }
memset(env, 0, offsetof(CPUARMState, end_reset_fields));
@@ -2211,12 +2213,15 @@ static void arm_cpu_class_init(ObjectClass *oc, void
*data)
ARMCPUClass *acc = ARM_CPU_CLASS(oc);
CPUClass *cc = CPU_CLASS(acc);
DeviceClass *dc = DEVICE_CLASS(oc);
+ ResettableClass *rc = RESETTABLE_CLASS(oc);
device_class_set_parent_realize(dc, arm_cpu_realizefn,
&acc->parent_realize);
device_class_set_props(dc, arm_cpu_properties);
- device_class_set_parent_reset(dc, arm_cpu_reset, &acc->parent_reset);
+
+ resettable_class_set_parent_phases(rc, NULL, arm_cpu_reset_hold, NULL,
+ &acc->parent_phases);
cc->class_by_name = arm_cpu_class_by_name;
cc->has_work = arm_cpu_has_work;
--
2.25.1
- [PULL 00/36] reset refactoring patches, Peter Maydell, 2022/12/16
- [PULL 01/36] hw/s390x/s390-pci-inst.c: Use device_cold_reset() to reset PCI devices, Peter Maydell, 2022/12/16
- [PULL 02/36] pci: Use device_cold_reset() and bus_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 03/36] hw/hyperv/vmbus: Use device_cold_reset() and bus_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 13/36] target/avr: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 20/36] target/mips: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 19/36] target/microblaze: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 22/36] target/openrisc: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 09/36] hw/misc/mos6522: Convert TYPE_MOS6522 to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 07/36] hw/input/ps2: Convert TYPE_PS2_DEVICE to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 12/36] target/arm: Convert to 3-phase reset,
Peter Maydell <=
- [PULL 04/36] Replace use of qdev_reset_all() with device_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 05/36] qdev: Remove qdev_reset_all() and qbus_reset_all(), Peter Maydell, 2022/12/16
- [PULL 06/36] hw: Remove device_legacy_reset(), Peter Maydell, 2022/12/16
- [PULL 14/36] target/cris: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 08/36] hw/input/ps2.c: Convert TYPE_PS2_{KBD, MOUSE}_DEVICE to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 10/36] hw/misc: Convert TYPE_MOS6522 subclasses to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 11/36] hw/core/cpu-common: Convert TYPE_CPU class to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 15/36] target/hexagon: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [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