13d0407baSopenharmony_ci#
23d0407baSopenharmony_ci# (C) COPYRIGHT 2012-2015 ARM Limited. All rights reserved.
33d0407baSopenharmony_ci#
43d0407baSopenharmony_ci# This program is free software and is provided to you under the terms of the
53d0407baSopenharmony_ci# GNU General Public License version 2 as published by the Free Software
63d0407baSopenharmony_ci# Foundation, and any use by you of this program is subject to the terms
73d0407baSopenharmony_ci# of such GNU licence.
83d0407baSopenharmony_ci#
93d0407baSopenharmony_ci# A copy of the licence is included with the program, and can also be obtained
103d0407baSopenharmony_ci# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
113d0407baSopenharmony_ci# Boston, MA  02110-1301, USA.
123d0407baSopenharmony_ci#
133d0407baSopenharmony_ci#
143d0407baSopenharmony_ci
153d0407baSopenharmony_ci
163d0407baSopenharmony_ci
173d0407baSopenharmony_cimenuconfig MALI_MIDGARD
183d0407baSopenharmony_ci	tristate "Mali Midgard series support"
193d0407baSopenharmony_ci	select GPU_TRACEPOINTS if ANDROID
203d0407baSopenharmony_ci	default n
213d0407baSopenharmony_ci	help
223d0407baSopenharmony_ci	  Enable this option to build support for a ARM Mali Midgard GPU.
233d0407baSopenharmony_ci
243d0407baSopenharmony_ci	  To compile this driver as a module, choose M here:
253d0407baSopenharmony_ci	  this will generate a single module, called mali_kbase.
263d0407baSopenharmony_ci
273d0407baSopenharmony_ciconfig MALI_GATOR_SUPPORT
283d0407baSopenharmony_ci	bool "Streamline support via Gator"
293d0407baSopenharmony_ci	depends on MALI_MIDGARD
303d0407baSopenharmony_ci	default n
313d0407baSopenharmony_ci	help
323d0407baSopenharmony_ci	  Adds diagnostic support for use with the ARM Streamline Performance Analyzer.
333d0407baSopenharmony_ci	  You will need the Gator device driver already loaded before loading this driver when enabling
343d0407baSopenharmony_ci	  Streamline debug support.
353d0407baSopenharmony_ci	  This is a legacy interface required by older versions of Streamline.
363d0407baSopenharmony_ci
373d0407baSopenharmony_ciconfig MALI_MIDGARD_DVFS
383d0407baSopenharmony_ci	bool "Enable legacy DVFS"
393d0407baSopenharmony_ci	depends on MALI_MIDGARD && !MALI_DEVFREQ && !MALI_PLATFORM_DEVICETREE
403d0407baSopenharmony_ci	default n
413d0407baSopenharmony_ci	help
423d0407baSopenharmony_ci	  Choose this option to enable legacy DVFS in the Mali Midgard DDK.
433d0407baSopenharmony_ci
443d0407baSopenharmony_ciconfig MALI_MIDGARD_ENABLE_TRACE
453d0407baSopenharmony_ci	bool "Enable kbase tracing"
463d0407baSopenharmony_ci	depends on MALI_MIDGARD
473d0407baSopenharmony_ci	default n
483d0407baSopenharmony_ci	help
493d0407baSopenharmony_ci	  Enables tracing in kbase.  Trace log available through
503d0407baSopenharmony_ci	  the "mali_trace" debugfs file, when the CONFIG_DEBUG_FS is enabled
513d0407baSopenharmony_ci
523d0407baSopenharmony_ciconfig MALI_DEVFREQ
533d0407baSopenharmony_ci	bool "devfreq support for Mali"
543d0407baSopenharmony_ci	depends on MALI_MIDGARD && PM_DEVFREQ
553d0407baSopenharmony_ci	select DEVFREQ_GOV_SIMPLE_ONDEMAND
563d0407baSopenharmony_ci	help
573d0407baSopenharmony_ci	  Support devfreq for Mali.
583d0407baSopenharmony_ci
593d0407baSopenharmony_ci	  Using the devfreq framework and, by default, the simpleondemand
603d0407baSopenharmony_ci	  governor, the frequency of Mali will be dynamically selected from the
613d0407baSopenharmony_ci	  available OPPs.
623d0407baSopenharmony_ci
633d0407baSopenharmony_ciconfig MALI_DMA_FENCE
643d0407baSopenharmony_ci	bool "DMA_BUF fence support for Mali"
653d0407baSopenharmony_ci	depends on MALI_MIDGARD && !KDS
663d0407baSopenharmony_ci	default n
673d0407baSopenharmony_ci	help
683d0407baSopenharmony_ci	  Support DMA_BUF fences for Mali.
693d0407baSopenharmony_ci
703d0407baSopenharmony_ci	  This option should only be enabled if KDS is not present and
713d0407baSopenharmony_ci	  the Linux Kernel has built in support for DMA_BUF fences.
723d0407baSopenharmony_ci
733d0407baSopenharmony_ci# MALI_EXPERT configuration options
743d0407baSopenharmony_ci
753d0407baSopenharmony_cimenuconfig MALI_EXPERT
763d0407baSopenharmony_ci	depends on MALI_MIDGARD
773d0407baSopenharmony_ci	bool "Enable Expert Settings"
783d0407baSopenharmony_ci	default n
793d0407baSopenharmony_ci	help
803d0407baSopenharmony_ci	  Enabling this option and modifying the default settings may produce a driver with performance or
813d0407baSopenharmony_ci	  other limitations.
823d0407baSopenharmony_ci
833d0407baSopenharmony_ciconfig MALI_CORESTACK
843d0407baSopenharmony_ci	bool "Support controlling power to the GPU core stack"
853d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
863d0407baSopenharmony_ci	default n
873d0407baSopenharmony_ci	help
883d0407baSopenharmony_ci	  Enabling this feature on supported GPUs will let the driver powering
893d0407baSopenharmony_ci	  on/off the GPU core stack independently without involving the Power
903d0407baSopenharmony_ci	  Domain Controller. This should only be enabled on platforms which
913d0407baSopenharmony_ci	  integration of the PDC to the Mali GPU is known to be problematic.
923d0407baSopenharmony_ci	  This feature is currently only supported on t-Six and t-HEx GPUs.
933d0407baSopenharmony_ci
943d0407baSopenharmony_ci	  If unsure, say N.
953d0407baSopenharmony_ci
963d0407baSopenharmony_ciconfig MALI_PRFCNT_SET_SECONDARY
973d0407baSopenharmony_ci	bool "Use secondary set of performance counters"
983d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
993d0407baSopenharmony_ci	default n
1003d0407baSopenharmony_ci	help
1013d0407baSopenharmony_ci	  Select this option to use secondary set of performance counters. Kernel
1023d0407baSopenharmony_ci	  features that depend on an access to the primary set of counters may
1033d0407baSopenharmony_ci	  become unavailable. Enabling this option will prevent power management
1043d0407baSopenharmony_ci	  from working optimally and may cause instrumentation tools to return
1053d0407baSopenharmony_ci	  bogus results.
1063d0407baSopenharmony_ci
1073d0407baSopenharmony_ci	  If unsure, say N.
1083d0407baSopenharmony_ci
1093d0407baSopenharmony_ciconfig MALI_PLATFORM_FAKE
1103d0407baSopenharmony_ci	bool "Enable fake platform device support"
1113d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
1123d0407baSopenharmony_ci	default n
1133d0407baSopenharmony_ci	help
1143d0407baSopenharmony_ci	  When you start to work with the Mali Midgard series device driver the platform-specific code of
1153d0407baSopenharmony_ci	  the Linux kernel for your platform may not be complete. In this situation the kernel device driver
1163d0407baSopenharmony_ci	  supports creating the platform device outside of the Linux platform-specific code.
1173d0407baSopenharmony_ci	  Enable this option if would like to use a platform device configuration from within the device driver.
1183d0407baSopenharmony_ci
1193d0407baSopenharmony_cichoice
1203d0407baSopenharmony_ci	prompt "Platform configuration"
1213d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
1223d0407baSopenharmony_ci	default MALI_PLATFORM_DEVICETREE
1233d0407baSopenharmony_ci	help
1243d0407baSopenharmony_ci	  Select the SOC platform that contains a Mali Midgard GPU
1253d0407baSopenharmony_ci
1263d0407baSopenharmony_ciconfig MALI_PLATFORM_DEVICETREE
1273d0407baSopenharmony_ci	bool "Device Tree platform"
1283d0407baSopenharmony_ci	depends on OF
1293d0407baSopenharmony_ci	help
1303d0407baSopenharmony_ci	  Select this option to use Device Tree with the Mali driver.
1313d0407baSopenharmony_ci
1323d0407baSopenharmony_ci	  When using this option the Mali driver will get the details of the
1333d0407baSopenharmony_ci	  GPU hardware from the Device Tree. This means that the same driver
1343d0407baSopenharmony_ci	  binary can run on multiple platforms as long as all the GPU hardware
1353d0407baSopenharmony_ci	  details are described in the device tree.
1363d0407baSopenharmony_ci
1373d0407baSopenharmony_ci	  Device Tree is the recommended method for the Mali driver platform
1383d0407baSopenharmony_ci	  integration.
1393d0407baSopenharmony_ci
1403d0407baSopenharmony_ciconfig MALI_PLATFORM_VEXPRESS
1413d0407baSopenharmony_ci	depends on ARCH_VEXPRESS && (ARCH_VEXPRESS_CA9X4 || ARCH_VEXPRESS_CA15X4)
1423d0407baSopenharmony_ci	bool "Versatile Express"
1433d0407baSopenharmony_ciconfig MALI_PLATFORM_VEXPRESS_VIRTEX7_40MHZ
1443d0407baSopenharmony_ci	depends on ARCH_VEXPRESS && (ARCH_VEXPRESS_CA9X4 || ARCH_VEXPRESS_CA15X4)
1453d0407baSopenharmony_ci	bool "Versatile Express w/Virtex7 @ 40Mhz"
1463d0407baSopenharmony_ciconfig MALI_PLATFORM_GOLDFISH
1473d0407baSopenharmony_ci	depends on ARCH_GOLDFISH
1483d0407baSopenharmony_ci	bool "Android Goldfish virtual CPU"
1493d0407baSopenharmony_ciconfig MALI_PLATFORM_PBX
1503d0407baSopenharmony_ci	depends on ARCH_REALVIEW && REALVIEW_EB_A9MP && MACH_REALVIEW_PBX
1513d0407baSopenharmony_ci	bool "Realview PBX-A9"
1523d0407baSopenharmony_ciconfig MALI_PLATFORM_THIRDPARTY
1533d0407baSopenharmony_ci	bool "Third Party Platform"
1543d0407baSopenharmony_ciendchoice
1553d0407baSopenharmony_ci
1563d0407baSopenharmony_ciconfig MALI_PLATFORM_THIRDPARTY_NAME
1573d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_PLATFORM_THIRDPARTY && MALI_EXPERT
1583d0407baSopenharmony_ci	string "Third party platform name"
1593d0407baSopenharmony_ci	help
1603d0407baSopenharmony_ci	  Enter the name of a third party platform that is supported. The third part configuration
1613d0407baSopenharmony_ci	  file must be in midgard/config/tpip/mali_kbase_config_xxx.c where xxx is the name
1623d0407baSopenharmony_ci	  specified here.
1633d0407baSopenharmony_ci
1643d0407baSopenharmony_ciconfig MALI_DEBUG
1653d0407baSopenharmony_ci	bool "Debug build"
1663d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
1673d0407baSopenharmony_ci	default n
1683d0407baSopenharmony_ci	help
1693d0407baSopenharmony_ci	  Select this option for increased checking and reporting of errors.
1703d0407baSopenharmony_ci
1713d0407baSopenharmony_ciconfig MALI_FENCE_DEBUG
1723d0407baSopenharmony_ci	bool "Debug sync fence usage"
1733d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT && (SYNC || SYNC_FILE)
1743d0407baSopenharmony_ci	default y if MALI_DEBUG
1753d0407baSopenharmony_ci	help
1763d0407baSopenharmony_ci	  Select this option to enable additional checking and reporting on the
1773d0407baSopenharmony_ci	  use of sync fences in the Mali driver.
1783d0407baSopenharmony_ci
1793d0407baSopenharmony_ci	  This will add a 3s timeout to all sync fence waits in the Mali
1803d0407baSopenharmony_ci	  driver, so that when work for Mali has been waiting on a sync fence
1813d0407baSopenharmony_ci	  for a long time a debug message will be printed, detailing what fence
1823d0407baSopenharmony_ci	  is causing the block, and which dependent Mali atoms are blocked as a
1833d0407baSopenharmony_ci	  result of this.
1843d0407baSopenharmony_ci
1853d0407baSopenharmony_ci	  The timeout can be changed at runtime through the js_soft_timeout
1863d0407baSopenharmony_ci	  device attribute, where the timeout is specified in milliseconds.
1873d0407baSopenharmony_ci
1883d0407baSopenharmony_ciconfig MALI_NO_MALI
1893d0407baSopenharmony_ci	bool "No Mali"
1903d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
1913d0407baSopenharmony_ci	default n
1923d0407baSopenharmony_ci	help
1933d0407baSopenharmony_ci	  This can be used to test the driver in a simulated environment
1943d0407baSopenharmony_ci	  whereby the hardware is not physically present. If the hardware is physically
1953d0407baSopenharmony_ci	  present it will not be used. This can be used to test the majority of the
1963d0407baSopenharmony_ci	  driver without needing actual hardware or for software benchmarking.
1973d0407baSopenharmony_ci	  All calls to the simulated hardware will complete immediately as if the hardware
1983d0407baSopenharmony_ci	  completed the task.
1993d0407baSopenharmony_ci
2003d0407baSopenharmony_ciconfig MALI_ERROR_INJECT
2013d0407baSopenharmony_ci	bool "Error injection"
2023d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT && MALI_NO_MALI
2033d0407baSopenharmony_ci	default n
2043d0407baSopenharmony_ci	help
2053d0407baSopenharmony_ci	  Enables insertion of errors to test module failure and recovery mechanisms.
2063d0407baSopenharmony_ci
2073d0407baSopenharmony_ciconfig MALI_TRACE_TIMELINE
2083d0407baSopenharmony_ci	bool "Timeline tracing"
2093d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
2103d0407baSopenharmony_ci	default n
2113d0407baSopenharmony_ci	help
2123d0407baSopenharmony_ci	  Enables timeline tracing through the kernel tracepoint system.
2133d0407baSopenharmony_ci
2143d0407baSopenharmony_ciconfig MALI_SYSTEM_TRACE
2153d0407baSopenharmony_ci	bool "Enable system event tracing support"
2163d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
2173d0407baSopenharmony_ci	default n
2183d0407baSopenharmony_ci	help
2193d0407baSopenharmony_ci	  Choose this option to enable system trace events for each
2203d0407baSopenharmony_ci	  kbase event.	This is typically used for debugging but has
2213d0407baSopenharmony_ci	  minimal overhead when not in use. Enable only if you know what
2223d0407baSopenharmony_ci	  you are doing.
2233d0407baSopenharmony_ci
2243d0407baSopenharmony_ciconfig MALI_GPU_MMU_AARCH64
2253d0407baSopenharmony_ci	bool "Use AArch64 page tables"
2263d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
2273d0407baSopenharmony_ci	default n
2283d0407baSopenharmony_ci	help
2293d0407baSopenharmony_ci	  Use AArch64 format page tables for the GPU instead of LPAE-style.
2303d0407baSopenharmony_ci	  The two formats have the same functionality and performance but a
2313d0407baSopenharmony_ci	  future GPU may deprecate or remove the legacy LPAE-style format.
2323d0407baSopenharmony_ci
2333d0407baSopenharmony_ci	  The LPAE-style format is supported on all Midgard and current Bifrost
2343d0407baSopenharmony_ci	  GPUs. Enabling AArch64 format restricts the driver to only supporting
2353d0407baSopenharmony_ci	  Bifrost GPUs.
2363d0407baSopenharmony_ci
2373d0407baSopenharmony_ci	  If in doubt, say N.
2383d0407baSopenharmony_ci
2393d0407baSopenharmony_ciconfig MALI_PWRSOFT_765
2403d0407baSopenharmony_ci	bool "PWRSOFT-765 ticket"
2413d0407baSopenharmony_ci	depends on MALI_MIDGARD && MALI_EXPERT
2423d0407baSopenharmony_ci	default n
2433d0407baSopenharmony_ci	help
2443d0407baSopenharmony_ci	  PWRSOFT-765 fixes devfreq cooling devices issues. However, they are
2453d0407baSopenharmony_ci	  not merged in mainline kernel yet. So this define helps to guard those
2463d0407baSopenharmony_ci	  parts of the code.
2473d0407baSopenharmony_ci
2483d0407baSopenharmony_cisource "vendor/drivers/gpu/arm/midgard/platform/Kconfig"
2493d0407baSopenharmony_cisource "vendor/drivers/gpu/arm/midgard/tests/Kconfig"
250