On Thu, 8 Jan 2026 at 14:34, Alex Bennée <[email protected]> wrote: > > Implement a proper cpu reset handler for tricore cpus. > > Signed-off-by: Alex Bennée <[email protected]> > --- > target/tricore/cpu.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c > index 04319e107ba..c3dda9f6a54 100644 > --- a/target/tricore/cpu.c > +++ b/target/tricore/cpu.c > @@ -24,6 +24,7 @@ > #include "qemu/error-report.h" > #include "tcg/debug-assert.h" > #include "accel/tcg/cpu-ops.h" > +#include "system/reset.h" > > static inline void set_feature(CPUTriCoreState *env, int feature) > { > @@ -81,6 +82,12 @@ static void tricore_cpu_reset_hold(Object *obj, ResetType > type) > cpu_state_reset(cpu_env(cs)); > } > > +static void tricore_cpu_reset(void *opaque) > +{ > + CPUState *cs = opaque; > + cpu_reset(cs); > +} > + > static bool tricore_cpu_has_work(CPUState *cs) > { > return true; > @@ -120,8 +127,8 @@ static void tricore_cpu_realizefn(DeviceState *dev, Error > **errp) > if (tricore_has_feature(env, TRICORE_FEATURE_131)) { > set_feature(env, TRICORE_FEATURE_13); > } > - cpu_reset(cs); > qemu_init_vcpu(cs); > + qemu_register_reset(tricore_cpu_reset, cs);
We currently call qemu_register_reset() inside the CPU's own realize function only for i386 and s390; for all other architectures we require the board code somehow to arrange to reset the CPU objects. We should figure out what the "right" way is we want to handle this and be consistent... Calling qemu_register_reset() with a function that calls cpu_reset() is not ideal, because it means that inside of a three-phase reset process we end up running all 3 phases of the CPU object's reset inside the 'hold' phase of the full process. What we want is for the CPU object's reset phases to be called as part of each phase of the full reset process. qemu_register_resettable() takes an object that implements Resettable, and is probably a better idea. -- PMM
