Dongjin Kim | c1fea30 | 2024-09-13 12:12:25 +0900 | [diff] [blame^] | 1 | # SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note |
| 2 | # |
| 3 | # (C) COPYRIGHT 2012-2022 ARM Limited. All rights reserved. |
| 4 | # |
| 5 | # This program is free software and is provided to you under the terms of the |
| 6 | # GNU General Public License version 2 as published by the Free Software |
| 7 | # Foundation, and any use by you of this program is subject to the terms |
| 8 | # of such GNU license. |
| 9 | # |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program; if not, you can access it online at |
| 17 | # http://www.gnu.org/licenses/gpl-2.0.html. |
| 18 | # |
| 19 | # |
| 20 | |
| 21 | # make $(src) as absolute path if it is not already, by prefixing $(srctree) |
| 22 | # This is to prevent any build issue due to wrong path. |
| 23 | src:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src)) |
| 24 | |
| 25 | # |
| 26 | # Prevent misuse when Kernel configurations are not present by default |
| 27 | # in out-of-tree builds |
| 28 | # |
| 29 | ifneq ($(CONFIG_ANDROID),n) |
| 30 | ifeq ($(CONFIG_GPU_TRACEPOINTS),n) |
| 31 | $(error CONFIG_GPU_TRACEPOINTS must be set in Kernel configuration) |
| 32 | endif |
| 33 | endif |
| 34 | |
| 35 | ifeq ($(CONFIG_DMA_SHARED_BUFFER),n) |
| 36 | $(error CONFIG_DMA_SHARED_BUFFER must be set in Kernel configuration) |
| 37 | endif |
| 38 | |
| 39 | ifeq ($(CONFIG_PM_DEVFREQ),n) |
| 40 | $(error CONFIG_PM_DEVFREQ must be set in Kernel configuration) |
| 41 | endif |
| 42 | |
| 43 | ifeq ($(CONFIG_DEVFREQ_THERMAL),n) |
| 44 | $(error CONFIG_DEVFREQ_THERMAL must be set in Kernel configuration) |
| 45 | endif |
| 46 | |
| 47 | ifeq ($(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND),n) |
| 48 | $(error CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND must be set in Kernel configuration) |
| 49 | endif |
| 50 | |
| 51 | ifeq ($(CONFIG_FW_LOADER), n) |
| 52 | $(error CONFIG_FW_LOADER must be set in Kernel configuration) |
| 53 | endif |
| 54 | |
| 55 | ifeq ($(CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS), y) |
| 56 | ifneq ($(CONFIG_DEBUG_FS), y) |
| 57 | $(error CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS depends on CONFIG_DEBUG_FS to be set in Kernel configuration) |
| 58 | endif |
| 59 | endif |
| 60 | |
| 61 | ifeq ($(CONFIG_MALI_FENCE_DEBUG), y) |
| 62 | ifneq ($(CONFIG_SYNC_FILE), y) |
| 63 | $(error CONFIG_MALI_FENCE_DEBUG depends on CONFIG_SYNC_FILE to be set in Kernel configuration) |
| 64 | endif |
| 65 | endif |
| 66 | |
| 67 | # |
| 68 | # Configurations |
| 69 | # |
| 70 | |
| 71 | # Driver version string which is returned to userspace via an ioctl |
| 72 | MALI_RELEASE_NAME ?= '"r41p0-01eac0"' |
| 73 | # Set up defaults if not defined by build system |
| 74 | ifeq ($(CONFIG_MALI_DEBUG), y) |
| 75 | MALI_UNIT_TEST = 1 |
| 76 | MALI_CUSTOMER_RELEASE ?= 0 |
| 77 | else |
| 78 | MALI_UNIT_TEST ?= 0 |
| 79 | MALI_CUSTOMER_RELEASE ?= 1 |
| 80 | endif |
| 81 | MALI_COVERAGE ?= 0 |
| 82 | |
| 83 | CONFIG_MALI_PLATFORM_NAME ?= "devicetree" |
| 84 | |
| 85 | # Kconfig passes in the name with quotes for in-tree builds - remove them. |
| 86 | MALI_PLATFORM_DIR := $(shell echo $(CONFIG_MALI_PLATFORM_NAME)) |
| 87 | |
| 88 | ifeq ($(CONFIG_MALI_CSF_SUPPORT),y) |
| 89 | MALI_JIT_PRESSURE_LIMIT_BASE = 0 |
| 90 | MALI_USE_CSF = 1 |
| 91 | else |
| 92 | MALI_JIT_PRESSURE_LIMIT_BASE ?= 1 |
| 93 | MALI_USE_CSF ?= 0 |
| 94 | endif |
| 95 | |
| 96 | |
| 97 | ifneq ($(CONFIG_MALI_KUTF), n) |
| 98 | MALI_KERNEL_TEST_API ?= 1 |
| 99 | else |
| 100 | MALI_KERNEL_TEST_API ?= 0 |
| 101 | endif |
| 102 | |
| 103 | # Experimental features (corresponding -D definition should be appended to |
| 104 | # ccflags-y below, e.g. for MALI_EXPERIMENTAL_FEATURE, |
| 105 | # -DMALI_EXPERIMENTAL_FEATURE=$(MALI_EXPERIMENTAL_FEATURE) should be appended) |
| 106 | # |
| 107 | # Experimental features must default to disabled, e.g.: |
| 108 | # MALI_EXPERIMENTAL_FEATURE ?= 0 |
| 109 | MALI_INCREMENTAL_RENDERING_JM ?= 0 |
| 110 | |
| 111 | # |
| 112 | # ccflags |
| 113 | # |
| 114 | ccflags-y = \ |
| 115 | -DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \ |
| 116 | -DMALI_USE_CSF=$(MALI_USE_CSF) \ |
| 117 | -DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \ |
| 118 | -DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \ |
| 119 | -DMALI_COVERAGE=$(MALI_COVERAGE) \ |
| 120 | -DMALI_RELEASE_NAME=$(MALI_RELEASE_NAME) \ |
| 121 | -DMALI_JIT_PRESSURE_LIMIT_BASE=$(MALI_JIT_PRESSURE_LIMIT_BASE) \ |
| 122 | -DMALI_INCREMENTAL_RENDERING_JM=$(MALI_INCREMENTAL_RENDERING_JM) \ |
| 123 | -DMALI_PLATFORM_DIR=$(MALI_PLATFORM_DIR) |
| 124 | |
| 125 | |
| 126 | ifeq ($(KBUILD_EXTMOD),) |
| 127 | # in-tree |
| 128 | ccflags-y +=-DMALI_KBASE_PLATFORM_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME) |
| 129 | else |
| 130 | # out-of-tree |
| 131 | ccflags-y +=-DMALI_KBASE_PLATFORM_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME) |
| 132 | endif |
| 133 | |
| 134 | ccflags-y += \ |
| 135 | -I$(srctree)/include/linux \ |
| 136 | -I$(srctree)/drivers/staging/android \ |
| 137 | -I$(src) \ |
| 138 | -I$(src)/platform/$(MALI_PLATFORM_DIR) \ |
| 139 | -I$(src)/../../../base \ |
| 140 | -I$(src)/../../../../include |
| 141 | |
| 142 | subdir-ccflags-y += $(ccflags-y) |
| 143 | |
| 144 | # |
| 145 | # Kernel Modules |
| 146 | # |
| 147 | obj-$(CONFIG_MALI_MIDGARD) += mali_kbase.o |
| 148 | obj-$(CONFIG_MALI_ARBITRATION) += ../arbitration/ |
| 149 | obj-$(CONFIG_MALI_KUTF) += tests/ |
| 150 | |
| 151 | mali_kbase-y := \ |
| 152 | mali_kbase_cache_policy.o \ |
| 153 | mali_kbase_ccswe.o \ |
| 154 | mali_kbase_mem.o \ |
| 155 | mali_kbase_mem_migrate.o \ |
| 156 | mali_kbase_mem_pool_group.o \ |
| 157 | mali_kbase_native_mgm.o \ |
| 158 | mali_kbase_ctx_sched.o \ |
| 159 | mali_kbase_gpuprops.o \ |
| 160 | mali_kbase_pm.o \ |
| 161 | mali_kbase_config.o \ |
| 162 | mali_kbase_kinstr_prfcnt.o \ |
| 163 | mali_kbase_vinstr.o \ |
| 164 | mali_kbase_softjobs.o \ |
| 165 | mali_kbase_hw.o \ |
| 166 | mali_kbase_debug.o \ |
| 167 | mali_kbase_gpu_memory_debugfs.o \ |
| 168 | mali_kbase_mem_linux.o \ |
| 169 | mali_kbase_core_linux.o \ |
| 170 | mali_kbase_mem_profile_debugfs.o \ |
| 171 | mali_kbase_disjoint_events.o \ |
| 172 | mali_kbase_debug_mem_view.o \ |
| 173 | mali_kbase_debug_mem_zones.o \ |
| 174 | mali_kbase_debug_mem_allocs.o \ |
| 175 | mali_kbase_smc.o \ |
| 176 | mali_kbase_mem_pool.o \ |
| 177 | mali_kbase_mem_pool_debugfs.o \ |
| 178 | mali_kbase_debugfs_helper.o \ |
| 179 | mali_kbase_strings.o \ |
| 180 | mali_kbase_as_fault_debugfs.o \ |
| 181 | mali_kbase_regs_history_debugfs.o \ |
| 182 | mali_kbase_dvfs_debugfs.o \ |
| 183 | mali_power_gpu_frequency_trace.o \ |
| 184 | mali_kbase_trace_gpu_mem.o \ |
| 185 | mali_kbase_pbha.o |
| 186 | |
| 187 | mali_kbase-$(CONFIG_DEBUG_FS) += mali_kbase_pbha_debugfs.o |
| 188 | |
| 189 | mali_kbase-$(CONFIG_MALI_CINSTR_GWT) += mali_kbase_gwt.o |
| 190 | |
| 191 | mali_kbase-$(CONFIG_SYNC_FILE) += \ |
| 192 | mali_kbase_fence_ops.o \ |
| 193 | mali_kbase_sync_file.o \ |
| 194 | mali_kbase_sync_common.o |
| 195 | |
| 196 | ifneq ($(CONFIG_MALI_CSF_SUPPORT),y) |
| 197 | mali_kbase-y += \ |
| 198 | mali_kbase_jm.o \ |
| 199 | mali_kbase_dummy_job_wa.o \ |
| 200 | mali_kbase_debug_job_fault.o \ |
| 201 | mali_kbase_event.o \ |
| 202 | mali_kbase_jd.o \ |
| 203 | mali_kbase_jd_debugfs.o \ |
| 204 | mali_kbase_js.o \ |
| 205 | mali_kbase_js_ctx_attr.o \ |
| 206 | mali_kbase_kinstr_jm.o |
| 207 | |
| 208 | mali_kbase-$(CONFIG_SYNC_FILE) += \ |
| 209 | mali_kbase_fence_ops.o \ |
| 210 | mali_kbase_fence.o |
| 211 | endif |
| 212 | |
| 213 | |
| 214 | INCLUDE_SUBDIR = \ |
| 215 | $(src)/context/Kbuild \ |
| 216 | $(src)/debug/Kbuild \ |
| 217 | $(src)/device/Kbuild \ |
| 218 | $(src)/backend/gpu/Kbuild \ |
| 219 | $(src)/mmu/Kbuild \ |
| 220 | $(src)/tl/Kbuild \ |
| 221 | $(src)/hwcnt/Kbuild \ |
| 222 | $(src)/gpu/Kbuild \ |
| 223 | $(src)/thirdparty/Kbuild \ |
| 224 | $(src)/platform/$(MALI_PLATFORM_DIR)/Kbuild |
| 225 | |
| 226 | ifeq ($(CONFIG_MALI_CSF_SUPPORT),y) |
| 227 | INCLUDE_SUBDIR += $(src)/csf/Kbuild |
| 228 | endif |
| 229 | |
| 230 | ifeq ($(CONFIG_MALI_ARBITER_SUPPORT),y) |
| 231 | INCLUDE_SUBDIR += $(src)/arbiter/Kbuild |
| 232 | endif |
| 233 | |
| 234 | ifeq ($(CONFIG_MALI_DEVFREQ),y) |
| 235 | ifeq ($(CONFIG_DEVFREQ_THERMAL),y) |
| 236 | INCLUDE_SUBDIR += $(src)/ipa/Kbuild |
| 237 | endif |
| 238 | endif |
| 239 | |
| 240 | ifeq ($(KBUILD_EXTMOD),) |
| 241 | # in-tree |
| 242 | -include $(INCLUDE_SUBDIR) |
| 243 | else |
| 244 | # out-of-tree |
| 245 | include $(INCLUDE_SUBDIR) |
| 246 | endif |