From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/8] arm64: Add EL2 switch to soft_restart
Date: Tue, 27 Jan 2015 16:46:20 +0000 [thread overview]
Message-ID: <20150127164619.GL17721@leverpostej> (raw)
In-Reply-To: <1422308928.21823.16.camel@infradead.org>
On Mon, Jan 26, 2015 at 09:48:48PM +0000, Geoff Levand wrote:
> Hi Mark,
>
> On Mon, 2015-01-26 at 19:02 +0000, Mark Rutland wrote:
> > On Sat, Jan 17, 2015 at 12:23:34AM +0000, Geoff Levand wrote:
> > > When a CPU is reset it needs to be put into the exception level it had when it
> > > entered the kernel. Update cpu_reset() to accept an argument el2_switch which
> > > signals cpu_reset() to enter the soft reset address at EL2. If el2_switch is
> > > not set the soft reset address will be entered at EL1.
> > >
> > > Update cpu_soft_restart() and soft_restart() to pass the return of
> > > is_hyp_mode_available() as the el2_switch value to cpu_reset(). Also update the
> > > comments of cpu_reset(), cpu_soft_restart() and soft_restart() to reflect this
> > > change.
> > >
> > > Signed-off-by: Geoff Levand <geoff@infradead.org>
> > > ---
> > > arch/arm64/include/asm/proc-fns.h | 4 ++--
> > > arch/arm64/kernel/process.c | 10 ++++++++-
> > > arch/arm64/mm/proc.S | 47 +++++++++++++++++++++++++++++----------
> > > 3 files changed, 46 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/arch/arm64/include/asm/proc-fns.h b/arch/arm64/include/asm/proc-fns.h
> > > index 9a8fd84..339394d 100644
> > > --- a/arch/arm64/include/asm/proc-fns.h
> > > +++ b/arch/arm64/include/asm/proc-fns.h
> > > @@ -32,8 +32,8 @@ extern void cpu_cache_off(void);
> > > extern void cpu_do_idle(void);
> > > extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
> > > extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
> > > -void cpu_soft_restart(phys_addr_t cpu_reset,
> > > - unsigned long addr) __attribute__((noreturn));
> > > +void cpu_soft_restart(phys_addr_t cpu_reset, unsigned long el2_switch,
> > > + unsigned long addr) __attribute__((noreturn));
> > > extern void cpu_do_suspend(struct cpu_suspend_ctx *ptr);
> > > extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr);
> > >
> > > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> > > index fde9923..371bbf1 100644
> > > --- a/arch/arm64/kernel/process.c
> > > +++ b/arch/arm64/kernel/process.c
> > > @@ -50,6 +50,7 @@
> > > #include <asm/mmu_context.h>
> > > #include <asm/processor.h>
> > > #include <asm/stacktrace.h>
> > > +#include <asm/virt.h>
> > >
> > > #ifdef CONFIG_CC_STACKPROTECTOR
> > > #include <linux/stackprotector.h>
> > > @@ -60,7 +61,14 @@ EXPORT_SYMBOL(__stack_chk_guard);
> > > void soft_restart(unsigned long addr)
> > > {
> > > setup_mm_for_reboot();
> > > - cpu_soft_restart(virt_to_phys(cpu_reset), addr);
> > > +
> > > + /* TODO: Remove this conditional when KVM can support CPU restart. */
> > > + if (IS_ENABLED(CONFIG_KVM))
> > > + cpu_soft_restart(virt_to_phys(cpu_reset), 0, addr);
> >
> > If we haven't torn down KVM, doesn't that mean that KVM is active at EL2
> > (with MMU and caches on) at this point?
> >
> > If that's the case then we cannot possibly try to call kexec(), because
> > we cannot touch the memory used by the page tables for those EL2
> > mappings. Things will explode if we do.
>
> This conditional is just if KVM, do things the old way (don't try to
> switch exception levels). It is to handle the system shutdown case.
Having grepped treewide for soft_restart, other than kexec there are no
users for arm64. So surely kexec is the only case to cater for at the
moment?
> Another patch in this series '[PATCH 7/8] arm64/kexec: Add checks for
> KVM' assures kexec cannot happen when KVM is configured.
It would be better to just move this earlier (or event better, implement
kvm teardown).
Mark.
next prev parent reply other threads:[~2015-01-27 16:46 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1415926876.git.geoff@infradead.orgg>
2015-01-17 0:23 ` [PATCH 0/8] arm64 kexec kernel patches V7 Geoff Levand
2015-01-17 0:23 ` [PATCH 1/8] arm64: Move proc-macros.S to include/asm Geoff Levand
2015-01-26 17:45 ` Catalin Marinas
2015-01-27 19:33 ` [PATCH V2 1/8] arm64: Fold proc-macros.S into assembler.h Geoff Levand
2015-01-17 0:23 ` [PATCH 4/8] arm64: Add EL2 switch to soft_restart Geoff Levand
2015-01-26 19:02 ` Mark Rutland
2015-01-26 21:48 ` Geoff Levand
2015-01-27 16:46 ` Mark Rutland [this message]
2015-01-27 18:34 ` Geoff Levand
2015-01-27 17:57 ` Catalin Marinas
2015-01-30 21:47 ` Geoff Levand
2015-01-17 0:23 ` [PATCH 5/8] arm64/kexec: Add core kexec support Geoff Levand
2015-01-26 19:16 ` Mark Rutland
2015-01-17 0:23 ` [PATCH 7/8] arm64/kexec: Add checks for KVM Geoff Levand
2015-01-26 19:19 ` Mark Rutland
2015-01-26 20:39 ` Christoffer Dall
2015-01-26 20:58 ` Geoff Levand
2015-01-26 21:00 ` Geoff Levand
2015-01-29 9:36 ` AKASHI Takahiro
2015-01-29 9:57 ` AKASHI Takahiro
2015-01-29 10:59 ` Marc Zyngier
2015-01-29 18:47 ` Mark Rutland
2015-01-30 6:10 ` AKASHI Takahiro
2015-01-30 12:14 ` Mark Rutland
2015-01-30 19:48 ` Geoff Levand
2015-02-02 8:18 ` AKASHI Takahiro
2015-02-06 0:11 ` Geoff Levand
2015-02-06 4:18 ` AKASHI Takahiro
2015-02-06 7:06 ` Geoff Levand
2015-01-17 0:23 ` [PATCH 6/8] arm64/kexec: Add pr_devel output Geoff Levand
2015-01-17 0:23 ` [PATCH 2/8] arm64: Convert hcalls to use ISS field Geoff Levand
2015-01-26 18:26 ` Catalin Marinas
2015-01-30 23:31 ` Geoff Levand
2015-02-02 16:04 ` Catalin Marinas
2015-01-30 23:33 ` [PATCH v2 " Geoff Levand
2015-02-19 20:57 ` Christoffer Dall
2015-02-25 22:09 ` Geoff Levand
2015-03-02 22:13 ` Christoffer Dall
2015-03-02 23:22 ` Geoff Levand
2015-03-03 21:47 ` Christopher Covington
2015-03-03 22:35 ` Geoff Levand
2015-01-17 0:23 ` [PATCH 8/8] arm64/kexec: Enable kexec in the arm64 defconfig Geoff Levand
2015-01-17 0:23 ` [PATCH 3/8] arm64: Add new hcall HVC_CALL_FUNC Geoff Levand
2015-01-27 17:39 ` Catalin Marinas
2015-01-27 18:00 ` Mark Rutland
2015-01-30 21:52 ` Geoff Levand
2015-01-26 17:44 ` [PATCH 0/8] arm64 kexec kernel patches V7 Catalin Marinas
2015-01-26 18:37 ` Grant Likely
2015-01-26 18:55 ` Mark Rutland
2015-01-26 20:57 ` Geoff Levand
2014-10-03 23:12 [PATCH 0/8] arm64 kexec kernel patches V4 Geoff Levand
2014-10-03 23:12 ` [PATCH 4/8] arm64: Add EL2 switch to soft_restart Geoff Levand
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=20150127164619.GL17721@leverpostej \
--to=mark.rutland@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).