Marc Bonnici | c66fc1b | 2021-12-16 18:31:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
Marc Bonnici | 503320e | 2022-02-21 15:02:36 +0000 | [diff] [blame] | 6 | #include <services/el3_spmc_ffa_memory.h> |
Marc Bonnici | c66fc1b | 2021-12-16 18:31:02 +0000 | [diff] [blame] | 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 | |
Chris Kay | 33bfc5e | 2023-02-14 11:30:04 +0000 | [diff] [blame] | 21 | __section(".arm_el3_tzc_dram") static uint8_t |
Marc Bonnici | c66fc1b | 2021-12-16 18:31:02 +0000 | [diff] [blame] | 22 | plat_spmc_shmem_datastore[PLAT_SPMC_SHMEM_DATASTORE_SIZE]; |
| 23 | |
| 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 | } |
Marc Bonnici | 503320e | 2022-02-21 15:02:36 +0000 | [diff] [blame] | 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 | */ |
| 40 | int plat_spmc_shmem_begin(struct ffa_mtd *desc) |
| 41 | { |
| 42 | return 0; |
| 43 | } |
| 44 | int plat_spmc_shmem_reclaim(struct ffa_mtd *desc) |
| 45 | { |
| 46 | return 0; |
| 47 | } |