1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2019-2022 ARM Limited. All rights reserved. 5 * 6 * This program is free software and is provided to you under the terms of the 7 * GNU General Public License version 2 as published by the Free Software 8 * Foundation, and any use by you of this program is subject to the terms 9 * of such GNU license. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, you can access it online at 18 * http://www.gnu.org/licenses/gpl-2.0.html. 19 * 20 */ 21 22 #ifndef _KBASE_CSF_PROTECTED_MEMORY_H_ 23 #define _KBASE_CSF_PROTECTED_MEMORY_H_ 24 25 #include "mali_kbase.h" 26 /** 27 * kbase_csf_protected_memory_init - Initilaise protected memory allocator. 28 * 29 * @kbdev: Device pointer. 30 * 31 * Return: 0 if success, or an error code on failure. 32 */ 33 int kbase_csf_protected_memory_init(struct kbase_device *const kbdev); 34 35 /** 36 * kbase_csf_protected_memory_term - Terminate prtotected memory allocator. 37 * 38 * @kbdev: Device pointer. 39 */ 40 void kbase_csf_protected_memory_term(struct kbase_device *const kbdev); 41 42 /** 43 * kbase_csf_protected_memory_alloc - Allocate protected memory pages. 44 * 45 * @kbdev: Device pointer. 46 * @phys: Array of physical addresses to be filled in by the protected 47 * memory allocator. 48 * @num_pages: Number of pages requested to be allocated. 49 * @is_small_page: Flag used to select the order of protected memory page. 50 * 51 * Return: Pointer to an array of protected memory allocations on success, 52 * or NULL on failure. 53 */ 54 struct protected_memory_allocation ** 55 kbase_csf_protected_memory_alloc( 56 struct kbase_device *const kbdev, 57 struct tagged_addr *phys, 58 size_t num_pages, 59 bool is_small_page); 60 61 /** 62 * kbase_csf_protected_memory_free - Free the allocated 63 * protected memory pages 64 * 65 * @kbdev: Device pointer. 66 * @pma: Array of pointer to protected memory allocations. 67 * @num_pages: Number of pages to be freed. 68 * @is_small_page: Flag used to select the order of protected memory page. 69 */ 70 void kbase_csf_protected_memory_free( 71 struct kbase_device *const kbdev, 72 struct protected_memory_allocation **pma, 73 size_t num_pages, 74 bool is_small_page); 75 #endif 76