| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2019-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 |
|---|
| .. | .. |
|---|
| 23 | 23 | |
|---|
| 24 | 24 | /** |
|---|
| 25 | 25 | * kbase_device_get_list - get device list. |
|---|
| 26 | | - * |
|---|
| 27 | 26 | * Get access to device list. |
|---|
| 28 | 27 | * |
|---|
| 29 | 28 | * Return: Pointer to the linked list head. |
|---|
| .. | .. |
|---|
| 40 | 39 | void kbase_device_put_list(const struct list_head *dev_list); |
|---|
| 41 | 40 | |
|---|
| 42 | 41 | /** |
|---|
| 43 | | - * Kbase_increment_device_id - increment device id. |
|---|
| 42 | + * kbase_increment_device_id - increment device id. |
|---|
| 44 | 43 | * |
|---|
| 45 | 44 | * Used to increment device id on successful initialization of the device. |
|---|
| 46 | 45 | */ |
|---|
| .. | .. |
|---|
| 55 | 54 | * When a device file is opened for the first time, |
|---|
| 56 | 55 | * load firmware and initialize hardware counter components. |
|---|
| 57 | 56 | * |
|---|
| 58 | | - * @return 0 on success. An error code on failure. |
|---|
| 57 | + * Return: 0 on success. An error code on failure. |
|---|
| 59 | 58 | */ |
|---|
| 60 | 59 | int kbase_device_firmware_init_once(struct kbase_device *kbdev); |
|---|
| 61 | 60 | |
|---|
| 62 | 61 | /** |
|---|
| 63 | 62 | * kbase_device_init - Device initialisation. |
|---|
| 64 | 63 | * |
|---|
| 64 | + * @kbdev: The kbase device structure for the device (must be a valid pointer) |
|---|
| 65 | + * |
|---|
| 65 | 66 | * This is called from device probe to initialise various other |
|---|
| 66 | 67 | * components needed. |
|---|
| 67 | | - * |
|---|
| 68 | | - * @kbdev: The kbase device structure for the device (must be a valid pointer) |
|---|
| 69 | 68 | * |
|---|
| 70 | 69 | * Return: 0 on success and non-zero value on failure. |
|---|
| 71 | 70 | */ |
|---|
| .. | .. |
|---|
| 74 | 73 | /** |
|---|
| 75 | 74 | * kbase_device_term - Device termination. |
|---|
| 76 | 75 | * |
|---|
| 77 | | - * This is called from device remove to terminate various components that |
|---|
| 78 | | - * were initialised during kbase_device_init. |
|---|
| 79 | | - * |
|---|
| 80 | 76 | * @kbdev: The kbase device structure for the device (must be a valid pointer) |
|---|
| 81 | 77 | * |
|---|
| 78 | + * This is called from device remove to terminate various components that |
|---|
| 79 | + * were initialised during kbase_device_init. |
|---|
| 82 | 80 | */ |
|---|
| 83 | 81 | void kbase_device_term(struct kbase_device *kbdev); |
|---|
| 84 | 82 | |
|---|
| .. | .. |
|---|
| 118 | 116 | bool kbase_is_gpu_removed(struct kbase_device *kbdev); |
|---|
| 119 | 117 | |
|---|
| 120 | 118 | /** |
|---|
| 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 | +/** |
|---|
| 121 | 156 | * kbase_gpu_start_cache_clean - Start a cache clean |
|---|
| 122 | 157 | * @kbdev: Kbase device |
|---|
| 158 | + * @flush_op: Flush command register value to be sent to HW |
|---|
| 123 | 159 | * |
|---|
| 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. |
|---|
| 126 | 162 | */ |
|---|
| 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); |
|---|
| 128 | 164 | |
|---|
| 129 | 165 | /** |
|---|
| 130 | 166 | * kbase_gpu_start_cache_clean_nolock - Start a cache clean |
|---|
| 131 | 167 | * @kbdev: Kbase device |
|---|
| 168 | + * @flush_op: Flush command register value to be sent to HW |
|---|
| 132 | 169 | * |
|---|
| 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. |
|---|
| 135 | 172 | */ |
|---|
| 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); |
|---|
| 137 | 175 | |
|---|
| 138 | 176 | /** |
|---|
| 139 | 177 | * kbase_gpu_wait_cache_clean - Wait for cache cleaning to finish |
|---|
| .. | .. |
|---|
| 170 | 208 | void kbase_gpu_cache_clean_wait_complete(struct kbase_device *kbdev); |
|---|
| 171 | 209 | |
|---|
| 172 | 210 | /** |
|---|
| 173 | | - * kbase_clean_caches_done - Issue preiously queued cache clean request or |
|---|
| 211 | + * kbase_clean_caches_done - Issue previously queued cache clean request or |
|---|
| 174 | 212 | * wake up the requester that issued cache clean. |
|---|
| 175 | 213 | * @kbdev: Kbase device |
|---|
| 176 | 214 | * |
|---|