xref: /arm-trusted-firmware/plat/arm/board/fvp/fvp_el3_spmc.c (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu /*
2*91f16700Schasinglulu  * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
3*91f16700Schasinglulu  *
4*91f16700Schasinglulu  * SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu  */
6*91f16700Schasinglulu #include <services/el3_spmc_ffa_memory.h>
7*91f16700Schasinglulu 
8*91f16700Schasinglulu #include <platform_def.h>
9*91f16700Schasinglulu 
10*91f16700Schasinglulu /*
11*91f16700Schasinglulu  * On the FVP platform when using the EL3 SPMC implementation allocate the
12*91f16700Schasinglulu  * datastore for tracking shared memory descriptors in the TZC DRAM section
13*91f16700Schasinglulu  * to ensure sufficient storage can be allocated.
14*91f16700Schasinglulu  * Provide an implementation of the accessor method to allow the datastore
15*91f16700Schasinglulu  * details to be retrieved by the SPMC.
16*91f16700Schasinglulu  * The SPMC will take care of initializing the memory region.
17*91f16700Schasinglulu  */
18*91f16700Schasinglulu 
19*91f16700Schasinglulu #define PLAT_SPMC_SHMEM_DATASTORE_SIZE 512 * 1024
20*91f16700Schasinglulu 
21*91f16700Schasinglulu __section(".arm_el3_tzc_dram") static uint8_t
22*91f16700Schasinglulu plat_spmc_shmem_datastore[PLAT_SPMC_SHMEM_DATASTORE_SIZE];
23*91f16700Schasinglulu 
24*91f16700Schasinglulu int plat_spmc_shmem_datastore_get(uint8_t **datastore, size_t *size)
25*91f16700Schasinglulu {
26*91f16700Schasinglulu 	*datastore = plat_spmc_shmem_datastore;
27*91f16700Schasinglulu 	*size = PLAT_SPMC_SHMEM_DATASTORE_SIZE;
28*91f16700Schasinglulu 	return 0;
29*91f16700Schasinglulu }
30*91f16700Schasinglulu 
31*91f16700Schasinglulu /*
32*91f16700Schasinglulu  * Add dummy implementations of memory management related platform hooks.
33*91f16700Schasinglulu  * These can be used to implement platform specific functionality to support
34*91f16700Schasinglulu  * a memory sharing/lending operation.
35*91f16700Schasinglulu  *
36*91f16700Schasinglulu  * Note: The hooks must be located as part of the initial share request and
37*91f16700Schasinglulu  * final reclaim to prevent order dependencies with operations that may take
38*91f16700Schasinglulu  * place in the normal world without visibility of the SPMC.
39*91f16700Schasinglulu  */
40*91f16700Schasinglulu int plat_spmc_shmem_begin(struct ffa_mtd *desc)
41*91f16700Schasinglulu {
42*91f16700Schasinglulu 	return 0;
43*91f16700Schasinglulu }
44*91f16700Schasinglulu int plat_spmc_shmem_reclaim(struct ffa_mtd *desc)
45*91f16700Schasinglulu {
46*91f16700Schasinglulu 	return 0;
47*91f16700Schasinglulu }
48