All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Claudio Fontana <cfontana@suse.de>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wenchao Wang <wenchao.wang@intel.com>,
	Roman Bolshakov <r.bolshakov@yadro.com>,
	Sunil Muthuswamy <sunilmut@microsoft.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Paul Durrant <paul@xen.org>, Jason Wang <jasowang@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org, Peter Xu <peterx@redhat.com>,
	Dario Faggioli <dfaggioli@suse.com>,
	Cameron Esfahani <dirty@apple.com>,
	haxm-team@intel.com, Colin Xu <colin.xu@intel.com>,
	Anthony Perard <anthony.perard@citrix.com>,
	Bruce Rogers <brogers@suse.com>, Olaf Hering <ohering@suse.de>,
	"Emilio G . Cota" <cota@braap.org>
Subject: Re: [RFC v7 14/22] cpu: Move cpu_exec_* to tcg_ops
Date: Fri, 4 Dec 2020 18:13:23 +0100	[thread overview]
Message-ID: <872334f0-b83f-3d7e-4d85-9a2b8e32884d@redhat.com> (raw)
In-Reply-To: <20201130023535.16689-15-cfontana@suse.de>

On 11/30/20 3:35 AM, Claudio Fontana wrote:
> From: Eduardo Habkost <ehabkost@redhat.com>
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  accel/tcg/cpu-exec.c            | 12 ++++++------
>  include/hw/core/cpu.h           |  6 ------
>  include/hw/core/tcg-cpu-ops.h   |  9 +++++++++
>  target/alpha/cpu.c              |  3 ++-
>  target/arm/cpu.c                |  2 +-
>  target/arm/cpu64.c              |  2 +-
>  target/arm/cpu_tcg.c            |  2 +-
>  target/avr/cpu.c                |  2 +-
>  target/cris/cpu.c               |  2 +-
>  target/hppa/cpu.c               |  2 +-
>  target/i386/tcg-cpu.c           |  6 +++---
>  target/lm32/cpu.c               |  2 +-
>  target/m68k/cpu.c               |  2 +-
>  target/microblaze/cpu.c         |  2 +-
>  target/mips/cpu.c               |  2 +-
>  target/nios2/cpu.c              |  2 +-
>  target/openrisc/cpu.c           |  2 +-
>  target/ppc/translate_init.c.inc |  6 +++---
>  target/riscv/cpu.c              |  2 +-
>  target/rx/cpu.c                 |  2 +-
>  target/s390x/cpu.c              |  2 +-
>  target/sh4/cpu.c                |  2 +-
>  target/sparc/cpu.c              |  2 +-
>  target/tilegx/cpu.c             |  2 +-
>  target/unicore32/cpu.c          |  2 +-
>  target/xtensa/cpu.c             |  2 +-
>  26 files changed, 43 insertions(+), 39 deletions(-)
> 
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 816ef29f68..07ff1fa4dc 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -240,8 +240,8 @@ static void cpu_exec_enter(CPUState *cpu)
>  {
>      CPUClass *cc = CPU_GET_CLASS(cpu);
>  
> -    if (cc->cpu_exec_enter) {
> -        cc->cpu_exec_enter(cpu);
> +    if (cc->tcg_ops.cpu_exec_enter) {
> +        cc->tcg_ops.cpu_exec_enter(cpu);
>      }
>  }
>  
> @@ -249,8 +249,8 @@ static void cpu_exec_exit(CPUState *cpu)
>  {
>      CPUClass *cc = CPU_GET_CLASS(cpu);
>  
> -    if (cc->cpu_exec_exit) {
> -        cc->cpu_exec_exit(cpu);
> +    if (cc->tcg_ops.cpu_exec_exit) {
> +        cc->tcg_ops.cpu_exec_exit(cpu);
>      }
>  }
>  
> @@ -625,8 +625,8 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
>             True when it is, and we should restart on a new TB,
>             and via longjmp via cpu_loop_exit.  */
>          else {
> -            if (cc->cpu_exec_interrupt &&
> -                cc->cpu_exec_interrupt(cpu, interrupt_request)) {
> +            if (cc->tcg_ops.cpu_exec_interrupt &&
> +                cc->tcg_ops.cpu_exec_interrupt(cpu, interrupt_request)) {
>                  if (need_replay_interrupt(interrupt_request)) {
>                      replay_interrupt();
>                  }
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 19211cb409..538f3e6cd3 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -146,9 +146,6 @@ struct TranslationBlock;
>   * @gdb_get_dynamic_xml: Callback to return dynamically generated XML for the
>   *   gdb stub. Returns a pointer to the XML contents for the specified XML file
>   *   or NULL if the CPU doesn't have a dynamically generated content for it.
> - * @cpu_exec_enter: Callback for cpu_exec preparation.
> - * @cpu_exec_exit: Callback for cpu_exec cleanup.
> - * @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec.
>   * @disas_set_info: Setup architecture specific components of disassembly info
>   * @adjust_watchpoint_address: Perform a target-specific adjustment to an
>   * address before attempting to match it against watchpoints.
> @@ -211,9 +208,6 @@ struct CPUClass {
>      const char *gdb_core_xml_file;
>      gchar * (*gdb_arch_name)(CPUState *cpu);
>      const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
> -    void (*cpu_exec_enter)(CPUState *cpu);
> -    void (*cpu_exec_exit)(CPUState *cpu);
> -    bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
>  
>      void (*disas_set_info)(CPUState *cpu, disassemble_info *info);
>      vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
> diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
> index 109291ac52..e12f32919b 100644
> --- a/include/hw/core/tcg-cpu-ops.h
> +++ b/include/hw/core/tcg-cpu-ops.h
> @@ -10,6 +10,9 @@
>  #ifndef TCG_CPU_OPS_H
>  #define TCG_CPU_OPS_H
>  
> +/**
> + * struct TcgCpuOperations: TCG operations specific to a CPU class
> + */
>  typedef struct TcgCpuOperations {
>      /**
>       * @initialize: Initalize TCG state
> @@ -28,6 +31,12 @@ typedef struct TcgCpuOperations {
>       * @set_pc(tb->pc).
>       */
>      void (*synchronize_from_tb)(CPUState *cpu, struct TranslationBlock *tb);
> +    /** @cpu_exec_enter: Callback for cpu_exec preparation */
> +    void (*cpu_exec_enter)(CPUState *cpu);
> +    /** @cpu_exec_exit: Callback for cpu_exec cleanup */
> +    void (*cpu_exec_exit)(CPUState *cpu);
> +    /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
> +    bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
>  } TcgCpuOperations;
>  
>  #endif /* TCG_CPU_OPS_H */
> diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
> index d66f0351a9..4f206c154d 100644
> --- a/target/alpha/cpu.c
> +++ b/target/alpha/cpu.c
> @@ -218,7 +218,6 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
>      cc->class_by_name = alpha_cpu_class_by_name;
>      cc->has_work = alpha_cpu_has_work;
>      cc->do_interrupt = alpha_cpu_do_interrupt;
> -    cc->cpu_exec_interrupt = alpha_cpu_exec_interrupt;
>      cc->dump_state = alpha_cpu_dump_state;
>      cc->set_pc = alpha_cpu_set_pc;
>      cc->gdb_read_register = alpha_cpu_gdb_read_register;
> @@ -234,6 +233,8 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
>      cc->tcg_ops.initialize = alpha_translate_init;
>  
>      cc->gdb_num_core_regs = 67;
> +
> +    cc->tcg_ops.cpu_exec_interrupt = alpha_cpu_exec_interrupt;

With cc->tcg_ops.* guarded with #ifdef CONFIG_TCG:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



  reply	other threads:[~2020-12-04 20:06 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30  2:35 [RFC v7 00/22] i386 cleanup Claudio Fontana
2020-11-30  2:35 ` [RFC v7 01/22] i386: move kvm accel files into kvm/ Claudio Fontana
2020-11-30  2:35 ` [RFC v7 02/22] i386: move whpx accel files into whpx/ Claudio Fontana
2020-11-30  2:35 ` [RFC v7 03/22] i386: move hax accel files into hax/ Claudio Fontana
2020-11-30  2:35 ` [RFC v7 04/22] i386: hvf: remove stale MAINTAINERS entry for old hvf stubs Claudio Fontana
2020-11-30  2:35 ` [RFC v7 05/22] i386: move TCG accel files into tcg/ Claudio Fontana
2020-11-30  2:35 ` [RFC v7 06/22] i386: move cpu dump out of helper.c into cpu-dump.c Claudio Fontana
2020-11-30  2:35 ` [RFC v7 07/22] i386: move TCG cpu class initialization out of helper.c Claudio Fontana
2020-11-30  2:35 ` [RFC v7 08/22] tcg: cpu_exec_{enter,exit} helpers Claudio Fontana
2020-11-30  2:35 ` [RFC v7 09/22] tcg: make CPUClass.cpu_exec_* optional Claudio Fontana
2020-11-30  2:35 ` [RFC v7 10/22] tcg: Make CPUClass.debug_excp_handler optional Claudio Fontana
2020-11-30  2:35 ` [RFC v7 11/22] cpu: Remove unnecessary noop methods Claudio Fontana
2020-11-30  2:35 ` [RFC v7 12/22] cpu: Introduce TCGCpuOperations struct Claudio Fontana
2020-12-04 17:10   ` Philippe Mathieu-Daudé
2020-12-04 17:28     ` Eduardo Habkost
2020-12-04 18:04       ` Claudio Fontana
2020-12-04 18:07         ` Claudio Fontana
2020-12-04 18:29           ` Eduardo Habkost
2020-12-04 18:02     ` Claudio Fontana
2020-11-30  2:35 ` [RFC v7 13/22] cpu: Move synchronize_from_tb() to tcg_ops Claudio Fontana
2020-12-04 17:12   ` Philippe Mathieu-Daudé
2020-11-30  2:35 ` [RFC v7 14/22] cpu: Move cpu_exec_* " Claudio Fontana
2020-12-04 17:13   ` Philippe Mathieu-Daudé [this message]
2020-11-30  2:35 ` [RFC v7 15/22] cpu: Move tlb_fill " Claudio Fontana
2020-12-04 17:14   ` Philippe Mathieu-Daudé
2020-12-04 17:37     ` Eduardo Habkost
2020-12-04 18:00       ` Philippe Mathieu-Daudé
2020-12-04 18:14         ` Claudio Fontana
2020-12-04 19:27           ` Philippe Mathieu-Daudé
2020-12-05 10:06             ` Claudio Fontana
2020-12-04 18:09       ` Claudio Fontana
2020-11-30  2:35 ` [RFC v7 16/22] cpu: Move debug_excp_handler " Claudio Fontana
2020-11-30  2:35 ` [RFC v7 17/22] accel: extend AccelState and AccelClass to user-mode Claudio Fontana
2020-11-30  2:35 ` [RFC v7 18/22] accel: replace struct CpusAccel with AccelOpsClass Claudio Fontana
2020-11-30  2:35 ` [RFC v7 19/22] accel: introduce AccelCPUClass extending CPUClass Claudio Fontana
2020-11-30  2:35 ` [RFC v7 20/22] i386: split cpu accelerators from cpu.c, using AccelCPUClass Claudio Fontana
2020-11-30  2:35 ` [RFC v7 21/22] cpu-exec: refactor realizefn for all targets Claudio Fontana
2020-11-30  2:35 ` [RFC v7 22/22] cpu: introduce cpu_accel_instance_init Claudio Fontana
2020-12-04 13:54 ` [RFC v7 00/22] i386 cleanup [hw/core/cpu.c common] Claudio Fontana
2020-12-04 13:55   ` Claudio Fontana
2020-12-04 16:07   ` Paolo Bonzini
2020-12-04 17:34     ` Eduardo Habkost
2020-12-04 17:59     ` Claudio Fontana

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=872334f0-b83f-3d7e-4d85-9a2b8e32884d@redhat.com \
    --to=philmd@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=brogers@suse.com \
    --cc=cfontana@suse.de \
    --cc=colin.xu@intel.com \
    --cc=cota@braap.org \
    --cc=dfaggioli@suse.com \
    --cc=dirty@apple.com \
    --cc=ehabkost@redhat.com \
    --cc=haxm-team@intel.com \
    --cc=jasowang@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=ohering@suse.de \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=r.bolshakov@yadro.com \
    --cc=richard.henderson@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=sunilmut@microsoft.com \
    --cc=thuth@redhat.com \
    --cc=wenchao.wang@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.