• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15KBUILD_CFLAGS += -include rename.h
16
17# Driver version string which is returned to userspace via an ioctl
18MALI_RELEASE_NAME ?= "r18p0-01rel0"
19
20# Paths required for build
21
22# make $(src) as absolute path if it isn't already, by prefixing $(srctree)
23src:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src))
24KBASE_PATH = $(src)
25KBASE_PLATFORM_PATH = $(KBASE_PATH)/platform_dummy
26UMP_PATH = $(src)/../../../base
27
28ifeq ($(CONFIG_MALI_ERROR_INJECTION),y)
29MALI_ERROR_INJECT_ON = 1
30endif
31
32# Set up defaults if not defined by build system
33MALI_CUSTOMER_RELEASE ?= 1
34MALI_UNIT_TEST ?= 0
35MALI_KERNEL_TEST_API ?= 0
36MALI_ERROR_INJECT_ON ?= 0
37MALI_MOCK_TEST ?= 0
38MALI_COVERAGE ?= 0
39MALI_INSTRUMENTATION_LEVEL ?= 0
40# This workaround is for what seems to be a compiler bug we observed in
41# GCC 4.7 on AOSP 4.3.  The bug caused an intermittent failure compiling
42# the "_Pragma" syntax, where an error message is returned:
43#
44# "internal compiler error: unspellable token PRAGMA"
45#
46# This regression has thus far only been seen on the GCC 4.7 compiler bundled
47# with AOSP 4.3.0.  So this makefile, intended for in-tree kernel builds
48# which are not known to be used with AOSP, is hardcoded to disable the
49# workaround, i.e. set the define to 0.
50MALI_GCC_WORKAROUND_MIDCOM_4598 ?= 0
51
52# Set up our defines, which will be passed to gcc
53DEFINES = \
54	-DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
55	-DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \
56	-DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
57	-DMALI_ERROR_INJECT_ON=$(MALI_ERROR_INJECT_ON) \
58	-DMALI_MOCK_TEST=$(MALI_MOCK_TEST) \
59	-DMALI_COVERAGE=$(MALI_COVERAGE) \
60	-DMALI_INSTRUMENTATION_LEVEL=$(MALI_INSTRUMENTATION_LEVEL) \
61	-DMALI_RELEASE_NAME=\"$(MALI_RELEASE_NAME)\" \
62	-DMALI_GCC_WORKAROUND_MIDCOM_4598=$(MALI_GCC_WORKAROUND_MIDCOM_4598)
63
64ifeq ($(KBUILD_EXTMOD),)
65# in-tree
66DEFINES +=-DMALI_KBASE_THIRDPARTY_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME)
67else
68# out-of-tree
69DEFINES +=-DMALI_KBASE_THIRDPARTY_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME)
70endif
71
72DEFINES += -I$(srctree)/drivers/staging/android
73
74# Use our defines when compiling
75ccflags-y += $(DEFINES) -I$(KBASE_PATH)   -I$(KBASE_PLATFORM_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
76subdir-ccflags-y += $(DEFINES) -I$(KBASE_PATH)   -I$(KBASE_PLATFORM_PATH) -I$(OSK_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
77
78SRC := \
79	mali_kbase_device.c \
80	mali_kbase_cache_policy.c \
81	mali_kbase_mem.c \
82	mali_kbase_mmu.c \
83	mali_kbase_ctx_sched.c \
84	mali_kbase_jd.c \
85	mali_kbase_jd_debugfs.c \
86	mali_kbase_jm.c \
87	mali_kbase_gpuprops.c \
88	mali_kbase_js.c \
89	mali_kbase_js_ctx_attr.c \
90	mali_kbase_event.c \
91	mali_kbase_context.c \
92	mali_kbase_pm.c \
93	mali_kbase_config.c \
94	mali_kbase_vinstr.c \
95	mali_kbase_softjobs.c \
96	mali_kbase_10969_workaround.c \
97	mali_kbase_hw.c \
98	mali_kbase_utility.c \
99	mali_kbase_debug.c \
100	mali_kbase_trace_timeline.c \
101	mali_kbase_gpu_memory_debugfs.c \
102	mali_kbase_mem_linux.c \
103	mali_kbase_core_linux.c \
104	mali_kbase_replay.c \
105	mali_kbase_mem_profile_debugfs.c \
106	mali_kbase_mmu_mode_lpae.c \
107	mali_kbase_mmu_mode_aarch64.c \
108	mali_kbase_disjoint_events.c \
109	mali_kbase_gator_api.c \
110	mali_kbase_debug_mem_view.c \
111	mali_kbase_debug_job_fault.c \
112	mali_kbase_smc.c \
113	mali_kbase_mem_pool.c \
114	mali_kbase_mem_pool_debugfs.c \
115	mali_kbase_tlstream.c \
116	mali_kbase_strings.c \
117	mali_kbase_as_fault_debugfs.c \
118	mali_kbase_regs_history_debugfs.c
119
120
121
122
123ifeq ($(MALI_UNIT_TEST),1)
124	SRC += mali_kbase_tlstream_test.c
125endif
126
127ifeq ($(MALI_CUSTOMER_RELEASE),0)
128	SRC += mali_kbase_regs_dump_debugfs.c
129endif
130
131
132ccflags-y += -I$(KBASE_PATH)
133
134ifeq ($(CONFIG_MALI_PLATFORM_FAKE),y)
135	SRC += mali_kbase_platform_fake.c
136
137	ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS),y)
138		SRC += platform/vexpress/mali_kbase_config_vexpress.c \
139		platform/vexpress/mali_kbase_cpu_vexpress.c
140		ccflags-y += -I$(src)/platform/vexpress
141	endif
142
143	ifeq ($(CONFIG_MALI_PLATFORM_RTSM_VE),y)
144		SRC += platform/rtsm_ve/mali_kbase_config_vexpress.c
145		ccflags-y += -I$(src)/platform/rtsm_ve
146	endif
147
148	ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_1XV7_A57),y)
149		SRC += platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c
150		ccflags-y += -I$(src)/platform/vexpress_1xv7_a57
151	endif
152
153	ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_6XVIRTEX7_10MHZ),y)
154		SRC += platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c \
155		platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.c
156		ccflags-y += -I$(src)/platform/vexpress_6xvirtex7_10mhz
157	endif
158endif # CONFIG_MALI_PLATFORM_FAKE=y
159
160# Tell the Linux build system from which .o file to create the kernel module
161obj-$(CONFIG_MALI_MIDGARD) += midgard_kbase.o
162
163# Tell the Linux build system to enable building of our .c files
164midgard_kbase-y := $(SRC:.c=.o)
165
166ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY),y)
167  # Kconfig passes in the name with quotes for in-tree builds - remove them.
168  platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME))
169  MALI_PLATFORM_THIRDPARTY_DIR := platform/$(platform_name)
170  ccflags-y += -I$(src)/$(MALI_PLATFORM_THIRDPARTY_DIR)
171  include $(src)/$(MALI_PLATFORM_THIRDPARTY_DIR)/Kbuild
172endif
173
174ifeq ($(CONFIG_MALI_DEVFREQ),y)
175  ifeq ($(CONFIG_DEVFREQ_THERMAL),y)
176    include $(src)/ipa/Kbuild
177  endif
178endif
179
180midgard_kbase-$(CONFIG_MALI_DMA_FENCE) += \
181	mali_kbase_dma_fence.o \
182	mali_kbase_fence.o
183midgard_kbase-$(CONFIG_SYNC) += \
184	mali_kbase_sync_android.o \
185	mali_kbase_sync_common.o
186midgard_kbase-$(CONFIG_SYNC_FILE) += \
187	mali_kbase_sync_file.o \
188	mali_kbase_sync_common.o \
189	mali_kbase_fence.o
190
191MALI_BACKEND_PATH ?= backend
192CONFIG_MALI_BACKEND ?= gpu
193CONFIG_MALI_BACKEND_REAL ?= $(CONFIG_MALI_BACKEND)
194
195ifeq ($(MALI_MOCK_TEST),1)
196ifeq ($(CONFIG_MALI_BACKEND_REAL),gpu)
197# Test functionality
198midgard_kbase-y += tests/internal/src/mock/mali_kbase_pm_driver_mock.o
199endif
200endif
201
202include  $(src)/$(MALI_BACKEND_PATH)/$(CONFIG_MALI_BACKEND_REAL)/Kbuild
203midgard_kbase-y += $(BACKEND:.c=.o)
204
205
206ccflags-y += -I$(src)/$(MALI_BACKEND_PATH)/$(CONFIG_MALI_BACKEND_REAL)
207subdir-ccflags-y += -I$(src)/$(MALI_BACKEND_PATH)/$(CONFIG_MALI_BACKEND_REAL)
208
209# Default to devicetree platform if neither a fake platform or a thirdparty
210# platform is configured.
211ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY)$(CONFIG_MALI_PLATFORM_FAKE),)
212CONFIG_MALI_PLATFORM_DEVICETREE := y
213endif
214
215midgard_kbase-$(CONFIG_MALI_PLATFORM_DEVICETREE) += \
216	platform/devicetree/mali_kbase_runtime_pm.o \
217	platform/devicetree/mali_kbase_config_devicetree.o
218ccflags-$(CONFIG_MALI_PLATFORM_DEVICETREE) += -I$(src)/platform/devicetree
219
220# For kutf and mali_kutf_irq_latency_test
221obj-$(CONFIG_MALI_KUTF) += tests/
222