| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2013-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2013-2023 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 |
|---|
| .. | .. |
|---|
| 31 | 31 | #include <mali_kbase_config_platform.h> |
|---|
| 32 | 32 | |
|---|
| 33 | 33 | enum { |
|---|
| 34 | | - /** |
|---|
| 35 | | - * Use unrestricted Address ID width on the AXI bus. |
|---|
| 36 | | - */ |
|---|
| 34 | + /* Use unrestricted Address ID width on the AXI bus. */ |
|---|
| 37 | 35 | KBASE_AID_32 = 0x0, |
|---|
| 38 | 36 | |
|---|
| 39 | | - /** |
|---|
| 40 | | - * Restrict GPU to a half of maximum Address ID count. |
|---|
| 37 | + /* Restrict GPU to a half of maximum Address ID count. |
|---|
| 41 | 38 | * This will reduce performance, but reduce bus load due to GPU. |
|---|
| 42 | 39 | */ |
|---|
| 43 | 40 | KBASE_AID_16 = 0x3, |
|---|
| 44 | 41 | |
|---|
| 45 | | - /** |
|---|
| 46 | | - * Restrict GPU to a quarter of maximum Address ID count. |
|---|
| 42 | + /* Restrict GPU to a quarter of maximum Address ID count. |
|---|
| 47 | 43 | * This will reduce performance, but reduce bus load due to GPU. |
|---|
| 48 | 44 | */ |
|---|
| 49 | | - KBASE_AID_8 = 0x2, |
|---|
| 45 | + KBASE_AID_8 = 0x2, |
|---|
| 50 | 46 | |
|---|
| 51 | | - /** |
|---|
| 52 | | - * Restrict GPU to an eighth of maximum Address ID count. |
|---|
| 47 | + /* Restrict GPU to an eighth of maximum Address ID count. |
|---|
| 53 | 48 | * This will reduce performance, but reduce bus load due to GPU. |
|---|
| 54 | 49 | */ |
|---|
| 55 | | - KBASE_AID_4 = 0x1 |
|---|
| 50 | + KBASE_AID_4 = 0x1 |
|---|
| 56 | 51 | }; |
|---|
| 57 | 52 | |
|---|
| 58 | 53 | enum { |
|---|
| 59 | | - /** |
|---|
| 60 | | - * Use unrestricted Address ID width on the AXI bus. |
|---|
| 54 | + /* Use unrestricted Address ID width on the AXI bus. |
|---|
| 61 | 55 | * Restricting ID width will reduce performance & bus load due to GPU. |
|---|
| 62 | 56 | */ |
|---|
| 63 | 57 | KBASE_3BIT_AID_32 = 0x0, |
|---|
| .. | .. |
|---|
| 78 | 72 | KBASE_3BIT_AID_12 = 0x5, |
|---|
| 79 | 73 | |
|---|
| 80 | 74 | /* Restrict GPU to 1/4 of maximum Address ID count. */ |
|---|
| 81 | | - KBASE_3BIT_AID_8 = 0x6, |
|---|
| 75 | + KBASE_3BIT_AID_8 = 0x6, |
|---|
| 82 | 76 | |
|---|
| 83 | 77 | /* Restrict GPU to 1/8 of maximum Address ID count. */ |
|---|
| 84 | | - KBASE_3BIT_AID_4 = 0x7 |
|---|
| 78 | + KBASE_3BIT_AID_4 = 0x7 |
|---|
| 85 | 79 | }; |
|---|
| 86 | 80 | |
|---|
| 87 | | -/** |
|---|
| 88 | | - * Default period for DVFS sampling (can be overridden by platform header) |
|---|
| 81 | +#if MALI_USE_CSF |
|---|
| 82 | +/* |
|---|
| 83 | + * Default value for the TIMER register of the IPA Control interface, |
|---|
| 84 | + * expressed in milliseconds. |
|---|
| 85 | + * |
|---|
| 86 | + * The chosen value is a trade off between two requirements: the IPA Control |
|---|
| 87 | + * interface should sample counters with a resolution in the order of |
|---|
| 88 | + * milliseconds, while keeping GPU overhead as limited as possible. |
|---|
| 89 | 89 | */ |
|---|
| 90 | +#define IPA_CONTROL_TIMER_DEFAULT_VALUE_MS ((u32)10) /* 10 milliseconds */ |
|---|
| 91 | +#endif /* MALI_USE_CSF */ |
|---|
| 92 | + |
|---|
| 93 | +/* Default period for DVFS sampling (can be overridden by platform header) */ |
|---|
| 90 | 94 | #ifndef DEFAULT_PM_DVFS_PERIOD |
|---|
| 91 | 95 | #define DEFAULT_PM_DVFS_PERIOD 100 /* 100ms */ |
|---|
| 92 | 96 | #endif |
|---|
| 93 | 97 | |
|---|
| 94 | | -/** |
|---|
| 95 | | - * Power Management poweroff tick granuality. This is in nanoseconds to |
|---|
| 98 | +/* Power Management poweroff tick granuality. This is in nanoseconds to |
|---|
| 96 | 99 | * allow HR timer support (can be overridden by platform header). |
|---|
| 97 | 100 | * |
|---|
| 98 | 101 | * On each scheduling tick, the power manager core may decide to: |
|---|
| .. | .. |
|---|
| 103 | 106 | #define DEFAULT_PM_GPU_POWEROFF_TICK_NS (400000) /* 400us */ |
|---|
| 104 | 107 | #endif |
|---|
| 105 | 108 | |
|---|
| 106 | | -/** |
|---|
| 107 | | - * Power Manager number of ticks before shader cores are powered off |
|---|
| 109 | +/* Power Manager number of ticks before shader cores are powered off |
|---|
| 108 | 110 | * (can be overridden by platform header). |
|---|
| 109 | 111 | */ |
|---|
| 110 | 112 | #ifndef DEFAULT_PM_POWEROFF_TICK_SHADER |
|---|
| 111 | 113 | #define DEFAULT_PM_POWEROFF_TICK_SHADER (2) /* 400-800us */ |
|---|
| 112 | 114 | #endif |
|---|
| 113 | 115 | |
|---|
| 114 | | -/** |
|---|
| 115 | | - * Default scheduling tick granuality (can be overridden by platform header) |
|---|
| 116 | | - */ |
|---|
| 116 | +/* Default scheduling tick granuality (can be overridden by platform header) */ |
|---|
| 117 | 117 | #ifndef DEFAULT_JS_SCHEDULING_PERIOD_NS |
|---|
| 118 | 118 | #define DEFAULT_JS_SCHEDULING_PERIOD_NS (100000000u) /* 100ms */ |
|---|
| 119 | 119 | #endif |
|---|
| 120 | 120 | |
|---|
| 121 | | -/** |
|---|
| 122 | | - * Default minimum number of scheduling ticks before jobs are soft-stopped. |
|---|
| 121 | +/* Default minimum number of scheduling ticks before jobs are soft-stopped. |
|---|
| 123 | 122 | * |
|---|
| 124 | 123 | * This defines the time-slice for a job (which may be different from that of a |
|---|
| 125 | 124 | * context) |
|---|
| 126 | 125 | */ |
|---|
| 127 | 126 | #define DEFAULT_JS_SOFT_STOP_TICKS (1) /* 100ms-200ms */ |
|---|
| 128 | 127 | |
|---|
| 129 | | -/** |
|---|
| 130 | | - * Default minimum number of scheduling ticks before CL jobs are soft-stopped. |
|---|
| 131 | | - */ |
|---|
| 128 | +/* Default minimum number of scheduling ticks before CL jobs are soft-stopped. */ |
|---|
| 132 | 129 | #define DEFAULT_JS_SOFT_STOP_TICKS_CL (1) /* 100ms-200ms */ |
|---|
| 133 | 130 | |
|---|
| 134 | | -/** |
|---|
| 135 | | - * Default minimum number of scheduling ticks before jobs are hard-stopped |
|---|
| 136 | | - */ |
|---|
| 131 | +/* Default minimum number of scheduling ticks before jobs are hard-stopped */ |
|---|
| 137 | 132 | #define DEFAULT_JS_HARD_STOP_TICKS_SS (50) /* 5s */ |
|---|
| 138 | 133 | |
|---|
| 139 | | -/** |
|---|
| 140 | | - * Default minimum number of scheduling ticks before CL jobs are hard-stopped. |
|---|
| 141 | | - */ |
|---|
| 134 | +/* Default minimum number of scheduling ticks before CL jobs are hard-stopped. */ |
|---|
| 142 | 135 | #define DEFAULT_JS_HARD_STOP_TICKS_CL (50) /* 5s */ |
|---|
| 143 | 136 | |
|---|
| 144 | | -/** |
|---|
| 145 | | - * Default minimum number of scheduling ticks before jobs are hard-stopped |
|---|
| 137 | +/* Default minimum number of scheduling ticks before jobs are hard-stopped |
|---|
| 146 | 138 | * during dumping |
|---|
| 147 | 139 | */ |
|---|
| 148 | 140 | #define DEFAULT_JS_HARD_STOP_TICKS_DUMPING (15000) /* 1500s */ |
|---|
| 149 | 141 | |
|---|
| 150 | | -/** |
|---|
| 151 | | - * Default timeout for some software jobs, after which the software event wait |
|---|
| 142 | +/* Default timeout for some software jobs, after which the software event wait |
|---|
| 152 | 143 | * jobs will be cancelled. |
|---|
| 153 | 144 | */ |
|---|
| 154 | 145 | #define DEFAULT_JS_SOFT_JOB_TIMEOUT (3000) /* 3s */ |
|---|
| 155 | 146 | |
|---|
| 156 | | -/** |
|---|
| 157 | | - * Default minimum number of scheduling ticks before the GPU is reset to clear a |
|---|
| 147 | +/* Default minimum number of scheduling ticks before the GPU is reset to clear a |
|---|
| 158 | 148 | * "stuck" job |
|---|
| 159 | 149 | */ |
|---|
| 160 | 150 | #define DEFAULT_JS_RESET_TICKS_SS (55) /* 5.5s */ |
|---|
| 161 | 151 | |
|---|
| 162 | | -/** |
|---|
| 163 | | - * Default minimum number of scheduling ticks before the GPU is reset to clear a |
|---|
| 152 | +/* Default minimum number of scheduling ticks before the GPU is reset to clear a |
|---|
| 164 | 153 | * "stuck" CL job. |
|---|
| 165 | 154 | */ |
|---|
| 166 | 155 | #define DEFAULT_JS_RESET_TICKS_CL (55) /* 5.5s */ |
|---|
| 167 | 156 | |
|---|
| 168 | | -/** |
|---|
| 169 | | - * Default minimum number of scheduling ticks before the GPU is reset to clear a |
|---|
| 157 | +/* Default minimum number of scheduling ticks before the GPU is reset to clear a |
|---|
| 170 | 158 | * "stuck" job during dumping. |
|---|
| 171 | 159 | */ |
|---|
| 172 | 160 | #define DEFAULT_JS_RESET_TICKS_DUMPING (15020) /* 1502s */ |
|---|
| 173 | 161 | |
|---|
| 174 | | -/** |
|---|
| 175 | | - * Default number of milliseconds given for other jobs on the GPU to be |
|---|
| 162 | +/* Nominal reference frequency that was used to obtain all following |
|---|
| 163 | + * <...>_TIMEOUT_CYCLES macros, in kHz. |
|---|
| 164 | + * |
|---|
| 165 | + * Timeouts are scaled based on the relation between this value and the lowest |
|---|
| 166 | + * GPU clock frequency. |
|---|
| 167 | + */ |
|---|
| 168 | +#define DEFAULT_REF_TIMEOUT_FREQ_KHZ (100000) |
|---|
| 169 | + |
|---|
| 170 | +#if MALI_USE_CSF |
|---|
| 171 | +/* Waiting timeout for status change acknowledgment, in clock cycles. |
|---|
| 172 | + * |
|---|
| 173 | + * This is also the default timeout to be used when an invalid timeout |
|---|
| 174 | + * selector is used to retrieve the timeout on CSF GPUs. |
|---|
| 175 | + * |
|---|
| 176 | + * Based on 75000ms timeout at nominal 100MHz, as is required for Android - based |
|---|
| 177 | + * on scaling from a 50MHz GPU system. |
|---|
| 178 | + */ |
|---|
| 179 | +#define CSF_FIRMWARE_TIMEOUT_CYCLES (7500000000ull) |
|---|
| 180 | + |
|---|
| 181 | +/* Timeout in clock cycles for GPU Power Management to reach the desired |
|---|
| 182 | + * Shader, L2 and MCU state. |
|---|
| 183 | + * |
|---|
| 184 | + * Based on 2500ms timeout at nominal 100MHz, scaled from a 50MHz GPU system. |
|---|
| 185 | + */ |
|---|
| 186 | +#define CSF_PM_TIMEOUT_CYCLES (250000000) |
|---|
| 187 | + |
|---|
| 188 | +/* Waiting timeout in clock cycles for GPU reset to complete. |
|---|
| 189 | + * |
|---|
| 190 | + * Based on 2500ms timeout at 100MHz, scaled from a 50MHz GPU system |
|---|
| 191 | + */ |
|---|
| 192 | +#define CSF_GPU_RESET_TIMEOUT_CYCLES (250000000) |
|---|
| 193 | + |
|---|
| 194 | +/* Waiting timeout in clock cycles for all active CSGs to be suspended. |
|---|
| 195 | + * |
|---|
| 196 | + * Based on 1500ms timeout at 100MHz, scaled from a 50MHz GPU system. |
|---|
| 197 | + */ |
|---|
| 198 | +#define CSF_CSG_SUSPEND_TIMEOUT_CYCLES (150000000) |
|---|
| 199 | + |
|---|
| 200 | +/* Waiting timeout in clock cycles for GPU firmware to boot. |
|---|
| 201 | + * |
|---|
| 202 | + * Based on 250ms timeout at 100MHz, scaled from a 50MHz GPU system. |
|---|
| 203 | + */ |
|---|
| 204 | +#define CSF_FIRMWARE_BOOT_TIMEOUT_CYCLES (25000000) |
|---|
| 205 | + |
|---|
| 206 | +/* Waiting timeout for a ping request to be acknowledged, in clock cycles. |
|---|
| 207 | + * |
|---|
| 208 | + * Based on 6000ms timeout at 100MHz, scaled from a 50MHz GPU system. |
|---|
| 209 | + */ |
|---|
| 210 | +#define CSF_FIRMWARE_PING_TIMEOUT_CYCLES (600000000ull) |
|---|
| 211 | + |
|---|
| 212 | +#else /* MALI_USE_CSF */ |
|---|
| 213 | + |
|---|
| 214 | +/* A default timeout in clock cycles to be used when an invalid timeout |
|---|
| 215 | + * selector is used to retrieve the timeout, on JM GPUs. |
|---|
| 216 | + */ |
|---|
| 217 | +#define JM_DEFAULT_TIMEOUT_CYCLES (150000000) |
|---|
| 218 | + |
|---|
| 219 | +/* Default number of milliseconds given for other jobs on the GPU to be |
|---|
| 176 | 220 | * soft-stopped when the GPU needs to be reset. |
|---|
| 177 | 221 | */ |
|---|
| 178 | | -#define DEFAULT_RESET_TIMEOUT_MS (3000) /* 3s */ |
|---|
| 222 | +#define JM_DEFAULT_RESET_TIMEOUT_MS (1) /* 1 ms */ |
|---|
| 179 | 223 | |
|---|
| 180 | | -/** |
|---|
| 181 | | - * Default timeslice that a context is scheduled in for, in nanoseconds. |
|---|
| 224 | +/* Default timeout in clock cycles to be used when checking if JS_COMMAND_NEXT |
|---|
| 225 | + * is updated on HW side so a Job Slot is considered free. |
|---|
| 226 | + * This timeout will only take effect on GPUs with low value for the minimum |
|---|
| 227 | + * GPU clock frequency (<= 100MHz). |
|---|
| 228 | + * |
|---|
| 229 | + * Based on 1ms timeout at 100MHz. Will default to 0ms on GPUs with higher |
|---|
| 230 | + * value for minimum GPU clock frequency. |
|---|
| 231 | + */ |
|---|
| 232 | +#define JM_DEFAULT_JS_FREE_TIMEOUT_CYCLES (100000) |
|---|
| 233 | + |
|---|
| 234 | +#endif /* MALI_USE_CSF */ |
|---|
| 235 | + |
|---|
| 236 | +/* Default timeslice that a context is scheduled in for, in nanoseconds. |
|---|
| 182 | 237 | * |
|---|
| 183 | 238 | * When a context has used up this amount of time across its jobs, it is |
|---|
| 184 | 239 | * scheduled out to let another run. |
|---|
| .. | .. |
|---|
| 188 | 243 | */ |
|---|
| 189 | 244 | #define DEFAULT_JS_CTX_TIMESLICE_NS (50000000) /* 50ms */ |
|---|
| 190 | 245 | |
|---|
| 191 | | -/** |
|---|
| 192 | | - * Maximum frequency (in kHz) that the GPU can be clocked. For some platforms |
|---|
| 246 | +/* Maximum frequency (in kHz) that the GPU can be clocked. For some platforms |
|---|
| 193 | 247 | * this isn't available, so we simply define a dummy value here. If devfreq |
|---|
| 194 | 248 | * is enabled the value will be read from there, otherwise this should be |
|---|
| 195 | 249 | * overridden by defining GPU_FREQ_KHZ_MAX in the platform file. |
|---|
| 196 | 250 | */ |
|---|
| 197 | 251 | #define DEFAULT_GPU_FREQ_KHZ_MAX (5000) |
|---|
| 198 | 252 | |
|---|
| 199 | | -/** |
|---|
| 200 | | - * Default timeout for task execution on an endpoint |
|---|
| 253 | +/* Default timeout for task execution on an endpoint |
|---|
| 201 | 254 | * |
|---|
| 202 | 255 | * Number of GPU clock cycles before the driver terminates a task that is |
|---|
| 203 | 256 | * making no forward progress on an endpoint (e.g. shader core). |
|---|
| .. | .. |
|---|
| 206 | 259 | */ |
|---|
| 207 | 260 | #define DEFAULT_PROGRESS_TIMEOUT ((u64)5 * 500 * 1024 * 1024) |
|---|
| 208 | 261 | |
|---|
| 209 | | -/** |
|---|
| 210 | | - * Default threshold at which to switch to incremental rendering |
|---|
| 262 | +/* Default threshold at which to switch to incremental rendering |
|---|
| 211 | 263 | * |
|---|
| 212 | 264 | * Fraction of the maximum size of an allocation that grows on GPU page fault |
|---|
| 213 | 265 | * that can be used up before the driver switches to incremental rendering, |
|---|
| .. | .. |
|---|
| 215 | 267 | */ |
|---|
| 216 | 268 | #define DEFAULT_IR_THRESHOLD (192) |
|---|
| 217 | 269 | |
|---|
| 270 | +/* Waiting time in clock cycles for the completion of a MMU operation. |
|---|
| 271 | + * |
|---|
| 272 | + * Ideally 1.6M GPU cycles required for the L2 cache (512KiB slice) flush. |
|---|
| 273 | + * |
|---|
| 274 | + * As a pessimistic value, 50M GPU cycles ( > 30 times bigger ) is chosen. |
|---|
| 275 | + * It corresponds to 0.5s in GPU @ 100Mhz. |
|---|
| 276 | + */ |
|---|
| 277 | +#define MMU_AS_INACTIVE_WAIT_TIMEOUT_CYCLES ((u64)50 * 1024 * 1024) |
|---|
| 218 | 278 | #endif /* _KBASE_CONFIG_DEFAULTS_H_ */ |
|---|
| 219 | | - |
|---|