[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/36] target/i386: Convert to 3-phase reset
From: |
Peter Maydell |
Subject: |
[PULL 16/36] target/i386: Convert to 3-phase reset |
Date: |
Fri, 16 Dec 2022 21:42:24 +0000 |
Convert the i386 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-7-peter.maydell@linaro.org
---
target/i386/cpu-qom.h | 4 ++--
target/i386/cpu.c | 12 ++++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/target/i386/cpu-qom.h b/target/i386/cpu-qom.h
index c557a522e1e..2350f4ae609 100644
--- a/target/i386/cpu-qom.h
+++ b/target/i386/cpu-qom.h
@@ -42,7 +42,7 @@ typedef struct X86CPUModel X86CPUModel;
* @migration_safe: See CpuDefinitionInfo::migration_safe
* @static_model: See CpuDefinitionInfo::static
* @parent_realize: The parent class' realize handler.
- * @parent_reset: The parent class' reset handler.
+ * @parent_phases: The parent class' reset phase handlers.
*
* An x86 CPU model or family.
*/
@@ -67,7 +67,7 @@ struct X86CPUClass {
DeviceRealize parent_realize;
DeviceUnrealize parent_unrealize;
- DeviceReset parent_reset;
+ ResettablePhases parent_phases;
};
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index ae502f0bfea..3410e5e4702 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5877,9 +5877,9 @@ static void x86_cpu_set_sgxlepubkeyhash(CPUX86State *env)
#endif
}
-static void x86_cpu_reset(DeviceState *dev)
+static void x86_cpu_reset_hold(Object *obj)
{
- CPUState *s = CPU(dev);
+ CPUState *s = CPU(obj);
X86CPU *cpu = X86_CPU(s);
X86CPUClass *xcc = X86_CPU_GET_CLASS(cpu);
CPUX86State *env = &cpu->env;
@@ -5887,7 +5887,9 @@ static void x86_cpu_reset(DeviceState *dev)
uint64_t xcr0;
int i;
- xcc->parent_reset(dev);
+ if (xcc->parent_phases.hold) {
+ xcc->parent_phases.hold(obj);
+ }
memset(env, 0, offsetof(CPUX86State, end_reset_fields));
@@ -7111,6 +7113,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc,
void *data)
X86CPUClass *xcc = X86_CPU_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
DeviceClass *dc = DEVICE_CLASS(oc);
+ ResettableClass *rc = RESETTABLE_CLASS(oc);
FeatureWord w;
device_class_set_parent_realize(dc, x86_cpu_realizefn,
@@ -7119,7 +7122,8 @@ static void x86_cpu_common_class_init(ObjectClass *oc,
void *data)
&xcc->parent_unrealize);
device_class_set_props(dc, x86_cpu_properties);
- device_class_set_parent_reset(dc, x86_cpu_reset, &xcc->parent_reset);
+ resettable_class_set_parent_phases(rc, NULL, x86_cpu_reset_hold, NULL,
+ &xcc->parent_phases);
cc->reset_dump_flags = CPU_DUMP_FPU | CPU_DUMP_CCOP;
cc->class_by_name = x86_cpu_class_by_name;
--
2.25.1
- [PULL 07/36] hw/input/ps2: Convert TYPE_PS2_DEVICE to 3-phase reset, (continued)
- [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, 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 <=
- [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, 2022/12/16