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 
ffa_vm_supports_indirect_messages(struct vm * vm)11 bool ffa_vm_supports_indirect_messages(struct vm *vm)
12 {
13 	return vm->ffa_version >= FFA_VERSION_1_1 &&
14 	       vm_supports_messaging_method(vm, FFA_PARTITION_INDIRECT_MSG);
15 }
16 
ffa_vm_managed_exit_supported(struct vm * vm)17 bool ffa_vm_managed_exit_supported(struct vm *vm)
18 {
19 	(void)vm;
20 
21 	return false;
22 }
23 
ffa_vm_find_locked(ffa_id_t vm_id)24 struct vm_locked ffa_vm_find_locked(ffa_id_t vm_id)
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 
ffa_vm_find_locked_create(ffa_id_t vm_id)33 struct vm_locked ffa_vm_find_locked_create(ffa_id_t vm_id)
34 {
35 	return ffa_vm_find_locked(vm_id);
36 }
37 
ffa_vm_notifications_info_get(uint16_t * ids,uint32_t * ids_count,uint32_t * lists_sizes,uint32_t * lists_count,const uint32_t ids_count_max)38 bool ffa_vm_notifications_info_get(	     // NOLINTNEXTLINE
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 
ffa_vm_destroy(struct vm_locked to_destroy_locked)52 void ffa_vm_destroy(struct vm_locked to_destroy_locked)
53 {
54 	/* Hypervisor never frees VM structs. */
55 	(void)to_destroy_locked;
56 }
57 
ffa_vm_free_resources(struct vm_locked vm_locked)58 void ffa_vm_free_resources(struct vm_locked vm_locked)
59 {
60 	(void)vm_locked;
61 }
62