[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v7 13/22] cpu: Move synchronize_from_tb() to tcg_ops
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [RFC v7 13/22] cpu: Move synchronize_from_tb() to tcg_ops |
Date: |
Fri, 4 Dec 2020 18:12:03 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
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>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [RFC v7 13/22] cpu: Move synchronize_from_tb() to tcg_ops,
Philippe Mathieu-Daudé <=