summaryrefslogtreecommitdiff
path: root/mali_kbase/Kbuild
blob: 666498c6f31da6f1745ebe6ddd0d829a70eb8082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
#
# (C) COPYRIGHT 2012-2023 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
# Foundation, and any use by you of this program is subject to the terms
# of such GNU license.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you can access it online at
# http://www.gnu.org/licenses/gpl-2.0.html.
#
#

# make $(src) as absolute path if it is not already, by prefixing $(srctree)
# This is to prevent any build issue due to wrong path.
src:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src))

#
# Prevent misuse when Kernel configurations are not present by default
# in out-of-tree builds
#
ifneq ($(CONFIG_ANDROID),n)
ifeq ($(CONFIG_GPU_TRACEPOINTS),n)
    $(error CONFIG_GPU_TRACEPOINTS must be set in Kernel configuration)
endif
endif

ifeq ($(CONFIG_DMA_SHARED_BUFFER),n)
    $(error CONFIG_DMA_SHARED_BUFFER must be set in Kernel configuration)
endif

ifeq ($(CONFIG_PM_DEVFREQ),n)
    $(error CONFIG_PM_DEVFREQ must be set in Kernel configuration)
endif

ifeq ($(CONFIG_DEVFREQ_THERMAL),n)
    $(error CONFIG_DEVFREQ_THERMAL must be set in Kernel configuration)
endif

ifeq ($(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND),n)
    $(error CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND must be set in Kernel configuration)
endif

ifeq ($(CONFIG_FW_LOADER), n)
    $(error CONFIG_FW_LOADER must be set in Kernel configuration)
endif

ifeq ($(CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS), y)
    ifneq ($(CONFIG_DEBUG_FS), y)
        $(error CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS depends on CONFIG_DEBUG_FS to be set in Kernel configuration)
    endif
endif

ifeq ($(CONFIG_MALI_FENCE_DEBUG), y)
    ifneq ($(CONFIG_SYNC_FILE), y)
        $(error CONFIG_MALI_FENCE_DEBUG depends on CONFIG_SYNC_FILE to be set in Kernel configuration)
    endif
endif

#
# Configurations
#

# We are building for Pixel
CONFIG_MALI_PLATFORM_NAME="pixel"

# Driver version string which is returned to userspace via an ioctl
MALI_RELEASE_NAME ?= '"r44p1-00dev3"'
# Set up defaults if not defined by build system
ifeq ($(CONFIG_MALI_DEBUG), y)
    MALI_UNIT_TEST = 1
    MALI_CUSTOMER_RELEASE ?= 0
else
    MALI_UNIT_TEST ?= 0
    MALI_CUSTOMER_RELEASE ?= 1
endif
MALI_COVERAGE ?= 0

# Kconfig passes in the name with quotes for in-tree builds - remove them.
MALI_PLATFORM_DIR := $(shell echo $(CONFIG_MALI_PLATFORM_NAME))

ifneq ($(CONFIG_SOC_GS101),y)
    CONFIG_MALI_CSF_SUPPORT ?= y
endif

ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
    MALI_JIT_PRESSURE_LIMIT_BASE = 0
    MALI_USE_CSF = 1
    ccflags-y += -DCONFIG_MALI_PIXEL_GPU_SSCD
ifeq ($(CONFIG_SOC_GS201),y)
ifeq ($(CONFIG_MALI_HOST_CONTROLS_SC_RAILS),y)
    ccflags-y += -DCONFIG_MALI_HOST_CONTROLS_SC_RAILS
endif
endif
else
    MALI_JIT_PRESSURE_LIMIT_BASE ?= 1
    MALI_USE_CSF ?= 0
endif


ifneq ($(CONFIG_MALI_KUTF), n)
    MALI_KERNEL_TEST_API ?= 1
else
    MALI_KERNEL_TEST_API ?= 0
endif

# Experimental features (corresponding -D definition should be appended to
# ccflags-y below, e.g. for MALI_EXPERIMENTAL_FEATURE,
# -DMALI_EXPERIMENTAL_FEATURE=$(MALI_EXPERIMENTAL_FEATURE) should be appended)
#
# Experimental features must default to disabled, e.g.:
# MALI_EXPERIMENTAL_FEATURE ?= 0
MALI_INCREMENTAL_RENDERING_JM ?= 0

#
# ccflags
#
ccflags-y += \
    -DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
    -DMALI_USE_CSF=$(MALI_USE_CSF) \
    -DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \
    -DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
    -DMALI_COVERAGE=$(MALI_COVERAGE) \
    -DMALI_RELEASE_NAME=$(MALI_RELEASE_NAME) \
    -DMALI_JIT_PRESSURE_LIMIT_BASE=$(MALI_JIT_PRESSURE_LIMIT_BASE) \
    -DMALI_INCREMENTAL_RENDERING_JM=$(MALI_INCREMENTAL_RENDERING_JM) \
    -DMALI_PLATFORM_DIR=$(MALI_PLATFORM_DIR)

ifeq ($(KBUILD_EXTMOD),)
# in-tree
    ccflags-y +=-DMALI_KBASE_PLATFORM_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
else
# out-of-tree
    ccflags-y +=-DMALI_KBASE_PLATFORM_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
endif

ccflags-y += \
    -I$(src) \
    -I$(src)/platform/$(MALI_PLATFORM_DIR) \
    -I$(src)/../../../base \
    -I$(src)/../../../../include \
    -I$(src)/tests/include

# Add include path for related GPU modules
ccflags-y += -I$(src)/../common/include

subdir-ccflags-y += $(ccflags-y)

#
# Kernel Modules
#
obj-$(CONFIG_MALI_MIDGARD) += mali_kbase.o
obj-$(CONFIG_MALI_ARBITRATION) += ../arbitration/
obj-$(CONFIG_MALI_KUTF)    += tests/

mali_kbase-y := \
    mali_kbase_cache_policy.o \
    mali_kbase_ccswe.o \
    mali_kbase_mem.o \
    mali_kbase_mem_migrate.o \
    mali_kbase_mem_pool_group.o \
    mali_kbase_native_mgm.o \
    mali_kbase_ctx_sched.o \
    mali_kbase_gpuprops.o \
    mali_kbase_pm.o \
    mali_kbase_config.o \
    mali_kbase_kinstr_prfcnt.o \
    mali_kbase_vinstr.o \
    mali_kbase_softjobs.o \
    mali_kbase_hw.o \
    mali_kbase_debug.o \
    mali_kbase_gpu_memory_debugfs.o \
    mali_kbase_mem_linux.o \
    mali_kbase_core_linux.o \
    mali_kbase_mem_profile_debugfs.o \
    mali_kbase_disjoint_events.o \
    mali_kbase_debug_mem_view.o \
    mali_kbase_debug_mem_zones.o \
    mali_kbase_debug_mem_allocs.o \
    mali_kbase_smc.o \
    mali_kbase_mem_pool.o \
    mali_kbase_mem_pool_debugfs.o \
    mali_kbase_debugfs_helper.o \
    mali_kbase_as_fault_debugfs.o \
    mali_kbase_regs_history_debugfs.o \
    mali_kbase_dvfs_debugfs.o \
    mali_power_gpu_frequency_trace.o \
    mali_kbase_trace_gpu_mem.o \
    mali_kbase_pbha.o

mali_kbase-$(CONFIG_DEBUG_FS) += mali_kbase_pbha_debugfs.o

mali_kbase-$(CONFIG_MALI_CINSTR_GWT) += mali_kbase_gwt.o

mali_kbase-$(CONFIG_SYNC_FILE) += \
    mali_kbase_fence_ops.o \
    mali_kbase_sync_file.o \
    mali_kbase_sync_common.o

mali_kbase-$(CONFIG_MALI_TRACE_POWER_GPU_WORK_PERIOD) += \
        mali_power_gpu_work_period_trace.o \
        mali_kbase_gpu_metrics.o

ifneq ($(CONFIG_MALI_CSF_SUPPORT),y)
    mali_kbase-y += \
        mali_kbase_jm.o \
        mali_kbase_dummy_job_wa.o \
        mali_kbase_debug_job_fault.o \
        mali_kbase_event.o \
        mali_kbase_jd.o \
        mali_kbase_jd_debugfs.o \
        mali_kbase_js.o \
        mali_kbase_js_ctx_attr.o \
        mali_kbase_kinstr_jm.o

    mali_kbase-$(CONFIG_SYNC_FILE) += \
        mali_kbase_fence_ops.o \
        mali_kbase_fence.o
endif


INCLUDE_SUBDIR = \
    $(src)/context/Kbuild \
    $(src)/debug/Kbuild \
    $(src)/device/Kbuild \
    $(src)/backend/gpu/Kbuild \
    $(src)/mmu/Kbuild \
    $(src)/tl/Kbuild \
    $(src)/hwcnt/Kbuild \
    $(src)/gpu/Kbuild \
    $(src)/thirdparty/Kbuild \
    $(src)/platform/$(MALI_PLATFORM_DIR)/Kbuild

ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
    INCLUDE_SUBDIR += $(src)/csf/Kbuild
endif

ifeq ($(CONFIG_MALI_ARBITER_SUPPORT),y)
    INCLUDE_SUBDIR += $(src)/arbiter/Kbuild
endif

ifeq ($(CONFIG_MALI_DEVFREQ),y)
    ifeq ($(CONFIG_DEVFREQ_THERMAL),y)
        INCLUDE_SUBDIR += $(src)/ipa/Kbuild
    endif
endif

ifeq ($(KBUILD_EXTMOD),)
# in-tree
    -include $(INCLUDE_SUBDIR)
else
# out-of-tree
    include $(INCLUDE_SUBDIR)
endif