diff options
author | Julius Werner <jwerner@chromium.org> | 2018-08-06 13:50:38 -0700 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2018-08-10 04:16:46 +0000 |
commit | e819c857607bb4a1c2911e2073aa588f74789ee1 (patch) | |
tree | 6344dcc7f78397ad89bcc0ae59cdfc0e139cc5c5 /src/arch/arm64/armv8/exception.c | |
parent | 0c5f61a01c3ebaa1c19f9a20d20d4b1353648d7c (diff) | |
download | coreboot-e819c857607bb4a1c2911e2073aa588f74789ee1.tar.xz |
arm64: Turn architectural register accessors into inline functions
Accesses to architectural registers should be really fast -- they're
just registers, after all. In fact, the arm64 architecture uses them for
some timing-senstive uses like the architectural timer. A read should be:
one instruction, no data dependencies, done.
However, our current coreboot framework wraps each of these accesses
into a separate function. Suddenly you have to spill registers on a
stack, make a function call, move your stack pointer, etc. When running
without MMU this adds a significant enough delay to cause timing
problems when bitbanging a UART on SDM845.
This patch replaces all those existing functions with static inline
definitions in the header so they will get reduced to a single
instruction as they should be. Also use some macros to condense the code
a little since they're all so regular, which should make it easier to
add more in the future. This patch also expands all the data types to
uint64_t since that's what the actual assembly instruction accesses,
even if the register itself only has 32 bits (the others will be ignored
by the processor and set to 0 on read). Arm regularly expands registers
as they add new bit fields to them with newer iterations of the
architecture anyway, so this just prepares us for the inevitable.
Change-Id: I2c41cc3ce49ee26bf12cd34e3d0509d8e61ffc63
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/27881
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/arch/arm64/armv8/exception.c')
-rw-r--r-- | src/arch/arm64/armv8/exception.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/arch/arm64/armv8/exception.c b/src/arch/arm64/armv8/exception.c index 924c344e13..e32c79a85a 100644 --- a/src/arch/arm64/armv8/exception.c +++ b/src/arch/arm64/armv8/exception.c @@ -78,9 +78,9 @@ static void print_regs(struct exc_state *exc_state) struct elx_state *elx = &exc_state->elx; struct regs *regs = &exc_state->regs; - printk(BIOS_DEBUG, "ELR = 0x%016llx ESR = 0x%08x\n", + printk(BIOS_DEBUG, "ELR = 0x%016llx ESR = 0x%08llx\n", elx->elr, raw_read_esr_el3()); - printk(BIOS_DEBUG, "FAR = 0x%016llx SPSR = 0x%08x\n", + printk(BIOS_DEBUG, "FAR = 0x%016llx SPSR = 0x%08llx\n", raw_read_far_el3(), raw_read_spsr_el3()); for (i = 0; i < 30; i += 2) { printk(BIOS_DEBUG, |