hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/arm/bifrost/mali_kbase_sync.h
....@@ -1,7 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 /*
33 *
4
- * (C) COPYRIGHT 2012-2016, 2018-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2012-2016, 2018-2022 ARM Limited. All rights reserved.
55 *
66 * This program is free software and is provided to you under the terms of the
77 * GNU General Public License version 2 as published by the Free Software
....@@ -30,9 +30,6 @@
3030
3131 #include <linux/fdtable.h>
3232 #include <linux/syscalls.h>
33
-#if IS_ENABLED(CONFIG_SYNC)
34
-#include <sync.h>
35
-#endif
3633 #if IS_ENABLED(CONFIG_SYNC_FILE)
3734 #include "mali_kbase_fence_defs.h"
3835 #include <linux/sync_file.h>
....@@ -66,41 +63,43 @@
6663 * - dup to add a ref
6764 * - close to remove a ref
6865 *
69
- * return: 0 on success, < 0 on error
66
+ * Return: 0 on success, < 0 on error
7067 */
7168 int kbase_sync_fence_stream_create(const char *name, int *const out_fd);
7269
7370 #if !MALI_USE_CSF
7471 /**
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
+ *
7674 * @katom: Atom to assign the new explicit fence to
7775 * @stream_fd: File descriptor for stream object to create fence on
7876 *
79
- * return: Valid file descriptor to fence or < 0 on error
77
+ * Return: Valid file descriptor to fence or < 0 on error
8078 */
8179 int kbase_sync_fence_out_create(struct kbase_jd_atom *katom, int stream_fd);
8280
8381 /**
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
8583 * @katom: Atom to assign the existing explicit fence to
8684 * @fd: File descriptor to an existing fence
8785 *
8886 * Assigns an explicit input fence to atom.
8987 * This can later be waited for by calling @kbase_sync_fence_in_wait
9088 *
91
- * return: 0 on success, < 0 on error
89
+ * Return: 0 on success, < 0 on error
9290 */
9391 int kbase_sync_fence_in_from_fd(struct kbase_jd_atom *katom, int fd);
9492 #endif /* !MALI_USE_CSF */
9593
9694 /**
9795 * kbase_sync_fence_validate() - Validate a fd to be a valid fence
96
+ *
9897 * @fd: File descriptor to check
9998 *
10099 * This function is only usable to catch unintentional user errors early,
101100 * it does not stop malicious code changing the fd after this function returns.
102101 *
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
104103 */
105104 int kbase_sync_fence_validate(int fd);
106105
....@@ -112,7 +111,7 @@
112111 *
113112 * Signal output fence attached on katom and remove the fence from the atom.
114113 *
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
116115 */
117116 enum base_jd_event_code
118117 kbase_sync_fence_out_trigger(struct kbase_jd_atom *katom, int result);
....@@ -127,7 +126,7 @@
127126 * If the fence isn't already signaled, then this kbase_sync framework will
128127 * take responsibility to continue the processing once the fence is signaled.
129128 *
130
- * return: 0 if already signaled, otherwise 1
129
+ * Return: 0 if already signaled, otherwise 1
131130 */
132131 int kbase_sync_fence_in_wait(struct kbase_jd_atom *katom);
133132
....@@ -157,28 +156,13 @@
157156 void kbase_sync_fence_out_remove(struct kbase_jd_atom *katom);
158157 #endif /* !MALI_USE_CSF */
159158
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
-
175159 #if !MALI_USE_CSF
176160 /**
177161 * kbase_sync_fence_in_info_get() - Retrieves information about input fence
178162 * @katom: Atom to get fence information from
179163 * @info: Struct to be filled with fence information
180164 *
181
- * return: 0 on success, < 0 on error
165
+ * Return: 0 on success, < 0 on error
182166 */
183167 int kbase_sync_fence_in_info_get(struct kbase_jd_atom *katom,
184168 struct kbase_sync_fence_info *info);
....@@ -188,13 +172,13 @@
188172 * @katom: Atom to get fence information from
189173 * @info: Struct to be filled with fence information
190174 *
191
- * return: 0 on success, < 0 on error
175
+ * Return: 0 on success, < 0 on error
192176 */
193177 int kbase_sync_fence_out_info_get(struct kbase_jd_atom *katom,
194178 struct kbase_sync_fence_info *info);
195179 #endif /* !MALI_USE_CSF */
196180
197
-#if defined(CONFIG_SYNC_FILE)
181
+#if IS_ENABLED(CONFIG_SYNC_FILE)
198182 #if (KERNEL_VERSION(4, 10, 0) > LINUX_VERSION_CODE)
199183 void kbase_sync_fence_info_get(struct fence *fence,
200184 struct kbase_sync_fence_info *info);
....@@ -208,7 +192,7 @@
208192 * kbase_sync_status_string() - Get string matching @status
209193 * @status: Value of fence status.
210194 *
211
- * return: Pointer to string describing @status.
195
+ * Return: Pointer to string describing @status.
212196 */
213197 const char *kbase_sync_status_string(int status);
214198
....@@ -221,7 +205,8 @@
221205
222206 #ifdef CONFIG_MALI_BIFROST_FENCE_DEBUG
223207 /**
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
+ *
225210 * @katom: Atom to trigger fence debug dump for
226211 */
227212 void kbase_sync_fence_in_dump(struct kbase_jd_atom *katom);