blob: f17f1fb58d0e76eb3f48e3e26dda063c50878f33 [file] [log] [blame]
Andrew Scull18834872018-10-12 11:48:09 +01001/*
Andrew Walbran692b3252019-03-07 15:51:31 +00002 * Copyright 2018 The Hafnium Authors.
Andrew Scull18834872018-10-12 11:48:09 +01003 *
Andrew Walbrane959ec12020-06-17 15:01:09 +01004 * 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.
Andrew Scull18834872018-10-12 11:48:09 +01007 */
8
Andrew Scullfbc938a2018-08-20 14:09:28 +01009#pragma once
Wedson Almeida Filho3fcbcff2018-07-10 23:53:39 +010010
Andrew Scull18c78fc2018-08-20 12:57:41 +010011#include "hf/cpu.h"
Wedson Almeida Filho22d5eaa2018-12-16 00:38:49 +000012#include "hf/mpool.h"
Andrew Scull18c78fc2018-08-20 12:57:41 +010013#include "hf/vm.h"
Wedson Almeida Filho3fcbcff2018-07-10 23:53:39 +010014
Andrew Scull6d2db332018-10-10 15:28:17 +010015#include "vmapi/hf/call.h"
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010016#include "vmapi/hf/ffa.h"
Andrew Scull6d2db332018-10-10 15:28:17 +010017
Wedson Almeida Filho22d5eaa2018-12-16 00:38:49 +000018void api_init(struct mpool *ppool);
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -050019struct vcpu *api_ffa_get_vm_vcpu(struct vm *vm, struct vcpu *current);
Andrew Walbran1f8d4872018-12-20 11:21:32 +000020void api_regs_state_saved(struct vcpu *vcpu);
Wedson Almeida Filhoea62e2e2019-01-09 19:14:59 +000021int64_t api_mailbox_writable_get(const struct vcpu *current);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010022int64_t api_mailbox_waiter_get(ffa_vm_id_t vm_id, const struct vcpu *current);
Andrew Walbranc1ad4ce2019-05-09 11:41:39 +010023int64_t api_debug_log(char c, struct vcpu *current);
Andrew Scull6bca35e2018-10-02 12:05:32 +010024
Andrew Scull33fecd32019-01-08 14:48:27 +000025struct vcpu *api_preempt(struct vcpu *current);
Andrew Scull33fecd32019-01-08 14:48:27 +000026struct vcpu *api_wait_for_interrupt(struct vcpu *current);
Andrew Walbran33645652019-04-15 12:29:31 +010027struct vcpu *api_vcpu_off(struct vcpu *current);
Andrew Scull9726c252019-01-23 13:44:19 +000028struct vcpu *api_abort(struct vcpu *current);
Andrew Walbran33645652019-04-15 12:29:31 +010029struct vcpu *api_wake_up(struct vcpu *current, struct vcpu *target_vcpu);
Andrew Walbran318f5732018-11-20 16:23:42 +000030
Manish Pandey35e452f2021-02-18 21:36:34 +000031int64_t api_interrupt_enable(uint32_t intid, bool enable,
32 enum interrupt_type type, struct vcpu *current);
Wedson Almeida Filhoc559d132019-01-09 19:33:40 +000033uint32_t api_interrupt_get(struct vcpu *current);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010034int64_t api_interrupt_inject(ffa_vm_id_t target_vm_id,
35 ffa_vcpu_index_t target_vcpu_idx, uint32_t intid,
Andrew Walbran42347a92019-05-09 13:59:03 +010036 struct vcpu *current, struct vcpu **next);
Manish Pandeya5f39fb2020-09-11 09:47:11 +010037int64_t api_interrupt_inject_locked(struct vcpu_locked target_locked,
38 uint32_t intid, struct vcpu *current,
39 struct vcpu **next);
J-Alves13394022021-06-30 13:48:49 +010040void api_sri_send_if_delayed(struct vcpu *current);
Jose Marinhoa1dfeda2019-02-27 16:46:03 +000041
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010042struct ffa_value api_ffa_msg_send(ffa_vm_id_t sender_vm_id,
43 ffa_vm_id_t receiver_vm_id, uint32_t size,
44 uint32_t attributes, struct vcpu *current,
45 struct vcpu **next);
Federico Recanati25053ee2022-03-14 15:01:53 +010046struct ffa_value api_ffa_msg_send2(ffa_vm_id_t sender_vm_id, uint32_t flags,
47 struct vcpu *current);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010048struct ffa_value api_ffa_msg_recv(bool block, struct vcpu *current,
49 struct vcpu **next);
Federico Recanati7bef0b92022-03-17 14:56:22 +010050struct ffa_value api_ffa_rx_release(ffa_vm_id_t receiver_id,
51 struct vcpu *current, struct vcpu **next);
Federico Recanati644f0462022-03-17 12:04:00 +010052struct ffa_value api_ffa_rx_acquire(ffa_vm_id_t receiver_id,
53 struct vcpu *current);
Manish Pandeyd34f8892020-06-19 17:41:07 +010054struct ffa_value api_vm_configure_pages(
55 struct mm_stage1_locked mm_stage1_locked, struct vm_locked vm_locked,
56 ipaddr_t send, ipaddr_t recv, uint32_t page_count,
57 struct mpool *local_page_pool);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010058struct ffa_value api_ffa_rxtx_map(ipaddr_t send, ipaddr_t recv,
Federico Recanati9f1b6532022-04-14 13:15:28 +020059 uint32_t page_count, struct vcpu *current);
Daniel Boulby9e420ca2021-07-07 15:03:49 +010060struct ffa_value api_ffa_rxtx_unmap(ffa_vm_id_t allocator_id,
61 struct vcpu *current);
Olivier Deprezee9d6a92019-11-26 09:14:11 +000062struct ffa_value api_yield(struct vcpu *current, struct vcpu **next);
Daniel Boulbybaeaf2e2021-12-09 11:42:36 +000063struct ffa_value api_ffa_version(struct vcpu *current,
64 uint32_t requested_version);
Fuad Tabbae4efcc32020-07-16 15:37:27 +010065struct ffa_value api_ffa_partition_info_get(struct vcpu *current,
Daniel Boulbyb46cad12021-12-13 17:47:21 +000066 const struct ffa_uuid *uuid,
67 const uint32_t flags);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010068struct ffa_value api_ffa_id_get(const struct vcpu *current);
Daniel Boulbyb2fb80e2021-02-03 15:09:23 +000069struct ffa_value api_ffa_spm_id_get(void);
J-Alves6f72ca82021-11-01 12:34:58 +000070struct ffa_value api_ffa_feature_success(uint32_t arg2);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010071struct ffa_value api_ffa_features(uint32_t function_id);
Madhukar Pappireddy5522c672021-12-17 16:35:51 -060072struct ffa_value api_ffa_msg_wait(struct vcpu *current, struct vcpu **next,
73 struct ffa_value *args);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010074struct ffa_value api_ffa_run(ffa_vm_id_t vm_id, ffa_vcpu_index_t vcpu_idx,
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -050075 struct vcpu *current, struct vcpu **next);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010076struct ffa_value api_ffa_mem_send(uint32_t share_func, uint32_t length,
77 uint32_t fragment_length, ipaddr_t address,
Andrew Walbran1a86aa92020-05-15 17:22:28 +010078 uint32_t page_count, struct vcpu *current);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010079struct ffa_value api_ffa_mem_retrieve_req(uint32_t length,
80 uint32_t fragment_length,
81 ipaddr_t address, uint32_t page_count,
82 struct vcpu *current);
83struct ffa_value api_ffa_mem_relinquish(struct vcpu *current);
84struct ffa_value api_ffa_mem_reclaim(ffa_memory_handle_t handle,
85 ffa_memory_region_flags_t flags,
86 struct vcpu *current);
Andrew Walbranca808b12020-05-15 17:22:28 +010087struct ffa_value api_ffa_mem_frag_rx(ffa_memory_handle_t handle,
88 uint32_t fragment_offset,
89 ffa_vm_id_t sender_vm_id,
90 struct vcpu *current);
91struct ffa_value api_ffa_mem_frag_tx(ffa_memory_handle_t handle,
92 uint32_t fragment_length,
93 ffa_vm_id_t sender_vm_id,
94 struct vcpu *current);
Olivier Deprezee9d6a92019-11-26 09:14:11 +000095struct ffa_value api_ffa_msg_send_direct_req(ffa_vm_id_t sender_vm_id,
96 ffa_vm_id_t receiver_vm_id,
97 struct ffa_value args,
98 struct vcpu *current,
99 struct vcpu **next);
100struct ffa_value api_ffa_msg_send_direct_resp(ffa_vm_id_t sender_vm_id,
101 ffa_vm_id_t receiver_vm_id,
102 struct ffa_value args,
103 struct vcpu *current,
104 struct vcpu **next);
Max Shvetsov40108e72020-08-27 12:39:50 +0100105struct ffa_value api_ffa_secondary_ep_register(ipaddr_t entry_point,
106 struct vcpu *current);
Manish Pandeya5f39fb2020-09-11 09:47:11 +0100107struct vcpu *api_switch_to_other_world(struct vcpu *current,
108 struct ffa_value other_world_ret,
109 enum vcpu_state vcpu_state);
J-Alvesa0f317d2021-06-09 13:31:59 +0100110struct ffa_value api_ffa_notification_bitmap_create(ffa_vm_id_t vm_id,
111 ffa_vcpu_count_t vcpu_count,
112 struct vcpu *current);
113struct ffa_value api_ffa_notification_bitmap_destroy(ffa_vm_id_t vm_id,
114 struct vcpu *current);
J-Alvesc003a7a2021-03-18 13:06:53 +0000115
116struct ffa_value api_ffa_notification_update_bindings(
117 ffa_vm_id_t sender_vm_id, ffa_vm_id_t receiver_vm_id, uint32_t flags,
118 ffa_notifications_bitmap_t notifications, bool is_bind,
119 struct vcpu *current);
J-Alvesaa79c012021-07-09 14:29:45 +0100120
121struct ffa_value api_ffa_notification_set(
122 ffa_vm_id_t sender_vm_id, ffa_vm_id_t receiver_vm_id, uint32_t flags,
123 ffa_notifications_bitmap_t notifications, struct vcpu *current);
124
125struct ffa_value api_ffa_notification_get(ffa_vm_id_t receiver_vm_id,
126 uint16_t vcpu_id, uint32_t flags,
127 struct vcpu *current);
J-Alvesc8e8a222021-06-08 17:33:52 +0100128
129struct ffa_value api_ffa_notification_info_get(struct vcpu *current);
Raghu Krishnamurthyea6d25f2021-09-14 15:27:06 -0700130
131struct ffa_value api_ffa_mem_perm_get(vaddr_t base_addr, struct vcpu *current);
132struct ffa_value api_ffa_mem_perm_set(vaddr_t base_addr, uint32_t page_count,
133 uint32_t mem_perm, struct vcpu *current);
Maksims Svecovs71b76702022-05-20 15:32:58 +0100134
135struct ffa_value api_ffa_console_log(const struct ffa_value args,
136 struct vcpu *current);