hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/arm/bifrost/device/mali_kbase_device.h
....@@ -1,7 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 /*
33 *
4
- * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2019-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
....@@ -23,7 +23,6 @@
2323
2424 /**
2525 * kbase_device_get_list - get device list.
26
- *
2726 * Get access to device list.
2827 *
2928 * Return: Pointer to the linked list head.
....@@ -40,7 +39,7 @@
4039 void kbase_device_put_list(const struct list_head *dev_list);
4140
4241 /**
43
- * Kbase_increment_device_id - increment device id.
42
+ * kbase_increment_device_id - increment device id.
4443 *
4544 * Used to increment device id on successful initialization of the device.
4645 */
....@@ -55,17 +54,17 @@
5554 * When a device file is opened for the first time,
5655 * load firmware and initialize hardware counter components.
5756 *
58
- * @return 0 on success. An error code on failure.
57
+ * Return: 0 on success. An error code on failure.
5958 */
6059 int kbase_device_firmware_init_once(struct kbase_device *kbdev);
6160
6261 /**
6362 * kbase_device_init - Device initialisation.
6463 *
64
+ * @kbdev: The kbase device structure for the device (must be a valid pointer)
65
+ *
6566 * This is called from device probe to initialise various other
6667 * components needed.
67
- *
68
- * @kbdev: The kbase device structure for the device (must be a valid pointer)
6968 *
7069 * Return: 0 on success and non-zero value on failure.
7170 */
....@@ -74,11 +73,10 @@
7473 /**
7574 * kbase_device_term - Device termination.
7675 *
77
- * This is called from device remove to terminate various components that
78
- * were initialised during kbase_device_init.
79
- *
8076 * @kbdev: The kbase device structure for the device (must be a valid pointer)
8177 *
78
+ * This is called from device remove to terminate various components that
79
+ * were initialised during kbase_device_init.
8280 */
8381 void kbase_device_term(struct kbase_device *kbdev);
8482
....@@ -118,22 +116,62 @@
118116 bool kbase_is_gpu_removed(struct kbase_device *kbdev);
119117
120118 /**
119
+ * kbase_gpu_cache_flush_pa_range_and_busy_wait() - Start a cache physical range flush
120
+ * and busy wait
121
+ *
122
+ * @kbdev: kbase device to issue the MMU operation on.
123
+ * @phys: Starting address of the physical range to start the operation on.
124
+ * @nr_bytes: Number of bytes to work on.
125
+ * @flush_op: Flush command register value to be sent to HW
126
+ *
127
+ * Issue a cache flush physical range command, then busy wait an irq status.
128
+ * This function will clear FLUSH_PA_RANGE_COMPLETED irq mask bit
129
+ * and busy-wait the rawstat register.
130
+ *
131
+ * Return: 0 if successful or a negative error code on failure.
132
+ */
133
+#if MALI_USE_CSF
134
+int kbase_gpu_cache_flush_pa_range_and_busy_wait(struct kbase_device *kbdev, phys_addr_t phys,
135
+ size_t nr_bytes, u32 flush_op);
136
+#endif /* MALI_USE_CSF */
137
+
138
+/**
139
+ * kbase_gpu_cache_flush_and_busy_wait - Start a cache flush and busy wait
140
+ * @kbdev: Kbase device
141
+ * @flush_op: Flush command register value to be sent to HW
142
+ *
143
+ * Issue a cache flush command to hardware, then busy wait an irq status.
144
+ * This function will clear CLEAN_CACHES_COMPLETED irq mask bit set by other
145
+ * threads through kbase_gpu_start_cache_clean(), and wake them up manually
146
+ * after the busy-wait is done. Any pended cache flush commands raised by
147
+ * other thread are handled in this function.
148
+ * hwaccess_lock must be held by the caller.
149
+ *
150
+ * Return: 0 if successful or a negative error code on failure.
151
+ */
152
+int kbase_gpu_cache_flush_and_busy_wait(struct kbase_device *kbdev,
153
+ u32 flush_op);
154
+
155
+/**
121156 * kbase_gpu_start_cache_clean - Start a cache clean
122157 * @kbdev: Kbase device
158
+ * @flush_op: Flush command register value to be sent to HW
123159 *
124
- * Issue a cache clean and invalidate command to hardware. This function will
125
- * take hwaccess_lock.
160
+ * Issue a given cache flush command to hardware.
161
+ * This function will take hwaccess_lock.
126162 */
127
-void kbase_gpu_start_cache_clean(struct kbase_device *kbdev);
163
+void kbase_gpu_start_cache_clean(struct kbase_device *kbdev, u32 flush_op);
128164
129165 /**
130166 * kbase_gpu_start_cache_clean_nolock - Start a cache clean
131167 * @kbdev: Kbase device
168
+ * @flush_op: Flush command register value to be sent to HW
132169 *
133
- * Issue a cache clean and invalidate command to hardware. hwaccess_lock
134
- * must be held by the caller.
170
+ * Issue a given cache flush command to hardware.
171
+ * hwaccess_lock must be held by the caller.
135172 */
136
-void kbase_gpu_start_cache_clean_nolock(struct kbase_device *kbdev);
173
+void kbase_gpu_start_cache_clean_nolock(struct kbase_device *kbdev,
174
+ u32 flush_op);
137175
138176 /**
139177 * kbase_gpu_wait_cache_clean - Wait for cache cleaning to finish
....@@ -170,7 +208,7 @@
170208 void kbase_gpu_cache_clean_wait_complete(struct kbase_device *kbdev);
171209
172210 /**
173
- * kbase_clean_caches_done - Issue preiously queued cache clean request or
211
+ * kbase_clean_caches_done - Issue previously queued cache clean request or
174212 * wake up the requester that issued cache clean.
175213 * @kbdev: Kbase device
176214 *