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 13/22] cpu: Move synchronize_from_tb() to tcg_ops
Date: Fri, 4 Dec 2020 18:12:03 +0100	[thread overview]
Message-ID: <87d91771-bdee-eece-5dcd-1649ba2be234@redhat.com> (raw)
In-Reply-To: <20201130023535.16689-14-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          |  4 ++--
>  include/hw/core/cpu.h         |  8 --------
>  include/hw/core/tcg-cpu-ops.h | 14 +++++++++++---
>  target/arm/cpu.c              |  2 +-
>  target/avr/cpu.c              |  2 +-
>  target/hppa/cpu.c             |  2 +-
>  target/i386/tcg-cpu.c         |  2 +-
>  target/microblaze/cpu.c       |  2 +-
>  target/mips/cpu.c             |  2 +-
>  target/riscv/cpu.c            |  2 +-
>  target/rx/cpu.c               |  2 +-
>  target/sh4/cpu.c              |  2 +-
>  target/sparc/cpu.c            |  2 +-
>  target/tricore/cpu.c          |  2 +-
>  14 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 64cba89356..816ef29f68 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -192,8 +192,8 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
>                                 TARGET_FMT_lx "] %s\n",
>                                 last_tb->tc.ptr, last_tb->pc,
>                                 lookup_symbol(last_tb->pc));
> -        if (cc->synchronize_from_tb) {
> -            cc->synchronize_from_tb(cpu, last_tb);
> +        if (cc->tcg_ops.synchronize_from_tb) {
> +            cc->tcg_ops.synchronize_from_tb(cpu, last_tb);
>          } else {
>              assert(cc->set_pc);
>              cc->set_pc(cpu, last_tb->pc);
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index c93b08a0fb..19211cb409 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -110,13 +110,6 @@ struct TranslationBlock;
>   *       If the target behaviour here is anything other than "set
>   *       the PC register to the value passed in" then the target must
>   *       also implement the synchronize_from_tb hook.
> - * @synchronize_from_tb: Callback for synchronizing state from a TCG
> - *       #TranslationBlock. This is called when we abandon execution
> - *       of a TB before starting it, and must set all parts of the CPU
> - *       state which the previous TB in the chain may not have updated.
> - *       This always includes at least the program counter; some targets
> - *       will need to do more. If this hook is not implemented then the
> - *       default is to call @set_pc(tb->pc).
>   * @tlb_fill: Callback for handling a softmmu tlb miss or user-only
>   *       address fault.  For system mode, if the access is valid, call
>   *       tlb_set_page and return true; if the access is invalid, and
> @@ -193,7 +186,6 @@ struct CPUClass {
>      void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
>                                 Error **errp);
>      void (*set_pc)(CPUState *cpu, vaddr value);
> -    void (*synchronize_from_tb)(CPUState *cpu, struct TranslationBlock *tb);
>      bool (*tlb_fill)(CPUState *cpu, vaddr address, int size,
>                       MMUAccessType access_type, int mmu_idx,
>                       bool probe, uintptr_t retaddr);
> diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
> index 4475ef0996..109291ac52 100644
> --- a/include/hw/core/tcg-cpu-ops.h
> +++ b/include/hw/core/tcg-cpu-ops.h
> @@ -10,9 +10,6 @@
>  #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
> @@ -20,6 +17,17 @@ typedef struct TcgCpuOperations {
>       * Called when the first CPU is realized.
>       */
>      void (*initialize)(void);
> +    /**
> +     * @synchronize_from_tb: Synchronize state from a TCG #TranslationBlock
> +     *
> +     * This is called when we abandon execution of a TB before
> +     * starting it, and must set all parts of the CPU state which
> +     * the previous TB in the chain may not have updated. This
> +     * will need to do more. If this hook is not implemented then
> +     * the default is to call
> +     * @set_pc(tb->pc).
> +     */
> +    void (*synchronize_from_tb)(CPUState *cpu, struct TranslationBlock *tb);
>  } TcgCpuOperations;
>  
>  #endif /* TCG_CPU_OPS_H */
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 1fa9382a7c..e29601d7db 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -2242,7 +2242,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
>      cc->cpu_exec_interrupt = arm_cpu_exec_interrupt;
>      cc->dump_state = arm_cpu_dump_state;
>      cc->set_pc = arm_cpu_set_pc;
> -    cc->synchronize_from_tb = arm_cpu_synchronize_from_tb;
> +    cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb;

Similar comment than previous patch, please keep cc->tcg_ops.*
guarded withing #ifdef CONFIG_TCG.

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



  reply	other threads:[~2020-12-04 19:59 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é [this message]
2020-11-30  2:35 ` [RFC v7 14/22] cpu: Move cpu_exec_* " Claudio Fontana
2020-12-04 17:13   ` Philippe Mathieu-Daudé
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=87d91771-bdee-eece-5dcd-1649ba2be234@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.