[Qemu-devel] [PATCH v3 28/39] target/tricore: Use env_cpu

Richard Henderson posted 39 patches 6 years, 9 months ago
Maintainers: Guan Xuetao <gxt@mprc.pku.edu.cn>, Laurent Vivier <laurent@vivier.eu>, Stefan Hajnoczi <stefanha@redhat.com>, Aurelien Jarno <aurelien@aurel32.net>, Chris Wulff <crwulff@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, David Hildenbrand <david@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, Andrzej Zaborowski <balrogg@gmail.com>, Stafford Horne <shorne@gmail.com>, Aleksandar Markovic <amarkovic@wavecomp.com>, Paolo Bonzini <pbonzini@redhat.com>, Aleksandar Rikalo <arikalo@wavecomp.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Sagar Karandikar <sagark@eecs.berkeley.edu>, Michael Walle <michael@walle.cc>, Eduardo Habkost <ehabkost@redhat.com>, Claudio Fontana <claudio.fontana@huawei.com>, Palmer Dabbelt <palmer@sifive.com>, Richard Henderson <rth@twiddle.net>, Artyom Tarasenko <atar4qemu@gmail.com>, Cornelia Huck <cohuck@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Alistair Francis <Alistair.Francis@wdc.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Marek Vasut <marex@denx.de>, Anthony Green <green@moxielogic.com>, Halil Pasic <pasic@linux.ibm.com>, Riku Voipio <riku.voipio@iki.fi>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Max Filippov <jcmvbkbc@gmail.com>
There is a newer version of this series
[Qemu-devel] [PATCH v3 28/39] target/tricore: Use env_cpu
Posted by Richard Henderson 6 years, 9 months ago
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/tricore/cpu.h       | 5 -----
 target/tricore/op_helper.c | 4 ++--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
index 4c997b6d30..fc3328fdf5 100644
--- a/target/tricore/cpu.h
+++ b/target/tricore/cpu.h
@@ -208,11 +208,6 @@ struct TriCoreCPU {
     CPUTriCoreState env;
 };
 
-static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env)
-{
-    return TRICORE_CPU(container_of(env, TriCoreCPU, env));
-}
-
 #define ENV_OFFSET offsetof(TriCoreCPU, env)
 
 hwaddr tricore_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
index ed9dc0c83e..ba2f21a6c3 100644
--- a/target/tricore/op_helper.c
+++ b/target/tricore/op_helper.c
@@ -29,7 +29,7 @@ static void QEMU_NORETURN
 raise_exception_sync_internal(CPUTriCoreState *env, uint32_t class, int tin,
                               uintptr_t pc, uint32_t fcd_pc)
 {
-    CPUState *cs = CPU(tricore_env_get_cpu(env));
+    CPUState *cs = env_cpu(env);
     /* in case we come from a helper-call we need to restore the PC */
     cpu_restore_state(cs, pc, true);
 
@@ -2800,7 +2800,7 @@ static inline void QEMU_NORETURN do_raise_exception_err(CPUTriCoreState *env,
                                                         int error_code,
                                                         uintptr_t pc)
 {
-    CPUState *cs = CPU(tricore_env_get_cpu(env));
+    CPUState *cs = env_cpu(env);
     cs->exception_index = exception;
     env->error_code = error_code;
     /* now we have a real cpu fault */
-- 
2.17.1


Re: [Qemu-devel] [PATCH v3 28/39] target/tricore: Use env_cpu
Posted by Alistair Francis 6 years, 9 months ago
On Tue, May 7, 2019 at 5:31 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/tricore/cpu.h       | 5 -----
>  target/tricore/op_helper.c | 4 ++--
>  2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
> index 4c997b6d30..fc3328fdf5 100644
> --- a/target/tricore/cpu.h
> +++ b/target/tricore/cpu.h
> @@ -208,11 +208,6 @@ struct TriCoreCPU {
>      CPUTriCoreState env;
>  };
>
> -static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env)
> -{
> -    return TRICORE_CPU(container_of(env, TriCoreCPU, env));
> -}
> -
>  #define ENV_OFFSET offsetof(TriCoreCPU, env)
>
>  hwaddr tricore_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
> diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
> index ed9dc0c83e..ba2f21a6c3 100644
> --- a/target/tricore/op_helper.c
> +++ b/target/tricore/op_helper.c
> @@ -29,7 +29,7 @@ static void QEMU_NORETURN
>  raise_exception_sync_internal(CPUTriCoreState *env, uint32_t class, int tin,
>                                uintptr_t pc, uint32_t fcd_pc)
>  {
> -    CPUState *cs = CPU(tricore_env_get_cpu(env));
> +    CPUState *cs = env_cpu(env);
>      /* in case we come from a helper-call we need to restore the PC */
>      cpu_restore_state(cs, pc, true);
>
> @@ -2800,7 +2800,7 @@ static inline void QEMU_NORETURN do_raise_exception_err(CPUTriCoreState *env,
>                                                          int error_code,
>                                                          uintptr_t pc)
>  {
> -    CPUState *cs = CPU(tricore_env_get_cpu(env));
> +    CPUState *cs = env_cpu(env);
>      cs->exception_index = exception;
>      env->error_code = error_code;
>      /* now we have a real cpu fault */
> --
> 2.17.1
>
>