| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2012-2016, 2018-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2012-2016, 2018-2022 ARM Limited. All rights reserved. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * This program is free software and is provided to you under the terms of the |
|---|
| 7 | 7 | * GNU General Public License version 2 as published by the Free Software |
|---|
| .. | .. |
|---|
| 30 | 30 | |
|---|
| 31 | 31 | #include <linux/fdtable.h> |
|---|
| 32 | 32 | #include <linux/syscalls.h> |
|---|
| 33 | | -#if IS_ENABLED(CONFIG_SYNC) |
|---|
| 34 | | -#include <sync.h> |
|---|
| 35 | | -#endif |
|---|
| 36 | 33 | #if IS_ENABLED(CONFIG_SYNC_FILE) |
|---|
| 37 | 34 | #include "mali_kbase_fence_defs.h" |
|---|
| 38 | 35 | #include <linux/sync_file.h> |
|---|
| .. | .. |
|---|
| 66 | 63 | * - dup to add a ref |
|---|
| 67 | 64 | * - close to remove a ref |
|---|
| 68 | 65 | * |
|---|
| 69 | | - * return: 0 on success, < 0 on error |
|---|
| 66 | + * Return: 0 on success, < 0 on error |
|---|
| 70 | 67 | */ |
|---|
| 71 | 68 | int kbase_sync_fence_stream_create(const char *name, int *const out_fd); |
|---|
| 72 | 69 | |
|---|
| 73 | 70 | #if !MALI_USE_CSF |
|---|
| 74 | 71 | /** |
|---|
| 75 | | - * kbase_sync_fence_out_create Create an explicit output fence to specified atom |
|---|
| 72 | + * kbase_sync_fence_out_create - Create an explicit output fence to specified atom |
|---|
| 73 | + * |
|---|
| 76 | 74 | * @katom: Atom to assign the new explicit fence to |
|---|
| 77 | 75 | * @stream_fd: File descriptor for stream object to create fence on |
|---|
| 78 | 76 | * |
|---|
| 79 | | - * return: Valid file descriptor to fence or < 0 on error |
|---|
| 77 | + * Return: Valid file descriptor to fence or < 0 on error |
|---|
| 80 | 78 | */ |
|---|
| 81 | 79 | int kbase_sync_fence_out_create(struct kbase_jd_atom *katom, int stream_fd); |
|---|
| 82 | 80 | |
|---|
| 83 | 81 | /** |
|---|
| 84 | | - * kbase_sync_fence_in_from_fd() Assigns an existing fence to specified atom |
|---|
| 82 | + * kbase_sync_fence_in_from_fd() - Assigns an existing fence to specified atom |
|---|
| 85 | 83 | * @katom: Atom to assign the existing explicit fence to |
|---|
| 86 | 84 | * @fd: File descriptor to an existing fence |
|---|
| 87 | 85 | * |
|---|
| 88 | 86 | * Assigns an explicit input fence to atom. |
|---|
| 89 | 87 | * This can later be waited for by calling @kbase_sync_fence_in_wait |
|---|
| 90 | 88 | * |
|---|
| 91 | | - * return: 0 on success, < 0 on error |
|---|
| 89 | + * Return: 0 on success, < 0 on error |
|---|
| 92 | 90 | */ |
|---|
| 93 | 91 | int kbase_sync_fence_in_from_fd(struct kbase_jd_atom *katom, int fd); |
|---|
| 94 | 92 | #endif /* !MALI_USE_CSF */ |
|---|
| 95 | 93 | |
|---|
| 96 | 94 | /** |
|---|
| 97 | 95 | * kbase_sync_fence_validate() - Validate a fd to be a valid fence |
|---|
| 96 | + * |
|---|
| 98 | 97 | * @fd: File descriptor to check |
|---|
| 99 | 98 | * |
|---|
| 100 | 99 | * This function is only usable to catch unintentional user errors early, |
|---|
| 101 | 100 | * it does not stop malicious code changing the fd after this function returns. |
|---|
| 102 | 101 | * |
|---|
| 103 | | - * return 0: if fd is for a valid fence, < 0 if invalid |
|---|
| 102 | + * Return: 0 if fd is for a valid fence, < 0 if invalid |
|---|
| 104 | 103 | */ |
|---|
| 105 | 104 | int kbase_sync_fence_validate(int fd); |
|---|
| 106 | 105 | |
|---|
| .. | .. |
|---|
| 112 | 111 | * |
|---|
| 113 | 112 | * Signal output fence attached on katom and remove the fence from the atom. |
|---|
| 114 | 113 | * |
|---|
| 115 | | - * return: The "next" event code for atom, typically JOB_CANCELLED or EVENT_DONE |
|---|
| 114 | + * Return: The "next" event code for atom, typically JOB_CANCELLED or EVENT_DONE |
|---|
| 116 | 115 | */ |
|---|
| 117 | 116 | enum base_jd_event_code |
|---|
| 118 | 117 | kbase_sync_fence_out_trigger(struct kbase_jd_atom *katom, int result); |
|---|
| .. | .. |
|---|
| 127 | 126 | * If the fence isn't already signaled, then this kbase_sync framework will |
|---|
| 128 | 127 | * take responsibility to continue the processing once the fence is signaled. |
|---|
| 129 | 128 | * |
|---|
| 130 | | - * return: 0 if already signaled, otherwise 1 |
|---|
| 129 | + * Return: 0 if already signaled, otherwise 1 |
|---|
| 131 | 130 | */ |
|---|
| 132 | 131 | int kbase_sync_fence_in_wait(struct kbase_jd_atom *katom); |
|---|
| 133 | 132 | |
|---|
| .. | .. |
|---|
| 157 | 156 | void kbase_sync_fence_out_remove(struct kbase_jd_atom *katom); |
|---|
| 158 | 157 | #endif /* !MALI_USE_CSF */ |
|---|
| 159 | 158 | |
|---|
| 160 | | -/** |
|---|
| 161 | | - * kbase_sync_fence_close_fd() - Close a file descriptor representing a fence |
|---|
| 162 | | - * @fd: File descriptor to close |
|---|
| 163 | | - */ |
|---|
| 164 | | -static inline void kbase_sync_fence_close_fd(int fd) |
|---|
| 165 | | -{ |
|---|
| 166 | | -#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE |
|---|
| 167 | | - close_fd(fd); |
|---|
| 168 | | -#elif KERNEL_VERSION(4, 17, 0) <= LINUX_VERSION_CODE |
|---|
| 169 | | - ksys_close(fd); |
|---|
| 170 | | -#else |
|---|
| 171 | | - sys_close(fd); |
|---|
| 172 | | -#endif |
|---|
| 173 | | -} |
|---|
| 174 | | - |
|---|
| 175 | 159 | #if !MALI_USE_CSF |
|---|
| 176 | 160 | /** |
|---|
| 177 | 161 | * kbase_sync_fence_in_info_get() - Retrieves information about input fence |
|---|
| 178 | 162 | * @katom: Atom to get fence information from |
|---|
| 179 | 163 | * @info: Struct to be filled with fence information |
|---|
| 180 | 164 | * |
|---|
| 181 | | - * return: 0 on success, < 0 on error |
|---|
| 165 | + * Return: 0 on success, < 0 on error |
|---|
| 182 | 166 | */ |
|---|
| 183 | 167 | int kbase_sync_fence_in_info_get(struct kbase_jd_atom *katom, |
|---|
| 184 | 168 | struct kbase_sync_fence_info *info); |
|---|
| .. | .. |
|---|
| 188 | 172 | * @katom: Atom to get fence information from |
|---|
| 189 | 173 | * @info: Struct to be filled with fence information |
|---|
| 190 | 174 | * |
|---|
| 191 | | - * return: 0 on success, < 0 on error |
|---|
| 175 | + * Return: 0 on success, < 0 on error |
|---|
| 192 | 176 | */ |
|---|
| 193 | 177 | int kbase_sync_fence_out_info_get(struct kbase_jd_atom *katom, |
|---|
| 194 | 178 | struct kbase_sync_fence_info *info); |
|---|
| 195 | 179 | #endif /* !MALI_USE_CSF */ |
|---|
| 196 | 180 | |
|---|
| 197 | | -#if defined(CONFIG_SYNC_FILE) |
|---|
| 181 | +#if IS_ENABLED(CONFIG_SYNC_FILE) |
|---|
| 198 | 182 | #if (KERNEL_VERSION(4, 10, 0) > LINUX_VERSION_CODE) |
|---|
| 199 | 183 | void kbase_sync_fence_info_get(struct fence *fence, |
|---|
| 200 | 184 | struct kbase_sync_fence_info *info); |
|---|
| .. | .. |
|---|
| 208 | 192 | * kbase_sync_status_string() - Get string matching @status |
|---|
| 209 | 193 | * @status: Value of fence status. |
|---|
| 210 | 194 | * |
|---|
| 211 | | - * return: Pointer to string describing @status. |
|---|
| 195 | + * Return: Pointer to string describing @status. |
|---|
| 212 | 196 | */ |
|---|
| 213 | 197 | const char *kbase_sync_status_string(int status); |
|---|
| 214 | 198 | |
|---|
| .. | .. |
|---|
| 221 | 205 | |
|---|
| 222 | 206 | #ifdef CONFIG_MALI_BIFROST_FENCE_DEBUG |
|---|
| 223 | 207 | /** |
|---|
| 224 | | - * kbase_sync_fence_in_dump() Trigger a debug dump of atoms input fence state |
|---|
| 208 | + * kbase_sync_fence_in_dump() - Trigger a debug dump of atoms input fence state |
|---|
| 209 | + * |
|---|
| 225 | 210 | * @katom: Atom to trigger fence debug dump for |
|---|
| 226 | 211 | */ |
|---|
| 227 | 212 | void kbase_sync_fence_in_dump(struct kbase_jd_atom *katom); |
|---|