blob: 9a7462f942d6305aec00247c1b783e22aa6e317b [file] [log] [blame]
Andrew Walbranb5ab43c2020-04-30 11:32:54 +01001/*
2 * Copyright 2019 The Hafnium Authors.
3 *
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 Walbranb5ab43c2020-04-30 11:32:54 +01007 */
8
9#pragma once
10
11#include "hf/mpool.h"
12#include "hf/vm.h"
13
14#include "vmapi/hf/ffa.h"
15
Daniel Boulby296ee702023-11-28 13:36:55 +000016bool is_ffa_hypervisor_retrieve_request(struct ffa_memory_region *request);
Daniel Boulby44e9b3b2024-01-17 12:21:44 +000017
Daniel Boulbyc7dc9322023-10-27 15:12:07 +010018bool ffa_memory_region_sanity_check(struct ffa_memory_region *memory_region,
Karl Meakin0e617d92024-04-05 12:55:22 +010019 enum ffa_version ffa_version,
Daniel Boulbyc7dc9322023-10-27 15:12:07 +010020 uint32_t fragment_length,
21 bool send_transaction);
22
Andrew Walbran1a86aa92020-05-15 17:22:28 +010023struct ffa_value ffa_memory_send(struct vm_locked from_locked,
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010024 struct ffa_memory_region *memory_region,
Andrew Walbran130a8ae2020-05-15 16:27:15 +010025 uint32_t memory_share_length,
Andrew Walbran1a86aa92020-05-15 17:22:28 +010026 uint32_t fragment_length, uint32_t share_func,
27 struct mpool *page_pool);
Andrew Walbranca808b12020-05-15 17:22:28 +010028struct ffa_value ffa_memory_send_continue(struct vm_locked from_locked,
29 void *fragment,
30 uint32_t fragment_length,
31 ffa_memory_handle_t handle,
32 struct mpool *page_pool);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010033struct ffa_value ffa_memory_retrieve(struct vm_locked to_locked,
34 struct ffa_memory_region *retrieve_request,
Andrew Walbran130a8ae2020-05-15 16:27:15 +010035 uint32_t retrieve_request_length,
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010036 struct mpool *page_pool);
Andrew Walbranca808b12020-05-15 17:22:28 +010037struct ffa_value ffa_memory_retrieve_continue(struct vm_locked to_locked,
38 ffa_memory_handle_t handle,
39 uint32_t fragment_offset,
J-Alves19e20cf2023-08-02 12:48:55 +010040 ffa_id_t sender_vm_id,
J-Alvesc3fd9752024-04-04 11:45:33 +010041 void *retrieve_continue_page,
Andrew Walbranca808b12020-05-15 17:22:28 +010042 struct mpool *page_pool);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010043struct ffa_value ffa_memory_relinquish(
44 struct vm_locked from_locked,
45 struct ffa_mem_relinquish *relinquish_request, struct mpool *page_pool);
46struct ffa_value ffa_memory_reclaim(struct vm_locked to_locked,
Andrew Walbranca808b12020-05-15 17:22:28 +010047 ffa_memory_handle_t handle,
48 ffa_memory_region_flags_t flags,
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010049 struct mpool *page_pool);