All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/9] arm64: clean up early boot function calls
@ 2016-08-24 14:35 Ard Biesheuvel
  2016-08-24 14:35 ` [PATCH v2 1/9] arm64: kernel: get rid of x25 and x26 with 'global' scope Ard Biesheuvel
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Ard Biesheuvel @ 2016-08-24 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

This v2 series is a followup to the single patch #1, whose v1 I sent out
about a week ago.

In a couple of places, the early boot code uses non-standard argument,
return value or return address registers when calling functions. This makes
the code more complicated than it needs to be, which was not a problem in the
early days, but with all the recent changes for KASLR, hibernate etc, it
makes sense to clean this up once and for all. This code removes all uses of
callee saved registers on the secondary boot and resume paths, and on th
primary boot path, it only leaves the necessary ones, and documents them
explicitly in patch #9.

I will leave it to the honourable arm64 maintainers to decide if any of
these improvements weigh up against the churn, given that this code has
already been updated numerous times over the past couple of kernel versions.

Adding James to cc since patch #6 may conflict with this hibernate/
debug-pagealloc series [0], to which I replied that merging .idmap.text
with .mmuoff.text would be a worthwhile simplification. 

Patch #1 removes the de facto requirement of __enable_mmu() that the
addresses of idmap_pg_dir and swapper_pg_dir must to be passed in register
x25 and x26, respectively. (v2: added Mark's ack)

Patch #2 fixes some style issues in sleep.S with no functional changes.

Patch #3 removes the use of x20 between el2_setup and set_cpu_boot_mode_flag()

Patch #4 moves the part of the KASLR processing that resides in __enable_mmu()
into primary_switch() (which is a more suitable place, given that only the
primary boot path ever invokes it)

Patch #5 replaces the special x27 return address of __enable_mmu() with x30/lr.
Given that we can no longer dereference literals containing virtual addresses,
all callers have been updated to return from __enable_mmu() back to the
idmap before performing a literal load + jump, this will allow us to simplify
the code in subsequent patches.

Patch #6 merges the code that executes before __enable_mmu() with the code
that executes after it, and changes the invocation of __enable_mmu() itself
into a simple bl instruction.

Patch #7 removes the 'global' x24 register in head.S, containing __PHYS_OFFSET

Patch #8 removes the use of x28 in __primary_switched(), and replaces it with
an ordinary stack frame to preserve the return address.

[0] http://marc.info/?l=linux-arm-kernel&m=147128126002457

Ard Biesheuvel (9):
  arm64: kernel: get rid of x25 and x26 with 'global' scope
  arm64: kernel: fix style issues in sleep.S
  arm64: kernel: use ordinary return/argument register for el2_setup()
  arm64: head.S: move KASLR processing out of __enable_mmu()
  arm64: kernel: use x30 for __enable_mmu return address
  arm64: call __enable_mmu as an ordinary function for secondary/resume
  arm64: kernel: drop use of x24 from primary boot path
  arm64: head.S: use ordinary stack frame for __primary_switched()
  arm64: head.S: document the use of callee saved registers

 arch/arm64/kernel/head.S  | 170 +++++++++++---------
 arch/arm64/kernel/sleep.S |  29 ++--
 2 files changed, 105 insertions(+), 94 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2016-08-30 14:50 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24 14:35 [PATCH v2 0/9] arm64: clean up early boot function calls Ard Biesheuvel
2016-08-24 14:35 ` [PATCH v2 1/9] arm64: kernel: get rid of x25 and x26 with 'global' scope Ard Biesheuvel
2016-08-24 14:35 ` [PATCH v2 2/9] arm64: kernel: fix style issues in sleep.S Ard Biesheuvel
2016-08-24 16:13   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 3/9] arm64: kernel: use ordinary return/argument register for el2_setup() Ard Biesheuvel
2016-08-24 16:20   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 4/9] arm64: head.S: move KASLR processing out of __enable_mmu() Ard Biesheuvel
2016-08-24 20:36   ` Mark Rutland
2016-08-24 20:44     ` Ard Biesheuvel
2016-08-24 20:46     ` Mark Rutland
2016-08-25 13:59       ` Ard Biesheuvel
2016-08-30 10:24         ` Mark Rutland
2016-08-30 13:45   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 5/9] arm64: kernel: use x30 for __enable_mmu return address Ard Biesheuvel
2016-08-24 14:36 ` [PATCH v2 6/9] arm64: call __enable_mmu as an ordinary function for secondary/resume Ard Biesheuvel
2016-08-30 14:07   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 7/9] arm64: kernel: drop use of x24 from primary boot path Ard Biesheuvel
2016-08-30 14:26   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 8/9] arm64: head.S: use ordinary stack frame for __primary_switched() Ard Biesheuvel
2016-08-30 14:38   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 9/9] arm64: head.S: document the use of callee saved registers Ard Biesheuvel
2016-08-30 14:43   ` Mark Rutland
2016-08-30 14:48 ` [PATCH v2 0/9] arm64: clean up early boot function calls Mark Rutland
2016-08-30 14:50   ` Ard Biesheuvel

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.