OSDN Git Service

BACKPORT: arm64: move sp_el0 and tpidr_el1 into cpu_suspend_ctx
authorMark Rutland <mark.rutland@arm.com>
Thu, 3 Nov 2016 20:23:09 +0000 (20:23 +0000)
committerZubin Mithra <zsm@google.com>
Wed, 9 Aug 2017 14:23:23 +0000 (15:23 +0100)
commit48dd80cb1343a0e535cc6065f078dfde9b60f5ba
treefbfcddbc513e7ba468cf5b64995db71650a960bb
parent0f9f933796581345224426a06d58edf1bbd5a26b
BACKPORT: arm64: move sp_el0 and tpidr_el1 into cpu_suspend_ctx

When returning from idle, we rely on the fact that thread_info lives at
the end of the kernel stack, and restore this by masking the saved stack
pointer. Subsequent patches will sever the relationship between the
stack and thread_info, and to cater for this we must save/restore sp_el0
explicitly, storing it in cpu_suspend_ctx.

As cpu_suspend_ctx must be doubleword aligned, this leaves us with an
extra slot in cpu_suspend_ctx. We can use this to save/restore tpidr_el1
in the same way, which simplifies the code, avoiding pointer chasing on
the restore path (as we no longer need to load thread_info::cpu followed
by the relevant slot in __per_cpu_offset based on this).

This patch stashes both registers in cpu_suspend_ctx.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Laura Abbott <labbott@redhat.com>
Cc: James Morse <james.morse@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This is a modification of Mark Rutland's original patch. The differences
from the original patch are as follows :-
- NR_CTX_REGS is set to 13 instead of 12
- x13 and x14 are used as temporary registers to hold sp_el0 and
  tpidr_el1 instead of x11 and x12.
- The values are temporarily stashed at offset 88 and 96 of
  cpu_suspend_ctx instead of 80 and 88.

The original patch would not apply cleanly and these changes were made
to resolve this.

Bug: 38331309
Change-Id: I4e72aebd51e99d3767487383c14a1ba784312bf1
(cherry picked from commit 623b476fc815464a0241ea7483da7b3580b7d8ac)
Signed-off-by: Zubin Mithra <zsm@google.com>
arch/arm64/include/asm/suspend.h
arch/arm64/kernel/sleep.S
arch/arm64/kernel/suspend.c
arch/arm64/mm/proc.S