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