qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	qemu-arm@nongnu.org, "Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH 1/4] target/arm: Make cpu_register() and set_feature() available for other files
Date: Mon, 23 Sep 2019 16:28:42 +0200	[thread overview]
Message-ID: <9457e42b-8550-561a-d2d0-7dce076af200@redhat.com> (raw)
In-Reply-To: <20190921150420.30743-2-thuth@redhat.com>

Hi Thomas,

On 9/21/19 5:04 PM, Thomas Huth wrote:
> Move the common set_feature() and unset_feature() functions from cpu.c and
> cpu64.c to internals.h, and make cpu_register() (renamed to arm_cpu_register())
> available from there, too, so we can register CPUs also from other files
> in the future.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Thanks

Eric
> ---
>  target/arm/cpu.c       | 20 ++------------------
>  target/arm/cpu64.c     | 17 +----------------
>  target/arm/internals.h | 18 ++++++++++++++++++
>  3 files changed, 21 insertions(+), 34 deletions(-)
> 
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 2399c14471..f1f9eecdc8 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -614,16 +614,6 @@ static bool arm_cpu_virtio_is_big_endian(CPUState *cs)
>  
>  #endif
>  
> -static inline void set_feature(CPUARMState *env, int feature)
> -{
> -    env->features |= 1ULL << feature;
> -}
> -
> -static inline void unset_feature(CPUARMState *env, int feature)
> -{
> -    env->features &= ~(1ULL << feature);
> -}
> -
>  static int
>  print_insn_thumb1(bfd_vma pc, disassemble_info *info)
>  {
> @@ -2515,12 +2505,6 @@ static void arm_max_initfn(Object *obj)
>  
>  #endif /* !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) */
>  
> -struct ARMCPUInfo {
> -    const char *name;
> -    void (*initfn)(Object *obj);
> -    void (*class_init)(ObjectClass *oc, void *data);
> -};
> -
>  static const ARMCPUInfo arm_cpus[] = {
>  #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
>      { .name = "arm926",      .initfn = arm926_initfn },
> @@ -2681,7 +2665,7 @@ static void cpu_register_class_init(ObjectClass *oc, void *data)
>      acc->info = data;
>  }
>  
> -static void cpu_register(const ARMCPUInfo *info)
> +void arm_cpu_register(const ARMCPUInfo *info)
>  {
>      TypeInfo type_info = {
>          .parent = TYPE_ARM_CPU,
> @@ -2722,7 +2706,7 @@ static void arm_cpu_register_types(void)
>      type_register_static(&idau_interface_type_info);
>  
>      while (info->name) {
> -        cpu_register(info);
> +        arm_cpu_register(info);
>          info++;
>      }
>  
> diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
> index d7f5bf610a..5239ba5529 100644
> --- a/target/arm/cpu64.c
> +++ b/target/arm/cpu64.c
> @@ -21,6 +21,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "cpu.h"
> +#include "internals.h"
>  #include "qemu/module.h"
>  #if !defined(CONFIG_USER_ONLY)
>  #include "hw/loader.h"
> @@ -29,16 +30,6 @@
>  #include "kvm_arm.h"
>  #include "qapi/visitor.h"
>  
> -static inline void set_feature(CPUARMState *env, int feature)
> -{
> -    env->features |= 1ULL << feature;
> -}
> -
> -static inline void unset_feature(CPUARMState *env, int feature)
> -{
> -    env->features &= ~(1ULL << feature);
> -}
> -
>  #ifndef CONFIG_USER_ONLY
>  static uint64_t a57_a53_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
>  {
> @@ -396,12 +387,6 @@ static void aarch64_max_initfn(Object *obj)
>      }
>  }
>  
> -struct ARMCPUInfo {
> -    const char *name;
> -    void (*initfn)(Object *obj);
> -    void (*class_init)(ObjectClass *oc, void *data);
> -};
> -
>  static const ARMCPUInfo aarch64_cpus[] = {
>      { .name = "cortex-a57",         .initfn = aarch64_a57_initfn },
>      { .name = "cortex-a53",         .initfn = aarch64_a53_initfn },
> diff --git a/target/arm/internals.h b/target/arm/internals.h
> index 232d963875..e71196ed5f 100644
> --- a/target/arm/internals.h
> +++ b/target/arm/internals.h
> @@ -1046,4 +1046,22 @@ void arm_log_exception(int idx);
>  
>  #endif /* !CONFIG_USER_ONLY */
>  
> +static inline void set_feature(CPUARMState *env, int feature)
> +{
> +    env->features |= 1ULL << feature;
> +}
> +
> +static inline void unset_feature(CPUARMState *env, int feature)
> +{
> +    env->features &= ~(1ULL << feature);
> +}
> +
> +struct ARMCPUInfo {
> +    const char *name;
> +    void (*initfn)(Object *obj);
> +    void (*class_init)(ObjectClass *oc, void *data);
> +};
> +
> +void arm_cpu_register(const ARMCPUInfo *info);
> +
>  #endif
> 


  reply	other threads:[~2019-09-23 14:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-21 15:04 [PATCH 0/4] Make it possible to compile with CONFIG_ARM_V7M=n Thomas Huth
2019-09-21 15:04 ` [PATCH 1/4] target/arm: Make cpu_register() and set_feature() available for other files Thomas Huth
2019-09-23 14:28   ` Auger Eric [this message]
2019-09-21 15:04 ` [PATCH 2/4] target/arm: Move cortex-m related functions to new file v7m.c Thomas Huth
2019-09-23 14:31   ` Auger Eric
2019-09-23 18:09     ` Thomas Huth
2019-09-23 18:45       ` Peter Maydell
2019-09-23 18:51         ` Thomas Huth
2019-09-23 18:54           ` Peter Maydell
2019-09-24 11:02       ` Auger Eric
2019-09-24 11:06         ` Thomas Huth
2019-09-24 11:24           ` Auger Eric
2019-09-23 14:34   ` Peter Maydell
2019-09-24  9:52     ` Philippe Mathieu-Daudé
2019-09-21 15:04 ` [PATCH 3/4] hw/arm: Move armv7m_nvic.c to hw/arm/ and always enable it for arm builds Thomas Huth
2019-09-23 14:52   ` Peter Maydell
2019-09-23 17:54     ` Thomas Huth
2019-09-23 18:27       ` Peter Maydell
2019-09-23 18:36         ` Thomas Huth
2019-09-23 18:50           ` Peter Maydell
2019-09-24  4:44             ` Thomas Huth
2019-09-24  9:42               ` Peter Maydell
2019-09-24  9:48                 ` Thomas Huth
2019-09-24 10:01                   ` Philippe Mathieu-Daudé
2019-09-21 15:04 ` [PATCH 4/4] default-configs: Do not enforce CONFIG_ARM_V7M anymore Thomas Huth
2019-09-23  8:37 ` [PATCH 0/4] Make it possible to compile with CONFIG_ARM_V7M=n Philippe Mathieu-Daudé
2019-09-23  8:50   ` Thomas Huth
2019-09-23  8:58     ` Philippe Mathieu-Daudé

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=9457e42b-8550-561a-d2d0-7dce076af200@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).