Commit Graph

12 Commits

Author SHA1 Message Date
Travis Geiselbrecht
91128ad729 [arch][arm64] clean up how secondary cpus are initialized and tracked
- Add a percpu structure for each cpu, akin to x86-64 and riscv. Pointed
  to by x18, which is now reserved for this in the kernel. Tweaked
  exception and context switch routines to leave x18 alone.
- Remove the cpu-trapping spinlock logic that is unused in mainline,
  probably. (Can add a new version of it back if it's necessary).
- Switch fdtwalk helper to using the newer, cleaner way of initializing
  secondaries using the PSCI CPU_ON argument that should be pretty
  standard on modern implementations. (Possibly an issue with old
  firmware).
- Remove the notion of computing the cpu ID from the Affinity levels,
  which doesn't really work properly on modern ARM CPUs which more or
  less abandoned the logical meaning of AFFn.
2025-10-12 19:47:33 -07:00
Travis Geiselbrecht
52fa818e21 [arch][arm64] remove an unnecessary call to arm64_el3_to_el1
The existing arm64_elx_to_el1 already handles dropping the primary and
any secondary cpu down to el1 by the time this code path is reached.
2024-11-10 03:39:34 +00:00
Travis Geiselbrecht
6e39e5674c [arch][arm64] Make sure mpidr_el1 and mipr_el1 is configured
When dropping from EL2 (or EL3), load vmpidr_el2 and vpidr_el2 with the
correct values to make sure EL1 sees the 'real' mpidr_el1 and midr_el1.

Though in most cases they're already configured by whatever firmware ran
before, there's no actual guarantee that it is, and it may be full of
random garbage.
2024-11-10 03:31:23 +00:00
Peter Collingbourne
bce9599d80 [arch][arm64] disable EL1 FPU traps even when starting at EL1
It is possible for early initialization functions such as lk_main()
to contain NEON instructions because we don't build the kernel with
-mgeneral-regs-only. As a result we can end up taking an FPU exception
before we are ready to handle it.

We didn't have this problem when starting at a higher exception level
than EL1 because we turned off FPU traps in arm64_elX_to_el1(). But we
neglected to do so when starting at EL1. Fix the problem by moving the
CPACR_EL1 manipulation out of arm64_elX_to_el1() and into arm_reset().
2022-03-30 11:04:11 -07:00
Travis Geiselbrecht
e2cda72095 [arch][arm64] tweak the arm64_elX_to_el1 routine to avoid using x0-x3
It's called immediately upon entering the kernel entry vector, prior
to knowing if it's the boot cpu or needing to save any boot arguments,
so avoid using these registers
2022-02-10 22:34:02 -08:00
Travis Geiselbrecht
cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
Eric Holland
e724ff9707 [aarch64] Fix stack pointer misalignment (#159)
sp can become misaligned from 16 byte boundry because context frame
is not a multiple of 16 bytes.
2016-09-06 12:21:34 -07:00
Gurjant Kalsi
173046ecca [squash] Use x4 as early scratch register in case args are passed in x0-x3 (changes as per code review). 2016-08-25 15:51:34 -07:00
Eric Holland
1164bc17bc [rpi3]64bit platform support 2016-08-23 12:28:13 -07:00
Arve Hjønnevåg
8c5bb922b7 [arch][arm64] Move push and pop asm macros to arch/asm_macros.h
Change-Id: Ic101965193304cae3c4aad49b5f2f4f08b2485a3
2015-03-19 18:01:11 -07:00
Travis Geiselbrecht
4ec1bac774 [arch][arm64] initial port to armv8-a (aarch64) 2014-01-26 22:52:16 -08:00