1#
2# (C) COPYRIGHT 2012-2020 ARM Limited. All rights reserved.
3#
4# This program is free software and is provided to you under the terms of the
5# GNU General Public License version 2 as published by the Free Software
6# Foundation, and any use by you of this program is subject to the terms
7# of such GNU licence.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, you can access it online at
16# http://www.gnu.org/licenses/gpl-2.0.html.
17#
18# SPDX-License-Identifier: GPL-2.0
19#
20#
21
22
23menuconfig MALI_BIFROST
24	tristate "Mali Bifrost series support"
25	select GPU_TRACEPOINTS if ANDROID
26	select DMA_SHARED_BUFFER
27	default n
28	help
29	  Enable this option to build support for a ARM Mali Bifrost GPU.
30
31	  To compile this driver as a module, choose M here:
32	  this will generate a single module, called mali_kbase.
33
34config MALI_BIFROST_GATOR_SUPPORT
35	bool "Enable Streamline tracing support"
36	depends on MALI_BIFROST
37	default n
38	help
39	  Enables kbase tracing used by the Arm Streamline Performance Analyzer.
40	  The tracepoints are used to derive GPU activity charts in Streamline.
41
42config MALI_BIFROST_DVFS
43	bool "Enable legacy DVFS"
44	depends on MALI_BIFROST && !MALI_BIFROST_DEVFREQ
45	default n
46	help
47	  Choose this option to enable legacy DVFS in the Mali Midgard DDK.
48
49config MALI_BIFROST_ENABLE_TRACE
50	bool "Enable kbase tracing"
51	depends on MALI_BIFROST
52	default y if MALI_BIFROST_DEBUG
53	default n
54	help
55	  Enables tracing in kbase.  Trace log available through
56	  the "mali_trace" debugfs file, when the CONFIG_DEBUG_FS is enabled
57
58config MALI_BIFROST_DEVFREQ
59	bool "devfreq support for Mali"
60	depends on MALI_BIFROST && PM_DEVFREQ
61	help
62	  Support devfreq for Mali.
63
64	  Using the devfreq framework and, by default, the simpleondemand
65	  governor, the frequency of Mali will be dynamically selected from the
66	  available OPPs.
67
68config MALI_BIFROST_DMA_FENCE
69	bool "DMA_BUF fence support for Mali"
70	depends on MALI_BIFROST
71	default n
72	help
73	  Support DMA_BUF fences for Mali.
74
75	  This option should only be enabled if the Linux Kernel has built in
76	  support for DMA_BUF fences.
77
78config MALI_PLATFORM_NAME
79	depends on MALI_BIFROST
80	string "Platform name"
81	default "devicetree"
82	help
83	  Enter the name of the desired platform configuration directory to
84	  include in the build. 'platform/$(MALI_PLATFORM_NAME)/Kbuild' must
85	  exist.
86
87config MALI_ARBITER_SUPPORT
88	bool "Enable arbiter support for Mali"
89	depends on MALI_BIFROST
90	default n
91	help
92	  Enable support for the arbiter interface in the driver.
93	  This allows an external arbiter to manage driver access
94	  to GPU hardware in a virtualized environment
95
96	  If unsure, say N.
97
98# MALI_BIFROST_EXPERT configuration options
99
100menuconfig MALI_BIFROST_EXPERT
101	depends on MALI_BIFROST
102	bool "Enable Expert Settings"
103	default n
104	help
105	  Enabling this option and modifying the default settings may produce a driver with performance or
106	  other limitations.
107
108config MALI_CORESTACK
109	bool "Support controlling power to the GPU core stack"
110	depends on MALI_BIFROST && MALI_BIFROST_EXPERT
111	default n
112	help
113	  Enabling this feature on supported GPUs will let the driver powering
114	  on/off the GPU core stack independently without involving the Power
115	  Domain Controller. This should only be enabled on platforms which
116	  integration of the PDC to the Mali GPU is known to be problematic.
117	  This feature is currently only supported on t-Six and t-HEx GPUs.
118
119	  If unsure, say N.
120
121config MALI_BIFROST_DEBUG
122	bool "Debug build"
123	depends on MALI_BIFROST && MALI_BIFROST_EXPERT
124	default n
125	help
126	  Select this option for increased checking and reporting of errors.
127
128config MALI_BIFROST_FENCE_DEBUG
129	bool "Debug sync fence usage"
130	depends on MALI_BIFROST && MALI_BIFROST_EXPERT && (SYNC || SYNC_FILE)
131	default y if MALI_BIFROST_DEBUG
132	help
133	  Select this option to enable additional checking and reporting on the
134	  use of sync fences in the Mali driver.
135
136	  This will add a 3s timeout to all sync fence waits in the Mali
137	  driver, so that when work for Mali has been waiting on a sync fence
138	  for a long time a debug message will be printed, detailing what fence
139	  is causing the block, and which dependent Mali atoms are blocked as a
140	  result of this.
141
142	  The timeout can be changed at runtime through the js_soft_timeout
143	  device attribute, where the timeout is specified in milliseconds.
144
145config MALI_BIFROST_NO_MALI
146	bool "No Mali"
147	depends on MALI_BIFROST && MALI_BIFROST_EXPERT
148	default n
149	help
150	  This can be used to test the driver in a simulated environment
151	  whereby the hardware is not physically present. If the hardware is physically
152	  present it will not be used. This can be used to test the majority of the
153	  driver without needing actual hardware or for software benchmarking.
154	  All calls to the simulated hardware will complete immediately as if the hardware
155	  completed the task.
156
157config MALI_REAL_HW
158	def_bool !MALI_BIFROST_NO_MALI
159
160config MALI_BIFROST_ERROR_INJECT
161	bool "Error injection"
162	depends on MALI_BIFROST && MALI_BIFROST_EXPERT && MALI_BIFROST_NO_MALI
163	default n
164	help
165	  Enables insertion of errors to test module failure and recovery mechanisms.
166
167config MALI_BIFROST_SYSTEM_TRACE
168	bool "Enable system event tracing support"
169	depends on MALI_BIFROST && MALI_BIFROST_EXPERT
170	default y if MALI_BIFROST_DEBUG
171	default n
172	help
173	  Choose this option to enable system trace events for each
174	  kbase event. This is typically used for debugging but has
175	  minimal overhead when not in use. Enable only if you know what
176	  you are doing.
177
178config MALI_2MB_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	  If in doubt, say N
188
189config MALI_PWRSOFT_765
190	bool "PWRSOFT-765 ticket"
191	depends on MALI_BIFROST && MALI_BIFROST_EXPERT
192	default n
193	help
194	  PWRSOFT-765 fixes devfreq cooling devices issues. The fix was merged
195	  in kernel v4.10, however if backported into the kernel then this
196	  option must be manually selected.
197
198	  If using kernel >= v4.10 then say N, otherwise if devfreq cooling
199	  changes have been backported say Y to avoid compilation errors.
200
201config MALI_MEMORY_FULLY_BACKED
202	bool "Memory fully physically-backed"
203	depends on MALI_BIFROST && MALI_BIFROST_EXPERT
204	default n
205	help
206	  This option enables full physical backing of all virtual
207	  memory allocations in the kernel. Notice that this build
208	  option only affects allocations of grow-on-GPU-page-fault
209	  memory.
210
211config MALI_DMA_BUF_MAP_ON_DEMAND
212	bool "Map imported dma-bufs on demand"
213	depends on MALI_BIFROST
214	default n
215	help
216	  This option caused kbase to set up the GPU mapping of imported
217	  dma-buf when needed to run atoms.  This is the legacy behaviour.
218
219	  This is intended for testing and the option will get removed in the
220	  future.
221
222config MALI_DMA_BUF_LEGACY_COMPAT
223	bool "Enable legacy compatibility cache flush on dma-buf map"
224	depends on MALI_BIFROST && !MALI_DMA_BUF_MAP_ON_DEMAND
225	default n
226	help
227	  This option enables compatibility with legacy dma-buf mapping
228	  behavior, then the dma-buf is mapped on import, by adding cache
229	  maintenance where MALI_DMA_BUF_MAP_ON_DEMAND would do the mapping,
230	  including a cache flush.
231
232	  This option might work-around issues related to missing cache
233	  flushes in other drivers. This only has an effect for clients using
234	  UK 11.18 or older. For later UK versions it is not possible.
235
236config MALI_HW_ERRATA_1485982_NOT_AFFECTED
237	bool "Disable workaround for BASE_HW_ISSUE_GPU2017_1336"
238	depends on MALI_BIFROST && MALI_BIFROST_EXPERT
239	default n
240	help
241	  This option disables the default workaround for GPU2017-1336. The
242	  workaround keeps the L2 cache powered up except for powerdown and reset.
243
244	  The workaround introduces a limitation that will prevent the running of
245	  protected mode content on fully coherent platforms, as the switch to IO
246	  coherency mode requires the L2 to be turned off.
247
248config MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE
249	bool "Use alternative workaround for BASE_HW_ISSUE_GPU2017_1336"
250	depends on MALI_BIFROST && MALI_BIFROST_EXPERT && !MALI_HW_ERRATA_1485982_NOT_AFFECTED
251	default n
252	help
253	  This option uses an alternative workaround for GPU2017-1336. Lowering
254	  the GPU clock to a, platform specific, known good frequeuncy before
255	  powering down the L2 cache. The clock can be specified in the device
256	  tree using the property, opp-mali-errata-1485982. Otherwise the
257	  slowest clock will be selected.
258
259config MALI_GEM5_BUILD
260	bool "Enable build of Mali kernel driver for GEM5"
261	depends on MALI_BIFROST
262	default n
263	help
264	  This option is to do a Mali GEM5 build.
265	  If unsure, say N.
266
267# Instrumentation options.
268
269config MALI_JOB_DUMP
270	bool "Enable system level support needed for job dumping"
271	depends on MALI_BIFROST && MALI_BIFROST_EXPERT
272	default n
273	help
274	  Choose this option to enable system level support needed for
275	  job dumping. This is typically used for instrumentation but has
276	  minimal overhead when not in use. Enable only if you know what
277	  you are doing.
278
279config MALI_BIFROST_PRFCNT_SET_SECONDARY
280	bool "Use secondary set of performance counters"
281	depends on MALI_BIFROST && MALI_BIFROST_EXPERT
282	default n
283	help
284	  Select this option to use secondary 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, say N.
291
292config MALI_PRFCNT_SET_SECONDARY_VIA_DEBUG_FS
293	bool "Use secondary set of performance counters"
294	depends on MALI_BIFROST && MALI_BIFROST_EXPERT && !MALI_BIFROST_PRFCNT_SET_SECONDARY && DEBUG_FS
295	default n
296	help
297	  Select this option to make the secondary set of performance counters
298	  available at runtime via debugfs. Kernel features that depend on an
299	  access to the primary set of counters may become unavailable.
300
301	  This feature is unsupported and unstable, and may break at any time.
302	  Enabling this option will prevent power management from working
303	  optimally and may cause instrumentation tools to return bogus results.
304
305	  If unsure, say N.
306
307source "vendor/drivers/gpu/arm/midgard/platform/Kconfig"
308# source "drivers/gpu/arm/midgard/tests/Kconfig"
309