Skip to content

Commit e5ccb3a

Browse files
lihuangrkhuangtao
authored andcommitted
MALI: bifrost: RK: add separate src dir of Bifrost driver for RK Linux device
The version of Bifrost DDK used in RK Linux device is different from the one used in Android platforms. It might be convenient to have a separate src directory for it. The new directory drivers/gpu/arm/bifrost_for_linux is copied from drivers/gpu/arm/bifrost of commit 25c5dc5a92y. It's on DDK r8p0-01rel0 Change-Id: I3b8b4f071104faf988e56b9b61d41378831943bb Signed-off-by: Putin Lee <putin.li@rock-chips.com>
1 parent f71c468 commit e5ccb3a

236 files changed

Lines changed: 77014 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#
2+
# (C) COPYRIGHT 2012-2016, 2017 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+
# A copy of the licence is included with the program, and can also be obtained
10+
# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
11+
# Boston, MA 02110-1301, USA.
12+
#
13+
#
14+
15+
# Driver version string which is returned to userspace via an ioctl
16+
MALI_RELEASE_NAME ?= "r8p0-01rel0"
17+
18+
# Paths required for build
19+
KBASE_PATH = $(src)
20+
KBASE_PLATFORM_PATH = $(KBASE_PATH)/platform_dummy
21+
UMP_PATH = $(src)/../../../base
22+
23+
ifeq ($(CONFIG_MALI_BIFROST_ERROR_INJECT),y)
24+
MALI_ERROR_INJECT_ON = 1
25+
endif
26+
27+
# Set up defaults if not defined by build system
28+
MALI_CUSTOMER_RELEASE ?= 1
29+
MALI_UNIT_TEST ?= 0
30+
MALI_KERNEL_TEST_API ?= 0
31+
MALI_ERROR_INJECT_ON ?= 0
32+
MALI_MOCK_TEST ?= 0
33+
MALI_COVERAGE ?= 0
34+
MALI_INSTRUMENTATION_LEVEL ?= 0
35+
CONFIG_MALI_PLATFORM_NAME ?= "devicetree"
36+
# This workaround is for what seems to be a compiler bug we observed in
37+
# GCC 4.7 on AOSP 4.3. The bug caused an intermittent failure compiling
38+
# the "_Pragma" syntax, where an error message is returned:
39+
#
40+
# "internal compiler error: unspellable token PRAGMA"
41+
#
42+
# This regression has thus far only been seen on the GCC 4.7 compiler bundled
43+
# with AOSP 4.3.0. So this makefile, intended for in-tree kernel builds
44+
# which are not known to be used with AOSP, is hardcoded to disable the
45+
# workaround, i.e. set the define to 0.
46+
MALI_GCC_WORKAROUND_MIDCOM_4598 ?= 0
47+
48+
# Set up our defines, which will be passed to gcc
49+
DEFINES = \
50+
-DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
51+
-DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \
52+
-DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
53+
-DMALI_ERROR_INJECT_ON=$(MALI_ERROR_INJECT_ON) \
54+
-DMALI_MOCK_TEST=$(MALI_MOCK_TEST) \
55+
-DMALI_COVERAGE=$(MALI_COVERAGE) \
56+
-DMALI_INSTRUMENTATION_LEVEL=$(MALI_INSTRUMENTATION_LEVEL) \
57+
-DMALI_RELEASE_NAME=\"$(MALI_RELEASE_NAME)\" \
58+
-DMALI_GCC_WORKAROUND_MIDCOM_4598=$(MALI_GCC_WORKAROUND_MIDCOM_4598)
59+
60+
ifeq ($(KBUILD_EXTMOD),)
61+
# in-tree
62+
DEFINES +=-DMALI_KBASE_PLATFORM_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
63+
else
64+
# out-of-tree
65+
DEFINES +=-DMALI_KBASE_PLATFORM_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
66+
endif
67+
68+
DEFINES += -I$(srctree)/drivers/staging/android
69+
70+
# Use our defines when compiling
71+
ccflags-y += $(DEFINES) -I$(KBASE_PATH) -I$(KBASE_PLATFORM_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
72+
subdir-ccflags-y += $(DEFINES) -I$(KBASE_PATH) -I$(KBASE_PLATFORM_PATH) -I$(OSK_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
73+
74+
SRC := \
75+
mali_kbase_device.c \
76+
mali_kbase_cache_policy.c \
77+
mali_kbase_mem.c \
78+
mali_kbase_mmu.c \
79+
mali_kbase_ctx_sched.c \
80+
mali_kbase_jd.c \
81+
mali_kbase_jd_debugfs.c \
82+
mali_kbase_jm.c \
83+
mali_kbase_gpuprops.c \
84+
mali_kbase_js.c \
85+
mali_kbase_js_ctx_attr.c \
86+
mali_kbase_event.c \
87+
mali_kbase_context.c \
88+
mali_kbase_pm.c \
89+
mali_kbase_config.c \
90+
mali_kbase_vinstr.c \
91+
mali_kbase_softjobs.c \
92+
mali_kbase_10969_workaround.c \
93+
mali_kbase_hw.c \
94+
mali_kbase_utility.c \
95+
mali_kbase_debug.c \
96+
mali_kbase_trace_timeline.c \
97+
mali_kbase_gpu_memory_debugfs.c \
98+
mali_kbase_mem_linux.c \
99+
mali_kbase_core_linux.c \
100+
mali_kbase_replay.c \
101+
mali_kbase_mem_profile_debugfs.c \
102+
mali_kbase_mmu_mode_lpae.c \
103+
mali_kbase_mmu_mode_aarch64.c \
104+
mali_kbase_disjoint_events.c \
105+
mali_kbase_gator_api.c \
106+
mali_kbase_debug_mem_view.c \
107+
mali_kbase_debug_job_fault.c \
108+
mali_kbase_smc.c \
109+
mali_kbase_mem_pool.c \
110+
mali_kbase_mem_pool_debugfs.c \
111+
mali_kbase_tlstream.c \
112+
mali_kbase_strings.c \
113+
mali_kbase_as_fault_debugfs.c \
114+
mali_kbase_regs_history_debugfs.c
115+
116+
117+
118+
119+
ifeq ($(MALI_UNIT_TEST),1)
120+
SRC += mali_kbase_tlstream_test.c
121+
endif
122+
123+
ifeq ($(MALI_CUSTOMER_RELEASE),0)
124+
SRC += mali_kbase_regs_dump_debugfs.c
125+
endif
126+
127+
128+
ccflags-y += -I$(KBASE_PATH)
129+
130+
# Tell the Linux build system from which .o file to create the kernel module
131+
obj-$(CONFIG_MALI_BIFROST) += bifrost_kbase.o
132+
133+
# Tell the Linux build system to enable building of our .c files
134+
bifrost_kbase-y := $(SRC:.c=.o)
135+
136+
# Kconfig passes in the name with quotes for in-tree builds - remove them.
137+
platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_NAME))
138+
MALI_PLATFORM_DIR := platform/$(platform_name)
139+
ccflags-y += -I$(src)/$(MALI_PLATFORM_DIR)
140+
include $(src)/$(MALI_PLATFORM_DIR)/Kbuild
141+
142+
ifeq ($(CONFIG_MALI_BIFROST_DEVFREQ),y)
143+
ifeq ($(CONFIG_DEVFREQ_THERMAL),y)
144+
include $(src)/ipa/Kbuild
145+
endif
146+
endif
147+
148+
bifrost_kbase-$(CONFIG_MALI_BIFROST_DMA_FENCE) += \
149+
mali_kbase_dma_fence.o \
150+
mali_kbase_fence.o
151+
bifrost_kbase-$(CONFIG_SYNC) += \
152+
mali_kbase_sync_android.o \
153+
mali_kbase_sync_common.o
154+
bifrost_kbase-$(CONFIG_SYNC_FILE) += \
155+
mali_kbase_sync_file.o \
156+
mali_kbase_sync_common.o \
157+
mali_kbase_fence.o
158+
159+
ifeq ($(MALI_MOCK_TEST),1)
160+
# Test functionality
161+
bifrost_kbase-y += tests/internal/src/mock/mali_kbase_pm_driver_mock.o
162+
endif
163+
164+
include $(src)/backend/gpu/Kbuild
165+
bifrost_kbase-y += $(BACKEND:.c=.o)
166+
167+
168+
ccflags-y += -I$(src)/backend/gpu
169+
subdir-ccflags-y += -I$(src)/backend/gpu
170+
171+
# For kutf and mali_kutf_irq_latency_test
172+
obj-$(CONFIG_MALI_KUTF) += tests/
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
#
2+
# (C) COPYRIGHT 2012-2017 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+
# A copy of the licence is included with the program, and can also be obtained
10+
# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
11+
# Boston, MA 02110-1301, USA.
12+
#
13+
#
14+
15+
16+
17+
menuconfig MALI_BIFROST
18+
tristate "Mali Bifrost series support"
19+
select GPU_TRACEPOINTS if ANDROID
20+
default n
21+
help
22+
Enable this option to build support for a ARM Mali Bifrost GPU.
23+
24+
To compile this driver as a module, choose M here:
25+
this will generate a single module, called mali_kbase.
26+
27+
config MALI_BIFROST_GATOR_SUPPORT
28+
bool "Streamline support via Gator"
29+
depends on MALI_BIFROST
30+
default n
31+
help
32+
Adds diagnostic support for use with the ARM Streamline Performance Analyzer.
33+
You will need the Gator device driver already loaded before loading this driver when enabling
34+
Streamline debug support.
35+
This is a legacy interface required by older versions of Streamline.
36+
37+
config MALI_BIFROST_DVFS
38+
bool "Enable legacy DVFS"
39+
depends on MALI_BIFROST && !MALI_BIFROST_DEVFREQ
40+
default n
41+
help
42+
Choose this option to enable legacy DVFS in the Mali Midgard DDK.
43+
44+
config MALI_BIFROST_ENABLE_TRACE
45+
bool "Enable kbase tracing"
46+
depends on MALI_BIFROST
47+
default n
48+
help
49+
Enables tracing in kbase. Trace log available through
50+
the "mali_trace" debugfs file, when the CONFIG_DEBUG_FS is enabled
51+
52+
config MALI_BIFROST_DEVFREQ
53+
bool "devfreq support for Mali"
54+
depends on MALI_BIFROST && PM_DEVFREQ
55+
help
56+
Support devfreq for Mali.
57+
58+
Using the devfreq framework and, by default, the simpleondemand
59+
governor, the frequency of Mali will be dynamically selected from the
60+
available OPPs.
61+
62+
config MALI_BIFROST_DMA_FENCE
63+
bool "DMA_BUF fence support for Mali"
64+
depends on MALI_BIFROST && !KDS
65+
default n
66+
help
67+
Support DMA_BUF fences for Mali.
68+
69+
This option should only be enabled if KDS is not present and
70+
the Linux Kernel has built in support for DMA_BUF fences.
71+
72+
config MALI_PLATFORM_NAME
73+
depends on MALI_BIFROST
74+
string "Platform name"
75+
default "devicetree"
76+
help
77+
Enter the name of the desired platform configuration directory to
78+
include in the build. 'platform/$(MALI_PLATFORM_NAME)/Kbuild' must
79+
exist.
80+
81+
# MALI_BIFROST_EXPERT configuration options
82+
83+
menuconfig MALI_BIFROST_EXPERT
84+
depends on MALI_BIFROST
85+
bool "Enable Expert Settings"
86+
default n
87+
help
88+
Enabling this option and modifying the default settings may produce a driver with performance or
89+
other limitations.
90+
91+
config MALI_CORESTACK
92+
bool "Support controlling power to the GPU core stack"
93+
depends on MALI_BIFROST && MALI_BIFROST_EXPERT
94+
default n
95+
help
96+
Enabling this feature on supported GPUs will let the driver powering
97+
on/off the GPU core stack independently without involving the Power
98+
Domain Controller. This should only be enabled on platforms which
99+
integration of the PDC to the Mali GPU is known to be problematic.
100+
This feature is currently only supported on t-Six and t-HEx GPUs.
101+
102+
If unsure, say N.
103+
104+
config MALI_BIFROST_PRFCNT_SET_SECONDARY
105+
bool "Use secondary set of performance counters"
106+
depends on MALI_BIFROST && MALI_BIFROST_EXPERT
107+
default n
108+
help
109+
Select this option to use secondary set of performance counters. Kernel
110+
features that depend on an access to the primary set of counters may
111+
become unavailable. Enabling this option will prevent power management
112+
from working optimally and may cause instrumentation tools to return
113+
bogus results.
114+
115+
If unsure, say N.
116+
117+
config MALI_BIFROST_DEBUG
118+
bool "Debug build"
119+
depends on MALI_BIFROST && MALI_BIFROST_EXPERT
120+
default n
121+
help
122+
Select this option for increased checking and reporting of errors.
123+
124+
config MALI_BIFROST_FENCE_DEBUG
125+
bool "Debug sync fence usage"
126+
depends on MALI_BIFROST && MALI_BIFROST_EXPERT && (SYNC || SYNC_FILE)
127+
default y if MALI_BIFROST_DEBUG
128+
help
129+
Select this option to enable additional checking and reporting on the
130+
use of sync fences in the Mali driver.
131+
132+
This will add a 3s timeout to all sync fence waits in the Mali
133+
driver, so that when work for Mali has been waiting on a sync fence
134+
for a long time a debug message will be printed, detailing what fence
135+
is causing the block, and which dependent Mali atoms are blocked as a
136+
result of this.
137+
138+
The timeout can be changed at runtime through the js_soft_timeout
139+
device attribute, where the timeout is specified in milliseconds.
140+
141+
config MALI_BIFROST_NO_MALI
142+
bool "No Mali"
143+
depends on MALI_BIFROST && MALI_BIFROST_EXPERT
144+
default n
145+
help
146+
This can be used to test the driver in a simulated environment
147+
whereby the hardware is not physically present. If the hardware is physically
148+
present it will not be used. This can be used to test the majority of the
149+
driver without needing actual hardware or for software benchmarking.
150+
All calls to the simulated hardware will complete immediately as if the hardware
151+
completed the task.
152+
153+
config MALI_BIFROST_ERROR_INJECT
154+
bool "Error injection"
155+
depends on MALI_BIFROST && MALI_BIFROST_EXPERT && MALI_BIFROST_NO_MALI
156+
default n
157+
help
158+
Enables insertion of errors to test module failure and recovery mechanisms.
159+
160+
config MALI_BIFROST_TRACE_TIMELINE
161+
bool "Timeline tracing"
162+
depends on MALI_BIFROST && MALI_BIFROST_EXPERT
163+
default n
164+
help
165+
Enables timeline tracing through the kernel tracepoint system.
166+
167+
config MALI_BIFROST_SYSTEM_TRACE
168+
bool "Enable system event tracing support"
169+
depends on MALI_BIFROST && MALI_BIFROST_EXPERT
170+
default n
171+
help
172+
Choose this option to enable system trace events for each
173+
kbase event. This is typically used for debugging but has
174+
minimal overhead when not in use. Enable only if you know what
175+
you are doing.
176+
177+
config MALI_2MB_ALLOC
178+
bool "Attempt to allocate 2MB pages"
179+
depends on MALI_BIFROST && MALI_BIFROST_EXPERT
180+
default n
181+
help
182+
Rather than allocating all GPU memory page-by-page, attempt to
183+
allocate 2MB pages from the kernel. This reduces TLB pressure and
184+
helps to prevent memory fragmentation.
185+
186+
If in doubt, say N
187+
188+
config MALI_PWRSOFT_765
189+
bool "PWRSOFT-765 ticket"
190+
default n
191+
help
192+
PWRSOFT-765 fixes devfreq cooling devices issues. However, they are
193+
not merged in mainline kernel yet. So this define helps to guard those
194+
parts of the code.
195+
196+
source "drivers/gpu/arm/bifrost/platform/Kconfig"
197+
# source "drivers/gpu/arm/bifrost/tests/Kconfig"

0 commit comments

Comments
 (0)