Daniel Boulby | b2fb80e | 2021-02-03 15:09:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2021 The Hafnium Authors. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style |
| 5 | * license that can be found in the LICENSE file or at |
| 6 | * https://opensource.org/licenses/BSD-3-Clause. |
| 7 | */ |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "hf/ffa.h" |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 12 | #include "hf/vcpu.h" |
Daniel Boulby | b2fb80e | 2021-02-03 15:09:23 +0000 | [diff] [blame] | 13 | |
| 14 | /** Returns the SPMC ID. */ |
| 15 | struct ffa_value plat_ffa_spmc_id_get(void); |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 16 | |
| 17 | void plat_ffa_log_init(void); |
| 18 | void plat_ffa_init(bool tee_enabled); |
| 19 | bool plat_ffa_is_direct_request_valid(struct vcpu *current, |
| 20 | ffa_vm_id_t sender_vm_id, |
| 21 | ffa_vm_id_t receiver_vm_id); |
| 22 | bool plat_ffa_is_direct_response_valid(struct vcpu *current, |
| 23 | ffa_vm_id_t sender_vm_id, |
| 24 | ffa_vm_id_t receiver_vm_id); |
| 25 | bool plat_ffa_direct_request_forward(ffa_vm_id_t receiver_vm_id, |
| 26 | struct ffa_value args, |
| 27 | struct ffa_value *ret); |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame^] | 28 | bool plat_ffa_is_notifications_create_valid(struct vcpu *current, |
| 29 | ffa_vm_id_t vm_id); |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 30 | /** |
Maksims Svecovs | 9ddf86a | 2021-05-06 17:17:21 +0100 | [diff] [blame] | 31 | * Checks whether managed exit is supported by given SP. |
| 32 | */ |
| 33 | bool plat_ffa_vm_managed_exit_supported(struct vm *vm); |
| 34 | |
| 35 | /** |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 36 | * Encodes memory handle according to section 5.10.2 of the FF-A v1.0 spec. |
| 37 | */ |
| 38 | ffa_memory_handle_t plat_ffa_memory_handle_make(uint64_t index); |
| 39 | |
| 40 | /** |
| 41 | * Checks whether given handle was allocated by current world, according to |
| 42 | * handle encoding rules. |
| 43 | */ |
| 44 | bool plat_ffa_memory_handle_allocated_by_current_world( |
| 45 | ffa_memory_handle_t handle); |
Maksims Svecovs | b596eab | 2021-04-27 00:52:27 +0100 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | * Return the FF-A partition info VM/SP properties given the VM id. |
| 49 | */ |
| 50 | ffa_partition_properties_t plat_ffa_partition_properties( |
| 51 | ffa_vm_id_t current_id, const struct vm *target); |
J-Alves | 4ef6e84 | 2021-03-18 12:47:01 +0000 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * Initializes the NWd VM structures for Notifications support. |
| 55 | */ |
| 56 | void plat_ffa_vm_init(void); |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame^] | 57 | |
| 58 | /** |
| 59 | * Get NWd VM's structure. |
| 60 | */ |
| 61 | struct vm_locked plat_ffa_vm_find_locked(ffa_vm_id_t vm_id); |
| 62 | |
| 63 | /** |
| 64 | * Creates a bitmap for the VM of the given ID. |
| 65 | */ |
| 66 | struct ffa_value plat_ffa_notifications_bitmap_create( |
| 67 | ffa_vm_id_t vm_id, ffa_vcpu_count_t vcpu_count); |
| 68 | |
| 69 | /** |
| 70 | * Destroys the notifications bitmap for the given VM ID. |
| 71 | */ |
| 72 | struct ffa_value plat_ffa_notifications_bitmap_destroy(ffa_vm_id_t vm_id); |