[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/36] target/loongarch: Convert to 3-phase reset
From: |
Peter Maydell |
Subject: |
[PULL 17/36] target/loongarch: Convert to 3-phase reset |
Date: |
Fri, 16 Dec 2022 21:42:25 +0000 |
Convert the loongarch 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>
Message-id: 20221124115023.2437291-8-peter.maydell@linaro.org
---
target/loongarch/cpu.h | 4 ++--
target/loongarch/cpu.c | 12 ++++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index e15c633b0bf..e35cf655975 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -356,7 +356,7 @@ OBJECT_DECLARE_CPU_TYPE(LoongArchCPU, LoongArchCPUClass,
/**
* LoongArchCPUClass:
* @parent_realize: The parent class' realize handler.
- * @parent_reset: The parent class' reset handler.
+ * @parent_phases: The parent class' reset phase handlers.
*
* A LoongArch CPU model.
*/
@@ -366,7 +366,7 @@ struct LoongArchCPUClass {
/*< public >*/
DeviceRealize parent_realize;
- DeviceReset parent_reset;
+ ResettablePhases parent_phases;
};
/*
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index e7b0e12be6a..290ab4d526b 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -450,14 +450,16 @@ void loongarch_cpu_list(void)
g_slist_free(list);
}
-static void loongarch_cpu_reset(DeviceState *dev)
+static void loongarch_cpu_reset_hold(Object *obj)
{
- CPUState *cs = CPU(dev);
+ CPUState *cs = CPU(obj);
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
LoongArchCPUClass *lacc = LOONGARCH_CPU_GET_CLASS(cpu);
CPULoongArchState *env = &cpu->env;
- lacc->parent_reset(dev);
+ if (lacc->parent_phases.hold) {
+ lacc->parent_phases.hold(obj);
+ }
env->fcsr0_mask = FCSR0_M1 | FCSR0_M2 | FCSR0_M3;
env->fcsr0 = 0x0;
@@ -694,10 +696,12 @@ static void loongarch_cpu_class_init(ObjectClass *c, void
*data)
LoongArchCPUClass *lacc = LOONGARCH_CPU_CLASS(c);
CPUClass *cc = CPU_CLASS(c);
DeviceClass *dc = DEVICE_CLASS(c);
+ ResettableClass *rc = RESETTABLE_CLASS(c);
device_class_set_parent_realize(dc, loongarch_cpu_realizefn,
&lacc->parent_realize);
- device_class_set_parent_reset(dc, loongarch_cpu_reset,
&lacc->parent_reset);
+ resettable_class_set_parent_phases(rc, NULL, loongarch_cpu_reset_hold,
NULL,
+ &lacc->parent_phases);
cc->class_by_name = loongarch_cpu_class_by_name;
cc->has_work = loongarch_cpu_has_work;
--
2.25.1
- [PULL 12/36] target/arm: Convert to 3-phase reset, (continued)
- [PULL 12/36] target/arm: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [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 <=
- [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, 2022/12/16
- [PULL 29/36] target/xtensa: Convert to 3-phase reset, Peter Maydell, 2022/12/16