[PATCH v2 09/24] accel/tcg: Remove CPUState.icount_decr_ptr

Richard Henderson posted 24 patches 2 years, 4 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Riku Voipio <riku.voipio@iki.fi>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Eduardo Habkost <eduardo@habkost.net>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Yanan Wang <wangyanan55@huawei.com>, Laurent Vivier <laurent@vivier.eu>, "Dr. David Alan Gilbert" <dave@treblig.org>, "Daniel P. Berrangé" <berrange@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Brian Cain <bcain@quicinc.com>, Alessandro Di Federico <ale@rev.ng>, Anton Johansson <anjo@rev.ng>, Song Gao <gaosong@loongson.cn>, Xiaojuan Yang <yangxiaojuan@loongson.cn>, 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>, Nicholas Piggin <npiggin@gmail.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liweiwei@iscas.ac.cn>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Christoph Muellner <christoph.muellner@vrull.eu>, Yoshinori Sato <ysato@users.sourceforge.jp>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, 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>
[PATCH v2 09/24] accel/tcg: Remove CPUState.icount_decr_ptr
Posted by Richard Henderson 2 years, 4 months ago
We can now access icount_decr directly.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/exec/cpu-all.h | 1 -
 include/hw/core/cpu.h  | 2 --
 hw/core/cpu-common.c   | 4 ++--
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index c3c78ed8ab..3b01e4ee25 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -434,7 +434,6 @@ void tcg_exec_unrealizefn(CPUState *cpu);
 static inline void cpu_set_cpustate_pointers(ArchCPU *cpu)
 {
     cpu->parent_obj.env_ptr = &cpu->env;
-    cpu->parent_obj.icount_decr_ptr = &cpu->parent_obj.neg.icount_decr;
 }
 
 /* Validate correct placement of CPUArchState. */
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 1f289136ec..44955af3bc 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -440,7 +440,6 @@ struct qemu_work_item;
  * @as: Pointer to the first AddressSpace, for the convenience of targets which
  *      only have a single AddressSpace
  * @env_ptr: Pointer to subclass-specific CPUArchState field.
- * @icount_decr_ptr: Pointer to IcountDecr field within subclass.
  * @gdb_regs: Additional GDB registers.
  * @gdb_num_regs: Number of total registers accessible to GDB.
  * @gdb_num_g_regs: Number of registers in GDB 'g' packets.
@@ -512,7 +511,6 @@ struct CPUState {
     MemoryRegion *memory;
 
     CPUArchState *env_ptr;
-    IcountDecr *icount_decr_ptr;
 
     CPUJumpCache *tb_jmp_cache;
 
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index ced66c2b34..08d5bbc873 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -86,7 +86,7 @@ void cpu_exit(CPUState *cpu)
     qatomic_set(&cpu->exit_request, 1);
     /* Ensure cpu_exec will see the exit request after TCG has exited.  */
     smp_wmb();
-    qatomic_set(&cpu->icount_decr_ptr->u16.high, -1);
+    qatomic_set(&cpu->neg.icount_decr.u16.high, -1);
 }
 
 static int cpu_common_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
@@ -130,7 +130,7 @@ static void cpu_common_reset_hold(Object *obj)
     cpu->halted = cpu->start_powered_off;
     cpu->mem_io_pc = 0;
     cpu->icount_extra = 0;
-    qatomic_set(&cpu->icount_decr_ptr->u32, 0);
+    qatomic_set(&cpu->neg.icount_decr.u32, 0);
     cpu->can_do_io = 1;
     cpu->exception_index = -1;
     cpu->crash_occurred = false;
-- 
2.34.1
Re: [PATCH v2 09/24] accel/tcg: Remove CPUState.icount_decr_ptr
Posted by Anton Johansson via 2 years, 4 months ago
On 9/14/23 04:44, Richard Henderson wrote:
> We can now access icount_decr directly.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   include/exec/cpu-all.h | 1 -
>   include/hw/core/cpu.h  | 2 --
>   hw/core/cpu-common.c   | 4 ++--
>   3 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> index c3c78ed8ab..3b01e4ee25 100644
> --- a/include/exec/cpu-all.h
> +++ b/include/exec/cpu-all.h
> @@ -434,7 +434,6 @@ void tcg_exec_unrealizefn(CPUState *cpu);
>   static inline void cpu_set_cpustate_pointers(ArchCPU *cpu)
>   {
>       cpu->parent_obj.env_ptr = &cpu->env;
> -    cpu->parent_obj.icount_decr_ptr = &cpu->parent_obj.neg.icount_decr;
>   }
>   
>   /* Validate correct placement of CPUArchState. */
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 1f289136ec..44955af3bc 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -440,7 +440,6 @@ struct qemu_work_item;
>    * @as: Pointer to the first AddressSpace, for the convenience of targets which
>    *      only have a single AddressSpace
>    * @env_ptr: Pointer to subclass-specific CPUArchState field.
> - * @icount_decr_ptr: Pointer to IcountDecr field within subclass.
>    * @gdb_regs: Additional GDB registers.
>    * @gdb_num_regs: Number of total registers accessible to GDB.
>    * @gdb_num_g_regs: Number of registers in GDB 'g' packets.
> @@ -512,7 +511,6 @@ struct CPUState {
>       MemoryRegion *memory;
>   
>       CPUArchState *env_ptr;
> -    IcountDecr *icount_decr_ptr;
>   
>       CPUJumpCache *tb_jmp_cache;
>   
> diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
> index ced66c2b34..08d5bbc873 100644
> --- a/hw/core/cpu-common.c
> +++ b/hw/core/cpu-common.c
> @@ -86,7 +86,7 @@ void cpu_exit(CPUState *cpu)
>       qatomic_set(&cpu->exit_request, 1);
>       /* Ensure cpu_exec will see the exit request after TCG has exited.  */
>       smp_wmb();
> -    qatomic_set(&cpu->icount_decr_ptr->u16.high, -1);
> +    qatomic_set(&cpu->neg.icount_decr.u16.high, -1);
>   }
>   
>   static int cpu_common_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
> @@ -130,7 +130,7 @@ static void cpu_common_reset_hold(Object *obj)
>       cpu->halted = cpu->start_powered_off;
>       cpu->mem_io_pc = 0;
>       cpu->icount_extra = 0;
> -    qatomic_set(&cpu->icount_decr_ptr->u32, 0);
> +    qatomic_set(&cpu->neg.icount_decr.u32, 0);
>       cpu->can_do_io = 1;
>       cpu->exception_index = -1;
>       cpu->crash_occurred = false;
Reviewed-by: Anton Johansson <anjo@rev.ng>