qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Greg Kurz <groug@kaod.org>, Eduardo Habkost <ehabkost@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	David Hildenbrand <david@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	qemu-devel@nongnu.org,
	Alistair Francis <alistair.francis@wdc.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH v3 1/2] cpu: Introduce cpu_class_set_parent_reset()
Date: Mon, 16 Dec 2019 16:35:36 +0100	[thread overview]
Message-ID: <ab343508-179d-5bb8-b7f5-1ba7272175ea@redhat.com> (raw)
In-Reply-To: <157650847239.354886.2782881118916307978.stgit@bahia.lan>

On 12/16/19 4:01 PM, Greg Kurz wrote:
> Similarly to what we already do with qdev, use a helper to overload the
> reset QOM methods of the parent in children classes, for clarity.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> Acked-by: David Hildenbrand <david@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   hw/core/cpu.c         |    8 ++++++++
>   include/hw/core/cpu.h |    4 ++++
>   2 files changed, 12 insertions(+)
> 
> diff --git a/hw/core/cpu.c b/hw/core/cpu.c
> index db1a03c6bbb3..fde5fd395b10 100644
> --- a/hw/core/cpu.c
> +++ b/hw/core/cpu.c
> @@ -239,6 +239,14 @@ void cpu_dump_statistics(CPUState *cpu, int flags)
>       }
>   }
>   
> +void cpu_class_set_parent_reset(CPUClass *cc,
> +                                void (*child_reset)(CPUState *cpu),
> +                                void (**parent_reset)(CPUState *cpu))
> +{
> +    *parent_reset = cc->reset;
> +    cc->reset = child_reset;
> +}
> +
>   void cpu_reset(CPUState *cpu)
>   {
>       CPUClass *klass = CPU_GET_CLASS(cpu);
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 77c6f0529903..73e9a869a41c 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -1135,6 +1135,10 @@ void cpu_exec_unrealizefn(CPUState *cpu);
>    */
>   bool target_words_bigendian(void);
>   
> +void cpu_class_set_parent_reset(CPUClass *cc,
> +                                void (*child_reset)(CPUState *cpu),
> +                                void (**parent_reset)(CPUState *cpu));
> +
>   #ifdef NEED_CPU_H
>   
>   #ifdef CONFIG_SOFTMMU
> 



  reply	other threads:[~2019-12-16 15:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 15:01 [PATCH v3 0/2] cpu: Clarify overloading of reset QOM methods Greg Kurz
2019-12-16 15:01 ` [PATCH v3 1/2] cpu: Introduce cpu_class_set_parent_reset() Greg Kurz
2019-12-16 15:35   ` Philippe Mathieu-Daudé [this message]
2019-12-16 15:01 ` [PATCH v3 2/2] cpu: Use cpu_class_set_parent_reset() Greg Kurz
2020-01-18 19:22 ` [PATCH v3 0/2] cpu: Clarify overloading of reset QOM methods Paolo Bonzini

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=ab343508-179d-5bb8-b7f5-1ba7272175ea@redhat.com \
    --to=philmd@redhat.com \
    --cc=alistair.francis@wdc.com \
    --cc=cohuck@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=groug@kaod.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).