mirror of
https://github.com/CTCaer/switch-l4t-atf.git
synced 2024-11-30 21:30:25 +00:00
spm-mm: Refactor spm_svc.h and its contents
Change-Id: I91c192924433226b54d33e57d56d146c1c6df81b Signed-off-by: Paul Beesley <paul.beesley@arm.com>
This commit is contained in:
parent
aeaa225cbe
commit
0bf9f567a7
@ -308,8 +308,8 @@ allows the Secure Partition to:
|
||||
Miscellaneous interfaces
|
||||
------------------------
|
||||
|
||||
``SPM_VERSION_AARCH32``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
``SPM_MM_VERSION_AARCH32``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Description
|
||||
|
||||
@ -369,7 +369,7 @@ Secure Partition Initialisation
|
||||
The SPM is responsible for initialising the architectural execution context to
|
||||
enable initialisation of a service in S-EL0. The responsibilities of the SPM are
|
||||
listed below. At the end of initialisation, the partition issues a
|
||||
``SP_EVENT_COMPLETE_AARCH64`` call (described later) to signal readiness for
|
||||
``MM_SP_EVENT_COMPLETE_AARCH64`` call (described later) to signal readiness for
|
||||
handling requests for services implemented by the Secure Partition. The
|
||||
initialisation event is executed as a Fast Call.
|
||||
|
||||
@ -488,12 +488,12 @@ Runtime Event Delegation
|
||||
The SPM receives requests for Secure Partition services through a synchronous
|
||||
invocation (i.e. a SMC from the Non-secure world). These requests are delegated
|
||||
to the partition by programming a return from the last
|
||||
``SP_EVENT_COMPLETE_AARCH64`` call received from the partition. The last call
|
||||
``MM_SP_EVENT_COMPLETE_AARCH64`` call received from the partition. The last call
|
||||
was made to signal either completion of Secure Partition initialisation or
|
||||
completion of a partition service request.
|
||||
|
||||
``SP_EVENT_COMPLETE_AARCH64``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
``MM_SP_EVENT_COMPLETE_AARCH64``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Description
|
||||
|
||||
@ -569,7 +569,7 @@ completion of a partition service request.
|
||||
|
||||
- Caller responsibilities
|
||||
|
||||
A Secure Partition must only call ``SP_EVENT_COMPLETE_AARCH64`` to signal
|
||||
A Secure Partition must only call ``MM_SP_EVENT_COMPLETE_AARCH64`` to signal
|
||||
completion of a request that was delegated to it by the SPM.
|
||||
|
||||
- Callee responsibilities
|
||||
@ -613,18 +613,19 @@ data and code) will be known only when the file is loaded into memory.
|
||||
|
||||
In this case, the Secure Partition needs a way to change the access permissions
|
||||
of its memory regions. The SPM provides this feature through the
|
||||
``SP_MEMORY_ATTRIBUTES_SET_AARCH64`` SVC interface. This interface is available
|
||||
to the Secure Partition during a specific time window: from the first entry into
|
||||
the Secure Partition up to the first ``SP_EVENT_COMPLETE`` call that signals the
|
||||
Secure Partition has finished its initialisation. Once the initialisation is
|
||||
complete, the SPM does not allow changes to the memory attributes.
|
||||
``MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64`` SVC interface. This interface is
|
||||
available to the Secure Partition during a specific time window: from the first
|
||||
entry into the Secure Partition up to the first ``SP_EVENT_COMPLETE`` call that
|
||||
signals the Secure Partition has finished its initialisation. Once the
|
||||
initialisation is complete, the SPM does not allow changes to the memory
|
||||
attributes.
|
||||
|
||||
This section describes the standard SVC interface that is implemented by the SPM
|
||||
to determine and change permission attributes of memory regions that belong to a
|
||||
Secure Partition.
|
||||
|
||||
``SP_MEMORY_ATTRIBUTES_GET_AARCH64``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
``MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Description
|
||||
|
||||
@ -673,7 +674,7 @@ Secure Partition.
|
||||
- ``NOT_SUPPORTED`` : The SPM does not support retrieval of attributes of
|
||||
any memory page that is accessible by the Secure Partition, or the
|
||||
function was called from the Non-secure world. Also returned if it is
|
||||
used after ``SP_EVENT_COMPLETE_AARCH64``.
|
||||
used after ``MM_SP_EVENT_COMPLETE_AARCH64``.
|
||||
|
||||
See `Error Codes`_ for integer values that are associated with each return
|
||||
code.
|
||||
@ -696,8 +697,8 @@ Secure Partition.
|
||||
The SPM must not return the memory access controls for a page of memory that
|
||||
is not accessible from a Secure Partition.
|
||||
|
||||
``SP_MEMORY_ATTRIBUTES_SET_AARCH64``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
``MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Description
|
||||
|
||||
@ -762,7 +763,7 @@ Secure Partition.
|
||||
- ``NOT_SUPPORTED``: The SPM does not permit change of attributes of any
|
||||
memory region that is accessible by the Secure Partition. Function was
|
||||
called from the Non-secure world. Also returned if it is used after
|
||||
``SP_EVENT_COMPLETE_AARCH64``.
|
||||
``MM_SP_EVENT_COMPLETE_AARCH64``.
|
||||
|
||||
See `Error Codes`_ for integer values that are associated with each return
|
||||
code.
|
||||
@ -776,8 +777,8 @@ Secure Partition.
|
||||
currently supported.
|
||||
|
||||
This function is only available at boot time. This interface is revoked after
|
||||
the Secure Partition sends the first ``SP_EVENT_COMPLETE_AARCH64`` to signal
|
||||
that it is initialised and ready to receive run-time requests.
|
||||
the Secure Partition sends the first ``MM_SP_EVENT_COMPLETE_AARCH64`` to
|
||||
signal that it is initialised and ready to receive run-time requests.
|
||||
|
||||
- Caller responsibilities
|
||||
|
||||
|
88
include/services/spm_mm_svc.h
Normal file
88
include/services/spm_mm_svc.h
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef SPM_MM_SVC_H
|
||||
#define SPM_MM_SVC_H
|
||||
|
||||
#include <lib/utils_def.h>
|
||||
|
||||
#define SPM_MM_VERSION_MAJOR U(0)
|
||||
#define SPM_MM_VERSION_MAJOR_SHIFT 16
|
||||
#define SPM_MM_VERSION_MAJOR_MASK U(0x7FFF)
|
||||
#define SPM_MM_VERSION_MINOR U(1)
|
||||
#define SPM_MM_VERSION_MINOR_SHIFT 0
|
||||
#define SPM_MM_VERSION_MINOR_MASK U(0xFFFF)
|
||||
#define SPM_MM_VERSION_FORM(major, minor) ((major << \
|
||||
SPM_MM_VERSION_MAJOR_SHIFT) | \
|
||||
(minor))
|
||||
#define SPM_MM_VERSION_COMPILED SPM_MM_VERSION_FORM(SPM_MM_VERSION_MAJOR, \
|
||||
SPM_MM_VERSION_MINOR)
|
||||
|
||||
/* These macros are used to identify SPM-MM calls using the SMC function ID */
|
||||
#define SPM_MM_FID_MASK U(0xffff)
|
||||
#define SPM_MM_FID_MIN_VALUE U(0x40)
|
||||
#define SPM_MM_FID_MAX_VALUE U(0x7f)
|
||||
#define is_spm_mm_fid(_fid) \
|
||||
((((_fid) & SPM_MM_FID_MASK) >= SPM_MM_FID_MIN_VALUE) && \
|
||||
(((_fid) & SPM_MM_FID_MASK) <= SPM_MM_FID_MAX_VALUE))
|
||||
|
||||
/*
|
||||
* SMC IDs defined for accessing services implemented by the Secure Partition
|
||||
* Manager from the Secure Partition(s). These services enable a partition to
|
||||
* handle delegated events and request privileged operations from the manager.
|
||||
* They occupy the range 0x60-0x7f.
|
||||
*/
|
||||
#define SPM_MM_VERSION_AARCH32 U(0x84000060)
|
||||
#define MM_SP_EVENT_COMPLETE_AARCH64 U(0xC4000061)
|
||||
#define MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64 U(0xC4000064)
|
||||
#define MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64 U(0xC4000065)
|
||||
|
||||
/*
|
||||
* Macros used by MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64.
|
||||
*/
|
||||
|
||||
#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_NOACCESS U(0)
|
||||
#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_RW U(1)
|
||||
/* Value U(2) is reserved. */
|
||||
#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_RO U(3)
|
||||
#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_MASK U(3)
|
||||
#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_SHIFT 0
|
||||
|
||||
#define MM_SP_MEMORY_ATTRIBUTES_EXEC (U(0) << 2)
|
||||
#define MM_SP_MEMORY_ATTRIBUTES_NON_EXEC (U(1) << 2)
|
||||
|
||||
|
||||
/* SPM error codes. */
|
||||
#define SPM_MM_SUCCESS 0
|
||||
#define SPM_MM_NOT_SUPPORTED -1
|
||||
#define SPM_MM_INVALID_PARAMETER -2
|
||||
#define SPM_MM_DENIED -3
|
||||
#define SPM_MM_NO_MEMORY -5
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
int32_t spm_mm_setup(void);
|
||||
|
||||
uint64_t spm_mm_smc_handler(uint32_t smc_fid,
|
||||
uint64_t x1,
|
||||
uint64_t x2,
|
||||
uint64_t x3,
|
||||
uint64_t x4,
|
||||
void *cookie,
|
||||
void *handle,
|
||||
uint64_t flags);
|
||||
|
||||
/* Helper to enter a secure partition */
|
||||
uint64_t spm_mm_sp_call(uint32_t smc_fid,
|
||||
uint64_t x1,
|
||||
uint64_t x2,
|
||||
uint64_t x3);
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* SPM_MM_SVC_H */
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef SPM_SVC_H
|
||||
#define SPM_SVC_H
|
||||
|
||||
#include <lib/utils_def.h>
|
||||
|
||||
#define SPM_VERSION_MAJOR U(0)
|
||||
#define SPM_VERSION_MAJOR_SHIFT 16
|
||||
#define SPM_VERSION_MAJOR_MASK U(0x7FFF)
|
||||
#define SPM_VERSION_MINOR U(1)
|
||||
#define SPM_VERSION_MINOR_SHIFT 0
|
||||
#define SPM_VERSION_MINOR_MASK U(0xFFFF)
|
||||
#define SPM_VERSION_FORM(major, minor) ((major << SPM_VERSION_MAJOR_SHIFT) | (minor))
|
||||
#define SPM_VERSION_COMPILED SPM_VERSION_FORM(SPM_VERSION_MAJOR, SPM_VERSION_MINOR)
|
||||
|
||||
/* The macros below are used to identify SPM calls from the SMC function ID */
|
||||
#define SPM_FID_MASK U(0xffff)
|
||||
#define SPM_FID_MIN_VALUE U(0x40)
|
||||
#define SPM_FID_MAX_VALUE U(0x7f)
|
||||
#define is_spm_fid(_fid) \
|
||||
((((_fid) & SPM_FID_MASK) >= SPM_FID_MIN_VALUE) && \
|
||||
(((_fid) & SPM_FID_MASK) <= SPM_FID_MAX_VALUE))
|
||||
|
||||
/*
|
||||
* SMC IDs defined for accessing services implemented by the Secure Partition
|
||||
* Manager from the Secure Partition(s). These services enable a partition to
|
||||
* handle delegated events and request privileged operations from the manager.
|
||||
* They occupy the range 0x60-0x7f.
|
||||
*/
|
||||
#define SPM_VERSION_AARCH32 U(0x84000060)
|
||||
#define SP_EVENT_COMPLETE_AARCH64 U(0xC4000061)
|
||||
#define SP_MEMORY_ATTRIBUTES_GET_AARCH64 U(0xC4000064)
|
||||
#define SP_MEMORY_ATTRIBUTES_SET_AARCH64 U(0xC4000065)
|
||||
|
||||
/*
|
||||
* Macros used by SP_MEMORY_ATTRIBUTES_SET_AARCH64.
|
||||
*/
|
||||
|
||||
#define SP_MEMORY_ATTRIBUTES_ACCESS_NOACCESS U(0)
|
||||
#define SP_MEMORY_ATTRIBUTES_ACCESS_RW U(1)
|
||||
/* Value U(2) is reserved. */
|
||||
#define SP_MEMORY_ATTRIBUTES_ACCESS_RO U(3)
|
||||
#define SP_MEMORY_ATTRIBUTES_ACCESS_MASK U(3)
|
||||
#define SP_MEMORY_ATTRIBUTES_ACCESS_SHIFT 0
|
||||
|
||||
#define SP_MEMORY_ATTRIBUTES_EXEC (U(0) << 2)
|
||||
#define SP_MEMORY_ATTRIBUTES_NON_EXEC (U(1) << 2)
|
||||
|
||||
|
||||
/* SPM error codes. */
|
||||
#define SPM_SUCCESS 0
|
||||
#define SPM_NOT_SUPPORTED -1
|
||||
#define SPM_INVALID_PARAMETER -2
|
||||
#define SPM_DENIED -3
|
||||
#define SPM_NO_MEMORY -5
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
int32_t spm_setup(void);
|
||||
|
||||
uint64_t spm_smc_handler(uint32_t smc_fid,
|
||||
uint64_t x1,
|
||||
uint64_t x2,
|
||||
uint64_t x3,
|
||||
uint64_t x4,
|
||||
void *cookie,
|
||||
void *handle,
|
||||
uint64_t flags);
|
||||
|
||||
/* Helper to enter a Secure Partition */
|
||||
uint64_t spm_sp_call(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3);
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* SPM_SVC_H */
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
@ -14,7 +14,7 @@
|
||||
#include <plat/common/platform.h>
|
||||
#include <services/mm_svc.h>
|
||||
#include <services/sdei.h>
|
||||
#include <services/spm_svc.h>
|
||||
#include <services/spm_mm_svc.h>
|
||||
|
||||
#include <sgi_ras.h>
|
||||
|
||||
@ -142,11 +142,11 @@ static int sgi_ras_intr_handler(const struct err_record_info *err_rec,
|
||||
sizeof(ras_map->ras_ev_num));
|
||||
header->message_len = 4;
|
||||
|
||||
spm_sp_call(MM_COMMUNICATE_AARCH64, (uint64_t)header, 0,
|
||||
plat_my_core_pos());
|
||||
spm_mm_sp_call(MM_COMMUNICATE_AARCH64, (uint64_t)header, 0,
|
||||
plat_my_core_pos());
|
||||
|
||||
/*
|
||||
* Do an EOI of the RAS interuupt. This allows the
|
||||
* Do an EOI of the RAS interrupt. This allows the
|
||||
* sdei event to be dispatched at the SDEI event's
|
||||
* priority.
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <plat/common/platform.h>
|
||||
#include <services/mm_svc.h>
|
||||
#include <services/spm_mm_partition.h>
|
||||
#include <services/spm_svc.h>
|
||||
#include <services/spm_mm_svc.h>
|
||||
#include <smccc_helpers.h>
|
||||
|
||||
#include "spm_private.h"
|
||||
@ -157,7 +157,7 @@ static int32_t spm_init(void)
|
||||
/*******************************************************************************
|
||||
* Initialize contexts of all Secure Partitions.
|
||||
******************************************************************************/
|
||||
int32_t spm_setup(void)
|
||||
int32_t spm_mm_setup(void)
|
||||
{
|
||||
sp_context_t *ctx;
|
||||
|
||||
@ -185,7 +185,7 @@ int32_t spm_setup(void)
|
||||
/*******************************************************************************
|
||||
* Function to perform a call to a Secure Partition.
|
||||
******************************************************************************/
|
||||
uint64_t spm_sp_call(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3)
|
||||
uint64_t spm_mm_sp_call(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3)
|
||||
{
|
||||
uint64_t rc;
|
||||
sp_context_t *sp_ptr = &sp_ctx;
|
||||
@ -223,12 +223,12 @@ static uint64_t mm_communicate(uint32_t smc_fid, uint64_t mm_cookie,
|
||||
/* Cookie. Reserved for future use. It must be zero. */
|
||||
if (mm_cookie != 0U) {
|
||||
ERROR("MM_COMMUNICATE: cookie is not zero\n");
|
||||
SMC_RET1(handle, SPM_INVALID_PARAMETER);
|
||||
SMC_RET1(handle, SPM_MM_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
if (comm_buffer_address == 0U) {
|
||||
ERROR("MM_COMMUNICATE: comm_buffer_address is zero\n");
|
||||
SMC_RET1(handle, SPM_INVALID_PARAMETER);
|
||||
SMC_RET1(handle, SPM_MM_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
if (comm_size_address != 0U) {
|
||||
@ -251,8 +251,8 @@ static uint64_t mm_communicate(uint32_t smc_fid, uint64_t mm_cookie,
|
||||
/* Save the Normal world context */
|
||||
cm_el1_sysregs_context_save(NON_SECURE);
|
||||
|
||||
rc = spm_sp_call(smc_fid, comm_buffer_address, comm_size_address,
|
||||
plat_my_core_pos());
|
||||
rc = spm_mm_sp_call(smc_fid, comm_buffer_address, comm_size_address,
|
||||
plat_my_core_pos());
|
||||
|
||||
/* Restore non-secure state */
|
||||
cm_el1_sysregs_context_restore(NON_SECURE);
|
||||
@ -270,7 +270,7 @@ static uint64_t mm_communicate(uint32_t smc_fid, uint64_t mm_cookie,
|
||||
/*******************************************************************************
|
||||
* Secure Partition Manager SMC handler.
|
||||
******************************************************************************/
|
||||
uint64_t spm_smc_handler(uint32_t smc_fid,
|
||||
uint64_t spm_mm_smc_handler(uint32_t smc_fid,
|
||||
uint64_t x1,
|
||||
uint64_t x2,
|
||||
uint64_t x3,
|
||||
@ -295,29 +295,29 @@ uint64_t spm_smc_handler(uint32_t smc_fid,
|
||||
|
||||
switch (smc_fid) {
|
||||
|
||||
case SPM_VERSION_AARCH32:
|
||||
SMC_RET1(handle, SPM_VERSION_COMPILED);
|
||||
case SPM_MM_VERSION_AARCH32:
|
||||
SMC_RET1(handle, SPM_MM_VERSION_COMPILED);
|
||||
|
||||
case SP_EVENT_COMPLETE_AARCH64:
|
||||
case MM_SP_EVENT_COMPLETE_AARCH64:
|
||||
spm_sp_synchronous_exit(x1);
|
||||
|
||||
case SP_MEMORY_ATTRIBUTES_GET_AARCH64:
|
||||
INFO("Received SP_MEMORY_ATTRIBUTES_GET_AARCH64 SMC\n");
|
||||
case MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64:
|
||||
INFO("Received MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64 SMC\n");
|
||||
|
||||
if (sp_ctx.state != SP_STATE_RESET) {
|
||||
WARN("SP_MEMORY_ATTRIBUTES_GET_AARCH64 is available at boot time only\n");
|
||||
SMC_RET1(handle, SPM_NOT_SUPPORTED);
|
||||
WARN("MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64 is available at boot time only\n");
|
||||
SMC_RET1(handle, SPM_MM_NOT_SUPPORTED);
|
||||
}
|
||||
SMC_RET1(handle,
|
||||
spm_memory_attributes_get_smc_handler(
|
||||
&sp_ctx, x1));
|
||||
|
||||
case SP_MEMORY_ATTRIBUTES_SET_AARCH64:
|
||||
INFO("Received SP_MEMORY_ATTRIBUTES_SET_AARCH64 SMC\n");
|
||||
case MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64:
|
||||
INFO("Received MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64 SMC\n");
|
||||
|
||||
if (sp_ctx.state != SP_STATE_RESET) {
|
||||
WARN("SP_MEMORY_ATTRIBUTES_SET_AARCH64 is available at boot time only\n");
|
||||
SMC_RET1(handle, SPM_NOT_SUPPORTED);
|
||||
WARN("MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64 is available at boot time only\n");
|
||||
SMC_RET1(handle, SPM_MM_NOT_SUPPORTED);
|
||||
}
|
||||
SMC_RET1(handle,
|
||||
spm_memory_attributes_set_smc_handler(
|
||||
@ -340,10 +340,10 @@ uint64_t spm_smc_handler(uint32_t smc_fid,
|
||||
case MM_COMMUNICATE_AARCH64:
|
||||
return mm_communicate(smc_fid, x1, x2, x3, handle);
|
||||
|
||||
case SP_MEMORY_ATTRIBUTES_GET_AARCH64:
|
||||
case SP_MEMORY_ATTRIBUTES_SET_AARCH64:
|
||||
case MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64:
|
||||
case MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64:
|
||||
/* SMC interfaces reserved for secure callers. */
|
||||
SMC_RET1(handle, SPM_NOT_SUPPORTED);
|
||||
SMC_RET1(handle, SPM_MM_NOT_SUPPORTED);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <platform_def.h>
|
||||
#include <plat/common/platform.h>
|
||||
#include <services/spm_mm_partition.h>
|
||||
#include <services/spm_svc.h>
|
||||
#include <services/spm_mm_svc.h>
|
||||
|
||||
#include "spm_private.h"
|
||||
#include "spm_shim_private.h"
|
||||
@ -50,21 +50,21 @@ static unsigned int smc_attr_to_mmap_attr(unsigned int attributes)
|
||||
{
|
||||
unsigned int tf_attr = 0U;
|
||||
|
||||
unsigned int access = (attributes & SP_MEMORY_ATTRIBUTES_ACCESS_MASK)
|
||||
>> SP_MEMORY_ATTRIBUTES_ACCESS_SHIFT;
|
||||
unsigned int access = (attributes & MM_SP_MEMORY_ATTRIBUTES_ACCESS_MASK)
|
||||
>> MM_SP_MEMORY_ATTRIBUTES_ACCESS_SHIFT;
|
||||
|
||||
if (access == SP_MEMORY_ATTRIBUTES_ACCESS_RW) {
|
||||
if (access == MM_SP_MEMORY_ATTRIBUTES_ACCESS_RW) {
|
||||
tf_attr |= MT_RW | MT_USER;
|
||||
} else if (access == SP_MEMORY_ATTRIBUTES_ACCESS_RO) {
|
||||
} else if (access == MM_SP_MEMORY_ATTRIBUTES_ACCESS_RO) {
|
||||
tf_attr |= MT_RO | MT_USER;
|
||||
} else {
|
||||
/* Other values are reserved. */
|
||||
assert(access == SP_MEMORY_ATTRIBUTES_ACCESS_NOACCESS);
|
||||
assert(access == MM_SP_MEMORY_ATTRIBUTES_ACCESS_NOACCESS);
|
||||
/* The only requirement is that there's no access from EL0 */
|
||||
tf_attr |= MT_RO | MT_PRIVILEGED;
|
||||
}
|
||||
|
||||
if ((attributes & SP_MEMORY_ATTRIBUTES_NON_EXEC) == 0) {
|
||||
if ((attributes & MM_SP_MEMORY_ATTRIBUTES_NON_EXEC) == 0) {
|
||||
tf_attr |= MT_EXECUTE;
|
||||
} else {
|
||||
tf_attr |= MT_EXECUTE_NEVER;
|
||||
@ -85,21 +85,21 @@ static unsigned int smc_mmap_to_smc_attr(unsigned int attr)
|
||||
|
||||
if ((attr & MT_USER) == 0) {
|
||||
/* No access from EL0. */
|
||||
data_access = SP_MEMORY_ATTRIBUTES_ACCESS_NOACCESS;
|
||||
data_access = MM_SP_MEMORY_ATTRIBUTES_ACCESS_NOACCESS;
|
||||
} else {
|
||||
if ((attr & MT_RW) != 0) {
|
||||
assert(MT_TYPE(attr) != MT_DEVICE);
|
||||
data_access = SP_MEMORY_ATTRIBUTES_ACCESS_RW;
|
||||
data_access = MM_SP_MEMORY_ATTRIBUTES_ACCESS_RW;
|
||||
} else {
|
||||
data_access = SP_MEMORY_ATTRIBUTES_ACCESS_RO;
|
||||
data_access = MM_SP_MEMORY_ATTRIBUTES_ACCESS_RO;
|
||||
}
|
||||
}
|
||||
|
||||
smc_attr |= (data_access & SP_MEMORY_ATTRIBUTES_ACCESS_MASK)
|
||||
<< SP_MEMORY_ATTRIBUTES_ACCESS_SHIFT;
|
||||
smc_attr |= (data_access & MM_SP_MEMORY_ATTRIBUTES_ACCESS_MASK)
|
||||
<< MM_SP_MEMORY_ATTRIBUTES_ACCESS_SHIFT;
|
||||
|
||||
if ((attr & MT_EXECUTE_NEVER) != 0U) {
|
||||
smc_attr |= SP_MEMORY_ATTRIBUTES_NON_EXEC;
|
||||
smc_attr |= MM_SP_MEMORY_ATTRIBUTES_NON_EXEC;
|
||||
}
|
||||
|
||||
return smc_attr;
|
||||
@ -123,7 +123,7 @@ int32_t spm_memory_attributes_get_smc_handler(sp_context_t *sp_ctx,
|
||||
if (rc == 0) {
|
||||
return (int32_t) smc_mmap_to_smc_attr(attributes);
|
||||
} else {
|
||||
return SPM_INVALID_PARAMETER;
|
||||
return SPM_MM_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,5 +151,5 @@ int spm_memory_attributes_set_smc_handler(sp_context_t *sp_ctx,
|
||||
/* Convert error codes of xlat_change_mem_attributes_ctx() into SPM. */
|
||||
assert((ret == 0) || (ret == -EINVAL));
|
||||
|
||||
return (ret == 0) ? SPM_SUCCESS : SPM_INVALID_PARAMETER;
|
||||
return (ret == 0) ? SPM_MM_SUCCESS : SPM_MM_INVALID_PARAMETER;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <lib/psci/psci.h>
|
||||
#include <lib/runtime_instr.h>
|
||||
#include <services/sdei.h>
|
||||
#include <services/spm_svc.h>
|
||||
#include <services/spm_mm_svc.h>
|
||||
#include <services/std_svc.h>
|
||||
#include <smccc_helpers.h>
|
||||
#include <tools_share/uuid.h>
|
||||
@ -46,7 +46,7 @@ static int32_t std_svc_setup(void)
|
||||
}
|
||||
|
||||
#if SPM_MM
|
||||
if (spm_setup() != 0) {
|
||||
if (spm_mm_setup() != 0) {
|
||||
ret = 1;
|
||||
}
|
||||
#endif
|
||||
@ -108,9 +108,9 @@ static uintptr_t std_svc_smc_handler(uint32_t smc_fid,
|
||||
* Dispatch SPM calls to SPM SMC handler and return its return
|
||||
* value
|
||||
*/
|
||||
if (is_spm_fid(smc_fid)) {
|
||||
return spm_smc_handler(smc_fid, x1, x2, x3, x4, cookie,
|
||||
handle, flags);
|
||||
if (is_spm_mm_fid(smc_fid)) {
|
||||
return spm_mm_smc_handler(smc_fid, x1, x2, x3, x4, cookie,
|
||||
handle, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user