All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Eric Bénard" <eric@eukrea.com>
To: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: Enable unaligned accesses on armv6 and later
Date: Thu, 12 Jul 2012 11:43:52 +0200	[thread overview]
Message-ID: <20120712114352.51e3de9b@eb-e6520> (raw)
In-Reply-To: <1341817779-29531-1-git-send-email-s.hauer@pengutronix.de>

Hi Sascha,

Le Mon,  9 Jul 2012 09:09:39 +0200,
Sascha Hauer <s.hauer@pengutronix.de> a écrit :

> We have the following in the tree:
> 
> |commit af42feb9d255bc3ea3b514180f265479ea8834f9
> |Author: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> |Date:   Mon Jan 2 11:49:17 2012 +0100
> |
> |    ARM: set SCTRL[A] only when architecture does not support unaligned access
> |
> |    Recent gcc generates code with unaligned access when architecture
> |    supports it. Setting A bit unconditionally causes data-aborts on such
> |    code rendering barebox unusable.
> |
> |    Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> |    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> What the patch tried is correct: We should set the A bit only when the architecture
> does not support unaligned accesses. To figure out whether the architecture supports
> unaligned accesses the patch tested for the U bit which is wrong. The U bit may be
> 0 after a reset, so instead of testing for the U bit we have to set it. This can
> be done on armv6 and later. All others have the A bit set to trap unaligned accesses.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> 
> Enrico, can you confirm this is correct?
> 
> Thanks
>  Sascha
> 
>  arch/arm/cpu/start.c |   12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
> index 3c282ee..523179d 100644
> --- a/arch/arm/cpu/start.c
> +++ b/arch/arm/cpu/start.c
> @@ -81,13 +81,11 @@ void __naked __bare_init reset(void)
>  	r &= ~(CR_M | CR_C | CR_B | CR_S | CR_R | CR_V);
>  	r |= CR_I;
>  
> -	if (!(r & CR_U))
> -		/* catch unaligned access on architectures which do not
> -		 * support unaligned access */
> -		r |= CR_A;
> -	else
> -		r &= ~CR_A;
> -
> +#if __LINUX_ARM_ARCH__ >= 6
> +	r |= CR_U;
> +#else
> +	r |= CR_A;
> +#endif
>  
>  #ifdef __ARMEB__
>  	r |= CR_B;

Tested-by: Eric Bénard <eric@eukrea.com>

this patch fix the crash we had in show_progress.

Eric

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2012-07-12  9:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-09  7:09 [PATCH] ARM: Enable unaligned accesses on armv6 and later Sascha Hauer
2012-07-12  9:43 ` Eric Bénard [this message]

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=20120712114352.51e3de9b@eb-e6520 \
    --to=eric@eukrea.com \
    --cc=barebox@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.