• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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# Driver version string which is returned to userspace via an ioctl
23MALI_RELEASE_NAME ?= "g2p0-01eac0"
24
25# Paths required for build
26
27# make $(src) as absolute path if it isn't already, by prefixing $(srctree)
28src:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src))
29KBASE_PATH = $(src)
30KBASE_PLATFORM_PATH = $(KBASE_PATH)/platform_dummy
31UMP_PATH = $(src)/../../../base
32
33# Set up defaults if not defined by build system
34MALI_CUSTOMER_RELEASE ?= 1
35MALI_USE_CSF ?= 0
36MALI_UNIT_TEST ?= 0
37MALI_KERNEL_TEST_API ?= 0
38MALI_COVERAGE ?= 0
39MALI_JIT_PRESSURE_LIMIT_BASE ?= 1
40CONFIG_MALI_PLATFORM_NAME ?= "devicetree"
41# Experimental features (corresponding -D definition should be appended to
42# DEFINES below, e.g. for MALI_EXPERIMENTAL_FEATURE,
43# -DMALI_EXPERIMENTAL_FEATURE=$(MALI_EXPERIMENTAL_FEATURE) should be appended)
44#
45# Experimental features must default to disabled, e.g.:
46# MALI_EXPERIMENTAL_FEATURE ?= 0
47MALI_INCREMENTAL_RENDERING ?= 0
48
49# Set up our defines, which will be passed to gcc
50DEFINES = \
51	-DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
52	-DMALI_USE_CSF=$(MALI_USE_CSF) \
53	-DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \
54	-DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
55	-DMALI_COVERAGE=$(MALI_COVERAGE) \
56	-DMALI_RELEASE_NAME=\"$(MALI_RELEASE_NAME)\" \
57	-DMALI_JIT_PRESSURE_LIMIT_BASE=$(MALI_JIT_PRESSURE_LIMIT_BASE) \
58	-DMALI_INCREMENTAL_RENDERING=$(MALI_INCREMENTAL_RENDERING)
59
60ifeq ($(KBUILD_EXTMOD),)
61# in-tree
62DEFINES +=-DMALI_KBASE_PLATFORM_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
63else
64# out-of-tree
65DEFINES +=-DMALI_KBASE_PLATFORM_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
66endif
67
68DEFINES += -I$(srctree)/drivers/staging/android
69
70DEFINES += -DMALI_KBASE_BUILD
71
72# Use our defines when compiling
73ccflags-y += $(DEFINES) -I$(KBASE_PATH)   -I$(KBASE_PLATFORM_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
74subdir-ccflags-y += $(DEFINES) -I$(KBASE_PATH)   -I$(KBASE_PLATFORM_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
75
76SRC := \
77	context/mali_kbase_context.c \
78	debug/mali_kbase_debug_ktrace.c \
79	device/mali_kbase_device.c \
80	device/mali_kbase_device_hw.c \
81	mali_kbase_cache_policy.c \
82	mali_kbase_ccswe.c \
83	mali_kbase_mem.c \
84	mali_kbase_mem_pool_group.c \
85	mali_kbase_native_mgm.c \
86	mali_kbase_ctx_sched.c \
87	mali_kbase_jm.c \
88	mali_kbase_gpuprops.c \
89	mali_kbase_pm.c \
90	mali_kbase_config.c \
91	mali_kbase_vinstr.c \
92	mali_kbase_hwcnt.c \
93	mali_kbase_hwcnt_backend_jm.c \
94	mali_kbase_hwcnt_gpu.c \
95	mali_kbase_hwcnt_legacy.c \
96	mali_kbase_hwcnt_types.c \
97	mali_kbase_hwcnt_virtualizer.c \
98	mali_kbase_softjobs.c \
99	mali_kbase_hw.c \
100	mali_kbase_debug.c \
101	mali_kbase_gpu_memory_debugfs.c \
102	mali_kbase_mem_linux.c \
103	mali_kbase_core_linux.c \
104	mali_kbase_mem_profile_debugfs.c \
105	mmu/mali_kbase_mmu.c \
106	mmu/mali_kbase_mmu_hw_direct.c \
107	mmu/mali_kbase_mmu_mode_lpae.c \
108	mmu/mali_kbase_mmu_mode_aarch64.c \
109	mali_kbase_disjoint_events.c \
110	mali_kbase_debug_mem_view.c \
111	mali_kbase_smc.c \
112	mali_kbase_mem_pool.c \
113	mali_kbase_mem_pool_debugfs.c \
114	mali_kbase_debugfs_helper.c \
115	mali_kbase_strings.c \
116	mali_kbase_as_fault_debugfs.c \
117	mali_kbase_regs_history_debugfs.c \
118	mali_power_gpu_frequency_trace.c \
119	mali_kbase_trace_gpu_mem.c \
120	thirdparty/mali_kbase_mmap.c \
121	tl/mali_kbase_timeline.c \
122	tl/mali_kbase_timeline_io.c \
123	tl/mali_kbase_tlstream.c \
124	tl/mali_kbase_tracepoints.c \
125	gpu/mali_kbase_gpu.c
126
127ifeq ($(MALI_USE_CSF),1)
128	SRC += \
129		debug/backend/mali_kbase_debug_ktrace_csf.c \
130		device/backend/mali_kbase_device_csf.c \
131		device/backend/mali_kbase_device_hw_csf.c \
132		gpu/backend/mali_kbase_gpu_fault_csf.c \
133		tl/backend/mali_kbase_timeline_csf.c \
134		mmu/backend/mali_kbase_mmu_csf.c \
135		context/backend/mali_kbase_context_csf.c
136else
137	SRC += \
138		mali_kbase_dummy_job_wa.c \
139		mali_kbase_debug_job_fault.c \
140		mali_kbase_event.c \
141		mali_kbase_jd.c \
142		mali_kbase_jd_debugfs.c \
143		mali_kbase_js.c \
144		mali_kbase_js_ctx_attr.c \
145		mali_kbase_kinstr_jm.c \
146		debug/backend/mali_kbase_debug_ktrace_jm.c \
147		device/backend/mali_kbase_device_jm.c \
148		device/backend/mali_kbase_device_hw_jm.c \
149		gpu/backend/mali_kbase_gpu_fault_jm.c \
150		tl/backend/mali_kbase_timeline_jm.c \
151		mmu/backend/mali_kbase_mmu_jm.c \
152		context/backend/mali_kbase_context_jm.c
153endif
154
155ifeq ($(CONFIG_MALI_CINSTR_GWT),y)
156	SRC += mali_kbase_gwt.c
157endif
158
159ifeq ($(MALI_UNIT_TEST),1)
160	SRC += tl/mali_kbase_timeline_test.c
161endif
162
163ifeq ($(MALI_CUSTOMER_RELEASE),0)
164	SRC += mali_kbase_regs_dump_debugfs.c
165endif
166
167
168ccflags-y += -I$(KBASE_PATH) -I$(KBASE_PATH)/debug \
169	-I$(KBASE_PATH)/debug/backend
170
171# Tell the Linux build system from which .o file to create the kernel module
172obj-$(CONFIG_MALI_BIFROST) += bifrost_kbase.o
173
174# Tell the Linux build system to enable building of our .c files
175bifrost_kbase-y := $(SRC:.c=.o)
176
177# Kconfig passes in the name with quotes for in-tree builds - remove them.
178platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_NAME))
179MALI_PLATFORM_DIR := platform/$(platform_name)
180ccflags-y += -I$(src)/$(MALI_PLATFORM_DIR)
181include $(src)/$(MALI_PLATFORM_DIR)/Kbuild
182
183ifeq ($(CONFIG_MALI_BIFROST_DEVFREQ),y)
184  ifeq ($(CONFIG_DEVFREQ_THERMAL),y)
185    include $(src)/ipa/Kbuild
186  endif
187endif
188
189ifeq ($(MALI_USE_CSF),1)
190	include $(src)/csf/Kbuild
191else
192# empty
193endif
194
195ifeq ($(CONFIG_MALI_ARBITER_SUPPORT),y)
196	include $(src)/arbiter/Kbuild
197else
198# empty
199endif
200
201ifeq ($(MALI_USE_CSF),0)
202	bifrost_kbase-$(CONFIG_MALI_BIFROST_DMA_FENCE) += \
203		mali_kbase_fence_ops.o \
204		mali_kbase_dma_fence.o \
205		mali_kbase_fence.o
206
207	bifrost_kbase-$(CONFIG_SYNC_FILE) += \
208		mali_kbase_fence_ops.o \
209		mali_kbase_fence.o
210endif
211
212bifrost_kbase-$(CONFIG_SYNC) += \
213	mali_kbase_sync_android.o \
214	mali_kbase_sync_common.o
215
216bifrost_kbase-$(CONFIG_SYNC_FILE) += \
217	mali_kbase_fence_ops.o \
218	mali_kbase_sync_file.o \
219	mali_kbase_sync_common.o
220
221include  $(src)/backend/gpu/Kbuild
222bifrost_kbase-y += $(BACKEND:.c=.o)
223
224
225ccflags-y += -I$(src)/backend/gpu
226subdir-ccflags-y += -I$(src)/backend/gpu
227
228# For kutf and mali_kutf_irq_latency_test
229obj-$(CONFIG_MALI_KUTF) += tests/
230