Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Daniel Mack <zonque@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>,
	kexec@lists.infradead.org, Sven Neumann <s.neumann@raumfeld.com>
Subject: Re: [kexec-tools][PATCH v2] zImage-arm: bugfix: kernel offset must be 0x8000
Date: Sun, 11 May 2014 08:48:37 +0900	[thread overview]
Message-ID: <20140510234837.GI31760@verge.net.au> (raw)
In-Reply-To: <5368B120.4000600@gmail.com>

On Tue, May 06, 2014 at 11:53:36AM +0200, Daniel Mack wrote:
> On 05/06/2014 02:38 AM, Wang Nan wrote:
> > This patch fixs a problem introduced by commit e5d6a55 which make ARM
> > kexec fails.
> > 
> > Due to that commit, kernel is loaded at a dynamically offset: it computes
> > extra_size using size of dtb, and load zImage at base + extra_size. When
> > dtb size small (for example, 0x3000 bytes), kernel will be loaded at
> > address like 0x60003000. For ARM zImage such address is incorrect.
> > 
> > In kernel code arch/arm/boot/compressed/head.S, zImage builds a
> > temporary page table at (pc & 0xf8000000) + TEXT_OFFSET - 0x4000. The
> > related instructions sequence is:
> > 
> >  mov     r4, pc
> >  and     r4, r4, #0xf8000000
> >  add     r4, r4, #TEXT_OFFSET @ (TEXT_OFFSET == 0x8000 on most platforms)
> >  call cache_on
> >    ...
> >    call __armv7_mmu_cache_on
> >      ...
> >      call __setup_mmu
> >        sub     r3, r4, #16384          @ Page directory size
> > 
> > r3 becomes page table pointer.
> > 
> > When kernel is loaded at 0x60003000, page table is still built at
> > 0x60004000, which destroys kernel.
> > 
> > This patch make extra_size a fix value (0x8000) to avoid the failure.
> > 
> > For the problem commit e5d6a55 tries solve, this patch uses
> > locate_holes() to find a place can hold initrd and dtb.
> > 
> > Change from v1:
> >  - Coding style enhancements.
> > 
> > Signed-off-by: Wang Nan <wangnan0@huawei.com>
> > Cc: Daniel Mack <zonque@gmail.com>
> 
> Tested-by: Daniel Mack <zonque@gmail.com>
> 
> 
> Many thanks again for the fix and the elaboration!

Thanks, and apologies for the delay.
I am currently returning from a weeks vacation.
I have applied this locally and will push it some
time after I get off the plane ride home.

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

      reply	other threads:[~2014-05-11  8:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-05 11:48 [kexec-tools][PATCH] zImage-arm: bugfix: load kernel at TEXT_OFFSET Wang Nan
2014-05-05 13:13 ` Daniel Mack
2014-05-06  0:38   ` [kexec-tools][PATCH v2] zImage-arm: bugfix: kernel offset must be 0x8000 Wang Nan
2014-05-06  9:53     ` Daniel Mack
2014-05-10 23:48       ` Simon Horman [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=20140510234837.GI31760@verge.net.au \
    --to=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=s.neumann@raumfeld.com \
    --cc=wangnan0@huawei.com \
    --cc=zonque@gmail.com \
    /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