qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: "Benoît Canet" <benoit.canet@gmail.com>, peter.maydell@linaro.org
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.
Date: Wed, 09 Nov 2011 16:34:37 +0100	[thread overview]
Message-ID: <4EBA9D8D.907@suse.de> (raw)
In-Reply-To: <1320850979-6620-2-git-send-email-benoit.canet@gmail.com>

Am 09.11.2011 16:02, schrieb Benoît Canet:
> The cpu capabilities passed by the elf loader in AT_HWCAP where

were

> a constant.
> Make AT_HWCAP reflect the emulated cpu features in order to give
> correct clues to eglibc.
> 
> Fix :  [Bug 887516] [NEW] VFP support reported for the PXA270
> 
> Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
> ---
>  linux-user/elfload.c |   43 +++++++++++++++++++++++++++++++++++++++----
>  1 files changed, 39 insertions(+), 4 deletions(-)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index a413976..73c939b 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -330,6 +330,10 @@ enum
>      ARM_HWCAP_ARM_NEON      = 1 << 11,
>      ARM_HWCAP_ARM_VFPv3     = 1 << 12,
>      ARM_HWCAP_ARM_VFPv3D16  = 1 << 13,
> +    ARM_HWCAP_ARM_TLS       = 1 << 14,
> +    ARM_HWCAP_ARM_VFPv4     = 1 << 15,
> +    ARM_HWCAP_ARM_IDIVA     = 1 << 16,
> +    ARM_HWCAP_ARM_IDIVT     = 1 << 17,
>  };
>  
>  #define TARGET_HAS_GUEST_VALIDATE_BASE
> @@ -375,10 +379,41 @@ bool guest_validate_base(unsigned long guest_base)
>      return 1; /* All good */
>  }
>  
> -#define ELF_HWCAP (ARM_HWCAP_ARM_SWP | ARM_HWCAP_ARM_HALF               \
> -                   | ARM_HWCAP_ARM_THUMB | ARM_HWCAP_ARM_FAST_MULT      \
> -                   | ARM_HWCAP_ARM_FPA | ARM_HWCAP_ARM_VFP              \
> -                   | ARM_HWCAP_ARM_NEON | ARM_HWCAP_ARM_VFPv3 )
> +
> +#define ELF_HWCAP get_elf_hwcap()
> +
> +static uint32_t get_elf_hwcap(void)
> +{
> +    CPUState *e = thread_env;
> +    uint32_t hwcaps = 0;
> +
> +    hwcaps |= ARM_HWCAP_ARM_SWP;
> +    hwcaps |= ARM_HWCAP_ARM_HALF;
> +    hwcaps |= ARM_HWCAP_ARM_THUMB;
> +    hwcaps |= ARM_HWCAP_ARM_FAST_MULT;
> +
> +    /* probe for the extra features */
> +#define SET_HWCAP(feat, hwcap) \
> +    do {if (arm_feature(e, feat)) { hwcaps |= hwcap; } } while (0)

Small nit: I notice there's a space missing after do {.
I wonder if Coding Style applies to macros, too. In that case this
should be five lines.

> +    SET_HWCAP(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP);
> +    SET_HWCAP(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT);
> +    SET_HWCAP(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE);
> +    SET_HWCAP(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON);
> +    SET_HWCAP(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3);
> +
> +    /* Strictly should be ARM_FEATURE_V5TE but we don't distinguish
> +     * as all our v5 cores are v5TE at the moment
> +     */
> +    SET_HWCAP(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP);

Peter, usually I'd rather have these things fixed for real before they
get forgotten, but I take it this one's for 1.0 and a V5TE feature and
V5TE => V5 inference rule would better be saved for 1.1? (I had a series
adding inference for V7 => V6 etc. removing duplicated code, not sure if
I submitted that yet...?)

Andreas

> +    SET_HWCAP(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS);
> +    SET_HWCAP(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4);
> +    SET_HWCAP(ARM_FEATURE_ARM_DIV, ARM_HWCAP_ARM_IDIVA);
> +    SET_HWCAP(ARM_FEATURE_THUMB_DIV, ARM_HWCAP_ARM_IDIVT);
> +#undef SET_HWCAP
> +
> +    return hwcaps;
> +}
>  
>  #endif
>  


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2011-11-09 15:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09 15:02 [Qemu-devel] [PATCH V4] Fix : [Bug 887516] [NEW] VFP support reported for the PXA270 Benoît Canet
2011-11-09 15:02 ` [Qemu-devel] [PATCH 1/2] arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features Benoît Canet
2011-11-09 15:34   ` Andreas Färber [this message]
2011-11-09 15:48     ` Peter Maydell
2011-11-09 15:02 ` [Qemu-devel] [PATCH 2/2] target-arm: remind to keep arm features in sync with linux-user/elfload.c Benoît Canet
  -- strict thread matches above, loose matches on Subject: below --
2011-11-09 17:32 [Qemu-devel] [PATCH V7] Fix : [Bug 887516] [NEW] VFP support reported for the PXA270 Benoît Canet
2011-11-09 17:32 ` [Qemu-devel] [PATCH 1/2] arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features Benoît Canet
2012-03-27 13:32   ` Benoît Canet
2011-11-09 17:03 [Qemu-devel] [PATCH V6] Fix : [Bug 887516] [NEW] VFP support reported for the PXA270 Benoît Canet
2011-11-09 17:03 ` [Qemu-devel] [PATCH 1/2] arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features Benoît Canet
2011-11-09 17:07   ` Andreas Färber
2011-11-09 17:25   ` Peter Maydell
2011-11-09 15:46 [Qemu-devel] [PATCH V5] Fix : [Bug 887516] [NEW] VFP support reported for the PXA270 Benoît Canet
2011-11-09 15:46 ` [Qemu-devel] [PATCH 1/2] arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features Benoît Canet
2011-11-09 14:41 [Qemu-devel] [PATCH V3] Fix : [Bug 887516] [NEW] VFP support reported for the PXA270 Benoît Canet
2011-11-09 14:41 ` [Qemu-devel] [PATCH 1/2] arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features Benoît Canet
2011-11-09 14:48   ` Peter Maydell

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=4EBA9D8D.907@suse.de \
    --to=afaerber@suse.de \
    --cc=benoit.canet@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).