1# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note 2# 3# (C) COPYRIGHT 2012-2023 ARM Limited. All rights reserved. 4# 5# This program is free software and is provided to you under the terms of the 6# GNU General Public License version 2 as published by the Free Software 7# Foundation, and any use by you of this program is subject to the terms 8# of such GNU license. 9# 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program; if not, you can access it online at 17# http://www.gnu.org/licenses/gpl-2.0.html. 18# 19# 20 21menuconfig MALI_BIFROST 22 tristate "Mali Bifrost series support" 23 select GPU_TRACEPOINTS if ANDROID 24 select DMA_SHARED_BUFFER 25 select FW_LOADER 26 default n 27 help 28 Enable this option to build support for a ARM Mali Bifrost GPU. 29 30 To compile this driver as a module, choose M here: 31 this will generate a single module, called mali_kbase. 32 33if MALI_BIFROST 34 35config MALI_PLATFORM_NAME 36 depends on MALI_BIFROST 37 string "Platform name" 38 default "devicetree" 39 help 40 Enter the name of the desired platform configuration directory to 41 include in the build. 'platform/$(MALI_PLATFORM_NAME)/Kbuild' must 42 exist. 43 44choice 45 prompt "Mali HW backend" 46 depends on MALI_BIFROST 47 default MALI_REAL_HW 48 49config MALI_REAL_HW 50 bool "Enable build of Mali kernel driver for real HW" 51 depends on MALI_BIFROST 52 help 53 This is the default HW backend. 54 55config MALI_BIFROST_NO_MALI 56 bool "Enable build of Mali kernel driver for No Mali" 57 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 58 help 59 This can be used to test the driver in a simulated environment 60 whereby the hardware is not physically present. If the hardware is physically 61 present it will not be used. This can be used to test the majority of the 62 driver without needing actual hardware or for software benchmarking. 63 All calls to the simulated hardware will complete immediately as if the hardware 64 completed the task. 65 66 67endchoice 68 69menu "Platform specific options" 70source "drivers/gpu/arm/bifrost/platform/Kconfig" 71endmenu 72 73config MALI_CSF_SUPPORT 74 bool "Enable Mali CSF based GPU support" 75 default n 76 help 77 Enables support for CSF based GPUs. 78 79config MALI_BIFROST_DEVFREQ 80 bool "Enable devfreq support for Mali" 81 depends on MALI_BIFROST && PM_DEVFREQ 82 select DEVFREQ_GOV_SIMPLE_ONDEMAND 83 default y 84 help 85 Support devfreq for Mali. 86 87 Using the devfreq framework and, by default, the simple on-demand 88 governor, the frequency of Mali will be dynamically selected from the 89 available OPPs. 90 91config MALI_BIFROST_DVFS 92 bool "Enable legacy DVFS" 93 depends on MALI_BIFROST && !MALI_BIFROST_DEVFREQ 94 default n 95 help 96 Choose this option to enable legacy DVFS in the Mali Midgard DDK. 97 98config MALI_BIFROST_GATOR_SUPPORT 99 bool "Enable Streamline tracing support" 100 depends on MALI_BIFROST 101 default y 102 help 103 Enables kbase tracing used by the Arm Streamline Performance Analyzer. 104 The tracepoints are used to derive GPU activity charts in Streamline. 105 106config MALI_BIFROST_ENABLE_TRACE 107 bool "Enable kbase tracing" 108 depends on MALI_BIFROST 109 default y if MALI_BIFROST_DEBUG 110 default n 111 help 112 Enables tracing in kbase. Trace log available through 113 the "mali_trace" debugfs file, when the CONFIG_DEBUG_FS is enabled 114 115config MALI_ARBITER_SUPPORT 116 bool "Enable arbiter support for Mali" 117 depends on MALI_BIFROST && !MALI_CSF_SUPPORT 118 default n 119 help 120 Enable support for the arbiter interface in the driver. 121 This allows an external arbiter to manage driver access 122 to GPU hardware in a virtualized environment 123 124 If unsure, say N. 125 126config MALI_DMA_BUF_MAP_ON_DEMAND 127 bool "Enable map imported dma-bufs on demand" 128 depends on MALI_BIFROST 129 default n 130 help 131 This option will cause kbase to set up the GPU mapping of imported 132 dma-buf when needed to run atoms. This is the legacy behavior. 133 134 This is intended for testing and the option will get removed in the 135 future. 136 137config MALI_DMA_BUF_LEGACY_COMPAT 138 bool "Enable legacy compatibility cache flush on dma-buf map" 139 depends on MALI_BIFROST && !MALI_DMA_BUF_MAP_ON_DEMAND 140 default n 141 help 142 This option enables compatibility with legacy dma-buf mapping 143 behavior, then the dma-buf is mapped on import, by adding cache 144 maintenance where MALI_DMA_BUF_MAP_ON_DEMAND would do the mapping, 145 including a cache flush. 146 147 This option might work-around issues related to missing cache 148 flushes in other drivers. This only has an effect for clients using 149 UK 11.18 or older. For later UK versions it is not possible. 150 151config MALI_CORESIGHT 152 depends on MALI_BIFROST && MALI_CSF_SUPPORT && !MALI_BIFROST_NO_MALI 153 bool "Enable Kbase CoreSight tracing support" 154 default n 155 156menuconfig MALI_BIFROST_EXPERT 157 depends on MALI_BIFROST 158 bool "Enable Expert Settings" 159 default n 160 help 161 Enabling this option and modifying the default settings may produce 162 a driver with performance or other limitations. 163 164if MALI_BIFROST_EXPERT 165 166config LARGE_PAGE_ALLOC_OVERRIDE 167 bool "Override default setting of 2MB pages" 168 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 169 default n 170 help 171 An override config for LARGE_PAGE_ALLOC config. 172 When LARGE_PAGE_ALLOC_OVERRIDE is Y, 2MB page allocation will be 173 enabled by LARGE_PAGE_ALLOC. When this is N, the feature will be 174 enabled when GPU HW satisfies requirements. 175 176 If in doubt, say N 177 178config LARGE_PAGE_ALLOC 179 bool "Attempt to allocate 2MB pages" 180 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 181 default n 182 help 183 Rather than allocating all GPU memory page-by-page, attempt to 184 allocate 2MB pages from the kernel. This reduces TLB pressure and 185 helps to prevent memory fragmentation. 186 187 Note this config applies only when LARGE_PAGE_ALLOC_OVERRIDE config 188 is enabled and enabling this on a GPU HW that does not satisfy 189 requirements can cause serious problem. 190 191 If in doubt, say N 192 193config MALI_MEMORY_FULLY_BACKED 194 bool "Enable memory fully physically-backed" 195 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 196 default n 197 help 198 This option enables full physical backing of all virtual 199 memory allocations in the kernel. Notice that this build 200 option only affects allocations of grow-on-GPU-page-fault 201 memory. 202 203config MALI_CORESTACK 204 bool "Enable support of GPU core stack power control" 205 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 206 default n 207 help 208 Enabling this feature on supported GPUs will let the driver powering 209 on/off the GPU core stack independently without involving the Power 210 Domain Controller. This should only be enabled on platforms which 211 integration of the PDC to the Mali GPU is known to be problematic. 212 This feature is currently only supported on t-Six and t-HEx GPUs. 213 214 If unsure, say N. 215 216comment "Platform options" 217 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 218 219config MALI_BIFROST_ERROR_INJECT 220 bool "Enable No Mali error injection" 221 depends on MALI_BIFROST && MALI_BIFROST_EXPERT && MALI_BIFROST_NO_MALI 222 default n 223 help 224 Enables insertion of errors to test module failure and recovery mechanisms. 225 226comment "Debug options" 227 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 228 229config MALI_BIFROST_DEBUG 230 bool "Enable debug build" 231 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 232 default n 233 help 234 Select this option for increased checking and reporting of errors. 235 236config MALI_BIFROST_FENCE_DEBUG 237 bool "Enable debug sync fence usage" 238 depends on MALI_BIFROST && MALI_BIFROST_EXPERT && SYNC_FILE 239 default y if MALI_BIFROST_DEBUG 240 help 241 Select this option to enable additional checking and reporting on the 242 use of sync fences in the Mali driver. 243 244 This will add a 3s timeout to all sync fence waits in the Mali 245 driver, so that when work for Mali has been waiting on a sync fence 246 for a long time a debug message will be printed, detailing what fence 247 is causing the block, and which dependent Mali atoms are blocked as a 248 result of this. 249 250 The timeout can be changed at runtime through the js_soft_timeout 251 device attribute, where the timeout is specified in milliseconds. 252 253config MALI_BIFROST_SYSTEM_TRACE 254 bool "Enable system event tracing support" 255 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 256 default y if MALI_BIFROST_DEBUG 257 default n 258 help 259 Choose this option to enable system trace events for each 260 kbase event. This is typically used for debugging but has 261 minimal overhead when not in use. Enable only if you know what 262 you are doing. 263 264comment "Instrumentation options" 265 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 266 267choice 268 prompt "Select Performance counters set" 269 default MALI_PRFCNT_SET_PRIMARY 270 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 271 272config MALI_PRFCNT_SET_PRIMARY 273 bool "Primary" 274 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 275 help 276 Select this option to use primary set of performance counters. 277 278config MALI_BIFROST_PRFCNT_SET_SECONDARY 279 bool "Secondary" 280 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 281 help 282 Select this option to use secondary set of performance counters. Kernel 283 features that depend on an access to the primary set of counters may 284 become unavailable. Enabling this option will prevent power management 285 from working optimally and may cause instrumentation tools to return 286 bogus results. 287 288 If unsure, use MALI_PRFCNT_SET_PRIMARY. 289 290config MALI_PRFCNT_SET_TERTIARY 291 bool "Tertiary" 292 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 293 help 294 Select this option to use tertiary set of performance counters. Kernel 295 features that depend on an access to the primary set of counters may 296 become unavailable. Enabling this option will prevent power management 297 from working optimally and may cause instrumentation tools to return 298 bogus results. 299 300 If unsure, use MALI_PRFCNT_SET_PRIMARY. 301 302endchoice 303 304config MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS 305 bool "Enable runtime selection of performance counters set via debugfs" 306 depends on MALI_BIFROST && MALI_BIFROST_EXPERT && DEBUG_FS 307 default n 308 help 309 Select this option to make the secondary set of performance counters 310 available at runtime via debugfs. Kernel features that depend on an 311 access to the primary set of counters may become unavailable. 312 313 If no runtime debugfs option is set, the build time counter set 314 choice will be used. 315 316 This feature is unsupported and unstable, and may break at any time. 317 Enabling this option will prevent power management from working 318 optimally and may cause instrumentation tools to return bogus results. 319 320 No validation is done on the debugfs input. Invalid input could cause 321 performance counter errors. Valid inputs are the values accepted by 322 the SET_SELECT bits of the PRFCNT_CONFIG register as defined in the 323 architecture specification. 324 325 If unsure, say N. 326 327config MALI_JOB_DUMP 328 bool "Enable system level support needed for job dumping" 329 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 330 default n 331 help 332 Choose this option to enable system level support needed for 333 job dumping. This is typically used for instrumentation but has 334 minimal overhead when not in use. Enable only if you know what 335 you are doing. 336 337comment "Workarounds" 338 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 339 340config MALI_PWRSOFT_765 341 bool "Enable workaround for PWRSOFT-765" 342 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 343 default n 344 help 345 PWRSOFT-765 fixes devfreq cooling devices issues. The fix was merged 346 in kernel v4.10, however if backported into the kernel then this 347 option must be manually selected. 348 349 If using kernel >= v4.10 then say N, otherwise if devfreq cooling 350 changes have been backported say Y to avoid compilation errors. 351 352config MALI_HW_ERRATA_1485982_NOT_AFFECTED 353 bool "Disable workaround for BASE_HW_ISSUE_GPU2017_1336" 354 depends on MALI_BIFROST && MALI_BIFROST_EXPERT 355 default n 356 help 357 This option disables the default workaround for GPU2017-1336. The 358 workaround keeps the L2 cache powered up except for powerdown and reset. 359 360 The workaround introduces a limitation that will prevent the running of 361 protected mode content on fully coherent platforms, as the switch to IO 362 coherency mode requires the L2 to be turned off. 363 364config MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE 365 bool "Use alternative workaround for BASE_HW_ISSUE_GPU2017_1336" 366 depends on MALI_BIFROST && MALI_BIFROST_EXPERT && !MALI_HW_ERRATA_1485982_NOT_AFFECTED 367 default n 368 help 369 This option uses an alternative workaround for GPU2017-1336. Lowering 370 the GPU clock to a, platform specific, known good frequency before 371 powering down the L2 cache. The clock can be specified in the device 372 tree using the property, opp-mali-errata-1485982. Otherwise the 373 slowest clock will be selected. 374 375endif 376 377config MALI_ARBITRATION 378 tristate "Enable Virtualization reference code" 379 depends on MALI_BIFROST 380 default n 381 help 382 Enables the build of several reference modules used in the reference 383 virtualization setup for Mali 384 If unsure, say N. 385 386 387# source "drivers/gpu/arm/bifrost/tests/Kconfig" 388 389endif 390