Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
44445ae5
Unverified
Commit
44445ae5
authored
6 years ago
by
Antonio Niño Díaz
Committed by
GitHub
6 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #1641 from jeenu-arm/ptrauth
AArch64: Enable lower ELs to use pointer authentication
parents
414c9e6d
3ff4aaac
master
v2.5
v2.5-rc1
v2.5-rc0
v2.4
v2.4-rc2
v2.4-rc1
v2.4-rc0
v2.3
v2.3-rc2
v2.3-rc1
v2.3-rc0
v2.2
v2.2-rc2
v2.2-rc1
v2.2-rc0
v2.1
v2.1-rc1
v2.1-rc0
arm_cca_v0.2
arm_cca_v0.1
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/firmware-design.rst
+6
-0
docs/firmware-design.rst
include/common/aarch64/el3_common_macros.S
+6
-1
include/common/aarch64/el3_common_macros.S
include/lib/aarch64/arch.h
+4
-0
include/lib/aarch64/arch.h
lib/el3_runtime/aarch64/context_mgmt.c
+14
-6
lib/el3_runtime/aarch64/context_mgmt.c
with
30 additions
and
7 deletions
+30
-7
docs/firmware-design.rst
View file @
44445ae5
...
...
@@ -2532,6 +2532,12 @@ This Architecture Extension is targeted when ``ARM_ARCH_MAJOR`` == 8 and
translation
table
entries
for
a
given
stage
of
translation
for
a
particular
translation
regime
.
Armv8
.3
-
A
~~~~~~~~~
-
Pointer
Authentication
features
of
Armv8
.3
-
A
are
unconditionally
enabled
so
that
lower
ELs
are
allowed
to
use
them
without
causing
a
trap
to
EL3
.
Armv7
-
A
~~~~~~~
...
...
This diff is collapsed.
Click to expand it.
include/common/aarch64/el3_common_macros.S
View file @
44445ae5
...
...
@@ -70,9 +70,14 @@
*
*
SCR_EL3
.
EA
:
Set
to
one
to
route
External
Aborts
and
SError
Interrupts
*
to
EL3
when
executing
at
any
EL
.
*
*
SCR_EL3
.
{
API
,
APK
}
:
For
Armv8
.3
pointer
authentication
feature
,
*
disable
traps
to
EL3
when
accessing
key
registers
or
using
pointer
*
authentication
instructions
from
lower
ELs
.
*
---------------------------------------------------------------------
*/
mov
x0
,
#((
SCR_RESET_VAL
| SCR_EA_BIT |
SCR_SIF_BIT
)
\
mov_imm
x0
,
((
SCR_RESET_VAL
| SCR_EA_BIT |
SCR_SIF_BIT
|
\
SCR_API_BIT
|
SCR_APK_BIT
)
\
&
~
(
SCR_TWE_BIT
| SCR_TWI_BIT |
SCR_SMD_BIT
))
msr
scr_el3
,
x0
...
...
This diff is collapsed.
Click to expand it.
include/lib/aarch64/arch.h
View file @
44445ae5
...
...
@@ -218,6 +218,8 @@
/* SCR definitions */
#define SCR_RES1_BITS ((U(1) << 4) | (U(1) << 5))
#define SCR_FIEN_BIT (U(1) << 21)
#define SCR_API_BIT (U(1) << 17)
#define SCR_APK_BIT (U(1) << 16)
#define SCR_TWE_BIT (U(1) << 13)
#define SCR_TWI_BIT (U(1) << 12)
#define SCR_ST_BIT (U(1) << 11)
...
...
@@ -274,6 +276,8 @@
#define VTTBR_BADDR_SHIFT U(0)
/* HCR definitions */
#define HCR_API_BIT (ULL(1) << 41)
#define HCR_APK_BIT (ULL(1) << 40)
#define HCR_RW_SHIFT U(31)
#define HCR_RW_BIT (ULL(1) << HCR_RW_SHIFT)
#define HCR_AMO_BIT (ULL(1) << 5)
...
...
This diff is collapsed.
Click to expand it.
lib/el3_runtime/aarch64/context_mgmt.c
View file @
44445ae5
...
...
@@ -290,6 +290,7 @@ void cm_prepare_el3_exit(uint32_t security_state)
uint32_t
sctlr_elx
,
scr_el3
,
mdcr_el2
;
cpu_context_t
*
ctx
=
cm_get_context
(
security_state
);
int
el2_unused
=
0
;
uint64_t
hcr_el2
=
0
;
assert
(
ctx
);
...
...
@@ -309,13 +310,20 @@ void cm_prepare_el3_exit(uint32_t security_state)
* EL2 present but unused, need to disable safely.
* SCTLR_EL2 can be ignored in this case.
*
* Initialise all fields in HCR_EL2, except HCR_EL2.RW,
* to zero so that Non-secure operations do not trap to
* EL2.
*
* HCR_EL2.RW: Set this field to match SCR_EL3.RW
* Set EL2 register width appropriately: Set HCR_EL2
* field to match SCR_EL3.RW.
*/
write_hcr_el2
((
scr_el3
&
SCR_RW_BIT
)
?
HCR_RW_BIT
:
0
);
if
(
scr_el3
&
SCR_RW_BIT
)
hcr_el2
|=
HCR_RW_BIT
;
/*
* For Armv8.3 pointer authentication feature, disable
* traps to EL2 when accessing key registers or using
* pointer authentication instructions from lower ELs.
*/
hcr_el2
|=
(
HCR_API_BIT
|
HCR_APK_BIT
);
write_hcr_el2
(
hcr_el2
);
/*
* Initialise CPTR_EL2 setting all fields rather than
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help