All of lore.kernel.org
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 2/5] ARM: reset: implement soft_restart for jumping to a physical address
Date: Tue, 22 Nov 2011 13:54:48 +0000	[thread overview]
Message-ID: <20111122135448.GG2066@localhost.localdomain> (raw)
In-Reply-To: <CAHkRjk4e7EEVsoM9oPBa993FZubO5trXDmw6S3VAq4s4wLTwzg@mail.gmail.com>

On Tue, Nov 22, 2011 at 01:41:24PM +0000, Catalin Marinas wrote:
> On 16 November 2011 17:54, Will Deacon <will.deacon@arm.com> wrote:
> > Tools such as kexec and CPU hotplug require a way to reset the processor
> > and branch to some code in physical space. This requires various bits of
> > jiggery pokery with the caches and MMU which, when it goes wrong, tends
> > to lock up the system.
> >
> > This patch fleshes out the soft_restart implementation so that it
> > branches to the reset code using the identity mapping. This requires us
> > to change to a temporary stack, held within the kernel image as a static
> > array, to avoid conflicting with the new view of memory.
> >
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > ---
> > ?arch/arm/kernel/process.c | ? 51 ++++++++++++++++++++++++++++++++++----------
> > ?1 files changed, 39 insertions(+), 12 deletions(-)
> >
> > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> > index a92ca50..577d092 100644
> > --- a/arch/arm/kernel/process.c
> > +++ b/arch/arm/kernel/process.c
> > @@ -92,29 +92,56 @@ static int __init hlt_setup(char *__unused)
> > ?__setup("nohlt", nohlt_setup);
> > ?__setup("hlt", hlt_setup);
> >
> > -void soft_restart(unsigned long addr)
> > +extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
> > +typedef void (*phys_reset_t)(unsigned long);
> > +
> > +/*
> > + * A temporary stack to use for CPU reset. This is static so that we
> > + * don't clobber it with the identity mapping. When running with this
> > + * stack, any references to the current task *will not work* so you
> > + * should really do as little as possible before jumping to your reset
> > + * code.
> > + */
> > +#define SOFT_RESTART_STACK_WORDS ? ? ? 32
> > +static u32 soft_restart_stack[SOFT_RESTART_STACK_WORDS];
> 
> Just for ABI stack alignment requirements, do we get the right
> alignment of this array in memory?

Could we fix that by making it a u64 array?

In architecture versions where it matters, the compiler should also 64-
bit align such an array.

Of we're paranoid, we could align the initial stack pointer explicitly.

Cheers
---Dave

  reply	other threads:[~2011-11-22 13:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16 17:54 [PATCH v6 0/5] kexec fixes and soft restart code Will Deacon
2011-11-16 17:54 ` [PATCH v6 1/5] ARM: lib: add call_with_stack function for safely changing stack Will Deacon
2011-11-22 13:42   ` Catalin Marinas
2011-11-16 17:54 ` [PATCH v6 2/5] ARM: reset: implement soft_restart for jumping to a physical address Will Deacon
2011-11-22 13:41   ` Catalin Marinas
2011-11-22 13:54     ` Dave Martin [this message]
2011-11-22 14:15     ` Will Deacon
2011-11-16 17:54 ` [PATCH v6 3/5] ARM: soft_restart: disable the outer L2 when the last CPU is going down Will Deacon
2011-11-16 18:20   ` Stephen Boyd
2011-11-16 18:30     ` Will Deacon
2011-11-16 21:59       ` Stephen Boyd
2011-11-16 17:54 ` [PATCH v6 4/5] ARM: stop: execute platform callback from cpu_stop code Will Deacon
2011-11-16 17:54 ` [PATCH v6 5/5] ARM: kexec: use soft_restart for branching to the reboot buffer Will Deacon

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=20111122135448.GG2066@localhost.localdomain \
    --to=dave.martin@linaro.org \
    --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.