Cleanups and improvements
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest15 patches 18 repliesIn review
- v213 patches 29 repliesSuperseded
- v113 patches 11 repliesSuperseded
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/15 | aarch64: correct ZCR_EL3.LEN initializationarch/ arch/ | +2 | 8 replies | |
| 2/15 | aarch64: correct SCTLR_EL1_KERNEL for AA32 kernelsarch/ | +9 | 2 replies | |
| 3/15 | Document entry requirementsarch/ arch/ arch/ | +27 | 1 reply | |
| 4/15 | Add bit-field macrosinclude/ | +66 | 2 replies | |
| 5/15 | aarch64: add system register accessorsarch/ arch/ | +32 | 0 replies | |
| 6/15 | aarch32: add coprocessor accessorsarch/ arch/ | +34 | 1 reply | |
| 7/15 | aarch64: add mov_64 macroarch/ | +9 | 0 replies | |
| 8/15 | aarch64: initialize SCTLR_ELx for the boot-wrapperarch/ arch/ | +88 | 1 reply | |
| 9/15 | Rework common init C codeMakefile.am arch/ arch/ +4 more | +58 | 0 replies | |
| 10/15 | Announce boot-wrapper mode / exception levelMakefile.am arch/ arch/ +4 more | +78 | 0 replies | |
| 11/15 | aarch64: move the bulk of EL3 initialization to CMakefile.am arch/ arch/ +1 more | +109 | 1 reply | |
| 12/15 | aarch32: move the bulk of Secure PL1 initialization to Carch/ arch/ arch/ | +22 | 0 replies | |
| 13/15 | Announce locations of memory objectscommon/ common/ include/ +1 more | +56 | 0 replies | |
| 14/15 | Rework bootmethod initializationMakefile.am arch/ arch/ +9 more | +69 | 1 reply | |
| 15/15 | Unify start_el3 & start_no_el3arch/ arch/ arch/ +2 more | +7 | 0 replies |
Reviews trailers per patch
All 15 patches have a Reviewed-by or Acked-by.
| Patch | Andre Przywara |
|---|---|
| 1/15 | R-b |
| 2/15 | R-b |
| 3/15 | R-b |
| 4/15 | R-b |
| 5/15 | R-b |
| 6/15 | R-b |
| 7/15 | R-b |
| 8/15 | R-b |
| 9/15 | R-b |
| 10/15 | R-b |
| 11/15 | R-b |
| 12/15 | R-b |
| 13/15 | R-b |
| 14/15 | R-b |
| 15/15 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [bootwrapper PATCH v3 00/15] Cleanups and improvements
This series reworks the aarch64 boot-wrapper, moving a fair amount of initialization code to C. This has a few benefits:
1) This makes the code more legible and easier to maintain.
Current feature detection and system register configuration is written in assembly, requiring runs of *almost* identical blocks of assembly to read ID registers and conditionally initialize register values. This requires a bunch of labels (which are all named numerically), and all the magic numbers are hard coded, so this gets pretty painful to read:
| mrs x1, id_aa64isar0_el1
| ubfx x1, x1, #24, #4
| cbz x1, 1f
|
| orr x0, x0, #(1 << 34) // TME enable
|
| 1:
In C, it's much easier to add helpers which use mnemonics, which makes the code much easier to read, and avoids the need to manually allocate registers, etc:
| if (mrs_field(ID_AA64ISAR0_EL1, TME))
| scr |= SCR_EL3_TME;
This should make it easier to handle new architectural extensions (and/or architecture variants such as ARMv8-R) in future.
2) This allows for better diagnostics.
Currently a mis-configured boot-wrapper is rather unforgiving, and provides no indication as to what might have gone wrong. By moving initialization to C, we can make use to the UART code to log diagnostic information, and we can more easily add additional error handling and conditional logic.
This series adds diagnostic information and error handling that can be used to identify problems such as the boot-wrapper being launched at the wrong exception level:
| Boot-wrapper v0.2
| Entered at EL2
| Memory layout:
| [0000000080000000..0000000080001f90] => boot-wrapper | [000000008000fff8..0000000080010000] => mbox | [0000000080200000..00000000822af200] => kernel | [0000000088000000..0000000088002857] => dtb |
| WARNING: PSCI could not be initialized. Boot may fail
Originally I had planned for this to be a more expansive set of changes, unifying some early control-flow, fixing some latent bugs, and making the boot-wrapper dynamically handle being entered at any of EL{3,2,1} with automated selection of a suitable DT. As the series has already become pretty long, I'd like to get this preparatory cleanup out of the way first, and handle those cases with subsequent patches.
If there are no objections I'll apply this by the end of this week.
I've pushed the series to the cleanup branch in the boot-wrapper repo:
https://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git/
git://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git
... and it should apply cleanup atop the master branch.
Since v1 [1]:
* Add comments for bit-field macros
* Use BIT() for *_RES1 definitions
* Complete start_el3/start_no_el3 cleanup
* Remove extraneous macro definition
Since v2 [2]:
* Accumulate tags
* Rebase atop other recent patches
* Correct ZCR_EL3.LEN initialization
* Drop BITS_INSERT()
* Split SCTLR_EL1 values used for AArch32 kernels
* Add missing SCTLR_EL1 RES1 bits
* Refactor print_ulong_hex()
* Refactor PSCI arch initialization
[1] https://lore.kernel.org/r/[email protected]/
[2] https://lore.kernel.org/r/[email protected]/
Thanks,
Mark.
Mark Rutland (15):
aarch64: correct ZCR_EL3.LEN initialization
aarch64: correct SCTLR_EL1_KERNEL for AA32 kernels Document entry requirements
Add bit-field macros
aarch64: add system register accessors
aarch32: add coprocessor accessors
aarch64: add mov_64 macro
aarch64: initialize SCTLR_ELx for the boot-wrapper Rework common init C code
Announce boot-wrapper mode / exception level
aarch64: move the bulk of EL3 initialization to C
aarch32: move the bulk of Secure PL1 initialization to C Announce locations of memory objects
Rework bootmethod initialization
Unify start_el3 & start_no_el3
Makefile.am | 7 +- arch/aarch32/boot.S | 33 ++++-- arch/aarch32/include/asm/cpu.h | 62 ++++++++--- arch/aarch32/include/asm/gic-v3.h | 6 +- arch/aarch32/init.c | 57 ++++++++++ arch/aarch32/psci.S | 16 +-- arch/aarch32/utils.S | 9 -- arch/aarch64/boot.S | 177 ++++++++++++------------------ arch/aarch64/common.S | 10 +- arch/aarch64/include/asm/cpu.h | 117 +++++++++++++++++--- arch/aarch64/include/asm/gic-v3.h | 10 +- arch/aarch64/init.c | 106 ++++++++++++++++++ arch/aarch64/psci.S | 22 +--- arch/aarch64/spin.S | 6 +- arch/aarch64/utils.S | 9 -- common/boot.c | 4 - common/init.c | 60 ++++++++++ common/platform.c | 45 +++++--- common/psci.c | 20 +++- include/bits.h | 66 +++++++++++ include/boot.h | 7 ++ include/platform.h | 20 ++++ model.lds.S | 20 +++- 23 files changed, 648 insertions(+), 241 deletions(-) create mode 100644 arch/aarch32/init.c create mode 100644 arch/aarch64/init.c create mode 100644 common/init.c create mode 100644 include/bits.h create mode 100644 include/platform.h
Signature · 7 lines
2.30.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel