Skip to content
GitLab
Menu
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
07f40001
Commit
07f40001
authored
May 08, 2017
by
davidcunado-arm
Committed by
GitHub
May 08, 2017
Browse files
Merge pull request #922 from davidcunado-arm/dc/smc_yielding_spds
Migrate secure payload dispatchers to new SMC terminology
parents
5e623277
bbbbcdae
Changes
8
Hide whitespace changes
Inline
Side-by-side
include/bl32/payloads/tlk.h
View file @
07f40001
...
...
@@ -12,18 +12,18 @@
/*
* Generate function IDs for the Trusted OS/Apps
*/
#define TLK_TOS_
ST
D_FID(fid) ((fid) | 0x72000000 | (0 << 31))
#define TLK_TA_
ST
D_FID(fid) ((fid) | 0x70000000 | (0 << 31))
#define TLK_TOS_
YIEL
D_FID(fid) ((fid) | 0x72000000 | (0 << 31))
#define TLK_TA_
YIEL
D_FID(fid) ((fid) | 0x70000000 | (0 << 31))
/*
* Trusted OS specific function IDs
*/
#define TLK_REGISTER_LOGBUF TLK_TOS_
ST
D_FID(0x1)
#define TLK_REGISTER_REQBUF TLK_TOS_
ST
D_FID(0x2)
#define TLK_RESUME_FID TLK_TOS_
ST
D_FID(0x100)
#define TLK_SYSTEM_SUSPEND TLK_TOS_
ST
D_FID(0xE001)
#define TLK_SYSTEM_RESUME TLK_TOS_
ST
D_FID(0xE002)
#define TLK_SYSTEM_OFF TLK_TOS_
ST
D_FID(0xE003)
#define TLK_REGISTER_LOGBUF TLK_TOS_
YIEL
D_FID(0x1)
#define TLK_REGISTER_REQBUF TLK_TOS_
YIEL
D_FID(0x2)
#define TLK_RESUME_FID TLK_TOS_
YIEL
D_FID(0x100)
#define TLK_SYSTEM_SUSPEND TLK_TOS_
YIEL
D_FID(0xE001)
#define TLK_SYSTEM_RESUME TLK_TOS_
YIEL
D_FID(0xE002)
#define TLK_SYSTEM_OFF TLK_TOS_
YIEL
D_FID(0xE003)
/*
* SMC function IDs that TLK uses to signal various forms of completions
...
...
@@ -40,10 +40,10 @@
/*
* Trusted Application specific function IDs
*/
#define TLK_OPEN_TA_SESSION TLK_TA_
ST
D_FID(0x1)
#define TLK_CLOSE_TA_SESSION TLK_TA_
ST
D_FID(0x2)
#define TLK_TA_LAUNCH_OP TLK_TA_
ST
D_FID(0x3)
#define TLK_TA_SEND_EVENT TLK_TA_
ST
D_FID(0x4)
#define TLK_OPEN_TA_SESSION TLK_TA_
YIEL
D_FID(0x1)
#define TLK_CLOSE_TA_SESSION TLK_TA_
YIEL
D_FID(0x2)
#define TLK_TA_LAUNCH_OP TLK_TA_
YIEL
D_FID(0x3)
#define TLK_TA_SEND_EVENT TLK_TA_
YIEL
D_FID(0x4)
/*
* Total number of function IDs implemented for services offered to NS clients.
...
...
services/spd/opteed/opteed_main.c
View file @
07f40001
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-201
7
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -235,7 +235,7 @@ uint64_t opteed_smc_handler(uint32_t smc_fid,
&
optee_vectors
->
fast_smc_entry
);
}
else
{
cm_set_elr_el3
(
SECURE
,
(
uint64_t
)
&
optee_vectors
->
st
d_smc_entry
);
&
optee_vectors
->
yiel
d_smc_entry
);
}
cm_el1_sysregs_context_restore
(
SECURE
);
...
...
@@ -401,13 +401,13 @@ DECLARE_RT_SVC(
opteed_smc_handler
);
/* Define an OPTEED runtime service descriptor for
standard
SMC calls */
/* Define an OPTEED runtime service descriptor for
yielding
SMC calls */
DECLARE_RT_SVC
(
opteed_std
,
OEN_TOS_START
,
OEN_TOS_END
,
SMC_TYPE_
ST
D
,
SMC_TYPE_
YIEL
D
,
NULL
,
opteed_smc_handler
);
services/spd/opteed/opteed_private.h
View file @
07f40001
/*
* Copyright (c) 2013-201
4
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-201
7
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -86,7 +86,7 @@
typedef
uint32_t
optee_vector_isn_t
;
typedef
struct
optee_vectors
{
optee_vector_isn_t
st
d_smc_entry
;
optee_vector_isn_t
yiel
d_smc_entry
;
optee_vector_isn_t
fast_smc_entry
;
optee_vector_isn_t
cpu_on_entry
;
optee_vector_isn_t
cpu_off_entry
;
...
...
services/spd/tlkd/tlkd_common.c
View file @
07f40001
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015
-2017
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -88,7 +88,7 @@ void tlkd_init_tlk_ep_state(struct entry_point_info *tlk_entry_point,
/* Associate this context with the cpu specified */
tlk_ctx
->
mpidr
=
read_mpidr_el1
();
clr_
st
d_smc_active_flag
(
tlk_ctx
->
state
);
clr_
yiel
d_smc_active_flag
(
tlk_ctx
->
state
);
cm_set_context
(
&
tlk_ctx
->
cpu_ctx
,
SECURE
);
if
(
rw
==
SP_AARCH64
)
...
...
services/spd/tlkd/tlkd_main.c
View file @
07f40001
/*
* Copyright (c) 2015-201
6
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -195,7 +195,7 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid,
* Applications.
* c. open/close sessions
* d. issue commands to the Trusted Apps
* e. resume the preempted
standard
SMC call.
* e. resume the preempted
yielding
SMC call.
*/
case
TLK_REGISTER_LOGBUF
:
case
TLK_REGISTER_REQBUF
:
...
...
@@ -217,15 +217,15 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid,
assert
(
handle
==
cm_get_context
(
NON_SECURE
));
/*
* Check if we are already processing a
standard
SMC
* Check if we are already processing a
yielding
SMC
* call. Of all the supported fids, only the "resume"
* fid expects the flag to be set.
*/
if
(
smc_fid
==
TLK_RESUME_FID
)
{
if
(
!
get_
st
d_smc_active_flag
(
tlk_ctx
.
state
))
if
(
!
get_
yiel
d_smc_active_flag
(
tlk_ctx
.
state
))
SMC_RET1
(
handle
,
SMC_UNK
);
}
else
{
if
(
get_
st
d_smc_active_flag
(
tlk_ctx
.
state
))
if
(
get_
yiel
d_smc_active_flag
(
tlk_ctx
.
state
))
SMC_RET1
(
handle
,
SMC_UNK
);
}
...
...
@@ -239,7 +239,7 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid,
/*
* Mark the SP state as active.
*/
set_
st
d_smc_active_flag
(
tlk_ctx
.
state
);
set_
yiel
d_smc_active_flag
(
tlk_ctx
.
state
);
/*
* We are done stashing the non-secure context. Ask the
...
...
@@ -298,7 +298,7 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid,
/*
* This is a request from the SP to mark completion of
* a
standard
function ID.
* a
yielding
function ID.
*/
case
TLK_REQUEST_DONE
:
if
(
ns
)
...
...
@@ -307,7 +307,7 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid,
/*
* Mark the SP state as inactive.
*/
clr_
st
d_smc_active_flag
(
tlk_ctx
.
state
);
clr_
yiel
d_smc_active_flag
(
tlk_ctx
.
state
);
/* Get a reference to the non-secure context */
ns_cpu_context
=
cm_get_context
(
NON_SECURE
);
...
...
@@ -411,13 +411,13 @@ DECLARE_RT_SVC(
tlkd_smc_handler
);
/* Define a SPD runtime service descriptor for
standard
SMC calls */
/* Define a SPD runtime service descriptor for
yielding
SMC calls */
DECLARE_RT_SVC
(
tlkd_tos_std
,
OEN_TOS_START
,
OEN_TOS_END
,
SMC_TYPE_
ST
D
,
SMC_TYPE_
YIEL
D
,
NULL
,
tlkd_smc_handler
);
...
...
@@ -433,13 +433,13 @@ DECLARE_RT_SVC(
tlkd_smc_handler
);
/* Define a SPD runtime service descriptor for
standard
SMC calls */
/* Define a SPD runtime service descriptor for
yielding
SMC calls */
DECLARE_RT_SVC
(
tlkd_tap_std
,
OEN_TAP_START
,
OEN_TAP_END
,
SMC_TYPE_
ST
D
,
SMC_TYPE_
YIEL
D
,
NULL
,
tlkd_smc_handler
);
services/spd/tlkd/tlkd_private.h
View file @
07f40001
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015
-2017
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -14,7 +14,7 @@
#include <psci.h>
/*
* This flag is used by the TLKD to determine if the SP is servicing a
standard
* This flag is used by the TLKD to determine if the SP is servicing a
yielding
* SMC request prior to programming the next entry into the SP e.g. if SP
* execution is preempted by a non-secure interrupt and handed control to the
* normal world. If another request which is distinct from what the SP was
...
...
@@ -22,15 +22,16 @@
* reject the new request or service it while ensuring that the previous context
* is not corrupted.
*/
#define STD_SMC_ACTIVE_FLAG_SHIFT 2
#define STD_SMC_ACTIVE_FLAG_MASK 1
#define get_std_smc_active_flag(state) (((state) >> STD_SMC_ACTIVE_FLAG_SHIFT) \
& STD_SMC_ACTIVE_FLAG_MASK)
#define set_std_smc_active_flag(state) ((state) |= \
(1 << STD_SMC_ACTIVE_FLAG_SHIFT))
#define clr_std_smc_active_flag(state) ((state) &= \
~(STD_SMC_ACTIVE_FLAG_MASK \
<< STD_SMC_ACTIVE_FLAG_SHIFT))
#define YIELD_SMC_ACTIVE_FLAG_SHIFT 2
#define YIELD_SMC_ACTIVE_FLAG_MASK 1
#define get_yield_smc_active_flag(state) \
(((state) >> YIELD_SMC_ACTIVE_FLAG_SHIFT) \
& YIELD_SMC_ACTIVE_FLAG_MASK)
#define set_yield_smc_active_flag(state) ((state) |= \
(1 << YIELD_SMC_ACTIVE_FLAG_SHIFT))
#define clr_yield_smc_active_flag(state) ((state) &= \
~(YIELD_SMC_ACTIVE_FLAG_MASK \
<< YIELD_SMC_ACTIVE_FLAG_SHIFT))
/*******************************************************************************
* Translate virtual address received from the NS world
...
...
services/spd/trusty/smcall.h
View file @
07f40001
...
...
@@ -24,9 +24,9 @@
)
#define SMC_FASTCALL_NR(entity, fn) SMC_NR((entity), (fn), 1, 0)
#define SMC_STDCALL_NR(entity, fn) SMC_NR((entity), (fn), 0, 0)
#define SMC_FASTCALL64_NR(entity, fn) SMC_NR((entity), (fn), 1, 1)
#define SMC_STDCALL64_NR(entity, fn) SMC_NR((entity), (fn), 0, 1)
#define SMC_YIELDCALL_NR(entity, fn) SMC_NR((entity), (fn), 0, 0)
#define SMC_YIELDCALL64_NR(entity, fn) SMC_NR((entity), (fn), 0, 1)
#define SMC_ENTITY_ARCH 0
/* ARM Architecture calls */
#define SMC_ENTITY_CPU 1
/* CPU Service calls */
...
...
@@ -39,14 +39,14 @@
#define SMC_ENTITY_LOGGING 51
/* Used for secure -> nonsecure logging */
#define SMC_ENTITY_SECURE_MONITOR 60
/* Trusted OS calls internal to secure monitor */
/* FC = Fast call,
S
C =
Standard
call */
#define SMC_
S
C_RESTART_LAST SMC_
ST
DCALL_NR (SMC_ENTITY_SECURE_MONITOR, 0)
#define SMC_
S
C_NOP SMC_
ST
DCALL_NR (SMC_ENTITY_SECURE_MONITOR, 1)
/* FC = Fast call,
Y
C =
Yielding
call */
#define SMC_
Y
C_RESTART_LAST SMC_
YIEL
DCALL_NR (SMC_ENTITY_SECURE_MONITOR, 0)
#define SMC_
Y
C_NOP SMC_
YIEL
DCALL_NR (SMC_ENTITY_SECURE_MONITOR, 1)
/*
* Return from secure os to non-secure os with return value in r1
*/
#define SMC_
S
C_NS_RETURN SMC_
ST
DCALL_NR (SMC_ENTITY_SECURE_MONITOR, 0)
#define SMC_
Y
C_NS_RETURN SMC_
YIEL
DCALL_NR (SMC_ENTITY_SECURE_MONITOR, 0)
#define SMC_FC_RESERVED SMC_FASTCALL_NR (SMC_ENTITY_SECURE_MONITOR, 0)
#define SMC_FC_FIQ_EXIT SMC_FASTCALL_NR (SMC_ENTITY_SECURE_MONITOR, 1)
...
...
@@ -64,12 +64,12 @@
#define SMC_FC_GET_VERSION_STR SMC_FASTCALL_NR (SMC_ENTITY_SECURE_MONITOR, 10)
/* Trusted OS entity calls */
#define SMC_
S
C_VIRTIO_GET_DESCR SMC_
ST
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 20)
#define SMC_
S
C_VIRTIO_START SMC_
ST
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 21)
#define SMC_
S
C_VIRTIO_STOP SMC_
ST
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 22)
#define SMC_
Y
C_VIRTIO_GET_DESCR SMC_
YIEL
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 20)
#define SMC_
Y
C_VIRTIO_START SMC_
YIEL
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 21)
#define SMC_
Y
C_VIRTIO_STOP SMC_
YIEL
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 22)
#define SMC_
S
C_VDEV_RESET SMC_
ST
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 23)
#define SMC_
S
C_VDEV_KICK_VQ SMC_
ST
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 24)
#define SMC_
S
C_SET_ROT_PARAMS SMC_
ST
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 65535)
#define SMC_
Y
C_VDEV_RESET SMC_
YIEL
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 23)
#define SMC_
Y
C_VDEV_KICK_VQ SMC_
YIEL
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 24)
#define SMC_
Y
C_SET_ROT_PARAMS SMC_
YIEL
DCALL_NR(SMC_ENTITY_TRUSTED_OS, 65535)
#endif
/* __LIB_SM_SMCALL_H */
services/spd/trusty/trusty.c
View file @
07f40001
...
...
@@ -221,14 +221,14 @@ static uint64_t trusty_smc_handler(uint32_t smc_fid,
* Verified Boot is not even supported and returning success here
* would not compromise the boot process.
*/
if
(
!
ep_info
&&
(
smc_fid
==
SMC_
S
C_SET_ROT_PARAMS
))
{
if
(
!
ep_info
&&
(
smc_fid
==
SMC_
Y
C_SET_ROT_PARAMS
))
{
SMC_RET1
(
handle
,
0
);
}
else
if
(
!
ep_info
)
{
SMC_RET1
(
handle
,
SMC_UNK
);
}
if
(
is_caller_secure
(
flags
))
{
if
(
smc_fid
==
SMC_
S
C_NS_RETURN
)
{
if
(
smc_fid
==
SMC_
Y
C_NS_RETURN
)
{
ret
=
trusty_context_switch
(
SECURE
,
x1
,
0
,
0
,
0
);
SMC_RET8
(
handle
,
ret
.
r0
,
ret
.
r1
,
ret
.
r2
,
ret
.
r3
,
ret
.
r4
,
ret
.
r5
,
ret
.
r6
,
ret
.
r7
);
...
...
@@ -424,13 +424,13 @@ DECLARE_RT_SVC(
trusty_smc_handler
);
/* Define a SPD runtime service descriptor for
standard
SMC calls */
/* Define a SPD runtime service descriptor for
yielding
SMC calls */
DECLARE_RT_SVC
(
trusty_std
,
OEN_TAP_START
,
SMC_ENTITY_SECURE_MONITOR
,
SMC_TYPE_
ST
D
,
SMC_TYPE_
YIEL
D
,
NULL
,
trusty_smc_handler
);
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