Karl Meakin | 5b2da50 | 2024-11-07 17:13:51 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2024 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 | #include "hf/vm.h" |
| 10 | |
Karl Meakin | 117c808 | 2024-12-04 16:03:28 +0000 | [diff] [blame^] | 11 | bool ffa_vm_supports_indirect_messages(struct vm *vm) |
Karl Meakin | 5b2da50 | 2024-11-07 17:13:51 +0000 | [diff] [blame] | 12 | { |
| 13 | return vm->ffa_version >= FFA_VERSION_1_1 && |
| 14 | vm_supports_messaging_method(vm, FFA_PARTITION_INDIRECT_MSG); |
| 15 | } |
| 16 | |
Karl Meakin | 117c808 | 2024-12-04 16:03:28 +0000 | [diff] [blame^] | 17 | bool ffa_vm_managed_exit_supported(struct vm *vm) |
Karl Meakin | 5b2da50 | 2024-11-07 17:13:51 +0000 | [diff] [blame] | 18 | { |
| 19 | (void)vm; |
| 20 | |
| 21 | return false; |
| 22 | } |
| 23 | |
Karl Meakin | 117c808 | 2024-12-04 16:03:28 +0000 | [diff] [blame^] | 24 | struct vm_locked ffa_vm_find_locked(ffa_id_t vm_id) |
Karl Meakin | 5b2da50 | 2024-11-07 17:13:51 +0000 | [diff] [blame] | 25 | { |
| 26 | if (vm_id_is_current_world(vm_id) || vm_id == HF_OTHER_WORLD_ID) { |
| 27 | return vm_find_locked(vm_id); |
| 28 | } |
| 29 | |
| 30 | return (struct vm_locked){.vm = NULL}; |
| 31 | } |
| 32 | |
Karl Meakin | 117c808 | 2024-12-04 16:03:28 +0000 | [diff] [blame^] | 33 | struct vm_locked ffa_vm_find_locked_create(ffa_id_t vm_id) |
Karl Meakin | 5b2da50 | 2024-11-07 17:13:51 +0000 | [diff] [blame] | 34 | { |
Karl Meakin | 117c808 | 2024-12-04 16:03:28 +0000 | [diff] [blame^] | 35 | return ffa_vm_find_locked(vm_id); |
Karl Meakin | 5b2da50 | 2024-11-07 17:13:51 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Karl Meakin | 117c808 | 2024-12-04 16:03:28 +0000 | [diff] [blame^] | 38 | bool ffa_vm_notifications_info_get( // NOLINTNEXTLINE |
Karl Meakin | 5b2da50 | 2024-11-07 17:13:51 +0000 | [diff] [blame] | 39 | uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE |
| 40 | uint32_t *lists_sizes, // NOLINTNEXTLINE |
| 41 | uint32_t *lists_count, const uint32_t ids_count_max) |
| 42 | { |
| 43 | (void)ids; |
| 44 | (void)ids_count; |
| 45 | (void)lists_sizes; |
| 46 | (void)lists_count; |
| 47 | (void)ids_count_max; |
| 48 | |
| 49 | return false; |
| 50 | } |
| 51 | |
Karl Meakin | 117c808 | 2024-12-04 16:03:28 +0000 | [diff] [blame^] | 52 | void ffa_vm_destroy(struct vm_locked to_destroy_locked) |
Karl Meakin | 5b2da50 | 2024-11-07 17:13:51 +0000 | [diff] [blame] | 53 | { |
| 54 | /* Hypervisor never frees VM structs. */ |
| 55 | (void)to_destroy_locked; |
| 56 | } |
| 57 | |
Karl Meakin | 117c808 | 2024-12-04 16:03:28 +0000 | [diff] [blame^] | 58 | void ffa_vm_free_resources(struct vm_locked vm_locked) |
Karl Meakin | 5b2da50 | 2024-11-07 17:13:51 +0000 | [diff] [blame] | 59 | { |
| 60 | (void)vm_locked; |
| 61 | } |