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