diff options
author | Julius Werner <jwerner@chromium.org> | 2018-08-03 17:14:45 -0700 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2018-08-10 04:16:25 +0000 |
commit | 0c5f61a01c3ebaa1c19f9a20d20d4b1353648d7c (patch) | |
tree | b200a6be0cbc43adfd25d6778afce750ae81739c /src/arch/arm64/armv8/lib/pstate.c | |
parent | 73be9dd82c033a9bce3fc7ff11dab453e9cfde82 (diff) | |
download | coreboot-0c5f61a01c3ebaa1c19f9a20d20d4b1353648d7c.tar.xz |
arm64: Drop checks for current exception level, hardcode EL3 assumption
When we first created the arm64 port, we weren't quite sure whether
coreboot would always run in EL3 on all platforms. The AArch64 A.R.M.
technically considers this exception level optional, but in practice all
SoCs seem to support it. We have since accumulated a lot of code that
already hardcodes an implicit or explicit assumption of executing in EL3
somewhere, so coreboot wouldn't work on a system that tries to enter it
in EL1/2 right now anyway.
However, some of our low level support libraries (in particular those
for accessing architectural registers) still have provisions for
running at different exception levels built-in, and often use switch
statements over the current exception level to decide which register to
access. This includes an unnecessarily large amount of code for what
should be single-instruction operations and precludes further
optimization via inlining.
This patch removes any remaining code that dynamically depends on the
current exception level and makes the assumption that coreboot executes
at EL3 official. If this ever needs to change for a future platform, it
would probably be cleaner to set the expected exception level in a
Kconfig rather than always probing it at runtime.
Change-Id: I1a9fb9b4227bd15a013080d1c7eabd48515fdb67
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/27880
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/arch/arm64/armv8/lib/pstate.c')
-rw-r--r-- | src/arch/arm64/armv8/lib/pstate.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/arch/arm64/armv8/lib/pstate.c b/src/arch/arm64/armv8/lib/pstate.c index e068031bd2..631974f6e0 100644 --- a/src/arch/arm64/armv8/lib/pstate.c +++ b/src/arch/arm64/armv8/lib/pstate.c @@ -32,12 +32,6 @@ uint32_t raw_read_current_el(void) return current_el; } -uint32_t get_current_el(void) -{ - uint32_t current_el = raw_read_current_el(); - return ((current_el >> CURRENT_EL_SHIFT) & CURRENT_EL_MASK); -} - /* DAIF */ uint32_t raw_read_daif(void) { @@ -164,28 +158,6 @@ void raw_write_elr_el3(uint64_t elr_el3) __asm__ __volatile__("msr ELR_EL3, %0\n\t" : : "r" (elr_el3) : "memory"); } -uint64_t raw_read_elr_current(void) -{ - uint32_t el = get_current_el(); - return raw_read_elr(el); -} - -void raw_write_elr_current(uint64_t elr) -{ - uint32_t el = get_current_el(); - raw_write_elr(elr, el); -} - -uint64_t raw_read_elr(uint32_t el) -{ - SWITCH_CASE_READ(raw_read_elr, elr, uint64_t, el); -} - -void raw_write_elr(uint64_t elr, uint32_t el) -{ - SWITCH_CASE_WRITE(raw_write_elr, elr, el); -} - /* FPCR */ uint32_t raw_read_fpcr(void) { @@ -320,16 +292,6 @@ void raw_write_sp_el3(uint64_t sp_el3) raw_write_spsel(spsel); } -uint64_t raw_read_sp_elx(uint32_t el) -{ - SWITCH_CASE_READ(raw_read_sp, sp, uint64_t, el); -} - -void raw_write_sp_elx(uint64_t sp_elx, uint32_t el) -{ - SWITCH_CASE_WRITE(raw_write_sp, sp_elx, el); -} - /* SPSR */ uint32_t raw_read_spsr_abt(void) { @@ -387,28 +349,6 @@ void raw_write_spsr_el3(uint32_t spsr_el3) __asm__ __volatile__("msr SPSR_EL3, %0\n\t" : : "r" ((uint64_t)spsr_el3) : "memory"); } -uint32_t raw_read_spsr_current(void) -{ - uint32_t el = get_current_el(); - return raw_read_spsr(el); -} - -void raw_write_spsr_current(uint32_t spsr) -{ - uint32_t el = get_current_el(); - raw_write_spsr(spsr, el); -} - -uint32_t raw_read_spsr(uint32_t el) -{ - SWITCH_CASE_READ(raw_read_spsr, spsr, uint32_t, el); -} - -void raw_write_spsr(uint32_t spsr, uint32_t el) -{ - SWITCH_CASE_WRITE(raw_write_spsr, spsr, el); -} - uint32_t raw_read_spsr_fiq(void) { uint64_t spsr_fiq; |