All of lore.kernel.org
 help / color / mirror / Atom feed
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/5] ARM: use generic unaligned.h
Date: Wed, 10 Oct 2012 08:29:27 -0500	[thread overview]
Message-ID: <50757837.8050200@gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.02.1210082354210.16518@xanadu.home>

On 10/08/2012 11:01 PM, Nicolas Pitre wrote:
> On Mon, 8 Oct 2012, Rob Herring wrote:
> 
>> On 10/08/2012 06:28 PM, Shawn Guo wrote:
>>> On Mon, Oct 08, 2012 at 03:34:57PM -0500, Rob Herring wrote:
>>>> On 10/08/2012 11:43 AM, Shawn Guo wrote:
>>>>> This patch has been merged into mainline as commit below.
>>>>>
>>>>>  d25c881 ARM: 7493/1: use generic unaligned.h
>>>>>
>>>>> It introduces a regression for me.  Check out the commit on mainline,
>>>>> build a v7 only kernel (imx5/6) with imx_v6_v7_defconfig, the kernel
>>>>> halts in decompressor.  But v6/v7 kernel (imx3/5/6) works fine.  The
>>>>> kernel built on the parent commit below works all fine.
>>>>
>>>> It actually fails in the decompressor or that's the last output you get?
>>>
>>> I think it fails in the decompressor, because what I see is 
>>>
>>> Uncompressing Linux...
>>>
>>> not
>>>
>>> Uncompressing Linux... done, booting the kernel.
>>>
>>>> I compared the decompressor disassembly of both cases and get the same
>>>> number of ldrb/strb instructions, so I don't think it is directly
>>>> related to alignment.
>>>>
>>>> I tried the XY decompressor as that is one difference, but that works
>>>> fine for me on highbank.
>>>>
>>>> Does it work with an empty uncompress.h functions? That should be the
>>>> only difference in our decompressor code.
>>>
>>> No, empty putc() in uncompress.h does not help.
>>>
>>> New finding is that it only fails with LZO decompressor while the other
>>> 3 Gzip, LZMA and XZ all work good.  We happen to have LZO as the default
>>> one in imx_v6_v7_defconfig.
>>
>> I must have had an old config with XZ. LZO fails because of this:
>>  
>> lib/decompress_unlzo.c: version = get_unaligned_be16(parse);
>> lib/decompress_unlzo.c: if (get_unaligned_be32(parse) & HEADER_HAS_FILTER)
>> lib/decompress_unlzo.c:         dst_len = get_unaligned_be32(in_buf);
>> lib/decompress_unlzo.c:         src_len = get_unaligned_be32(in_buf);
>>
>> This was what I was afraid of. The decompressor runs with the sysctrl
>> register A bit in whatever state the bootloader left it in. In the case
>> of u-boot it is set, and the maintainers are pretty set on not allowing
>> unaligned accesses if you've seen the recent discussion.
> 
> This is not an u-Boot issue.  The kernel code expects misaligned 
> accesses to be handled by the hardware on ARMv6+ now.  So it better 
> enforce proper A bit state itself.
> 
>> This should fix things.
>>
>> Rob
>>
>> 8<---------------------------------------------------------------------
>>
>> diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
>> index bc67cbf..1f87d22 100644
>> --- a/arch/arm/boot/compressed/head.S
>> +++ b/arch/arm/boot/compressed/head.S
>> @@ -654,6 +654,7 @@ __armv7_mmu_cache_on:
>>  #endif
>>                 mrc     p15, 0, r0, c1, c0, 0   @ read control reg
>>                 bic     r0, r0, #1 << 28        @ clear SCTLR.TRE
>> +               bic     r0, r0, #1 << 1         @ clear SCTLR.A
>>                 orr     r0, r0, #0x5000         @ I-cache enable, RR cache replacement
>>                 orr     r0, r0, #0x003c         @ write buffer
>>  #ifdef CONFIG_MMU
>>
> 
> That's OK for ARMv7, but in the ARMv6 case we use __armv4_mmu_cache_on.  
> So this patch is incomplete.

It is still optional on v6 and the compiler will not emit unaligned
accesses for v6 (which is why it worked when v6 platforms were enabled).
That does raise a bigger question. If we're doing combined v6 and v7
builds, do we want this to require unaligned accesses are enabled and if
so, can we force that on in the compiler?

Rob

  reply	other threads:[~2012-10-10 13:29 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-05  1:23 [PATCH v2 0/5] Use more asm-generic headers Rob Herring
2012-08-05  1:23 ` [PATCH v2 1/5] ARM: use generic version of identical asm headers Rob Herring
2012-08-05  1:23 ` [PATCH v2 2/5] ARM: add strstr declaration for decompressors Rob Herring
2012-08-05  1:23 ` [PATCH v2 3/5] ARM: use generic unaligned.h Rob Herring
2012-10-08 16:43   ` Shawn Guo
2012-10-08 20:34     ` Rob Herring
2012-10-08 23:28       ` Shawn Guo
2012-10-09  2:27         ` Rob Herring
2012-10-09  2:45           ` Shawn Guo
2012-10-09  4:01           ` Nicolas Pitre
2012-10-10 13:29             ` Rob Herring [this message]
2012-10-10 13:57               ` Nicolas Pitre
2012-10-11 12:43                 ` [PATCH] ARM: decompressor: clear SCTLR.A bit for v7 cores Rob Herring
2012-10-11 13:09                   ` Russell King - ARM Linux
2012-10-11 13:31                     ` Rob Herring
2012-10-11 13:41                       ` Russell King - ARM Linux
2012-10-11 15:44                         ` Nicolas Pitre
2012-10-23 20:32                           ` Gregory CLEMENT
2012-10-25 12:07                             ` Russell King - ARM Linux
2012-10-11 13:59                       ` Russell King - ARM Linux
2012-10-11 15:58                         ` Nicolas Pitre
2012-10-25  9:34                   ` Johannes Stezenbach
2012-10-25 12:41                     ` Rob Herring
2012-10-25 13:30                       ` Arnd Bergmann
2012-10-25 14:16                       ` Johannes Stezenbach
2012-10-25 14:25                         ` Rob Herring
2012-10-25 15:02                           ` Nicolas Pitre
2012-10-25 15:08                           ` Johannes Stezenbach
2012-11-05 10:48                             ` Dave Martin
2012-11-05 11:13                               ` Russell King - ARM Linux
2012-11-05 13:02                                 ` Dave Martin
2012-11-05 13:43                                   ` Johannes Stezenbach
2012-11-05 15:39                                   ` Russell King - ARM Linux
2012-11-05 16:13                                     ` Nicolas Pitre
2012-11-05 17:26                                       ` Dave Martin
2012-11-05 17:44                                         ` Rob Herring
2012-11-05 20:02                                           ` Nicolas Pitre
2012-11-05 17:46                                         ` Nicolas Pitre
2012-11-05 13:48                                 ` Rob Herring
2012-11-05 22:02                                   ` Michael Hope
2013-02-20 14:56                                     ` Johannes Stezenbach
2013-02-20 15:07                                       ` Johannes Stezenbach
2012-08-05  1:23 ` [PATCH v2 4/5] ARM: use generic termios.h Rob Herring
2012-08-05  1:24 ` [PATCH v2 5/5] ARM: convert asm/irqflags.h to use asm-generic/irqflags.h Rob Herring
2012-08-05  9:34 ` [PATCH v2 0/5] Use more asm-generic headers Thomas Petazzoni
2012-08-06 14:35 ` Arnd Bergmann

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=50757837.8050200@gmail.com \
    --to=robherring2@gmail.com \
    --cc=linux-arm-kernel@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.