qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, "Michael Rolnik" <mrolnik@gmail.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Taylor Simpson" <tsimpson@quicinc.com>,
	"Song Gao" <gaosong@loongson.cn>,
	"Xiaojuan Yang" <yangxiaojuan@loongson.cn>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Chris Wulff" <crwulff@gmail.com>, "Marek Vasut" <marex@denx.de>,
	"Stafford Horne" <shorne@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Bin Meng" <bin.meng@windriver.com>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org
Subject: Re: [PATCH for-8.0 13/19] target/ppc: Convert to 3-phase reset
Date: Thu, 24 Nov 2022 16:18:30 +0100	[thread overview]
Message-ID: <20221124161830.3411f177@bahia> (raw)
In-Reply-To: <20221124115023.2437291-14-peter.maydell@linaro.org>

On Thu, 24 Nov 2022 11:50:16 +0000
Peter Maydell <peter.maydell@linaro.org> wrote:

> Convert the ppc 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: Greg Kurz <groug@kaod.org>

>  target/ppc/cpu-qom.h  |  4 ++--
>  target/ppc/cpu_init.c | 12 ++++++++----
>  2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
> index 89ff88f28c9..0fbd8b72468 100644
> --- a/target/ppc/cpu-qom.h
> +++ b/target/ppc/cpu-qom.h
> @@ -143,7 +143,7 @@ typedef struct PPCHash64Options PPCHash64Options;
>  /**
>   * PowerPCCPUClass:
>   * @parent_realize: The parent class' realize handler.
> - * @parent_reset: The parent class' reset handler.
> + * @parent_phases: The parent class' reset phase handlers.
>   *
>   * A PowerPC CPU model.
>   */
> @@ -154,7 +154,7 @@ struct PowerPCCPUClass {
>  
>      DeviceRealize parent_realize;
>      DeviceUnrealize parent_unrealize;
> -    DeviceReset parent_reset;
> +    ResettablePhases parent_phases;
>      void (*parent_parse_features)(const char *type, char *str, Error **errp);
>  
>      uint32_t pvr;
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index cbf00813743..95d25856a0e 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -7031,16 +7031,18 @@ static bool ppc_cpu_has_work(CPUState *cs)
>      return cs->interrupt_request & CPU_INTERRUPT_HARD;
>  }
>  
> -static void ppc_cpu_reset(DeviceState *dev)
> +static void ppc_cpu_reset_hold(Object *obj)
>  {
> -    CPUState *s = CPU(dev);
> +    CPUState *s = CPU(obj);
>      PowerPCCPU *cpu = POWERPC_CPU(s);
>      PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
>      CPUPPCState *env = &cpu->env;
>      target_ulong msr;
>      int i;
>  
> -    pcc->parent_reset(dev);
> +    if (pcc->parent_phases.hold) {
> +        pcc->parent_phases.hold(obj);
> +    }
>  
>      msr = (target_ulong)0;
>      msr |= (target_ulong)MSR_HVB;
> @@ -7267,6 +7269,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>      PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
>      CPUClass *cc = CPU_CLASS(oc);
>      DeviceClass *dc = DEVICE_CLASS(oc);
> +    ResettableClass *rc = RESETTABLE_CLASS(oc);
>  
>      device_class_set_parent_realize(dc, ppc_cpu_realize,
>                                      &pcc->parent_realize);
> @@ -7275,7 +7278,8 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>      pcc->pvr_match = ppc_pvr_match_default;
>      device_class_set_props(dc, ppc_cpu_properties);
>  
> -    device_class_set_parent_reset(dc, ppc_cpu_reset, &pcc->parent_reset);
> +    resettable_class_set_parent_phases(rc, NULL, ppc_cpu_reset_hold, NULL,
> +                                       &pcc->parent_phases);
>  
>      cc->class_by_name = ppc_cpu_class_by_name;
>      cc->has_work = ppc_cpu_has_work;



  parent reply	other threads:[~2022-11-24 15:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 11:50 [PATCH for-8.0 00/19] Convert most CPU classes to 3-phase reset Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 01/19] hw/core/cpu-common: Convert TYPE_CPU class " Peter Maydell
2022-11-27 22:30   ` Alistair Francis
2022-11-24 11:50 ` [PATCH for-8.0 02/19] target/arm: Convert " Peter Maydell
2022-11-24 15:15   ` Cédric Le Goater
2022-11-27 22:28   ` Alistair Francis
2022-11-24 11:50 ` [PATCH for-8.0 03/19] target/avr: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 04/19] target/cris: " Peter Maydell
2022-11-24 14:44   ` Edgar E. Iglesias
2022-11-24 11:50 ` [PATCH for-8.0 05/19] target/hexagon: " Peter Maydell
2022-11-30  4:38   ` Taylor Simpson
2022-11-24 11:50 ` [PATCH for-8.0 06/19] target/i386: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 07/19] target/loongarch: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 08/19] target/m68k: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 09/19] target/microblaze: " Peter Maydell
2022-11-24 14:44   ` Edgar E. Iglesias
2022-11-24 11:50 ` [PATCH for-8.0 10/19] target/mips: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 11/19] target/nios2: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 12/19] target/openrisc: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 13/19] target/ppc: " Peter Maydell
2022-11-24 15:15   ` Cédric Le Goater
2022-11-24 15:18   ` Greg Kurz [this message]
2022-11-24 11:50 ` [PATCH for-8.0 14/19] target/riscv: " Peter Maydell
2022-11-27 22:29   ` Alistair Francis
2022-11-24 11:50 ` [PATCH for-8.0 15/19] target/rx: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 16/19] target/sh4: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 17/19] target/sparc: " Peter Maydell
2022-11-30  9:23   ` Mark Cave-Ayland
2022-11-24 11:50 ` [PATCH for-8.0 18/19] target/tricore: " Peter Maydell
2022-11-24 11:50 ` [PATCH for-8.0 19/19] target/xtensa: " Peter Maydell
2022-11-24 13:46 ` [PATCH for-8.0 00/19] Convert most CPU classes " Philippe Mathieu-Daudé
2022-11-30 10:51   ` Philippe Mathieu-Daudé
2022-11-30 12:38     ` Peter Maydell
2022-11-30 13:22       ` Philippe Mathieu-Daudé
2022-11-26 15:50 ` Richard Henderson
2022-12-16 16:02 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221124161830.3411f177@bahia \
    --to=groug@kaod.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=alistair.francis@wdc.com \
    --cc=atar4qemu@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=bin.meng@windriver.com \
    --cc=clg@kaod.org \
    --cc=crwulff@gmail.com \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=edgar.iglesias@gmail.com \
    --cc=gaosong@loongson.cn \
    --cc=jcmvbkbc@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=laurent@vivier.eu \
    --cc=marex@denx.de \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mrolnik@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=shorne@gmail.com \
    --cc=tsimpson@quicinc.com \
    --cc=yangxiaojuan@loongson.cn \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).