All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Christopher Covington <cov@codeaurora.org>,
	Peter Maydell <peter.maydell@linaro.org>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Joel Fernandes <joelf@ti.com>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: Change of TEXT_OFFSET for multi_v7_defconfig
Date: Thu, 17 Apr 2014 12:11:24 -0500	[thread overview]
Message-ID: <CAL_Jsq+aYXTQCzCtxPnS=zhBCba6-mEz+kT-mHTDW602E0vbDw@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1404161428280.980@knanqh.ubzr>

On Wed, Apr 16, 2014 at 2:14 PM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote:
> On Wed, 16 Apr 2014, Christopher Covington wrote:
>
>> On 04/15/2014 06:44 AM, Daniel Thompson wrote:
>> > Hi Folks

[snip]

>> Or could we patch up the linker script to set zero-based ELF load
>> memory addresses (LMAs) [4] so that the physical addresses are almost right,
>> you just might have to add a system-specific RAM offset, perhaps pulled out of
>> the device tree? If that won't work, we could generate some kind of
>> vmlinux-phys with physical addresses. The latter two options might also
>> simplify external debugging before __turn_mmu_on(). I like the sound of the
>> LMA approach best, assuming it doesn't break existing stuff (I notice a few AT
>> directives in vmlinux.lds.S). Some of this might transfer to arm64 as well.
>> What do you all think?
>
> If you really really want to get at the TEXT_OFFSET value in the
> uncompressed image, the simplest way would be:
>
> diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
> index f8c08839ed..de84d0635a 100644
> --- a/arch/arm/kernel/head.S
> +++ b/arch/arm/kernel/head.S
> @@ -78,6 +78,11 @@
>
>         __HEAD
>  ENTRY(stext)
> +
> +       b       1f
> +       .word   TEXT_OFFSET             @ located at a 4-byte offset in Image
> +1:
> +
>   ARM_BE8(setend        be )                    @ ensure we are in BE8 mode
>
>   THUMB(        adr     r9, BSYM(1f)    )       @ Kernel is always entered in ARM.
>
> This way the first word for Image would always be 0xea000000 and the
> second one would be TEXT_OFFSET.  No other kernel Image binaries ever
> had 0xea000000 as their first word so that also let you validate whether
> or not the TEXT_OFFSET value is there.

Better yet, we should adopt the arm64 Image header which has this and
other fields for arm Image files. We're going to have to deal with raw
Image (and Image.gz) in bootloaders for arm64, so we might as well
align things.

Rob

WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: Change of TEXT_OFFSET for multi_v7_defconfig
Date: Thu, 17 Apr 2014 12:11:24 -0500	[thread overview]
Message-ID: <CAL_Jsq+aYXTQCzCtxPnS=zhBCba6-mEz+kT-mHTDW602E0vbDw@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1404161428280.980@knanqh.ubzr>

On Wed, Apr 16, 2014 at 2:14 PM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote:
> On Wed, 16 Apr 2014, Christopher Covington wrote:
>
>> On 04/15/2014 06:44 AM, Daniel Thompson wrote:
>> > Hi Folks

[snip]

>> Or could we patch up the linker script to set zero-based ELF load
>> memory addresses (LMAs) [4] so that the physical addresses are almost right,
>> you just might have to add a system-specific RAM offset, perhaps pulled out of
>> the device tree? If that won't work, we could generate some kind of
>> vmlinux-phys with physical addresses. The latter two options might also
>> simplify external debugging before __turn_mmu_on(). I like the sound of the
>> LMA approach best, assuming it doesn't break existing stuff (I notice a few AT
>> directives in vmlinux.lds.S). Some of this might transfer to arm64 as well.
>> What do you all think?
>
> If you really really want to get at the TEXT_OFFSET value in the
> uncompressed image, the simplest way would be:
>
> diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
> index f8c08839ed..de84d0635a 100644
> --- a/arch/arm/kernel/head.S
> +++ b/arch/arm/kernel/head.S
> @@ -78,6 +78,11 @@
>
>         __HEAD
>  ENTRY(stext)
> +
> +       b       1f
> +       .word   TEXT_OFFSET             @ located at a 4-byte offset in Image
> +1:
> +
>   ARM_BE8(setend        be )                    @ ensure we are in BE8 mode
>
>   THUMB(        adr     r9, BSYM(1f)    )       @ Kernel is always entered in ARM.
>
> This way the first word for Image would always be 0xea000000 and the
> second one would be TEXT_OFFSET.  No other kernel Image binaries ever
> had 0xea000000 as their first word so that also let you validate whether
> or not the TEXT_OFFSET value is there.

Better yet, we should adopt the arm64 Image header which has this and
other fields for arm Image files. We're going to have to deal with raw
Image (and Image.gz) in bootloaders for arm64, so we might as well
align things.

Rob

  parent reply	other threads:[~2014-04-17 17:11 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 10:44 Change of TEXT_OFFSET for multi_v7_defconfig Daniel Thompson
2014-04-15 10:44 ` Daniel Thompson
2014-04-15 17:53 ` Stephen Boyd
2014-04-15 17:53   ` Stephen Boyd
2014-04-16 16:18 ` Christopher Covington
2014-04-16 16:18   ` Christopher Covington
2014-04-16 19:14   ` Nicolas Pitre
2014-04-16 19:14     ` Nicolas Pitre
2014-04-16 21:08     ` Christopher Covington
2014-04-16 21:08       ` Christopher Covington
2014-04-16 21:36       ` Peter Maydell
2014-04-16 21:36         ` Peter Maydell
2014-04-16 22:34         ` Russell King - ARM Linux
2014-04-16 22:34           ` Russell King - ARM Linux
2014-04-16 22:33       ` Russell King - ARM Linux
2014-04-16 22:33         ` Russell King - ARM Linux
2014-04-16 23:21       ` Nicolas Pitre
2014-04-16 23:21         ` Nicolas Pitre
2014-04-17 18:33         ` Christopher Covington
2014-04-17 18:33           ` Christopher Covington
2014-04-17 19:48           ` Nicolas Pitre
2014-04-17 19:48             ` Nicolas Pitre
2014-04-17 20:49             ` Christopher Covington
2014-04-17 20:49               ` Christopher Covington
2014-04-17 20:54               ` Peter Maydell
2014-04-17 20:54                 ` Peter Maydell
2014-04-17 20:35           ` Jason Gunthorpe
2014-04-17 20:35             ` Jason Gunthorpe
2014-04-22  9:44             ` Daniel Thompson
2014-04-22  9:44               ` Daniel Thompson
2014-04-22 17:05               ` Jason Gunthorpe
2014-04-22 17:05                 ` Jason Gunthorpe
2014-04-22 17:55                 ` Nicolas Pitre
2014-04-22 17:55                   ` Nicolas Pitre
2014-04-22 18:36                   ` Russell King - ARM Linux
2014-04-22 18:36                     ` Russell King - ARM Linux
2014-04-22 14:50             ` Michal Simek
2014-04-22 14:50               ` [Qemu-devel] " Michal Simek
2014-04-22 17:00               ` Jason Gunthorpe
2014-04-22 17:00                 ` Jason Gunthorpe
2014-04-22 17:11               ` Russell King - ARM Linux
2014-04-22 17:11                 ` Russell King - ARM Linux
2014-04-22 17:53                 ` Jason Gunthorpe
2014-04-22 17:53                   ` Jason Gunthorpe
2014-04-22 18:12                   ` Russell King - ARM Linux
2014-04-22 18:12                     ` Russell King - ARM Linux
2014-04-22 18:32                   ` Arnd Bergmann
2014-04-22 18:32                     ` Arnd Bergmann
2014-04-22 18:38                     ` Russell King - ARM Linux
2014-04-22 18:38                       ` Russell King - ARM Linux
2014-04-22 18:45                       ` Arnd Bergmann
2014-04-22 18:45                         ` Arnd Bergmann
2014-04-17 17:11     ` Rob Herring [this message]
2014-04-17 17:11       ` Rob Herring
2014-04-17 20:06       ` Nicolas Pitre
2014-04-17 20:06         ` Nicolas Pitre
2014-04-17 20:16         ` Russell King - ARM Linux
2014-04-17 20:16           ` Russell King - ARM Linux
2014-04-17 21:18           ` Rob Herring
2014-04-17 21:18             ` Rob Herring
2014-04-17 21:35             ` Russell King - ARM Linux
2014-04-17 21:35               ` Russell King - ARM Linux
2014-04-18  2:53               ` Rob Herring
2014-04-18  2:53                 ` Rob Herring
2014-04-18  4:34                 ` Nicolas Pitre
2014-04-18  4:34                   ` Nicolas Pitre
2014-04-22 10:26                   ` Daniel Thompson
2014-04-22 10:26                     ` Daniel Thompson
2014-04-22 10:40                     ` Russell King - ARM Linux
2014-04-22 10:40                       ` Russell King - ARM Linux
2014-04-22 11:41                       ` Daniel Thompson
2014-04-22 11:41                         ` Daniel Thompson
2014-04-18  8:41                 ` Russell King - ARM Linux
2014-04-18  8:41                   ` Russell King - ARM Linux
2014-04-22  9:53               ` Daniel Thompson
2014-04-22  9:53                 ` Daniel Thompson
2014-04-22 10:07                 ` Russell King - ARM Linux
2014-04-22 10:07                   ` Russell King - ARM Linux

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='CAL_Jsq+aYXTQCzCtxPnS=zhBCba6-mEz+kT-mHTDW602E0vbDw@mail.gmail.com' \
    --to=robherring2@gmail.com \
    --cc=cov@codeaurora.org \
    --cc=daniel.thompson@linaro.org \
    --cc=joelf@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sboyd@codeaurora.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.