public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 2/2] arm: add initial support for Amlogic Meson and ODROID-C2
Date: Wed, 13 Apr 2016 18:34:57 -0400	[thread overview]
Message-ID: <20160413223457.GP13577@bill-the-cat> (raw)
In-Reply-To: <570EBC6B.3020507@suse.de>

On Wed, Apr 13, 2016 at 11:38:51PM +0200, Alexander Graf wrote:
> On 13.04.16 13:52, Marek Vasut wrote:
> > On 04/13/2016 01:22 PM, Beniamino Galvani wrote:
> >> On Wed, Apr 13, 2016 at 12:26:43AM +0200, Marek Vasut wrote:
> >>>> So, after some investigation, the reason is that the code runs when
> >>>> caches are still disabled and thus all the memory is treated as
> >>>> Device-nGnRnE, requiring aligned accesses.
> >>>
> >>> You mean 8-byte aligned accesses, correct ?
> >>
> >> Yes.
> >>
> >>>> The return value of
> >>>> fdt_getprop() is guaranteed to be aligned to a 4 byte boundary (but
> >>>> not 8)
> >>>
> >>> The return value of fdt_getprop() is a pointer, thus 8byte long on
> >>> aarch64 and thus aligned to 8 bytes on the stack unless there is
> >>> some real problem.
> >>
> >> Right, however I'm not talking about the alignment of the pointer on
> >> the stack, but about the value of the pointer, which depends on the
> >> offset inside the device tree blob of the property. If I use this:
> >>
> >>     val = fdt_getprop(gd->fdt_blob, offset, "reg", &len)
> >>     gd->ram_size = fdt64_to_cpu(*(fdt64_t *)val)
> >>
> >> when the CPU tries to dereference val (which is something like
> >> 0x00000000010429e4) an alignment fault is generated for the reason
> >> stated above.
> > 
> > Oh, now it's clear what the problem is, thanks. But then, we'd need such
> > fixups all over the place I'm afraid. Isn't there some way to enable
> > support for "unaligned" accesses instead?
> 
> Yes, and it's called "enable the MMU". You could probably do this in the
> early dram init stage already, but I'm not sure it's worth it. The NXP
> people are the only ones doing it really early today FWIW.
> 
> Also, if you find it more readable, you could just use
> get_unaligned_be64(). It gets you down to byte accesses rather than
> 32bit fetches, but the function name makes it pretty obvious what we're
> looking at.

OK, now I'm starting to get nightmares back to our last unaligned access
discussion.  Is ARMv8 doing something radically different from ARMv7
here, wrt unaligned accesses?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160413/4cf4c8d8/attachment.sig>

  reply	other threads:[~2016-04-13 22:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-10 15:30 [U-Boot] [PATCH v3 0/2] Amlogic Meson GXBaby and ODROID-C2 support Beniamino Galvani
2016-04-10 15:30 ` [U-Boot] [PATCH v3 1/2] net: designware: fix descriptor layout and warnings on 64-bit archs Beniamino Galvani
2016-04-10 23:59   ` Marek Vasut
2016-04-11 20:46     ` Beniamino Galvani
2016-04-10 15:30 ` [U-Boot] [PATCH v3 2/2] arm: add initial support for Amlogic Meson and ODROID-C2 Beniamino Galvani
2016-04-11  0:08   ` Marek Vasut
2016-04-11 21:02     ` Beniamino Galvani
2016-04-11 21:08       ` Marek Vasut
2016-04-12 21:50         ` Beniamino Galvani
2016-04-12 22:26           ` Marek Vasut
2016-04-13 11:22             ` Beniamino Galvani
2016-04-13 11:52               ` Marek Vasut
2016-04-13 21:38                 ` Alexander Graf
2016-04-13 22:34                   ` Tom Rini [this message]
2016-04-13 22:42                     ` Alexander Graf
2016-04-13 22:51                       ` Tom Rini
2016-04-13 22:53                         ` Alexander Graf
2016-04-13 23:12                           ` Marek Vasut
2016-04-14  7:08                             ` Alexander Graf

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=20160413223457.GP13577@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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