exception_asm.S: skip msr hcr_el2 if not required

When guarded exception levels are enabled hcr_el2 can no longer be written to from EL2.
A future commit will however use el1_call to jump to GL1. It will setup hcr_el2 before
enabling GXF such that the write doesn't have to happen in el1_call anymore

Signed-off-by: Sven Peter <sven@svenpeter.dev>
This commit is contained in:
Sven Peter 2021-05-08 14:54:07 +02:00 committed by Hector Martin
parent 148fe31122
commit 813e40f4ca

View file

@ -132,13 +132,17 @@ el0_ret:
el1_call:
str x30, [sp, #-16]!
// Enable EL1
// Enable EL1, but only if not already done.
// this check is here because writes to hcr_el2 are only possible from GL2
// if that mode has been enabled
mrs x5, hcr_el2
bic x5, x5, #(1 << 27)
msr hcr_el2, x5
bic x6, x5, #(1 << 27)
cmp x5, x6
beq 1f
msr hcr_el2, x6
isb
mrs x5, daif
1: mrs x5, daif
msr daifclr, 3
mov x6, #5
orr x5, x5, x6 // EL1h