From e42736e67f7d84d329d9595b7393e6784c5b887f Mon Sep 17 00:00:00 2001 From: Sidath Senanayake Date: Mon, 22 Jan 2018 13:55:38 +0100 Subject: Mali Bifrost DDK r10p0 KMD Provenance: 27ee08eb4 (collaborate/EAC/b_r10p0) BX304L01B-BU-00000-r10p0-01rel0 BX304L06A-BU-00000-r10p0-01rel0 BX304X07X-BU-00000-r10p0-01rel0 Signed-off-by: Sidath Senanayake Change-Id: I31c8d66dad91c5b998f3e07757054c37c6aea963 --- mali_kbase/Kbuild | 23 +- mali_kbase/Kconfig | 24 +- mali_kbase/Makefile | 14 +- mali_kbase/Makefile.kbase | 14 +- mali_kbase/Mconfig | 207 +++++++++ mali_kbase/backend/gpu/Kbuild | 14 +- mali_kbase/backend/gpu/mali_kbase_backend_config.h | 15 +- .../backend/gpu/mali_kbase_cache_policy_backend.c | 15 +- .../backend/gpu/mali_kbase_cache_policy_backend.h | 15 +- .../gpu/mali_kbase_debug_job_fault_backend.c | 15 +- mali_kbase/backend/gpu/mali_kbase_devfreq.c | 24 +- mali_kbase/backend/gpu/mali_kbase_devfreq.h | 15 +- mali_kbase/backend/gpu/mali_kbase_device_hw.c | 15 +- .../backend/gpu/mali_kbase_device_internal.h | 15 +- mali_kbase/backend/gpu/mali_kbase_gpu.c | 15 +- .../backend/gpu/mali_kbase_gpuprops_backend.c | 15 +- mali_kbase/backend/gpu/mali_kbase_instr_backend.c | 15 +- mali_kbase/backend/gpu/mali_kbase_instr_defs.h | 15 +- mali_kbase/backend/gpu/mali_kbase_instr_internal.h | 15 +- mali_kbase/backend/gpu/mali_kbase_irq_internal.h | 15 +- mali_kbase/backend/gpu/mali_kbase_irq_linux.c | 15 +- mali_kbase/backend/gpu/mali_kbase_jm_as.c | 15 +- mali_kbase/backend/gpu/mali_kbase_jm_defs.h | 15 +- mali_kbase/backend/gpu/mali_kbase_jm_hw.c | 17 +- mali_kbase/backend/gpu/mali_kbase_jm_internal.h | 15 +- mali_kbase/backend/gpu/mali_kbase_jm_rb.c | 15 +- mali_kbase/backend/gpu/mali_kbase_jm_rb.h | 15 +- mali_kbase/backend/gpu/mali_kbase_js_affinity.c | 15 +- mali_kbase/backend/gpu/mali_kbase_js_affinity.h | 15 +- mali_kbase/backend/gpu/mali_kbase_js_backend.c | 15 +- mali_kbase/backend/gpu/mali_kbase_js_internal.h | 15 +- mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.c | 15 +- mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.h | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_always_on.c | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_always_on.h | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_backend.c | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_ca.c | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_ca.h | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.c | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.c | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.h | 15 +- .../backend/gpu/mali_kbase_pm_coarse_demand.c | 15 +- .../backend/gpu/mali_kbase_pm_coarse_demand.h | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_defs.h | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_demand.c | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_demand.h | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_driver.c | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_internal.h | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_metrics.c | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_policy.c | 15 +- mali_kbase/backend/gpu/mali_kbase_pm_policy.h | 15 +- mali_kbase/backend/gpu/mali_kbase_time.c | 15 +- mali_kbase/backend/gpu/mali_kbase_time.h | 15 +- mali_kbase/build.bp | 95 +++++ mali_kbase/docs/Doxyfile | 18 +- mali_kbase/docs/policy_operation_diagram.dot | 15 +- mali_kbase/docs/policy_overview.dot | 15 +- mali_kbase/ipa/Kbuild | 14 +- mali_kbase/ipa/mali_kbase_ipa.c | 37 +- mali_kbase/ipa/mali_kbase_ipa.h | 15 +- mali_kbase/ipa/mali_kbase_ipa_debugfs.c | 31 +- mali_kbase/ipa/mali_kbase_ipa_debugfs.h | 15 +- mali_kbase/ipa/mali_kbase_ipa_simple.c | 53 ++- mali_kbase/ipa/mali_kbase_ipa_simple.h | 15 +- mali_kbase/ipa/mali_kbase_ipa_vinstr_common.c | 15 +- mali_kbase/ipa/mali_kbase_ipa_vinstr_common.h | 15 +- mali_kbase/ipa/mali_kbase_ipa_vinstr_g71.c | 15 +- mali_kbase/mali_base_hwconfig_features.h | 45 +- mali_kbase/mali_base_hwconfig_issues.h | 31 +- mali_kbase/mali_base_kernel.h | 176 +++----- mali_kbase/mali_base_mem_priv.h | 15 +- mali_kbase/mali_base_vendor_specific_func.h | 15 +- mali_kbase/mali_kbase.h | 76 +++- mali_kbase/mali_kbase_10969_workaround.c | 15 +- mali_kbase/mali_kbase_10969_workaround.h | 15 +- mali_kbase/mali_kbase_as_fault_debugfs.c | 15 +- mali_kbase/mali_kbase_as_fault_debugfs.h | 15 +- mali_kbase/mali_kbase_cache_policy.c | 15 +- mali_kbase/mali_kbase_cache_policy.h | 15 +- mali_kbase/mali_kbase_config.c | 25 +- mali_kbase/mali_kbase_config.h | 68 +-- mali_kbase/mali_kbase_config_defaults.h | 23 +- mali_kbase/mali_kbase_context.c | 20 +- mali_kbase/mali_kbase_context.h | 15 +- mali_kbase/mali_kbase_core_linux.c | 463 ++++++++------------- mali_kbase/mali_kbase_ctx_sched.c | 15 +- mali_kbase/mali_kbase_ctx_sched.h | 15 +- mali_kbase/mali_kbase_debug.c | 15 +- mali_kbase/mali_kbase_debug.h | 15 +- mali_kbase/mali_kbase_debug_job_fault.c | 15 +- mali_kbase/mali_kbase_debug_job_fault.h | 15 +- mali_kbase/mali_kbase_debug_mem_view.c | 15 +- mali_kbase/mali_kbase_debug_mem_view.h | 15 +- mali_kbase/mali_kbase_defs.h | 80 +++- mali_kbase/mali_kbase_device.c | 15 +- mali_kbase/mali_kbase_disjoint_events.c | 15 +- mali_kbase/mali_kbase_dma_fence.c | 15 +- mali_kbase/mali_kbase_dma_fence.h | 15 +- mali_kbase/mali_kbase_event.c | 15 +- mali_kbase/mali_kbase_fence.c | 15 +- mali_kbase/mali_kbase_fence.h | 15 +- mali_kbase/mali_kbase_fence_defs.h | 15 +- mali_kbase/mali_kbase_gator.h | 15 +- mali_kbase/mali_kbase_gator_api.c | 15 +- mali_kbase/mali_kbase_gator_api.h | 15 +- mali_kbase/mali_kbase_gator_hwcnt_names.h | 17 +- mali_kbase/mali_kbase_gator_hwcnt_names_thex.h | 15 +- mali_kbase/mali_kbase_gator_hwcnt_names_tkax.h | 19 +- mali_kbase/mali_kbase_gator_hwcnt_names_tmix.h | 15 +- mali_kbase/mali_kbase_gator_hwcnt_names_tnox.h | 19 +- mali_kbase/mali_kbase_gator_hwcnt_names_tsix.h | 15 +- mali_kbase/mali_kbase_gator_hwcnt_names_ttrx.h | 296 +++++++++++++ mali_kbase/mali_kbase_gpu_id.h | 15 +- mali_kbase/mali_kbase_gpu_memory_debugfs.c | 15 +- mali_kbase/mali_kbase_gpu_memory_debugfs.h | 15 +- mali_kbase/mali_kbase_gpuprops.c | 24 +- mali_kbase/mali_kbase_gpuprops.h | 15 +- mali_kbase/mali_kbase_gpuprops_types.h | 15 +- mali_kbase/mali_kbase_gwt.c | 286 +++++++++++++ mali_kbase/mali_kbase_gwt.h | 55 +++ mali_kbase/mali_kbase_hw.c | 15 +- mali_kbase/mali_kbase_hw.h | 15 +- mali_kbase/mali_kbase_hwaccess_backend.h | 15 +- mali_kbase/mali_kbase_hwaccess_defs.h | 15 +- mali_kbase/mali_kbase_hwaccess_gpuprops.h | 15 +- mali_kbase/mali_kbase_hwaccess_instr.h | 15 +- mali_kbase/mali_kbase_hwaccess_jm.h | 15 +- mali_kbase/mali_kbase_hwaccess_pm.h | 15 +- mali_kbase/mali_kbase_hwaccess_time.h | 15 +- mali_kbase/mali_kbase_hwcnt_reader.h | 15 +- mali_kbase/mali_kbase_ioctl.h | 135 +++++- mali_kbase/mali_kbase_jd.c | 28 +- mali_kbase/mali_kbase_jd_debugfs.c | 15 +- mali_kbase/mali_kbase_jd_debugfs.h | 15 +- mali_kbase/mali_kbase_jm.c | 15 +- mali_kbase/mali_kbase_jm.h | 15 +- mali_kbase/mali_kbase_js.c | 41 +- mali_kbase/mali_kbase_js.h | 56 +-- mali_kbase/mali_kbase_js_ctx_attr.c | 15 +- mali_kbase/mali_kbase_js_ctx_attr.h | 15 +- mali_kbase/mali_kbase_js_defs.h | 17 +- mali_kbase/mali_kbase_linux.h | 15 +- mali_kbase/mali_kbase_mem.c | 292 ++++++++++--- mali_kbase/mali_kbase_mem.h | 110 +++-- mali_kbase/mali_kbase_mem_linux.c | 233 +++-------- mali_kbase/mali_kbase_mem_linux.h | 15 +- mali_kbase/mali_kbase_mem_lowlevel.h | 15 +- mali_kbase/mali_kbase_mem_pool.c | 29 +- mali_kbase/mali_kbase_mem_pool_debugfs.c | 15 +- mali_kbase/mali_kbase_mem_pool_debugfs.h | 15 +- mali_kbase/mali_kbase_mem_profile_debugfs.c | 15 +- mali_kbase/mali_kbase_mem_profile_debugfs.h | 15 +- .../mali_kbase_mem_profile_debugfs_buf_size.h | 15 +- mali_kbase/mali_kbase_mmu.c | 288 +++++++++++-- mali_kbase/mali_kbase_mmu_hw.h | 15 +- mali_kbase/mali_kbase_mmu_mode_aarch64.c | 15 +- mali_kbase/mali_kbase_mmu_mode_lpae.c | 15 +- mali_kbase/mali_kbase_platform_fake.c | 15 +- mali_kbase/mali_kbase_pm.c | 15 +- mali_kbase/mali_kbase_pm.h | 15 +- mali_kbase/mali_kbase_profiling_gator_api.h | 15 +- mali_kbase/mali_kbase_regs_history_debugfs.c | 15 +- mali_kbase/mali_kbase_regs_history_debugfs.h | 15 +- mali_kbase/mali_kbase_replay.c | 15 +- mali_kbase/mali_kbase_smc.c | 15 +- mali_kbase/mali_kbase_smc.h | 15 +- mali_kbase/mali_kbase_softjobs.c | 52 +-- mali_kbase/mali_kbase_strings.c | 15 +- mali_kbase/mali_kbase_strings.h | 15 +- mali_kbase/mali_kbase_sync.h | 15 +- mali_kbase/mali_kbase_sync_android.c | 15 +- mali_kbase/mali_kbase_sync_common.c | 15 +- mali_kbase/mali_kbase_sync_file.c | 15 +- mali_kbase/mali_kbase_tlstream.c | 25 +- mali_kbase/mali_kbase_tlstream.h | 23 +- mali_kbase/mali_kbase_trace_defs.h | 15 +- mali_kbase/mali_kbase_trace_timeline.c | 15 +- mali_kbase/mali_kbase_trace_timeline.h | 15 +- mali_kbase/mali_kbase_trace_timeline_defs.h | 15 +- mali_kbase/mali_kbase_utility.c | 15 +- mali_kbase/mali_kbase_utility.h | 15 +- mali_kbase/mali_kbase_vinstr.c | 15 +- mali_kbase/mali_kbase_vinstr.h | 15 +- mali_kbase/mali_linux_kbase_trace.h | 15 +- mali_kbase/mali_linux_trace.h | 15 +- mali_kbase/mali_malisw.h | 15 +- mali_kbase/mali_midg_coherency.h | 15 +- mali_kbase/mali_midg_regmap.h | 15 +- mali_kbase/mali_timeline.h | 15 +- mali_kbase/mali_uk.h | 15 +- mali_kbase/platform/Kconfig | 14 +- mali_kbase/platform/devicetree/Kbuild | 14 +- .../devicetree/mali_kbase_config_devicetree.c | 21 +- .../devicetree/mali_kbase_config_platform.h | 50 +-- .../platform/devicetree/mali_kbase_runtime_pm.c | 15 +- mali_kbase/platform/mali_kbase_platform_common.h | 26 -- mali_kbase/platform/vexpress/Kbuild | 15 +- .../platform/vexpress/mali_kbase_config_platform.h | 52 +-- .../platform/vexpress/mali_kbase_config_vexpress.c | 23 +- .../platform/vexpress/mali_kbase_cpu_vexpress.c | 279 ------------- .../platform/vexpress/mali_kbase_cpu_vexpress.h | 38 -- mali_kbase/platform/vexpress_1xv7_a57/Kbuild | 14 +- .../vexpress_1xv7_a57/mali_kbase_config_platform.h | 50 +-- .../vexpress_1xv7_a57/mali_kbase_config_vexpress.c | 21 +- .../platform/vexpress_6xvirtex7_10mhz/Kbuild | 14 +- .../mali_kbase_config_platform.h | 52 +-- .../mali_kbase_config_vexpress.c | 23 +- .../mali_kbase_cpu_vexpress.c | 71 ---- .../mali_kbase_cpu_vexpress.h | 28 -- mali_kbase/platform_dummy/mali_ukk_os.h | 15 +- mali_kbase/protected_mode_switcher.h | 15 +- mali_kbase/sconscript | 15 +- mali_kbase/tests/Kbuild | 14 +- mali_kbase/tests/Kconfig | 14 +- mali_kbase/tests/include/kutf/kutf_helpers.h | 15 +- mali_kbase/tests/include/kutf/kutf_helpers_user.h | 15 +- mali_kbase/tests/include/kutf/kutf_mem.h | 15 +- mali_kbase/tests/include/kutf/kutf_resultset.h | 15 +- mali_kbase/tests/include/kutf/kutf_suite.h | 15 +- mali_kbase/tests/include/kutf/kutf_utils.h | 15 +- mali_kbase/tests/kutf/Kbuild | 14 +- mali_kbase/tests/kutf/Kconfig | 14 +- mali_kbase/tests/kutf/Makefile | 14 +- mali_kbase/tests/kutf/kutf_helpers.c | 15 +- mali_kbase/tests/kutf/kutf_helpers_user.c | 16 +- mali_kbase/tests/kutf/kutf_mem.c | 16 +- mali_kbase/tests/kutf/kutf_resultset.c | 15 +- mali_kbase/tests/kutf/kutf_suite.c | 35 +- mali_kbase/tests/kutf/kutf_utils.c | 15 +- mali_kbase/tests/kutf/sconscript | 14 +- mali_kbase/tests/mali_kutf_irq_test/Kbuild | 14 +- mali_kbase/tests/mali_kutf_irq_test/Kconfig | 14 +- mali_kbase/tests/mali_kutf_irq_test/Makefile | 14 +- .../mali_kutf_irq_test/mali_kutf_irq_test_main.c | 15 +- mali_kbase/tests/mali_kutf_irq_test/sconscript | 14 +- mali_kbase/tests/sconscript | 14 +- mali_kbase/thirdparty/mali_kbase_mmap.c | 321 ++++++++++++++ 238 files changed, 4734 insertions(+), 2665 deletions(-) create mode 100644 mali_kbase/Mconfig create mode 100644 mali_kbase/build.bp create mode 100644 mali_kbase/mali_kbase_gator_hwcnt_names_ttrx.h create mode 100644 mali_kbase/mali_kbase_gwt.c create mode 100644 mali_kbase/mali_kbase_gwt.h delete mode 100644 mali_kbase/platform/mali_kbase_platform_common.h delete mode 100644 mali_kbase/platform/vexpress/mali_kbase_cpu_vexpress.c delete mode 100644 mali_kbase/platform/vexpress/mali_kbase_cpu_vexpress.h delete mode 100644 mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.c delete mode 100644 mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.h create mode 100644 mali_kbase/thirdparty/mali_kbase_mmap.c diff --git a/mali_kbase/Kbuild b/mali_kbase/Kbuild index 9947768..67acc6f 100644 --- a/mali_kbase/Kbuild +++ b/mali_kbase/Kbuild @@ -6,16 +6,22 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - # Driver version string which is returned to userspace via an ioctl -MALI_RELEASE_NAME ?= "r9p0-01rel0" +MALI_RELEASE_NAME ?= "r10p0-01rel0" # Paths required for build KBASE_PATH = $(src) @@ -111,10 +117,13 @@ SRC := \ mali_kbase_tlstream.c \ mali_kbase_strings.c \ mali_kbase_as_fault_debugfs.c \ - mali_kbase_regs_history_debugfs.c - + mali_kbase_regs_history_debugfs.c \ + thirdparty/mali_kbase_mmap.c +ifeq ($(CONFIG_MALI_JOB_DUMP),y) + SRC += mali_kbase_gwt.c +endif ifeq ($(MALI_UNIT_TEST),1) SRC += mali_kbase_tlstream_test.c diff --git a/mali_kbase/Kconfig b/mali_kbase/Kconfig index bcc2d4a..84ad143 100644 --- a/mali_kbase/Kconfig +++ b/mali_kbase/Kconfig @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - menuconfig MALI_MIDGARD @@ -174,6 +180,16 @@ config MALI_SYSTEM_TRACE minimal overhead when not in use. Enable only if you know what you are doing. +config MALI_JOB_DUMPING + bool "Enable system level support needed for job dumping" + depends on MALI_MIDGARD && MALI_EXPERT + default n + help + Choose this option to enable system level support needed for + job dumping. This is typically used for instrumentation but has + minimal overhead when not in use. Enable only if you know what + you are doing. + config MALI_2MB_ALLOC bool "Attempt to allocate 2MB pages" depends on MALI_MIDGARD && MALI_EXPERT diff --git a/mali_kbase/Makefile b/mali_kbase/Makefile index b7b261a..cfe6fc3 100644 --- a/mali_kbase/Makefile +++ b/mali_kbase/Makefile @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - KDIR ?= /lib/modules/$(shell uname -r)/build diff --git a/mali_kbase/Makefile.kbase b/mali_kbase/Makefile.kbase index 2bef9c2..d7898cb 100644 --- a/mali_kbase/Makefile.kbase +++ b/mali_kbase/Makefile.kbase @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - EXTRA_CFLAGS += -I$(ROOT) -I$(KBASE_PATH) -I$(OSK_PATH)/src/linux/include -I$(KBASE_PATH)/platform_$(PLATFORM) diff --git a/mali_kbase/Mconfig b/mali_kbase/Mconfig new file mode 100644 index 0000000..9cfa368 --- /dev/null +++ b/mali_kbase/Mconfig @@ -0,0 +1,207 @@ +# +# (C) COPYRIGHT 2012-2017 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 licence. +# +# A copy of the licence is included with the program, and can also be obtained +# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# + + +menuconfig MALI_MIDGARD + bool "Mali Midgard series support" + default y + help + Enable this option to build support for a ARM Mali Midgard GPU. + + To compile this driver as a module, choose M here: + this will generate a single module, called mali_kbase. + +config MALI_GATOR_SUPPORT + bool "Streamline support via Gator" + depends on MALI_MIDGARD + default y if INSTRUMENTATION_STREAMLINE_OLD + default n + help + Adds diagnostic support for use with the ARM Streamline Performance Analyzer. + You will need the Gator device driver already loaded before loading this driver when enabling + Streamline debug support. + This is a legacy interface required by older versions of Streamline. + +config MALI_MIDGARD_DVFS + bool "Enable legacy DVFS" + depends on MALI_MIDGARD && !MALI_DEVFREQ + default n + help + Choose this option to enable legacy DVFS in the Mali Midgard DDK. + +config MALI_MIDGARD_ENABLE_TRACE + bool "Enable kbase tracing" + depends on MALI_MIDGARD + default n + help + Enables tracing in kbase. Trace log available through + the "mali_trace" debugfs file, when the CONFIG_DEBUG_FS is enabled + +config MALI_DEVFREQ + bool "devfreq support for Mali" + depends on MALI_MIDGARD + default y if PLATFORM_JUNO + default y if PLATFORM_CUSTOM + help + Support devfreq for Mali. + + Using the devfreq framework and, by default, the simpleondemand + governor, the frequency of Mali will be dynamically selected from the + available OPPs. + +config MALI_DMA_FENCE + bool "DMA_BUF fence support for Mali" + depends on MALI_MIDGARD + default n + help + Support DMA_BUF fences for Mali. + + This option should only be enabled if the Linux Kernel has built in + support for DMA_BUF fences. + +config MALI_PLATFORM_NAME + depends on MALI_MIDGARD + string "Platform name" + default "arndale" if PLATFORM_ARNDALE + default "arndale_octa" if PLATFORM_ARNDALE_OCTA + default "rk" if PLATFORM_FIREFLY + default "hisilicon" if PLATFORM_HIKEY960 + default "vexpress" if PLATFORM_VEXPRESS + default "devicetree" + help + Enter the name of the desired platform configuration directory to + include in the build. 'platform/$(MALI_PLATFORM_NAME)/Kbuild' must + exist. + +config MALI_MOCK_TEST + bool + depends on MALI_MIDGARD && !RELEASE + default y + +# MALI_EXPERT configuration options + +menuconfig MALI_EXPERT + depends on MALI_MIDGARD + bool "Enable Expert Settings" + default y + help + Enabling this option and modifying the default settings may produce a driver with performance or + other limitations. + +config MALI_CORESTACK + bool "Support controlling power to the GPU core stack" + depends on MALI_MIDGARD && MALI_EXPERT + default n + help + Enabling this feature on supported GPUs will let the driver powering + on/off the GPU core stack independently without involving the Power + Domain Controller. This should only be enabled on platforms which + integration of the PDC to the Mali GPU is known to be problematic. + This feature is currently only supported on t-Six and t-HEx GPUs. + + If unsure, say N. + +config MALI_PRFCNT_SET_SECONDARY + bool "Use secondary set of performance counters" + depends on MALI_MIDGARD && MALI_EXPERT + default n + help + Select this option to use secondary set of performance counters. Kernel + features that depend on an access to the primary set of counters may + become unavailable. Enabling this option will prevent power management + from working optimally and may cause instrumentation tools to return + bogus results. + + If unsure, say N. + +config MALI_DEBUG + bool "Debug build" + depends on MALI_MIDGARD && MALI_EXPERT + default y if DEBUG + default n + help + Select this option for increased checking and reporting of errors. + +config MALI_FENCE_DEBUG + bool "Debug sync fence usage" + depends on MALI_MIDGARD && MALI_EXPERT + default y if MALI_DEBUG + help + Select this option to enable additional checking and reporting on the + use of sync fences in the Mali driver. + + This will add a 3s timeout to all sync fence waits in the Mali + driver, so that when work for Mali has been waiting on a sync fence + for a long time a debug message will be printed, detailing what fence + is causing the block, and which dependent Mali atoms are blocked as a + result of this. + + The timeout can be changed at runtime through the js_soft_timeout + device attribute, where the timeout is specified in milliseconds. + +config MALI_ERROR_INJECT + bool "Error injection" + depends on MALI_MIDGARD && MALI_EXPERT && NO_MALI + default n + help + Enables insertion of errors to test module failure and recovery mechanisms. + +config MALI_ERROR_INJECT_RANDOM + bool "Random error injection" + depends on MALI_MIDGARD && MALI_EXPERT && NO_MALI && MALI_ERROR_INJECT + default n + help + Injected errors are random, rather than user-driven. + +config MALI_TRACE_TIMELINE + bool "Timeline tracing" + depends on MALI_MIDGARD && MALI_EXPERT + default n + help + Enables timeline tracing through the kernel tracepoint system. + +config MALI_SYSTEM_TRACE + bool "Enable system event tracing support" + depends on MALI_MIDGARD && MALI_EXPERT + default n + help + Choose this option to enable system trace events for each + kbase event. This is typically used for debugging but has + minimal overhead when not in use. Enable only if you know what + you are doing. + +config MALI_2MB_ALLOC + bool "Attempt to allocate 2MB pages" + depends on MALI_MIDGARD && MALI_EXPERT + default n + help + Rather than allocating all GPU memory page-by-page, attempt to + allocate 2MB pages from the kernel. This reduces TLB pressure and + helps to prevent memory fragmentation. + + If in doubt, say N + +config MALI_FPGA_BUS_LOGGER + bool "Enable bus log integration" + depends on MALI_MIDGARD && MALI_EXPERT + default n + +config MALI_PWRSOFT_765 + bool "PWRSOFT-765 ticket" + depends on MALI_MIDGARD && MALI_EXPERT + default n + help + PWRSOFT-765 fixes devfreq cooling devices issues. However, they are + not merged in mainline kernel yet. So this define helps to guard those + parts of the code. diff --git a/mali_kbase/backend/gpu/Kbuild b/mali_kbase/backend/gpu/Kbuild index 5f700e9..bdf4c5a 100644 --- a/mali_kbase/backend/gpu/Kbuild +++ b/mali_kbase/backend/gpu/Kbuild @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - BACKEND += \ backend/gpu/mali_kbase_cache_policy_backend.c \ diff --git a/mali_kbase/backend/gpu/mali_kbase_backend_config.h b/mali_kbase/backend/gpu/mali_kbase_backend_config.h index c8ae87e..196a776 100644 --- a/mali_kbase/backend/gpu/mali_kbase_backend_config.h +++ b/mali_kbase/backend/gpu/mali_kbase_backend_config.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Backend specific configuration */ diff --git a/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c b/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c index fef9a2c..49567f7 100644 --- a/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include "backend/gpu/mali_kbase_cache_policy_backend.h" #include diff --git a/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.h b/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.h index fe98691..f78ada7 100644 --- a/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.h +++ b/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_CACHE_POLICY_BACKEND_H_ #define _KBASE_CACHE_POLICY_BACKEND_H_ diff --git a/mali_kbase/backend/gpu/mali_kbase_debug_job_fault_backend.c b/mali_kbase/backend/gpu/mali_kbase_debug_job_fault_backend.c index 7851ea6..c9c463e 100644 --- a/mali_kbase/backend/gpu/mali_kbase_debug_job_fault_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_debug_job_fault_backend.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include "mali_kbase_debug_job_fault.h" diff --git a/mali_kbase/backend/gpu/mali_kbase_devfreq.c b/mali_kbase/backend/gpu/mali_kbase_devfreq.c index e280322..9c9a0b3 100644 --- a/mali_kbase/backend/gpu/mali_kbase_devfreq.c +++ b/mali_kbase/backend/gpu/mali_kbase_devfreq.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include @@ -204,6 +209,9 @@ static int kbase_devfreq_init_freq_table(struct kbase_device *kbdev, opp = dev_pm_opp_find_freq_floor(kbdev->dev, &freq); if (IS_ERR(opp)) break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + dev_pm_opp_put(opp); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) */ dp->freq_table[i] = freq; } @@ -331,6 +339,12 @@ int kbase_devfreq_init(struct kbase_device *kbdev) if (kbase_devfreq_init_freq_table(kbdev, dp)) return -EFAULT; + if (dp->max_state > 0) { + /* Record the maximum frequency possible */ + kbdev->gpu_props.props.core_props.gpu_freq_khz_max = + dp->freq_table[0] / 1000; + }; + err = kbase_devfreq_init_core_mask_table(kbdev); if (err) return err; diff --git a/mali_kbase/backend/gpu/mali_kbase_devfreq.h b/mali_kbase/backend/gpu/mali_kbase_devfreq.h index c0bf8b1..0634038 100644 --- a/mali_kbase/backend/gpu/mali_kbase_devfreq.h +++ b/mali_kbase/backend/gpu/mali_kbase_devfreq.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _BASE_DEVFREQ_H_ #define _BASE_DEVFREQ_H_ diff --git a/mali_kbase/backend/gpu/mali_kbase_device_hw.c b/mali_kbase/backend/gpu/mali_kbase_device_hw.c index dcdf15c..a0dfd81 100644 --- a/mali_kbase/backend/gpu/mali_kbase_device_hw.c +++ b/mali_kbase/backend/gpu/mali_kbase_device_hw.c @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * */ diff --git a/mali_kbase/backend/gpu/mali_kbase_device_internal.h b/mali_kbase/backend/gpu/mali_kbase_device_internal.h index 5b20445..729256e 100644 --- a/mali_kbase/backend/gpu/mali_kbase_device_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_device_internal.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Backend-specific HW access device APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_gpu.c b/mali_kbase/backend/gpu/mali_kbase_gpu.c index 6bceba1..881d50c 100644 --- a/mali_kbase/backend/gpu/mali_kbase_gpu.c +++ b/mali_kbase/backend/gpu/mali_kbase_gpu.c @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Register-based HW access backend APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c b/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c index b395325..02dc1ea 100644 --- a/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel property query backend APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_instr_backend.c b/mali_kbase/backend/gpu/mali_kbase_instr_backend.c index 7ad309e..3cbfb44 100644 --- a/mali_kbase/backend/gpu/mali_kbase_instr_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_instr_backend.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * GPU backend instrumentation APIs. */ diff --git a/mali_kbase/backend/gpu/mali_kbase_instr_defs.h b/mali_kbase/backend/gpu/mali_kbase_instr_defs.h index 4794672..fb55d2d 100644 --- a/mali_kbase/backend/gpu/mali_kbase_instr_defs.h +++ b/mali_kbase/backend/gpu/mali_kbase_instr_defs.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Backend-specific instrumentation definitions */ diff --git a/mali_kbase/backend/gpu/mali_kbase_instr_internal.h b/mali_kbase/backend/gpu/mali_kbase_instr_internal.h index e96aeae..608379e 100644 --- a/mali_kbase/backend/gpu/mali_kbase_instr_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_instr_internal.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Backend-specific HW access instrumentation APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_irq_internal.h b/mali_kbase/backend/gpu/mali_kbase_irq_internal.h index 8781561..ca3c048 100644 --- a/mali_kbase/backend/gpu/mali_kbase_irq_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_irq_internal.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Backend specific IRQ APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_irq_linux.c b/mali_kbase/backend/gpu/mali_kbase_irq_linux.c index 8416b80..95bebf8 100644 --- a/mali_kbase/backend/gpu/mali_kbase_irq_linux.c +++ b/mali_kbase/backend/gpu/mali_kbase_irq_linux.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_as.c b/mali_kbase/backend/gpu/mali_kbase_jm_as.c index c660c80..4c99152 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_as.c +++ b/mali_kbase/backend/gpu/mali_kbase_jm_as.c @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Register backend context / address space management */ diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_defs.h b/mali_kbase/backend/gpu/mali_kbase_jm_defs.h index 08a7400..27a6ca0 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_defs.h +++ b/mali_kbase/backend/gpu/mali_kbase_jm_defs.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Register-based HW access backend specific definitions */ diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_hw.c b/mali_kbase/backend/gpu/mali_kbase_jm_hw.c index 0a2a0b7..331f6ee 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_hw.c +++ b/mali_kbase/backend/gpu/mali_kbase_jm_hw.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel job manager APIs */ @@ -745,7 +750,7 @@ void kbase_job_slot_ctx_priority_check_locked(struct kbase_context *kctx, if (katom->sched_priority > priority) { if (!stop_sent) - KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITY_CHANGE( + KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITIZED( target_katom); kbase_job_slot_softstop(kbdev, js, katom); diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_internal.h b/mali_kbase/backend/gpu/mali_kbase_jm_internal.h index 1f382b3..d71a9ed 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_jm_internal.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Job Manager backend-specific low-level APIs. */ diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_rb.c b/mali_kbase/backend/gpu/mali_kbase_jm_rb.c index a41e7b5..ee93d4e 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_rb.c +++ b/mali_kbase/backend/gpu/mali_kbase_jm_rb.c @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Register-based HW access backend specific APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_rb.h b/mali_kbase/backend/gpu/mali_kbase_jm_rb.h index 1e0e05a..4567008 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_rb.h +++ b/mali_kbase/backend/gpu/mali_kbase_jm_rb.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Register-based HW access backend specific APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_js_affinity.c b/mali_kbase/backend/gpu/mali_kbase_js_affinity.c index 54d8ddd..c937eca 100644 --- a/mali_kbase/backend/gpu/mali_kbase_js_affinity.c +++ b/mali_kbase/backend/gpu/mali_kbase_js_affinity.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel affinity manager APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_js_affinity.h b/mali_kbase/backend/gpu/mali_kbase_js_affinity.h index 35d9781..dbabd94 100644 --- a/mali_kbase/backend/gpu/mali_kbase_js_affinity.h +++ b/mali_kbase/backend/gpu/mali_kbase_js_affinity.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Affinity Manager internal APIs. */ diff --git a/mali_kbase/backend/gpu/mali_kbase_js_backend.c b/mali_kbase/backend/gpu/mali_kbase_js_backend.c index 63d048f..2dc9785 100644 --- a/mali_kbase/backend/gpu/mali_kbase_js_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_js_backend.c @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Register-based HW access backend specific job scheduler APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_js_internal.h b/mali_kbase/backend/gpu/mali_kbase_js_internal.h index 3f53779..6576e55 100644 --- a/mali_kbase/backend/gpu/mali_kbase_js_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_js_internal.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Register-based HW access backend specific job scheduler APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.c b/mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.c index aa1817c..ad27202 100644 --- a/mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.c +++ b/mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include diff --git a/mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.h b/mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.h index c02253c..1f76eed 100644 --- a/mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.h +++ b/mali_kbase/backend/gpu/mali_kbase_mmu_hw_direct.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Interface file for the direct implementation for MMU hardware access * diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c index 0614348..2ed7dfd 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * "Always on" power management policy */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h index f9d244b..d61d0d0 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h @@ -8,16 +8,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * "Always on" power management policy */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_backend.c b/mali_kbase/backend/gpu/mali_kbase_pm_backend.c index a871eae..0d899cc 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_backend.c @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * GPU backend implementation of base kernel power management APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_ca.c b/mali_kbase/backend/gpu/mali_kbase_pm_ca.c index 85890f1..5b369fb 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_ca.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel core availability APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_ca.h b/mali_kbase/backend/gpu/mali_kbase_pm_ca.h index ee9e751..2b005c9 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_ca.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel core availability APIs */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.c b/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.c index 66bf660..4bb4c40 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * A core availability policy implementing core mask selection from devfreq OPPs * diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h b/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h index 7ab3cd4..f67ec65 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * A core availability policy for use with devfreq, where core masks are * associated with OPPs. diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.c b/mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.c index 864612d..1eea7e8 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * A power policy implementing fixed core availability */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.h b/mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.h index a763155..68a2eac 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca_fixed.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * A power policy implementing fixed core availability */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c index f891fa2..602e175 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * "Coarse Demand" power management policy */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h index 749d305..f2b49eb 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * "Coarse Demand" power management policy */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_defs.h b/mali_kbase/backend/gpu/mali_kbase_pm_defs.h index 352744e..6dddb07 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_defs.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_defs.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Backend-specific Power Manager definitions */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_demand.c b/mali_kbase/backend/gpu/mali_kbase_pm_demand.c index 81322fd..e0edddc 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_demand.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_demand.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * A simple demand based power management policy */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_demand.h b/mali_kbase/backend/gpu/mali_kbase_pm_demand.h index c0c84b6..5ee1824 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_demand.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_demand.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * A simple demand based power management policy */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_driver.c b/mali_kbase/backend/gpu/mali_kbase_pm_driver.c index 26802e4..44803ab 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_driver.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_driver.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel Power Management hardware control */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_internal.h b/mali_kbase/backend/gpu/mali_kbase_pm_internal.h index 7b77823..831971b 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_internal.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Power management API definitions used internally by GPU backend */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c b/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c index 024248c..a8020b6 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Metrics for power management */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_policy.c b/mali_kbase/backend/gpu/mali_kbase_pm_policy.c index 075f020..f1e73a1 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_policy.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_policy.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Power policy API implementations */ diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_policy.h b/mali_kbase/backend/gpu/mali_kbase_pm_policy.h index 611a90e..852fedd 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_policy.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_policy.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Power policy API definitions */ diff --git a/mali_kbase/backend/gpu/mali_kbase_time.c b/mali_kbase/backend/gpu/mali_kbase_time.c index d992989..cef0745 100644 --- a/mali_kbase/backend/gpu/mali_kbase_time.c +++ b/mali_kbase/backend/gpu/mali_kbase_time.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/backend/gpu/mali_kbase_time.h b/mali_kbase/backend/gpu/mali_kbase_time.h index 35088ab..e1bd263 100644 --- a/mali_kbase/backend/gpu/mali_kbase_time.h +++ b/mali_kbase/backend/gpu/mali_kbase_time.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_BACKEND_TIME_H_ #define _KBASE_BACKEND_TIME_H_ diff --git a/mali_kbase/build.bp b/mali_kbase/build.bp new file mode 100644 index 0000000..4517b46 --- /dev/null +++ b/mali_kbase/build.bp @@ -0,0 +1,95 @@ +/* + * Copyright: + * ---------------------------------------------------------------------------- + * This confidential and proprietary software may be used only as authorized + * by a licensing agreement from ARM Limited. + * (C) COPYRIGHT 2017 ARM Limited, ALL RIGHTS RESERVED + * The entire notice above must be reproduced on all authorized copies and + * copies may only be made to the extent permitted by a licensing agreement + * from ARM Limited. + * ---------------------------------------------------------------------------- + */ + +bob_defaults { + name: "mali_kbase_shared_config_defaults", + no_mali: { + kbuild_options: ["CONFIG_MALI_NO_MALI=y"], + }, + mali_corestack: { + kbuild_options: ["CONFIG_MALI_CORESTACK=y"], + }, + mali_devfreq: { + kbuild_options: ["CONFIG_MALI_DEVFREQ=y"], + }, + + defaults: ["kernel_defaults"], +} + +bob_kernel_module { + name: "mali_kbase", + srcs: [ + "*.c", + "*.h", + "Kbuild", + "backend/gpu/*.c", + "backend/gpu/*.h", + "backend/gpu/Kbuild", + "ipa/*.c", + "ipa/*.h", + "ipa/Kbuild", + "platform/*.h", + "platform/*/*.c", + "platform/*/*.h", + "platform/*/Kbuild", + "thirdparty/*.c", + ], + kbuild_options: [ + "CONFIG_MALI_KUTF=n", + "CONFIG_MALI_MIDGARD=m", + "CONFIG_MALI_NO_MALI_DEFAULT_GPU={{.gpu}}", + "CONFIG_MALI_PLATFORM_NAME={{.mali_platform_name}}", + "MALI_KERNEL_TEST_API={{.unit_test_code}}", + "MALI_MOCK_TEST={{.mali_mock_test}}", + "MALI_UNIT_TEST={{.unit_test_code}}", + ], + cinstr_job_dump: { + kbuild_options: ["CONFIG_MALI_JOB_DUMP=y"], + }, + mali_debug: { + kbuild_options: ["CONFIG_MALI_DEBUG=y"], + }, + mali_gator_support: { + kbuild_options: ["CONFIG_MALI_GATOR_SUPPORT=y"], + }, + mali_system_trace: { + kbuild_options: ["CONFIG_MALI_SYSTEM_TRACE=y"], + }, + mali_error_inject: { + kbuild_options: ["CONFIG_MALI_ERROR_INJECT=y"], + }, + mali_error_inject_random: { + kbuild_options: ["CONFIG_MALI_ERROR_INJECT_RANDOM=y"], + }, + mali_trace_timeline: { + kbuild_options: ["CONFIG_MALI_TRACE_TIMELINE=y"], + }, + mali_prfcnt_set_secondary: { + kbuild_options: ["CONFIG_MALI_PRFCNT_SET_SECONDARY=y"], + }, + mali_fpga_bus_logger: { + kbuild_options: ["CONFIG_MALI_FPGA_BUS_LOGGER=y"], + }, + mali_midgard_dvfs: { + kbuild_options: ["CONFIG_MALI_MIDGARD_DVFS=y"], + }, + mali_2mb_alloc: { + kbuild_options: ["CONFIG_MALI_2MB_ALLOC=y"], + }, + mali_mock_test: { + srcs: ["tests/internal/src/mock/mali_kbase_pm_driver_mock.c"], + }, + ump: { + extra_symbols: ["ump"], + }, + defaults: ["mali_kbase_shared_config_defaults"], +} diff --git a/mali_kbase/docs/Doxyfile b/mali_kbase/docs/Doxyfile index 35ff2f1..cea7bd9 100644 --- a/mali_kbase/docs/Doxyfile +++ b/mali_kbase/docs/Doxyfile @@ -1,17 +1,23 @@ # -# (C) COPYRIGHT 2011-2013, 2015 ARM Limited. All rights reserved. +# (C) COPYRIGHT 2011-2013, 2015, 2017 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 licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - ############################################################################## @@ -64,7 +70,7 @@ FILE_PATTERNS += # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE += ../../kernel/drivers/gpu/arm/midgard/platform ../../kernel/drivers/gpu/arm/midgard/platform_dummy ../../kernel/drivers/gpu/arm/midgard/scripts ../../kernel/drivers/gpu/arm/midgard/tests ../../kernel/drivers/gpu/arm/midgard/Makefile ../../kernel/drivers/gpu/arm/midgard/Makefile.kbase ../../kernel/drivers/gpu/arm/midgard/Kbuild ../../kernel/drivers/gpu/arm/midgard/Kconfig ../../kernel/drivers/gpu/arm/midgard/sconscript ../../kernel/drivers/gpu/arm/midgard/docs ../../kernel/drivers/gpu/arm/midgard/pm_test_script.sh ../../kernel/drivers/gpu/arm/midgard/mali_uk.h ../../kernel/drivers/gpu/arm/midgard/Makefile +EXCLUDE += ../../kernel/drivers/gpu/arm/midgard/platform ../../kernel/drivers/gpu/arm/midgard/platform_dummy ../../kernel/drivers/gpu/arm/midgard/scripts ../../kernel/drivers/gpu/arm/midgard/tests ../../kernel/drivers/gpu/arm/midgard/Makefile ../../kernel/drivers/gpu/arm/midgard/Makefile.kbase ../../kernel/drivers/gpu/arm/midgard/Kbuild ../../kernel/drivers/gpu/arm/midgard/Kconfig ../../kernel/drivers/gpu/arm/midgard/sconscript ../../kernel/drivers/gpu/arm/midgard/docs ../../kernel/drivers/gpu/arm/midgard/mali_uk.h ../../kernel/drivers/gpu/arm/midgard/Makefile # If the value of the INPUT tag contains directories, you can use the diff --git a/mali_kbase/docs/policy_operation_diagram.dot b/mali_kbase/docs/policy_operation_diagram.dot index 7ae05c2..a15b558 100644 --- a/mali_kbase/docs/policy_operation_diagram.dot +++ b/mali_kbase/docs/policy_operation_diagram.dot @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - digraph policy_objects_diagram { rankdir=LR; size="12,8"; diff --git a/mali_kbase/docs/policy_overview.dot b/mali_kbase/docs/policy_overview.dot index 159b993..6b87335 100644 --- a/mali_kbase/docs/policy_overview.dot +++ b/mali_kbase/docs/policy_overview.dot @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - digraph policy_objects_diagram { rankdir=LR size="6,6" diff --git a/mali_kbase/ipa/Kbuild b/mali_kbase/ipa/Kbuild index 8e37f40..fcc079c 100644 --- a/mali_kbase/ipa/Kbuild +++ b/mali_kbase/ipa/Kbuild @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - mali_kbase-y += \ ipa/mali_kbase_ipa_simple.o \ diff --git a/mali_kbase/ipa/mali_kbase_ipa.c b/mali_kbase/ipa/mali_kbase_ipa.c index 1450c2c..d16069f 100644 --- a/mali_kbase/ipa/mali_kbase_ipa.c +++ b/mali_kbase/ipa/mali_kbase_ipa.c @@ -7,13 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include @@ -109,6 +114,10 @@ static struct device_node *get_model_dt_node(struct kbase_ipa_model *model) snprintf(compat_string, sizeof(compat_string), "arm,%s", model->ops->name); + /* of_find_compatible_node() will call of_node_put() on the root node, + * so take a reference on it first. + */ + of_node_get(model->kbdev->dev->of_node); model_dt_node = of_find_compatible_node(model->kbdev->dev->of_node, NULL, compat_string); if (!model_dt_node && !model->missing_dt_node_warning) { @@ -130,6 +139,10 @@ int kbase_ipa_model_add_param_s32(struct kbase_ipa_model *model, char *origin; err = of_property_read_u32_array(model_dt_node, name, addr, num_elems); + /* We're done with model_dt_node now, so drop the reference taken in + * get_model_dt_node()/of_find_compatible_node(). + */ + of_node_put(model_dt_node); if (err && dt_required) { memset(addr, 0, sizeof(s32) * num_elems); @@ -177,6 +190,12 @@ int kbase_ipa_model_add_param_string(struct kbase_ipa_model *model, err = of_property_read_string(model_dt_node, name, &string_prop_value); + + /* We're done with model_dt_node now, so drop the reference taken in + * get_model_dt_node()/of_find_compatible_node(). + */ + of_node_put(model_dt_node); + if (err && dt_required) { strncpy(addr, "", size - 1); dev_warn(model->kbdev->dev, @@ -198,7 +217,6 @@ int kbase_ipa_model_add_param_string(struct kbase_ipa_model *model, err = kbase_ipa_model_param_add(model, name, addr, size, PARAM_TYPE_STRING); - return err; } @@ -325,8 +343,11 @@ int kbase_ipa_init(struct kbase_device *kbdev) ops = kbase_ipa_model_ops_find(kbdev, model_name); kbdev->ipa.configured_model = kbase_ipa_init_model(kbdev, ops); if (!kbdev->ipa.configured_model) { - err = -EINVAL; - goto end; + dev_warn(kbdev->dev, + "Failed to initialize ipa-model: \'%s\'\n" + "Falling back on default model\n", + model_name); + kbdev->ipa.configured_model = default_model; } } else { kbdev->ipa.configured_model = default_model; diff --git a/mali_kbase/ipa/mali_kbase_ipa.h b/mali_kbase/ipa/mali_kbase_ipa.h index 469f33c..736399a 100644 --- a/mali_kbase/ipa/mali_kbase_ipa.h +++ b/mali_kbase/ipa/mali_kbase_ipa.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_IPA_H_ #define _KBASE_IPA_H_ diff --git a/mali_kbase/ipa/mali_kbase_ipa_debugfs.c b/mali_kbase/ipa/mali_kbase_ipa_debugfs.c index d3ac7c3..029023c 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_debugfs.c +++ b/mali_kbase/ipa/mali_kbase_ipa_debugfs.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include @@ -56,14 +61,18 @@ static int param_int_set(void *data, u64 val) struct kbase_ipa_model_param *param = data; struct kbase_ipa_model *model = param->model; s64 sval = (s64) val; + s32 old_val; int err = 0; if (sval < S32_MIN || sval > S32_MAX) return -ERANGE; mutex_lock(¶m->model->kbdev->ipa.lock); + old_val = *param->addr.s32p; *param->addr.s32p = val; err = kbase_ipa_model_recalculate(model); + if (err < 0) + *param->addr.s32p = old_val; mutex_unlock(¶m->model->kbdev->ipa.lock); return err; @@ -92,6 +101,7 @@ static ssize_t param_string_set(struct file *file, const char __user *user_buf, { struct kbase_ipa_model_param *param = file->private_data; struct kbase_ipa_model *model = param->model; + char *old_str = NULL; ssize_t ret = count; size_t buf_size; int err; @@ -103,6 +113,12 @@ static ssize_t param_string_set(struct file *file, const char __user *user_buf, goto end; } + old_str = kstrndup(param->addr.str, param->size, GFP_KERNEL); + if (!old_str) { + ret = -ENOMEM; + goto end; + } + buf_size = min(param->size - 1, count); if (copy_from_user(param->addr.str, user_buf, buf_size)) { ret = -EFAULT; @@ -112,10 +128,13 @@ static ssize_t param_string_set(struct file *file, const char __user *user_buf, param->addr.str[buf_size] = '\0'; err = kbase_ipa_model_recalculate(model); - if (err < 0) + if (err < 0) { ret = err; + strlcpy(param->addr.str, old_str, param->size); + } end: + kfree(old_str); mutex_unlock(&model->kbdev->ipa.lock); return ret; diff --git a/mali_kbase/ipa/mali_kbase_ipa_debugfs.h b/mali_kbase/ipa/mali_kbase_ipa_debugfs.h index f624de9..a983d9c 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_debugfs.h +++ b/mali_kbase/ipa/mali_kbase_ipa_debugfs.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_IPA_DEBUGFS_H_ #define _KBASE_IPA_DEBUGFS_H_ diff --git a/mali_kbase/ipa/mali_kbase_ipa_simple.c b/mali_kbase/ipa/mali_kbase_ipa_simple.c index 70e08b3..639ade2 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_simple.c +++ b/mali_kbase/ipa/mali_kbase_ipa_simple.c @@ -7,14 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - +#include #include #ifdef CONFIG_DEVFREQ_THERMAL #include @@ -91,7 +97,7 @@ struct kbase_ipa_model_simple_data { u32 dynamic_coefficient; u32 static_coefficient; s32 ts[4]; - char tz_name[16]; + char tz_name[THERMAL_NAME_LENGTH]; struct thermal_zone_device *gpu_tz; struct task_struct *poll_temperature_thread; int current_temperature; @@ -283,20 +289,43 @@ static int kbase_simple_power_model_recalculate(struct kbase_ipa_model *model) (struct kbase_ipa_model_simple_data *)model->model_data; struct thermal_zone_device *tz; + lockdep_assert_held(&model->kbdev->ipa.lock); + if (!strnlen(model_data->tz_name, sizeof(model_data->tz_name))) { - tz = NULL; + model_data->gpu_tz = NULL; } else { - tz = thermal_zone_get_zone_by_name(model_data->tz_name); + char tz_name[THERMAL_NAME_LENGTH]; + + strlcpy(tz_name, model_data->tz_name, sizeof(tz_name)); + + /* Release ipa.lock so that thermal_list_lock is not acquired + * with ipa.lock held, thereby avoid lock ordering violation + * lockdep warning. The warning comes as a chain of locks + * ipa.lock --> thermal_list_lock --> tz->lock gets formed + * on registering devfreq cooling device when probe method + * of mali platform driver is invoked. + */ + mutex_unlock(&model->kbdev->ipa.lock); + tz = thermal_zone_get_zone_by_name(tz_name); + mutex_lock(&model->kbdev->ipa.lock); if (IS_ERR_OR_NULL(tz)) { pr_warn_ratelimited("Error %ld getting thermal zone \'%s\', not yet ready?\n", - PTR_ERR(tz), model_data->tz_name); - tz = NULL; + PTR_ERR(tz), tz_name); return -EPROBE_DEFER; } - } - ACCESS_ONCE(model_data->gpu_tz) = tz; + /* Check if another thread raced against us & updated the + * thermal zone name string. Update the gpu_tz pointer only if + * the name string did not change whilst we retrieved the new + * thermal_zone_device pointer, otherwise model_data->tz_name & + * model_data->gpu_tz would become inconsistent with each other. + * The below check will succeed only for the thread which last + * updated the name string. + */ + if (strncmp(tz_name, model_data->tz_name, sizeof(tz_name)) == 0) + model_data->gpu_tz = tz; + } return 0; } diff --git a/mali_kbase/ipa/mali_kbase_ipa_simple.h b/mali_kbase/ipa/mali_kbase_ipa_simple.h index e78d617..fed67d5 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_simple.h +++ b/mali_kbase/ipa/mali_kbase_ipa_simple.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_IPA_SIMPLE_H_ #define _KBASE_IPA_SIMPLE_H_ diff --git a/mali_kbase/ipa/mali_kbase_ipa_vinstr_common.c b/mali_kbase/ipa/mali_kbase_ipa_vinstr_common.c index 9b9fa0e..b9a9e57 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_vinstr_common.c +++ b/mali_kbase/ipa/mali_kbase_ipa_vinstr_common.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include "mali_kbase_ipa_vinstr_common.h" #if MALI_UNIT_TEST diff --git a/mali_kbase/ipa/mali_kbase_ipa_vinstr_common.h b/mali_kbase/ipa/mali_kbase_ipa_vinstr_common.h index d212c87..7233642 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_vinstr_common.h +++ b/mali_kbase/ipa/mali_kbase_ipa_vinstr_common.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_IPA_VINSTR_COMMON_H_ #define _KBASE_IPA_VINSTR_COMMON_H_ diff --git a/mali_kbase/ipa/mali_kbase_ipa_vinstr_g71.c b/mali_kbase/ipa/mali_kbase_ipa_vinstr_g71.c index 4e4c059..d07fb36 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_vinstr_g71.c +++ b/mali_kbase/ipa/mali_kbase_ipa_vinstr_g71.c @@ -7,13 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include "mali_kbase_ipa_vinstr_common.h" diff --git a/mali_kbase/mali_base_hwconfig_features.h b/mali_kbase/mali_base_hwconfig_features.h index c077461..e0eebd8 100644 --- a/mali_kbase/mali_base_hwconfig_features.h +++ b/mali_kbase/mali_base_hwconfig_features.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* AUTOMATICALLY GENERATED FILE. If you want to amend the issues/features, * please update base/tools/hwconfig_generator/hwc_{issues,features}.py * For more information see base/tools/hwconfig_generator/README @@ -429,4 +434,34 @@ static const enum base_hw_feature base_hw_features_tBOx[] = { BASE_HW_FEATURE_END }; +static const enum base_hw_feature base_hw_features_tEGx[] = { + BASE_HW_FEATURE_JOBCHAIN_DISAMBIGUATION, + BASE_HW_FEATURE_PWRON_DURING_PWROFF_TRANS, + BASE_HW_FEATURE_XAFFINITY, + BASE_HW_FEATURE_WARPING, + BASE_HW_FEATURE_INTERPIPE_REG_ALIASING, + BASE_HW_FEATURE_32_BIT_UNIFORM_ADDRESS, + BASE_HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL, + BASE_HW_FEATURE_BRNDOUT_CC, + BASE_HW_FEATURE_BRNDOUT_KILL, + BASE_HW_FEATURE_LD_ST_LEA_TEX, + BASE_HW_FEATURE_LD_ST_TILEBUFFER, + BASE_HW_FEATURE_LINEAR_FILTER_FLOAT, + BASE_HW_FEATURE_MRT, + BASE_HW_FEATURE_MSAA_16X, + BASE_HW_FEATURE_NEXT_INSTRUCTION_TYPE, + BASE_HW_FEATURE_OUT_OF_ORDER_EXEC, + BASE_HW_FEATURE_T7XX_PAIRING_RULES, + BASE_HW_FEATURE_TEST4_DATUM_MODE, + BASE_HW_FEATURE_THREAD_GROUP_SPLIT, + BASE_HW_FEATURE_FLUSH_REDUCTION, + BASE_HW_FEATURE_PROTECTED_MODE, + BASE_HW_FEATURE_PROTECTED_DEBUG_MODE, + BASE_HW_FEATURE_COHERENCY_REG, + BASE_HW_FEATURE_AARCH64_MMU, + BASE_HW_FEATURE_TLS_HASHING, + BASE_HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG, + BASE_HW_FEATURE_END +}; + #endif /* _BASE_HWCONFIG_FEATURES_H_ */ diff --git a/mali_kbase/mali_base_hwconfig_issues.h b/mali_kbase/mali_base_hwconfig_issues.h index 58710f6..7b70e7a 100644 --- a/mali_kbase/mali_base_hwconfig_issues.h +++ b/mali_kbase/mali_base_hwconfig_issues.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* AUTOMATICALLY GENERATED FILE. If you want to amend the issues/features, * please update base/tools/hwconfig_generator/hwc_{issues,features}.py * For more information see base/tools/hwconfig_generator/README @@ -1101,7 +1106,6 @@ static const enum base_hw_issue base_hw_issues_model_tSIx[] = { static const enum base_hw_issue base_hw_issues_tDVx_r0p0[] = { BASE_HW_ISSUE_9435, - BASE_HW_ISSUE_11054, BASE_HW_ISSUE_TMIX_8133, BASE_HW_ISSUE_TSIX_1116, BASE_HW_ISSUE_END @@ -1190,4 +1194,19 @@ static const enum base_hw_issue base_hw_issues_model_tBOx[] = { BASE_HW_ISSUE_END }; +static const enum base_hw_issue base_hw_issues_tEGx_r0p0[] = { + BASE_HW_ISSUE_9435, + BASE_HW_ISSUE_TMIX_8133, + BASE_HW_ISSUE_TSIX_1116, + BASE_HW_ISSUE_END +}; + +static const enum base_hw_issue base_hw_issues_model_tEGx[] = { + BASE_HW_ISSUE_5736, + BASE_HW_ISSUE_9435, + BASE_HW_ISSUE_TMIX_8133, + BASE_HW_ISSUE_TSIX_1116, + BASE_HW_ISSUE_END +}; + #endif /* _BASE_HWCONFIG_ISSUES_H_ */ diff --git a/mali_kbase/mali_base_kernel.h b/mali_kbase/mali_base_kernel.h index 94d1d74..e6b568f 100644 --- a/mali_kbase/mali_base_kernel.h +++ b/mali_kbase/mali_base_kernel.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base structures shared with the kernel. */ @@ -58,12 +63,14 @@ typedef struct base_mem_handle { #error assert macro not defined! #endif -#if defined PAGE_MASK +#if defined(PAGE_MASK) && defined(PAGE_SHIFT) +#define LOCAL_PAGE_SHIFT PAGE_SHIFT #define LOCAL_PAGE_LSB ~PAGE_MASK #else #include #if defined OSU_CONFIG_CPU_PAGE_SIZE_LOG2 +#define LOCAL_PAGE_SHIFT OSU_CONFIG_CPU_PAGE_SIZE_LOG2 #define LOCAL_PAGE_LSB ((1ul << OSU_CONFIG_CPU_PAGE_SIZE_LOG2) - 1) #else #error Failed to find page size @@ -130,6 +137,10 @@ typedef u32 base_mem_alloc_flags; * RESERVED: (1U << 7) * RESERVED: (1U << 8) */ +#define BASE_MEM_RESERVED_BIT_5 ((base_mem_alloc_flags)1 << 5) +#define BASE_MEM_RESERVED_BIT_6 ((base_mem_alloc_flags)1 << 6) +#define BASE_MEM_RESERVED_BIT_7 ((base_mem_alloc_flags)1 << 7) +#define BASE_MEM_RESERVED_BIT_8 ((base_mem_alloc_flags)1 << 8) /* Grow backing store on GPU Page Fault */ @@ -179,14 +190,21 @@ typedef u32 base_mem_alloc_flags; * Bit 19 is reserved. * * Do not remove, use the next unreserved bit for new flags - **/ + */ #define BASE_MEM_RESERVED_BIT_19 ((base_mem_alloc_flags)1 << 19) +/** + * Memory starting from the end of the initial commit is aligned to 'extent' + * pages, where 'extent' must be a power of 2 and no more than + * BASE_MEM_TILER_ALIGN_TOP_EXTENT_MAX_PAGES + */ +#define BASE_MEM_TILER_ALIGN_TOP ((base_mem_alloc_flags)1 << 20) + /* Number of bits used as flags for base memory management * * Must be kept in sync with the base_mem_alloc_flags flags */ -#define BASE_MEM_FLAGS_NR_BITS 20 +#define BASE_MEM_FLAGS_NR_BITS 21 /* A mask for all output bits, excluding IN/OUT bits. */ @@ -204,6 +222,22 @@ typedef u32 base_mem_alloc_flags; (BASE_MEM_DONT_NEED | BASE_MEM_COHERENT_SYSTEM | \ BASE_MEM_COHERENT_LOCAL) + +/* A mask of all currently reserved flags + */ +#define BASE_MEM_FLAGS_RESERVED \ + (BASE_MEM_RESERVED_BIT_5 | BASE_MEM_RESERVED_BIT_6 | \ + BASE_MEM_RESERVED_BIT_7 | BASE_MEM_RESERVED_BIT_8 | \ + BASE_MEM_RESERVED_BIT_19) + +/* A mask of all the flags that can be returned via the base_mem_get_flags() + * interface. + */ +#define BASE_MEM_FLAGS_QUERYABLE \ + (BASE_MEM_FLAGS_INPUT_MASK & ~(BASE_MEM_SAME_VA | \ + BASE_MEM_COHERENT_SYSTEM_REQUIRED | BASE_MEM_DONT_NEED | \ + BASE_MEM_IMPORT_SHARED | BASE_MEM_FLAGS_RESERVED)) + /** * enum base_mem_import_type - Memory types supported by @a base_mem_import * @@ -277,6 +311,14 @@ struct base_mem_import_user_buffer { /* Mask to detect 4GB boundary alignment */ #define BASE_MEM_MASK_4GB 0xfffff000UL +/** + * Limit on the 'extent' parameter for an allocation with the + * BASE_MEM_TILER_ALIGN_TOP flag set + * + * This is the same as the maximum limit for a Buffer Descriptor's chunk size + */ +#define BASE_MEM_TILER_ALIGN_TOP_EXTENT_MAX_PAGES \ + ((2ull * 1024ull * 1024ull) >> (LOCAL_PAGE_SHIFT)) /* Bit mask of cookies used for for memory allocation setup */ #define KBASE_COOKIE_MASK ~1UL /* bit 0 is reserved */ @@ -504,7 +546,8 @@ typedef u32 base_jd_core_req; * The first pre_dep object must be configured for the external resouces to use, * the second pre_dep object can be used to create other dependencies. * - * This bit may not be used in combination with BASE_JD_REQ_EVENT_COALESCE. + * This bit may not be used in combination with BASE_JD_REQ_EVENT_COALESCE and + * BASE_JD_REQ_SOFT_EVENT_WAIT. */ #define BASE_JD_REQ_EXTERNAL_RESOURCES ((base_jd_core_req)1 << 8) @@ -1258,9 +1301,9 @@ typedef struct base_dump_cpu_gpu_counters { * Architecture, but is necessary for OpenCL's clGetDeviceInfo() function. * * The GPU properties are obtained by a call to - * _mali_base_get_gpu_props(). This simply returns a pointer to a const + * base_get_gpu_props(). This simply returns a pointer to a const * base_gpu_props structure. It is constant for the life of a base - * context. Multiple calls to _mali_base_get_gpu_props() to a base context + * context. Multiple calls to base_get_gpu_props() to a base context * return the same pointer to a constant structure. This avoids cache pollution * of the common data. * @@ -1269,96 +1312,6 @@ typedef struct base_dump_cpu_gpu_counters { * base_context. * * - * @section sec_base_user_api_gpuprops_config Platform Config Compile-time Properties - * - * The Platform Config File sets up gpu properties that are specific to a - * certain platform. Properties that are 'Implementation Defined' in the - * Midgard Architecture spec are placed here. - * - * @note Reference configurations are provided for Midgard Implementations, such as - * the Mali-T600 family. The customer need not repeat this information, and can select one of - * these reference configurations. For example, VA_BITS, PA_BITS and the - * maximum number of samples per pixel might vary between Midgard Implementations, but - * \b not for platforms using the Mali-T604. This information is placed in - * the reference configuration files. - * - * The System Integrator creates the following structure: - * - platform_XYZ - * - platform_XYZ/plat - * - platform_XYZ/plat/plat_config.h - * - * They then edit plat_config.h, using the example plat_config.h files as a - * guide. - * - * At the very least, the customer must set @ref CONFIG_GPU_CORE_TYPE, and will - * receive a helpful \#error message if they do not do this correctly. This - * selects the Reference Configuration for the Midgard Implementation. The rationale - * behind this decision (against asking the customer to write \#include - * in their plat_config.h) is as follows: - * - This mechanism 'looks' like a regular config file (such as Linux's - * .config) - * - It is difficult to get wrong in a way that will produce strange build - * errors: - * - They need not know where the mali_t600.h, other_midg_gpu.h etc. files are stored - and - * so they won't accidentally pick another file with 'mali_t600' in its name - * - When the build doesn't work, the System Integrator may think the DDK is - * doesn't work, and attempt to fix it themselves: - * - For the @ref CONFIG_GPU_CORE_TYPE mechanism, the only way to get past the - * error is to set @ref CONFIG_GPU_CORE_TYPE, and this is what the \#error tells - * you. - * - For a \#include mechanism, checks must still be made elsewhere, which the - * System Integrator may try working around by setting \#defines (such as - * VA_BITS) themselves in their plat_config.h. In the worst case, they may - * set the prevention-mechanism \#define of - * "A_CORRECT_MIDGARD_CORE_WAS_CHOSEN". - * - In this case, they would believe they are on the right track, because - * the build progresses with their fix, but with errors elsewhere. - * - * However, there is nothing to prevent the customer using \#include to organize - * their own configurations files hierarchically. - * - * The mechanism for the header file processing is as follows: - * - * @dot - digraph plat_config_mechanism { - rankdir=BT - size="6,6" - - "mali_base.h"; - "gpu/mali_gpu.h"; - - node [ shape=box ]; - { - rank = same; ordering = out; - - "gpu/mali_gpu_props.h"; - "base/midg_gpus/mali_t600.h"; - "base/midg_gpus/other_midg_gpu.h"; - } - { rank = same; "plat/plat_config.h"; } - { - rank = same; - "gpu/mali_gpu.h" [ shape=box ]; - gpu_chooser [ label="" style="invisible" width=0 height=0 fixedsize=true ]; - select_gpu [ label="Mali-T600 | Other\n(select_gpu.h)" shape=polygon,sides=4,distortion=0.25 width=3.3 height=0.99 fixedsize=true ] ; - } - node [ shape=box ]; - { rank = same; "plat/plat_config.h"; } - { rank = same; "mali_base.h"; } - - "mali_base.h" -> "gpu/mali_gpu.h" -> "gpu/mali_gpu_props.h"; - "mali_base.h" -> "plat/plat_config.h" ; - "mali_base.h" -> select_gpu ; - - "plat/plat_config.h" -> gpu_chooser [style="dotted,bold" dir=none weight=4] ; - gpu_chooser -> select_gpu [style="dotted,bold"] ; - - select_gpu -> "base/midg_gpus/mali_t600.h" ; - select_gpu -> "base/midg_gpus/other_midg_gpu.h" ; - } - @enddot - * - * * @section sec_base_user_api_gpuprops_kernel Kernel Operation * * During Base Context Create time, user-side makes a single kernel call: @@ -1429,23 +1382,10 @@ struct mali_base_gpu_core_props { u16 padding; - /** - * This property is deprecated since it has not contained the real current - * value of GPU clock speed. It is kept here only for backwards compatibility. - * For the new ioctl interface, it is ignored and is treated as a padding - * to keep the structure of the same size and retain the placement of its - * members. - */ - u32 gpu_speed_mhz; - - /** - * @usecase GPU clock max/min speed is required for computing best/worst case - * in tasks as job scheduling ant irq_throttling. (It is not specified in the - * Midgard Architecture). - * Also, GPU clock max speed is used for OpenCL's clGetDeviceInfo() function. + /* The maximum GPU frequency. Reported to applications by + * clGetDeviceInfo() */ u32 gpu_freq_khz_max; - u32 gpu_freq_khz_min; /** * Size of the shader program counter, in bits. @@ -1610,7 +1550,7 @@ struct gpu_raw_gpu_props { }; /** - * Return structure for _mali_base_get_gpu_props(). + * Return structure for base_get_gpu_props(). * * NOTE: the raw_props member in this data structure contains the register * values from which the value of the other members are derived. The derived @@ -1618,7 +1558,7 @@ struct gpu_raw_gpu_props { * of the layout of the registers. * */ -typedef struct mali_base_gpu_props { +typedef struct base_gpu_props { struct mali_base_gpu_core_props core_props; struct mali_base_gpu_l2_cache_props l2_props; u64 unused_1; /* keep for backwards compatibility */ diff --git a/mali_kbase/mali_base_mem_priv.h b/mali_kbase/mali_base_mem_priv.h index 4a98a72..52c8a4f 100644 --- a/mali_kbase/mali_base_mem_priv.h +++ b/mali_kbase/mali_base_mem_priv.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _BASE_MEM_PRIV_H_ #define _BASE_MEM_PRIV_H_ diff --git a/mali_kbase/mali_base_vendor_specific_func.h b/mali_kbase/mali_base_vendor_specific_func.h index be454a2..5e8add8 100644 --- a/mali_kbase/mali_base_vendor_specific_func.h +++ b/mali_kbase/mali_base_vendor_specific_func.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _BASE_VENDOR_SPEC_FUNC_H_ #define _BASE_VENDOR_SPEC_FUNC_H_ diff --git a/mali_kbase/mali_kbase.h b/mali_kbase/mali_kbase.h index 11113a9..7174ef2 100644 --- a/mali_kbase/mali_kbase.h +++ b/mali_kbase/mali_kbase.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_H_ #define _KBASE_H_ @@ -24,14 +29,12 @@ #include -#include - #include #include #include #include #include -#include +#include #include #include #include @@ -112,6 +115,49 @@ struct kbase_context * kbase_create_context(struct kbase_device *kbdev, bool is_compat); void kbase_destroy_context(struct kbase_context *kctx); + +/** + * kbase_get_unmapped_area() - get an address range which is currently + * unmapped. + * @filp: File operations associated with kbase device. + * @addr: CPU mapped address (set to 0 since MAP_FIXED mapping is not allowed + * as Mali GPU driver decides about the mapping). + * @len: Length of the address range. + * @pgoff: Page offset within the GPU address space of the kbase context. + * @flags: Flags for the allocation. + * + * Finds the unmapped address range which satisfies requirements specific to + * GPU and those provided by the call parameters. + * + * 1) Requirement for allocations greater than 2MB: + * - alignment offset is set to 2MB and the alignment mask to 2MB decremented + * by 1. + * + * 2) Requirements imposed for the shader memory alignment: + * - alignment is decided by the number of GPU pc bits which can be read from + * GPU properties of the device associated with this kbase context; alignment + * offset is set to this value in bytes and the alignment mask to the offset + * decremented by 1. + * - allocations must not to be at 4GB boundaries. Such cases are indicated + * by the flag KBASE_REG_GPU_NX not being set (check the flags of the kbase + * region). 4GB boundaries can be checked against @ref BASE_MEM_MASK_4GB. + * + * 3) Requirements imposed for tiler memory alignment, cases indicated by + * the flag @ref KBASE_REG_TILER_ALIGN_TOP (check the flags of the kbase + * region): + * - alignment offset is set to the difference between the kbase region + * extent (converted from the original value in pages to bytes) and the kbase + * region initial_commit (also converted from the original value in pages to + * bytes); alignment mask is set to the kbase region extent in bytes and + * decremented by 1. + * + * Return: if successful, address of the unmapped area aligned as required; + * error code (negative) in case of failure; + */ +unsigned long kbase_get_unmapped_area(struct file *filp, + const unsigned long addr, const unsigned long len, + const unsigned long pgoff, const unsigned long flags); + int kbase_jd_init(struct kbase_context *kctx); void kbase_jd_exit(struct kbase_context *kctx); @@ -541,20 +587,6 @@ void kbasep_trace_clear(struct kbase_device *kbdev); /** PRIVATE - do not use directly. Use KBASE_TRACE_DUMP() instead */ void kbasep_trace_dump(struct kbase_device *kbdev); -#ifdef CONFIG_MALI_DEBUG -/** - * kbase_set_driver_inactive - Force driver to go inactive - * @kbdev: Device pointer - * @inactive: true if driver should go inactive, false otherwise - * - * Forcing the driver inactive will cause all future IOCTLs to wait until the - * driver is made active again. This is intended solely for the use of tests - * which require that no jobs are running while the test executes. - */ -void kbase_set_driver_inactive(struct kbase_device *kbdev, bool inactive); -#endif /* CONFIG_MALI_DEBUG */ - - #if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_MALI_NO_MALI) /* kbase_io_history_init - initialize data struct for register access history diff --git a/mali_kbase/mali_kbase_10969_workaround.c b/mali_kbase/mali_kbase_10969_workaround.c index 6b3559d..e0e40a9 100644 --- a/mali_kbase/mali_kbase_10969_workaround.c +++ b/mali_kbase/mali_kbase_10969_workaround.c @@ -7,13 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/mali_kbase_10969_workaround.h b/mali_kbase/mali_kbase_10969_workaround.h index 099a298..624dc4a 100644 --- a/mali_kbase/mali_kbase_10969_workaround.h +++ b/mali_kbase/mali_kbase_10969_workaround.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_10969_WORKAROUND_ #define _KBASE_10969_WORKAROUND_ diff --git a/mali_kbase/mali_kbase_as_fault_debugfs.c b/mali_kbase/mali_kbase_as_fault_debugfs.c index f910fe9..1dee5cb 100644 --- a/mali_kbase/mali_kbase_as_fault_debugfs.c +++ b/mali_kbase/mali_kbase_as_fault_debugfs.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include diff --git a/mali_kbase/mali_kbase_as_fault_debugfs.h b/mali_kbase/mali_kbase_as_fault_debugfs.h index 3ed2248..496d8b1 100644 --- a/mali_kbase/mali_kbase_as_fault_debugfs.h +++ b/mali_kbase/mali_kbase_as_fault_debugfs.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_AS_FAULT_DEBUG_FS_H #define _KBASE_AS_FAULT_DEBUG_FS_H diff --git a/mali_kbase/mali_kbase_cache_policy.c b/mali_kbase/mali_kbase_cache_policy.c index 1d11de6..18444b8 100644 --- a/mali_kbase/mali_kbase_cache_policy.c +++ b/mali_kbase/mali_kbase_cache_policy.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Cache Policy API. */ diff --git a/mali_kbase/mali_kbase_cache_policy.h b/mali_kbase/mali_kbase_cache_policy.h index 0c18bdb..8a1e529 100644 --- a/mali_kbase/mali_kbase_cache_policy.h +++ b/mali_kbase/mali_kbase_cache_policy.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Cache Policy API. */ diff --git a/mali_kbase/mali_kbase_config.c b/mali_kbase/mali_kbase_config.c index fb615ae..ce7070d 100644 --- a/mali_kbase/mali_kbase_config.c +++ b/mali_kbase/mali_kbase_config.c @@ -1,22 +1,27 @@ /* * - * (C) COPYRIGHT 2011-2015 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2015,2017 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 licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include @@ -41,11 +46,3 @@ void kbasep_platform_device_term(struct kbase_device *kbdev) platform_funcs_p->platform_term_func(kbdev); } -int kbase_cpuprops_get_default_clock_speed(u32 * const clock_speed) -{ - KBASE_DEBUG_ASSERT(NULL != clock_speed); - - *clock_speed = 100; - return 0; -} - diff --git a/mali_kbase/mali_kbase_config.h b/mali_kbase/mali_kbase_config.h index 212e3b1..1637fcb 100644 --- a/mali_kbase/mali_kbase_config.h +++ b/mali_kbase/mali_kbase_config.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_config.h * Configuration API and Attributes for KBase @@ -25,10 +30,10 @@ #ifndef _KBASE_CONFIG_H_ #define _KBASE_CONFIG_H_ -#include - +#include #include #include +#include /** * @addtogroup base_api @@ -45,8 +50,6 @@ * @{ */ -#include - /* Forward declaration of struct kbase_device */ struct kbase_device; @@ -208,41 +211,6 @@ struct kbase_pm_callback_conf { int (*power_runtime_idle_callback)(struct kbase_device *kbdev); }; -/** - * kbase_cpuprops_get_default_clock_speed - default for CPU_SPEED_FUNC - * @clock_speed - see kbase_cpu_clk_speed_func for details on the parameters - * - * Returns 0 on success, negative error code otherwise. - * - * Default implementation of CPU_SPEED_FUNC. This function sets clock_speed - * to 100, so will be an underestimate for any real system. - */ -int kbase_cpuprops_get_default_clock_speed(u32 * const clock_speed); - -/** - * kbase_cpu_clk_speed_func - Type of the function pointer for CPU_SPEED_FUNC - * @param clock_speed - pointer to store the current CPU clock speed in MHz - * - * Returns 0 on success, otherwise negative error code. - * - * This is mainly used to implement OpenCL's clGetDeviceInfo(). - */ -typedef int (*kbase_cpu_clk_speed_func) (u32 *clock_speed); - -/** - * kbase_gpu_clk_speed_func - Type of the function pointer for GPU_SPEED_FUNC - * @param clock_speed - pointer to store the current GPU clock speed in MHz - * - * Returns 0 on success, otherwise negative error code. - * When an error is returned the caller assumes maximum GPU speed stored in - * gpu_freq_khz_max. - * - * If the system timer is not available then this function is required - * for the OpenCL queue profiling to return correct timing information. - * - */ -typedef int (*kbase_gpu_clk_speed_func) (u32 *clock_speed); - #ifdef CONFIG_OF struct kbase_platform_config { }; @@ -304,18 +272,6 @@ int kbasep_platform_device_init(struct kbase_device *kbdev); */ void kbasep_platform_device_term(struct kbase_device *kbdev); - -/** - * kbase_platform_early_init - Early initialisation of the platform code - * - * This function will be called when the module is loaded to perform any - * early initialisation required by the platform code. Such as reading - * platform specific device tree entries for the GPU. - * - * Return: 0 for success, any other fail causes module initialisation to fail - */ -int kbase_platform_early_init(void); - #ifndef CONFIG_OF /** * kbase_platform_register - Register a platform device for the GPU diff --git a/mali_kbase/mali_kbase_config_defaults.h b/mali_kbase/mali_kbase_config_defaults.h index aee6b0c..dbb4f97 100644 --- a/mali_kbase/mali_kbase_config_defaults.h +++ b/mali_kbase/mali_kbase_config_defaults.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_config_defaults.h * @@ -267,5 +272,13 @@ enum { */ #define PLATFORM_POWER_DOWN_ONLY (0) +/* + * Maximum frequency (in kHz) that the GPU can be clocked. For some platforms + * this isn't available, so we simply define a dummy value here. If devfreq + * is enabled the value will be read from there, otherwise this should be + * overridden by defining GPU_FREQ_KHZ_MAX in the platform file. + */ +#define DEFAULT_GPU_FREQ_KHZ_MAX (5000) + #endif /* _KBASE_CONFIG_DEFAULTS_H_ */ diff --git a/mali_kbase/mali_kbase_context.c b/mali_kbase/mali_kbase_context.c index f43db48..868442a 100644 --- a/mali_kbase/mali_kbase_context.c +++ b/mali_kbase/mali_kbase_context.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel context APIs */ @@ -59,6 +64,11 @@ kbase_create_context(struct kbase_device *kbdev, bool is_compat) atomic_set(&kctx->refcount, 0); if (is_compat) kbase_ctx_flag_set(kctx, KCTX_COMPAT); +#if defined(CONFIG_64BIT) + else + kbase_ctx_flag_set(kctx, KCTX_FORCE_SAME_VA); +#endif /* !defined(CONFIG_64BIT) */ + #ifdef CONFIG_MALI_TRACE_TIMELINE kctx->timeline.owner_tgid = task_tgid_nr(current); #endif diff --git a/mali_kbase/mali_kbase_context.h b/mali_kbase/mali_kbase_context.h index a3f5bb0..431f9e5 100644 --- a/mali_kbase/mali_kbase_context.h +++ b/mali_kbase/mali_kbase_context.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_CONTEXT_H_ #define _KBASE_CONTEXT_H_ diff --git a/mali_kbase/mali_kbase_core_linux.c b/mali_kbase/mali_kbase_core_linux.c index a6b0ac7..22c995a 100644 --- a/mali_kbase/mali_kbase_core_linux.c +++ b/mali_kbase/mali_kbase_core_linux.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include @@ -44,6 +49,10 @@ #include #include "mali_kbase_ioctl.h" +#ifdef CONFIG_MALI_JOB_DUMP +#include "mali_kbase_gwt.h" +#endif + #include #include #include @@ -63,12 +72,12 @@ #include #include #include -#include #if defined(CONFIG_SYNC) || defined(CONFIG_SYNC_FILE) #include #endif /* CONFIG_SYNC || CONFIG_SYNC_FILE */ #include #include +#include #include @@ -169,22 +178,6 @@ enum { inited_ctx_sched = (1u << 22) }; - -#ifdef CONFIG_MALI_DEBUG -#define INACTIVE_WAIT_MS (5000) - -void kbase_set_driver_inactive(struct kbase_device *kbdev, bool inactive) -{ - kbdev->driver_inactive = inactive; - wake_up(&kbdev->driver_inactive_wait); - - /* Wait for any running IOCTLs to complete */ - if (inactive) - msleep(INACTIVE_WAIT_MS); -} -KBASE_EXPORT_TEST_API(kbase_set_driver_inactive); -#endif /* CONFIG_MALI_DEBUG */ - static struct kbase_device *to_kbase_device(struct device *dev) { return dev_get_drvdata(dev); @@ -337,6 +330,55 @@ static const struct file_operations kbase_infinite_cache_fops = { .read = read_ctx_infinite_cache, }; +static ssize_t write_ctx_force_same_va(struct file *f, const char __user *ubuf, + size_t size, loff_t *off) +{ + struct kbase_context *kctx = f->private_data; + int err; + bool value; + + err = kstrtobool_from_user(ubuf, size, &value); + if (err) + return err; + + if (value) { +#if defined(CONFIG_64BIT) + /* 32-bit clients cannot force SAME_VA */ + if (kbase_ctx_flag(kctx, KCTX_COMPAT)) + return -EINVAL; + kbase_ctx_flag_set(kctx, KCTX_FORCE_SAME_VA); +#else /* defined(CONFIG_64BIT) */ + /* 32-bit clients cannot force SAME_VA */ + return -EINVAL; +#endif /* defined(CONFIG_64BIT) */ + } else { + kbase_ctx_flag_clear(kctx, KCTX_FORCE_SAME_VA); + } + + return size; +} + +static ssize_t read_ctx_force_same_va(struct file *f, char __user *ubuf, + size_t size, loff_t *off) +{ + struct kbase_context *kctx = f->private_data; + char buf[32]; + int count; + bool value; + + value = kbase_ctx_flag(kctx, KCTX_FORCE_SAME_VA); + + count = scnprintf(buf, sizeof(buf), "%s\n", value ? "Y" : "N"); + + return simple_read_from_buffer(ubuf, size, off, buf, count); +} + +static const struct file_operations kbase_force_same_va_fops = { + .open = simple_open, + .write = write_ctx_force_same_va, + .read = read_ctx_force_same_va, +}; + static int kbase_open(struct inode *inode, struct file *filp) { struct kbase_device *kbdev = NULL; @@ -376,7 +418,9 @@ static int kbase_open(struct inode *inode, struct file *filp) } debugfs_create_file("infinite_cache", 0644, kctx->kctx_dentry, - kctx, &kbase_infinite_cache_fops); + kctx, &kbase_infinite_cache_fops); + debugfs_create_file("force_same_va", S_IRUSR | S_IWUSR, + kctx->kctx_dentry, kctx, &kbase_force_same_va_fops); mutex_init(&kctx->mem_profile_lock); @@ -529,12 +573,11 @@ static int kbase_api_mem_alloc(struct kbase_context *kctx, u64 flags = alloc->in.flags; u64 gpu_va; -#if defined(CONFIG_64BIT) - if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) { + if ((!kbase_ctx_flag(kctx, KCTX_COMPAT)) && + kbase_ctx_flag(kctx, KCTX_FORCE_SAME_VA)) { /* force SAME_VA if a 64-bit client */ flags |= BASE_MEM_SAME_VA; } -#endif reg = kbase_mem_alloc(kctx, alloc->in.va_pages, alloc->in.commit_pages, @@ -686,6 +729,17 @@ static int kbase_api_mem_find_cpu_offset(struct kbase_context *kctx, &find->out.offset); } +static int kbase_api_mem_find_gpu_start_and_offset(struct kbase_context *kctx, + union kbase_ioctl_mem_find_gpu_start_and_offset *find) +{ + return kbasep_find_enclosing_gpu_mapping_start_and_offset( + kctx, + find->in.gpu_addr, + find->in.size, + &find->out.start, + &find->out.offset); +} + static int kbase_api_get_context_id(struct kbase_context *kctx, struct kbase_ioctl_get_context_id *info) { @@ -723,6 +777,9 @@ static int kbase_api_mem_alias(struct kbase_context *kctx, if (alias->in.nents == 0 || alias->in.nents > 2048) return -EINVAL; + if (alias->in.stride > (U64_MAX / 2048)) + return -EINVAL; + ai = vmalloc(sizeof(*ai) * alias->in.nents); if (!ai) return -ENOMEM; @@ -861,6 +918,74 @@ static int kbase_api_soft_event_update(struct kbase_context *kctx, return kbase_soft_event_update(kctx, update->event, update->new_status); } +static int kbase_api_sticky_resource_map(struct kbase_context *kctx, + struct kbase_ioctl_sticky_resource_map *map) +{ + int ret; + u64 i; + u64 gpu_addr[BASE_EXT_RES_COUNT_MAX]; + + if (!map->count || map->count > BASE_EXT_RES_COUNT_MAX) + return -EOVERFLOW; + + ret = copy_from_user(gpu_addr, u64_to_user_ptr(map->address), + sizeof(u64) * map->count); + + if (ret != 0) + return -EFAULT; + + kbase_gpu_vm_lock(kctx); + + for (i = 0; i < map->count; i++) { + if (!kbase_sticky_resource_acquire(kctx, gpu_addr[i])) { + /* Invalid resource */ + ret = -EINVAL; + break; + } + } + + if (ret != 0) { + while (i > 0) { + i--; + kbase_sticky_resource_release(kctx, NULL, gpu_addr[i]); + } + } + + kbase_gpu_vm_unlock(kctx); + + return ret; +} + +static int kbase_api_sticky_resource_unmap(struct kbase_context *kctx, + struct kbase_ioctl_sticky_resource_unmap *unmap) +{ + int ret; + u64 i; + u64 gpu_addr[BASE_EXT_RES_COUNT_MAX]; + + if (!unmap->count || unmap->count > BASE_EXT_RES_COUNT_MAX) + return -EOVERFLOW; + + ret = copy_from_user(gpu_addr, u64_to_user_ptr(unmap->address), + sizeof(u64) * unmap->count); + + if (ret != 0) + return -EFAULT; + + kbase_gpu_vm_lock(kctx); + + for (i = 0; i < unmap->count; i++) { + if (!kbase_sticky_resource_release(kctx, NULL, gpu_addr[i])) { + /* Invalid resource, but we keep going anyway */ + ret = -EINVAL; + } + } + + kbase_gpu_vm_unlock(kctx); + + return ret; +} + #if MALI_UNIT_TEST static int kbase_api_tlstream_test(struct kbase_context *kctx, struct kbase_ioctl_tlstream_test *test) @@ -1000,6 +1125,9 @@ static long kbase_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) KBASE_HANDLE_IOCTL_INOUT(KBASE_IOCTL_MEM_FIND_CPU_OFFSET, kbase_api_mem_find_cpu_offset, union kbase_ioctl_mem_find_cpu_offset); + KBASE_HANDLE_IOCTL_INOUT(KBASE_IOCTL_MEM_FIND_GPU_START_AND_OFFSET, + kbase_api_mem_find_gpu_start_and_offset, + union kbase_ioctl_mem_find_gpu_start_and_offset); KBASE_HANDLE_IOCTL_OUT(KBASE_IOCTL_GET_CONTEXT_ID, kbase_api_get_context_id, struct kbase_ioctl_get_context_id); @@ -1035,6 +1163,21 @@ static long kbase_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) KBASE_HANDLE_IOCTL_IN(KBASE_IOCTL_SOFT_EVENT_UPDATE, kbase_api_soft_event_update, struct kbase_ioctl_soft_event_update); +#ifdef CONFIG_MALI_JOB_DUMP + KBASE_HANDLE_IOCTL(KBASE_IOCTL_CINSTR_GWT_START, + kbase_gpu_gwt_start); + KBASE_HANDLE_IOCTL(KBASE_IOCTL_CINSTR_GWT_STOP, + kbase_gpu_gwt_stop); + KBASE_HANDLE_IOCTL_INOUT(KBASE_IOCTL_CINSTR_GWT_DUMP, + kbase_gpu_gwt_dump, + union kbase_ioctl_cinstr_gwt_dump); +#endif + KBASE_HANDLE_IOCTL_IN(KBASE_IOCTL_STICKY_RESOURCE_MAP, + kbase_api_sticky_resource_map, + struct kbase_ioctl_sticky_resource_map); + KBASE_HANDLE_IOCTL_IN(KBASE_IOCTL_STICKY_RESOURCE_UNMAP, + kbase_api_sticky_resource_unmap, + struct kbase_ioctl_sticky_resource_unmap); #if MALI_UNIT_TEST KBASE_HANDLE_IOCTL_IN(KBASE_IOCTL_TLSTREAM_TEST, @@ -1121,242 +1264,6 @@ static int kbase_check_flags(int flags) return 0; } - -/** - * align_and_check - Align the specified pointer to the provided alignment and - * check that it is still in range. - * @gap_end: Highest possible start address for allocation (end of gap in - * address space) - * @gap_start: Start address of current memory area / gap in address space - * @info: vm_unmapped_area_info structure passed to caller, containing - * alignment, length and limits for the allocation - * @is_shader_code: True if the allocation is for shader code (which has - * additional alignment requirements) - * - * Return: true if gap_end is now aligned correctly and is still in range, - * false otherwise - */ -static bool align_and_check(unsigned long *gap_end, unsigned long gap_start, - struct vm_unmapped_area_info *info, bool is_shader_code) -{ - /* Compute highest gap address at the desired alignment */ - (*gap_end) -= info->length; - (*gap_end) -= (*gap_end - info->align_offset) & info->align_mask; - - if (is_shader_code) { - /* Check for 4GB boundary */ - if (0 == (*gap_end & BASE_MEM_MASK_4GB)) - (*gap_end) -= (info->align_offset ? info->align_offset : - info->length); - if (0 == ((*gap_end + info->length) & BASE_MEM_MASK_4GB)) - (*gap_end) -= (info->align_offset ? info->align_offset : - info->length); - - if (!(*gap_end & BASE_MEM_MASK_4GB) || !((*gap_end + - info->length) & BASE_MEM_MASK_4GB)) - return false; - } - - - if ((*gap_end < info->low_limit) || (*gap_end < gap_start)) - return false; - - - return true; -} - -/* The following function is taken from the kernel and just - * renamed. As it's not exported to modules we must copy-paste it here. - */ - -static unsigned long kbase_unmapped_area_topdown(struct vm_unmapped_area_info - *info, bool is_shader_code) -{ - struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; - unsigned long length, low_limit, high_limit, gap_start, gap_end; - - /* Adjust search length to account for worst case alignment overhead */ - length = info->length + info->align_mask; - if (length < info->length) - return -ENOMEM; - - /* - * Adjust search limits by the desired length. - * See implementation comment at top of unmapped_area(). - */ - gap_end = info->high_limit; - if (gap_end < length) - return -ENOMEM; - high_limit = gap_end - length; - - if (info->low_limit > high_limit) - return -ENOMEM; - low_limit = info->low_limit + length; - - /* Check highest gap, which does not precede any rbtree node */ - gap_start = mm->highest_vm_end; - if (gap_start <= high_limit) { - if (align_and_check(&gap_end, gap_start, info, is_shader_code)) - return gap_end; - } - - /* Check if rbtree root looks promising */ - if (RB_EMPTY_ROOT(&mm->mm_rb)) - return -ENOMEM; - vma = rb_entry(mm->mm_rb.rb_node, struct vm_area_struct, vm_rb); - if (vma->rb_subtree_gap < length) - return -ENOMEM; - - while (true) { - /* Visit right subtree if it looks promising */ - gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; - if (gap_start <= high_limit && vma->vm_rb.rb_right) { - struct vm_area_struct *right = - rb_entry(vma->vm_rb.rb_right, - struct vm_area_struct, vm_rb); - if (right->rb_subtree_gap >= length) { - vma = right; - continue; - } - } - -check_current: - /* Check if current node has a suitable gap */ - gap_end = vma->vm_start; - if (gap_end < low_limit) - return -ENOMEM; - if (gap_start <= high_limit && gap_end - gap_start >= length) { - /* We found a suitable gap. Clip it with the original - * high_limit. */ - if (gap_end > info->high_limit) - gap_end = info->high_limit; - - if (align_and_check(&gap_end, gap_start, info, - is_shader_code)) - return gap_end; - } - - /* Visit left subtree if it looks promising */ - if (vma->vm_rb.rb_left) { - struct vm_area_struct *left = - rb_entry(vma->vm_rb.rb_left, - struct vm_area_struct, vm_rb); - if (left->rb_subtree_gap >= length) { - vma = left; - continue; - } - } - - /* Go back up the rbtree to find next candidate node */ - while (true) { - struct rb_node *prev = &vma->vm_rb; - if (!rb_parent(prev)) - return -ENOMEM; - vma = rb_entry(rb_parent(prev), - struct vm_area_struct, vm_rb); - if (prev == vma->vm_rb.rb_right) { - gap_start = vma->vm_prev ? - vma->vm_prev->vm_end : 0; - goto check_current; - } - } - } - - return -ENOMEM; -} - -static unsigned long kbase_get_unmapped_area(struct file *filp, - const unsigned long addr, const unsigned long len, - const unsigned long pgoff, const unsigned long flags) -{ - /* based on get_unmapped_area, but simplified slightly due to that some - * values are known in advance */ - struct kbase_context *kctx = filp->private_data; - struct mm_struct *mm = current->mm; - struct vm_unmapped_area_info info; - unsigned long align_offset = 0; - unsigned long align_mask = 0; - unsigned long high_limit = mm->mmap_base; - unsigned long low_limit = PAGE_SIZE; - int cpu_va_bits = BITS_PER_LONG; - int gpu_pc_bits = - kctx->kbdev->gpu_props.props.core_props.log2_program_counter_size; - bool is_shader_code = false; - unsigned long ret; - - /* err on fixed address */ - if ((flags & MAP_FIXED) || addr) - return -EINVAL; - -#ifdef CONFIG_64BIT - /* too big? */ - if (len > TASK_SIZE - SZ_2M) - return -ENOMEM; - - if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) { - - if (kbase_hw_has_feature(kctx->kbdev, - BASE_HW_FEATURE_33BIT_VA)) { - high_limit = kctx->same_va_end << PAGE_SHIFT; - } else { - high_limit = min_t(unsigned long, mm->mmap_base, - (kctx->same_va_end << PAGE_SHIFT)); - if (len >= SZ_2M) { - align_offset = SZ_2M; - align_mask = SZ_2M - 1; - } - } - - low_limit = SZ_2M; - } else { - cpu_va_bits = 32; - } -#endif /* CONFIG_64BIT */ - if ((PFN_DOWN(BASE_MEM_COOKIE_BASE) <= pgoff) && - (PFN_DOWN(BASE_MEM_FIRST_FREE_ADDRESS) > pgoff)) { - int cookie = pgoff - PFN_DOWN(BASE_MEM_COOKIE_BASE); - - if (!kctx->pending_regions[cookie]) - return -EINVAL; - - if (!(kctx->pending_regions[cookie]->flags & - KBASE_REG_GPU_NX)) { - if (cpu_va_bits > gpu_pc_bits) { - align_offset = 1ULL << gpu_pc_bits; - align_mask = align_offset - 1; - is_shader_code = true; - } - } -#ifndef CONFIG_64BIT - } else { - return current->mm->get_unmapped_area(filp, addr, len, pgoff, - flags); -#endif - } - - info.flags = 0; - info.length = len; - info.low_limit = low_limit; - info.high_limit = high_limit; - info.align_offset = align_offset; - info.align_mask = align_mask; - - ret = kbase_unmapped_area_topdown(&info, is_shader_code); - - if (IS_ERR_VALUE(ret) && high_limit == mm->mmap_base && - high_limit < (kctx->same_va_end << PAGE_SHIFT)) { - /* Retry above mmap_base */ - info.low_limit = mm->mmap_base; - info.high_limit = min_t(u64, TASK_SIZE, - (kctx->same_va_end << PAGE_SHIFT)); - - ret = kbase_unmapped_area_topdown(&info, is_shader_code); - } - - return ret; -} - static const struct file_operations kbase_fops = { .owner = THIS_MODULE, .open = kbase_open, @@ -3127,7 +3034,7 @@ static int power_control_init(struct platform_device *pdev) } #endif /* LINUX_VERSION_CODE >= 3, 12, 0 */ - kbdev->clock = clk_get(kbdev->dev, "clk_mali"); + kbdev->clock = of_clk_get(kbdev->dev->of_node, 0); if (IS_ERR_OR_NULL(kbdev->clock)) { err = PTR_ERR(kbdev->clock); kbdev->clock = NULL; @@ -3545,10 +3452,6 @@ static int kbase_platform_device_remove(struct platform_device *pdev) kbase_debug_job_fault_dev_term(kbdev); kbdev->inited_subsys &= ~inited_job_fault; } - if (kbdev->inited_subsys & inited_vinstr) { - kbase_vinstr_term(kbdev->vinstr_ctx); - kbdev->inited_subsys &= ~inited_vinstr; - } #ifdef CONFIG_MALI_DEVFREQ if (kbdev->inited_subsys & inited_devfreq) { @@ -3557,6 +3460,11 @@ static int kbase_platform_device_remove(struct platform_device *pdev) } #endif + if (kbdev->inited_subsys & inited_vinstr) { + kbase_vinstr_term(kbdev->vinstr_ctx); + kbdev->inited_subsys &= ~inited_vinstr; + } + if (kbdev->inited_subsys & inited_backend_late) { kbase_backend_late_term(kbdev); kbdev->inited_subsys &= ~inited_backend_late; @@ -3649,14 +3557,6 @@ static int kbase_platform_device_probe(struct platform_device *pdev) const struct list_head *dev_list; int err = 0; -#ifdef CONFIG_OF - err = kbase_platform_early_init(); - if (err) { - dev_err(&pdev->dev, "Early platform initialization failed\n"); - kbase_platform_device_remove(pdev); - return err; - } -#endif kbdev = kbase_device_alloc(); if (!kbdev) { dev_err(&pdev->dev, "Allocate device failed\n"); @@ -3722,10 +3622,15 @@ static int kbase_platform_device_probe(struct platform_device *pdev) kbase_disjoint_init(kbdev); - /* obtain min/max configured gpu frequencies */ + /* obtain max configured gpu frequency, if devfreq is enabled then + * this will be overridden by the highest operating point found + */ core_props = &(kbdev->gpu_props.props.core_props); - core_props->gpu_freq_khz_min = GPU_FREQ_KHZ_MIN; +#ifdef GPU_FREQ_KHZ_MAX core_props->gpu_freq_khz_max = GPU_FREQ_KHZ_MAX; +#else + core_props->gpu_freq_khz_max = DEFAULT_GPU_FREQ_KHZ_MAX; +#endif err = kbase_device_init(kbdev); if (err) { @@ -4090,10 +3995,6 @@ static int __init kbase_driver_init(void) { int ret; - ret = kbase_platform_early_init(); - if (ret) - return ret; - ret = kbase_platform_register(); if (ret) return ret; diff --git a/mali_kbase/mali_kbase_ctx_sched.c b/mali_kbase/mali_kbase_ctx_sched.c index e2f7baa..85a6afd 100644 --- a/mali_kbase/mali_kbase_ctx_sched.c +++ b/mali_kbase/mali_kbase_ctx_sched.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include diff --git a/mali_kbase/mali_kbase_ctx_sched.h b/mali_kbase/mali_kbase_ctx_sched.h index 77d2232..400ee62 100644 --- a/mali_kbase/mali_kbase_ctx_sched.h +++ b/mali_kbase/mali_kbase_ctx_sched.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_CTX_SCHED_H_ #define _KBASE_CTX_SCHED_H_ diff --git a/mali_kbase/mali_kbase_debug.c b/mali_kbase/mali_kbase_debug.c index fb57ac2..118f787 100644 --- a/mali_kbase/mali_kbase_debug.c +++ b/mali_kbase/mali_kbase_debug.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include static struct kbasep_debug_assert_cb kbasep_debug_assert_registered_cb = { diff --git a/mali_kbase/mali_kbase_debug.h b/mali_kbase/mali_kbase_debug.h index d7873c5..2fdb72d 100644 --- a/mali_kbase/mali_kbase_debug.h +++ b/mali_kbase/mali_kbase_debug.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_DEBUG_H #define _KBASE_DEBUG_H diff --git a/mali_kbase/mali_kbase_debug_job_fault.c b/mali_kbase/mali_kbase_debug_job_fault.c index f29430d..d2c09d6 100644 --- a/mali_kbase/mali_kbase_debug_job_fault.c +++ b/mali_kbase/mali_kbase_debug_job_fault.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/mali_kbase_debug_job_fault.h b/mali_kbase/mali_kbase_debug_job_fault.h index a2bf898..f5ab0a4 100644 --- a/mali_kbase/mali_kbase_debug_job_fault.h +++ b/mali_kbase/mali_kbase_debug_job_fault.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_DEBUG_JOB_FAULT_H #define _KBASE_DEBUG_JOB_FAULT_H diff --git a/mali_kbase/mali_kbase_debug_mem_view.c b/mali_kbase/mali_kbase_debug_mem_view.c index c65b4df..d2c57ca 100644 --- a/mali_kbase/mali_kbase_debug_mem_view.c +++ b/mali_kbase/mali_kbase_debug_mem_view.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Debugfs interface to dump the memory visible to the GPU */ diff --git a/mali_kbase/mali_kbase_debug_mem_view.h b/mali_kbase/mali_kbase_debug_mem_view.h index 20ab51a..886ca94 100644 --- a/mali_kbase/mali_kbase_debug_mem_view.h +++ b/mali_kbase/mali_kbase_debug_mem_view.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_DEBUG_MEM_VIEW_H #define _KBASE_DEBUG_MEM_VIEW_H diff --git a/mali_kbase/mali_kbase_defs.h b/mali_kbase/mali_kbase_defs.h index 09415b3..4bb3442 100644 --- a/mali_kbase/mali_kbase_defs.h +++ b/mali_kbase/mali_kbase_defs.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_defs.h * @@ -436,6 +441,8 @@ struct kbase_jd_atom { u32 device_nr; u64 affinity; u64 jc; + /* Copy of data read from the user space buffer that jc points to */ + void *softjob_data; enum kbase_atom_coreref_state coreref_state; #if defined(CONFIG_SYNC) /* Stores either an input or output fence, depending on soft-job type */ @@ -513,10 +520,6 @@ struct kbase_jd_atom { /* Note: refer to kbasep_js_atom_retained_state, which will take a copy of some of the following members */ enum base_jd_event_code event_code; base_jd_core_req core_req; /**< core requirements */ - /** Job Slot to retry submitting to if submission from IRQ handler failed - * - * NOTE: see if this can be unified into the another member e.g. the event */ - int retry_submit_on_slot; u32 ticks; /* JS atom priority with respect to other atoms on its kctx. */ @@ -1276,6 +1279,14 @@ struct kbase_device { /* Current serialization mode. See KBASE_SERIALIZE_* for details */ u8 serialize_jobs; + +#ifdef CONFIG_MALI_JOB_DUMP + /* Used to backup status of job serialization mode + * when we use GWT and restore when GWT is disabled. + * GWT uses full serialization mode. + */ + u8 backup_serialize_jobs; +#endif }; /** @@ -1332,6 +1343,14 @@ struct jsctx_queue { * context, to disable use of implicit dma-buf fences. This is used to avoid * potential synchronization deadlocks. * + * @KCTX_FORCE_SAME_VA: Set when BASE_MEM_SAME_VA should be forced on memory + * allocations. For 64-bit clients it is enabled by default, and disabled by + * default on 32-bit clients. Being able to clear this flag is only used for + * testing purposes of the custom zone allocation on 64-bit user-space builds, + * where we also require more control than is available through e.g. the JIT + * allocation mechanism. However, the 64-bit user-space client must still + * reserve a JIT region using KBASE_IOCTL_MEM_JIT_INIT + * * All members need to be separate bits. This enum is intended for use in a * bitmask where multiple values get OR-ed together. */ @@ -1347,6 +1366,7 @@ enum kbase_context_flags { KCTX_SCHEDULED = 1U << 8, KCTX_DYING = 1U << 9, KCTX_NO_IMPLICIT_SYNC = 1U << 10, + KCTX_FORCE_SAME_VA = 1U << 11, }; struct kbase_sub_alloc { @@ -1531,8 +1551,50 @@ struct kbase_context { /* Current age count, used to determine age for newly submitted atoms */ u32 age_count; + +#ifdef CONFIG_MALI_JOB_DUMP + /* Used for tracking GPU writes. + * (protected by kbase_context.reg_lock) + */ + bool gwt_enabled; + + /* Simple sticky bit flag to know if GWT was ever enabled + * (protected by kbase_context.reg_lock) + */ + bool gwt_was_enabled; + + /* Current list of GPU writes. + * (protected by kbase_context.reg_lock) + */ + struct list_head gwt_current_list; + + /* Snapshot of list of GPU writes for sending to user space. */ + struct list_head gwt_snapshot_list; + +#endif }; +#ifdef CONFIG_MALI_JOB_DUMP +/** + * struct kbasep_gwt_list_element - Structure used to collect GPU + * write faults. + * @link: List head for adding write faults. + * @handle: The handle for the modified region. + * @offset: The offset in pages of the modified + * part of the region. + * @num_pages: The number of pages modified. + * + * Using this structure all GPU write faults are stored in a list. + */ +struct kbasep_gwt_list_element { + struct list_head link; + u64 handle; + u64 offset; + u64 num_pages; +}; + +#endif + /** * struct kbase_ctx_ext_res_meta - Structure which binds an external resource * to a @kbase_context. diff --git a/mali_kbase/mali_kbase_device.c b/mali_kbase/mali_kbase_device.c index 717795b..d294042 100644 --- a/mali_kbase/mali_kbase_device.c +++ b/mali_kbase/mali_kbase_device.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel device APIs */ diff --git a/mali_kbase/mali_kbase_disjoint_events.c b/mali_kbase/mali_kbase_disjoint_events.c index f70bccc..68eb4ed 100644 --- a/mali_kbase/mali_kbase_disjoint_events.c +++ b/mali_kbase/mali_kbase_disjoint_events.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel disjoint events helper functions */ diff --git a/mali_kbase/mali_kbase_dma_fence.c b/mali_kbase/mali_kbase_dma_fence.c index 9197743..6a95900 100644 --- a/mali_kbase/mali_kbase_dma_fence.c +++ b/mali_kbase/mali_kbase_dma_fence.c @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* Include mali_kbase_dma_fence.h before checking for CONFIG_MALI_DMA_FENCE as * it will be set there. */ diff --git a/mali_kbase/mali_kbase_dma_fence.h b/mali_kbase/mali_kbase_dma_fence.h index c9ab403..2a4d6fc 100644 --- a/mali_kbase/mali_kbase_dma_fence.h +++ b/mali_kbase/mali_kbase_dma_fence.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_DMA_FENCE_H_ #define _KBASE_DMA_FENCE_H_ diff --git a/mali_kbase/mali_kbase_event.c b/mali_kbase/mali_kbase_event.c index 1881486..e290fce 100644 --- a/mali_kbase/mali_kbase_event.c +++ b/mali_kbase/mali_kbase_event.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/mali_kbase_fence.c b/mali_kbase/mali_kbase_fence.c index 17b5621..ac8272c 100644 --- a/mali_kbase/mali_kbase_fence.c +++ b/mali_kbase/mali_kbase_fence.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/mali_kbase_fence.h b/mali_kbase/mali_kbase_fence.h index f3ed025..865060d 100644 --- a/mali_kbase/mali_kbase_fence.h +++ b/mali_kbase/mali_kbase_fence.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_FENCE_H_ #define _KBASE_FENCE_H_ diff --git a/mali_kbase/mali_kbase_fence_defs.h b/mali_kbase/mali_kbase_fence_defs.h index 9e027fc..b629a88 100644 --- a/mali_kbase/mali_kbase_fence_defs.h +++ b/mali_kbase/mali_kbase_fence_defs.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_FENCE_DEFS_H_ #define _KBASE_FENCE_DEFS_H_ diff --git a/mali_kbase/mali_kbase_gator.h b/mali_kbase/mali_kbase_gator.h index ce65b55..4f54817 100644 --- a/mali_kbase/mali_kbase_gator.h +++ b/mali_kbase/mali_kbase_gator.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* NB taken from gator */ /* * List of possible actions to be controlled by DS-5 Streamline. diff --git a/mali_kbase/mali_kbase_gator_api.c b/mali_kbase/mali_kbase_gator_api.c index fac4d94..2fa6806 100644 --- a/mali_kbase/mali_kbase_gator_api.c +++ b/mali_kbase/mali_kbase_gator_api.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include "mali_kbase.h" #include "mali_kbase_hw.h" #include "mali_kbase_mem_linux.h" diff --git a/mali_kbase/mali_kbase_gator_api.h b/mali_kbase/mali_kbase_gator_api.h index ef9ac0f..bd0589e 100644 --- a/mali_kbase/mali_kbase_gator_api.h +++ b/mali_kbase/mali_kbase_gator_api.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_GATOR_API_H_ #define _KBASE_GATOR_API_H_ diff --git a/mali_kbase/mali_kbase_gator_hwcnt_names.h b/mali_kbase/mali_kbase_gator_hwcnt_names.h index 6fe6530..b048db8 100644 --- a/mali_kbase/mali_kbase_gator_hwcnt_names.h +++ b/mali_kbase/mali_kbase_gator_hwcnt_names.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_GATOR_HWCNT_NAMES_H_ #define _KBASE_GATOR_HWCNT_NAMES_H_ @@ -2166,4 +2171,6 @@ static const char * const hardware_counters_mali_t88x[] = { #include "mali_kbase_gator_hwcnt_names_tkax.h" +#include "mali_kbase_gator_hwcnt_names_ttrx.h" + #endif diff --git a/mali_kbase/mali_kbase_gator_hwcnt_names_thex.h b/mali_kbase/mali_kbase_gator_hwcnt_names_thex.h index 15fd4ef..af00a6a 100644 --- a/mali_kbase/mali_kbase_gator_hwcnt_names_thex.h +++ b/mali_kbase/mali_kbase_gator_hwcnt_names_thex.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * This header was autogenerated, it should not be edited. */ diff --git a/mali_kbase/mali_kbase_gator_hwcnt_names_tkax.h b/mali_kbase/mali_kbase_gator_hwcnt_names_tkax.h index a131d45..1c1f669 100644 --- a/mali_kbase/mali_kbase_gator_hwcnt_names_tkax.h +++ b/mali_kbase/mali_kbase_gator_hwcnt_names_tkax.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * This header was autogenerated, it should not be edited. */ @@ -173,11 +178,11 @@ static const char * const hardware_counters_mali_tKAx[] = { "TKAx_FRAG_QUADS_EZS_KILL", "TKAx_FRAG_LZS_TEST", "TKAx_FRAG_LZS_KILL", - "", + "TKAx_WARP_REG_SIZE_64", "TKAx_FRAG_PTILES", "TKAx_FRAG_TRANS_ELIM", "TKAx_QUAD_FPK_KILLER", - "", + "TKAx_FULL_QUAD_WARPS", "TKAx_COMPUTE_ACTIVE", "TKAx_COMPUTE_TASKS", "TKAx_COMPUTE_WARPS", diff --git a/mali_kbase/mali_kbase_gator_hwcnt_names_tmix.h b/mali_kbase/mali_kbase_gator_hwcnt_names_tmix.h index 8a215f7..233ffbe 100644 --- a/mali_kbase/mali_kbase_gator_hwcnt_names_tmix.h +++ b/mali_kbase/mali_kbase_gator_hwcnt_names_tmix.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * This header was autogenerated, it should not be edited. */ diff --git a/mali_kbase/mali_kbase_gator_hwcnt_names_tnox.h b/mali_kbase/mali_kbase_gator_hwcnt_names_tnox.h index b6175a5..fbb5080 100644 --- a/mali_kbase/mali_kbase_gator_hwcnt_names_tnox.h +++ b/mali_kbase/mali_kbase_gator_hwcnt_names_tnox.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * This header was autogenerated, it should not be edited. */ @@ -173,11 +178,11 @@ static const char * const hardware_counters_mali_tNOx[] = { "TNOx_FRAG_QUADS_EZS_KILL", "TNOx_FRAG_LZS_TEST", "TNOx_FRAG_LZS_KILL", - "", + "TNOx_WARP_REG_SIZE_64", "TNOx_FRAG_PTILES", "TNOx_FRAG_TRANS_ELIM", "TNOx_QUAD_FPK_KILLER", - "", + "TNOx_FULL_QUAD_WARPS", "TNOx_COMPUTE_ACTIVE", "TNOx_COMPUTE_TASKS", "TNOx_COMPUTE_WARPS", diff --git a/mali_kbase/mali_kbase_gator_hwcnt_names_tsix.h b/mali_kbase/mali_kbase_gator_hwcnt_names_tsix.h index fb6a143..552db57 100644 --- a/mali_kbase/mali_kbase_gator_hwcnt_names_tsix.h +++ b/mali_kbase/mali_kbase_gator_hwcnt_names_tsix.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * This header was autogenerated, it should not be edited. */ diff --git a/mali_kbase/mali_kbase_gator_hwcnt_names_ttrx.h b/mali_kbase/mali_kbase_gator_hwcnt_names_ttrx.h new file mode 100644 index 0000000..d1bb02a --- /dev/null +++ b/mali_kbase/mali_kbase_gator_hwcnt_names_ttrx.h @@ -0,0 +1,296 @@ +/* + * + * (C) COPYRIGHT 2016-2017 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 licence. + * + * 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. + * + * SPDX-License-Identifier: GPL-2.0 + * + */ + +/* + * This header was autogenerated, it should not be edited. + */ + +#ifndef _KBASE_GATOR_HWCNT_NAMES_TTRX_H_ +#define _KBASE_GATOR_HWCNT_NAMES_TTRX_H_ + +static const char * const hardware_counters_mali_tTRx[] = { + /* Performance counters for the Job Manager */ + "", + "", + "", + "", + "TTRx_MESSAGES_SENT", + "TTRx_MESSAGES_RECEIVED", + "TTRx_GPU_ACTIVE", + "TTRx_IRQ_ACTIVE", + "TTRx_JS0_JOBS", + "TTRx_JS0_TASKS", + "TTRx_JS0_ACTIVE", + "", + "TTRx_JS0_WAIT_READ", + "TTRx_JS0_WAIT_ISSUE", + "TTRx_JS0_WAIT_DEPEND", + "TTRx_JS0_WAIT_FINISH", + "TTRx_JS1_JOBS", + "TTRx_JS1_TASKS", + "TTRx_JS1_ACTIVE", + "", + "TTRx_JS1_WAIT_READ", + "TTRx_JS1_WAIT_ISSUE", + "TTRx_JS1_WAIT_DEPEND", + "TTRx_JS1_WAIT_FINISH", + "TTRx_JS2_JOBS", + "TTRx_JS2_TASKS", + "TTRx_JS2_ACTIVE", + "", + "TTRx_JS2_WAIT_READ", + "TTRx_JS2_WAIT_ISSUE", + "TTRx_JS2_WAIT_DEPEND", + "TTRx_JS2_WAIT_FINISH", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + + /* Performance counters for the Tiler */ + "", + "", + "", + "", + "TTRx_TILER_ACTIVE", + "TTRx_JOBS_PROCESSED", + "TTRx_TRIANGLES", + "TTRx_LINES", + "TTRx_POINTS", + "TTRx_FRONT_FACING", + "TTRx_BACK_FACING", + "TTRx_PRIM_VISIBLE", + "TTRx_PRIM_CULLED", + "TTRx_PRIM_CLIPPED", + "TTRx_PRIM_SAT_CULLED", + "TTRx_BIN_ALLOC_INIT", + "TTRx_BIN_ALLOC_OVERFLOW", + "TTRx_BUS_READ", + "", + "TTRx_BUS_WRITE", + "TTRx_LOADING_DESC", + "", + "", + "", + "", + "TTRx_PREFETCH_STALL", + "TTRx_VCACHE_HIT", + "TTRx_VCACHE_MISS", + "TTRx_VCACHE_LINE_WAIT", + "TTRx_VFETCH_POS_READ_WAIT", + "TTRx_VFETCH_VERTEX_WAIT", + "TTRx_VFETCH_STALL", + "TTRx_PRIMASSY_STALL", + "TTRx_BBOX_GEN_STALL", + "", + "", + "", + "", + "", + "TTRx_BINNER_STALL", + "TTRx_ITER_STALL", + "TTRx_COMPRESS_MISS", + "TTRx_COMPRESS_STALL", + "TTRx_PCACHE_HIT", + "TTRx_PCACHE_MISS", + "TTRx_PCACHE_MISS_STALL", + "TTRx_PCACHE_EVICT_STALL", + "TTRx_PMGR_PTR_WR_STALL", + "TTRx_PMGR_PTR_RD_STALL", + "TTRx_PMGR_CMD_WR_STALL", + "TTRx_WRBUF_ACTIVE", + "TTRx_WRBUF_HIT", + "TTRx_WRBUF_MISS", + "TTRx_WRBUF_NO_FREE_LINE_STALL", + "TTRx_WRBUF_NO_AXI_ID_STALL", + "TTRx_WRBUF_AXI_STALL", + "", + "", + "", + "TTRx_UTLB_TRANS", + "TTRx_UTLB_TRANS_HIT", + "TTRx_UTLB_TRANS_STALL", + "TTRx_UTLB_TRANS_MISS_DELAY", + "TTRx_UTLB_MMU_REQ", + + /* Performance counters for the Shader Core */ + "", + "", + "", + "", + "TTRx_FRAG_ACTIVE", + "TTRx_FRAG_PRIMITIVES", + "TTRx_FRAG_PRIM_RAST", + "TTRx_FRAG_FPK_ACTIVE", + "TTRx_FRAG_STARVING", + "TTRx_FRAG_WARPS", + "TTRx_FRAG_PARTIAL_WARPS", + "TTRx_FRAG_QUADS_RAST", + "TTRx_FRAG_QUADS_EZS_TEST", + "TTRx_FRAG_QUADS_EZS_UPDATE", + "TTRx_FRAG_QUADS_EZS_KILL", + "TTRx_FRAG_LZS_TEST", + "TTRx_FRAG_LZS_KILL", + "", + "TTRx_FRAG_PTILES", + "TTRx_FRAG_TRANS_ELIM", + "TTRx_QUAD_FPK_KILLER", + "", + "TTRx_COMPUTE_ACTIVE", + "TTRx_COMPUTE_TASKS", + "TTRx_COMPUTE_WARPS", + "TTRx_COMPUTE_STARVING", + "TTRx_EXEC_CORE_ACTIVE", + "TTRx_EXEC_ACTIVE", + "TTRx_EXEC_INSTR_COUNT", + "TTRx_EXEC_INSTR_DIVERGED", + "TTRx_EXEC_INSTR_STARVING", + "TTRx_ARITH_INSTR_SINGLE_FMA", + "TTRx_ARITH_INSTR_DOUBLE", + "TTRx_ARITH_INSTR_MSG", + "TTRx_ARITH_INSTR_MSG_ONLY", + "TTRx_TEX_INSTR", + "TTRx_TEX_INSTR_MIPMAP", + "TTRx_TEX_INSTR_COMPRESSED", + "TTRx_TEX_INSTR_3D", + "TTRx_TEX_INSTR_TRILINEAR", + "TTRx_TEX_COORD_ISSUE", + "TTRx_TEX_COORD_STALL", + "TTRx_TEX_STARVE_CACHE", + "TTRx_TEX_STARVE_FILTER", + "TTRx_LS_MEM_READ_FULL", + "TTRx_LS_MEM_READ_SHORT", + "TTRx_LS_MEM_WRITE_FULL", + "TTRx_LS_MEM_WRITE_SHORT", + "TTRx_LS_MEM_ATOMIC", + "TTRx_VARY_INSTR", + "TTRx_VARY_SLOT_32", + "TTRx_VARY_SLOT_16", + "TTRx_ATTR_INSTR", + "TTRx_ARITH_INSTR_FP_MUL", + "TTRx_BEATS_RD_FTC", + "TTRx_BEATS_RD_FTC_EXT", + "TTRx_BEATS_RD_LSC", + "TTRx_BEATS_RD_LSC_EXT", + "TTRx_BEATS_RD_TEX", + "TTRx_BEATS_RD_TEX_EXT", + "TTRx_BEATS_RD_OTHER", + "TTRx_BEATS_WR_LSC", + "TTRx_BEATS_WR_TIB", + "", + + /* Performance counters for the Memory System */ + "", + "", + "", + "", + "TTRx_MMU_REQUESTS", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "TTRx_L2_RD_MSG_IN", + "TTRx_L2_RD_MSG_IN_STALL", + "TTRx_L2_WR_MSG_IN", + "TTRx_L2_WR_MSG_IN_STALL", + "TTRx_L2_SNP_MSG_IN", + "TTRx_L2_SNP_MSG_IN_STALL", + "TTRx_L2_RD_MSG_OUT", + "TTRx_L2_RD_MSG_OUT_STALL", + "TTRx_L2_WR_MSG_OUT", + "TTRx_L2_ANY_LOOKUP", + "TTRx_L2_READ_LOOKUP", + "TTRx_L2_WRITE_LOOKUP", + "TTRx_L2_EXT_SNOOP_LOOKUP", + "TTRx_L2_EXT_READ", + "TTRx_L2_EXT_READ_NOSNP", + "TTRx_L2_EXT_READ_UNIQUE", + "TTRx_L2_EXT_READ_BEATS", + "TTRx_L2_EXT_AR_STALL", + "TTRx_L2_EXT_AR_CNT_Q1", + "TTRx_L2_EXT_AR_CNT_Q2", + "TTRx_L2_EXT_AR_CNT_Q3", + "TTRx_L2_EXT_RRESP_0_127", + "TTRx_L2_EXT_RRESP_128_191", + "TTRx_L2_EXT_RRESP_192_255", + "TTRx_L2_EXT_RRESP_256_319", + "TTRx_L2_EXT_RRESP_320_383", + "TTRx_L2_EXT_WRITE", + "TTRx_L2_EXT_WRITE_NOSNP_FULL", + "TTRx_L2_EXT_WRITE_NOSNP_PTL", + "TTRx_L2_EXT_WRITE_SNP_FULL", + "TTRx_L2_EXT_WRITE_SNP_PTL", + "TTRx_L2_EXT_WRITE_BEATS", + "TTRx_L2_EXT_W_STALL", + "TTRx_L2_EXT_AW_CNT_Q1", + "TTRx_L2_EXT_AW_CNT_Q2", + "TTRx_L2_EXT_AW_CNT_Q3", + "TTRx_L2_EXT_SNOOP", + "TTRx_L2_EXT_SNOOP_STALL", + "TTRx_L2_EXT_SNOOP_RESP_CLEAN", + "TTRx_L2_EXT_SNOOP_RESP_DATA", + "TTRx_L2_EXT_SNOOP_INTERNAL", + "", + "", + "", + "", + "", + "", + "", +}; + +#endif /* _KBASE_GATOR_HWCNT_NAMES_TTRX_H_ */ diff --git a/mali_kbase/mali_kbase_gpu_id.h b/mali_kbase/mali_kbase_gpu_id.h index 32b9513..4052e2f 100644 --- a/mali_kbase/mali_kbase_gpu_id.h +++ b/mali_kbase/mali_kbase_gpu_id.h @@ -7,13 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_GPU_ID_H_ #define _KBASE_GPU_ID_H_ diff --git a/mali_kbase/mali_kbase_gpu_memory_debugfs.c b/mali_kbase/mali_kbase_gpu_memory_debugfs.c index 6df0a1c..2fd0332 100644 --- a/mali_kbase/mali_kbase_gpu_memory_debugfs.c +++ b/mali_kbase/mali_kbase_gpu_memory_debugfs.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #ifdef CONFIG_DEBUG_FS diff --git a/mali_kbase/mali_kbase_gpu_memory_debugfs.h b/mali_kbase/mali_kbase_gpu_memory_debugfs.h index 7045693..28a871a 100644 --- a/mali_kbase/mali_kbase_gpu_memory_debugfs.h +++ b/mali_kbase/mali_kbase_gpu_memory_debugfs.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_gpu_memory_debugfs.h * Header file for gpu_memory entry in debugfs diff --git a/mali_kbase/mali_kbase_gpuprops.c b/mali_kbase/mali_kbase_gpuprops.c index 624d078..9a9ce2d 100644 --- a/mali_kbase/mali_kbase_gpuprops.c +++ b/mali_kbase/mali_kbase_gpuprops.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Base kernel property query APIs */ @@ -24,7 +29,6 @@ #include #include #include -#include #include #include "mali_kbase_ioctl.h" #include @@ -295,15 +299,13 @@ static struct { int size; } gpu_property_mapping[] = { #define PROP(name, member) \ - {KBASE_GPUPROP_ ## name, offsetof(struct mali_base_gpu_props, member), \ - sizeof(((struct mali_base_gpu_props *)0)->member)} + {KBASE_GPUPROP_ ## name, offsetof(struct base_gpu_props, member), \ + sizeof(((struct base_gpu_props *)0)->member)} PROP(PRODUCT_ID, core_props.product_id), PROP(VERSION_STATUS, core_props.version_status), PROP(MINOR_REVISION, core_props.minor_revision), PROP(MAJOR_REVISION, core_props.major_revision), - PROP(GPU_SPEED_MHZ, core_props.gpu_speed_mhz), PROP(GPU_FREQ_KHZ_MAX, core_props.gpu_freq_khz_max), - PROP(GPU_FREQ_KHZ_MIN, core_props.gpu_freq_khz_min), PROP(LOG2_PROGRAM_COUNTER_SIZE, core_props.log2_program_counter_size), PROP(TEXTURE_FEATURES_0, core_props.texture_features[0]), PROP(TEXTURE_FEATURES_1, core_props.texture_features[1]), @@ -391,7 +393,7 @@ static struct { int kbase_gpuprops_populate_user_buffer(struct kbase_device *kbdev) { struct kbase_gpu_props *kprops = &kbdev->gpu_props; - struct mali_base_gpu_props *props = &kprops->props; + struct base_gpu_props *props = &kprops->props; u32 count = ARRAY_SIZE(gpu_property_mapping); u32 i; u32 size = 0; diff --git a/mali_kbase/mali_kbase_gpuprops.h b/mali_kbase/mali_kbase_gpuprops.h index e88af25..37d9c08 100644 --- a/mali_kbase/mali_kbase_gpuprops.h +++ b/mali_kbase/mali_kbase_gpuprops.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_gpuprops.h * Base kernel property query APIs diff --git a/mali_kbase/mali_kbase_gpuprops_types.h b/mali_kbase/mali_kbase_gpuprops_types.h index 10794fc..a3ddec7 100644 --- a/mali_kbase/mali_kbase_gpuprops_types.h +++ b/mali_kbase/mali_kbase_gpuprops_types.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_gpuprops_types.h * Base kernel property query APIs diff --git a/mali_kbase/mali_kbase_gwt.c b/mali_kbase/mali_kbase_gwt.c new file mode 100644 index 0000000..2caab87 --- /dev/null +++ b/mali_kbase/mali_kbase_gwt.c @@ -0,0 +1,286 @@ +/* + * + * (C) COPYRIGHT 2010-2017 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 licence. + * + * 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. + * + * SPDX-License-Identifier: GPL-2.0 + * + */ + +#include "mali_kbase_gwt.h" +#include + +static inline void kbase_gpu_gwt_setup_page_permission( + struct kbase_context *kctx, + unsigned long flag, + struct rb_node *node) +{ + struct rb_node *rbnode = node; + + while (rbnode) { + struct kbase_va_region *reg; + int err = 0; + + reg = rb_entry(rbnode, struct kbase_va_region, rblink); + if (reg->nr_pages && !(reg->flags & KBASE_REG_FREE) && + (reg->flags & KBASE_REG_GPU_WR)) { + err = kbase_mmu_update_pages(kctx, reg->start_pfn, + kbase_get_gpu_phy_pages(reg), + reg->gpu_alloc->nents, + reg->flags & flag); + if (err) + dev_warn(kctx->kbdev->dev, "kbase_mmu_update_pages failure\n"); + } + + rbnode = rb_next(rbnode); + } +} + +static void kbase_gpu_gwt_setup_pages(struct kbase_context *kctx, + unsigned long flag) +{ + kbase_gpu_gwt_setup_page_permission(kctx, flag, + rb_first(&(kctx->reg_rbtree_same))); + kbase_gpu_gwt_setup_page_permission(kctx, flag, + rb_first(&(kctx->reg_rbtree_exec))); + kbase_gpu_gwt_setup_page_permission(kctx, flag, + rb_first(&(kctx->reg_rbtree_custom))); +} + + +int kbase_gpu_gwt_start(struct kbase_context *kctx) +{ + kbase_gpu_vm_lock(kctx); + if (kctx->gwt_enabled) { + kbase_gpu_vm_unlock(kctx); + return -EBUSY; + } + + INIT_LIST_HEAD(&kctx->gwt_current_list); + INIT_LIST_HEAD(&kctx->gwt_snapshot_list); + + /* If GWT is enabled using new vector dumping format + * from user space, back up status of the job serialization flag and + * use full serialisation of jobs for dumping. + * Status will be restored on end of dumping in gwt_stop. + */ + kctx->kbdev->backup_serialize_jobs = kctx->kbdev->serialize_jobs; + kctx->kbdev->serialize_jobs = KBASE_SERIALIZE_INTRA_SLOT | + KBASE_SERIALIZE_INTER_SLOT; + + /* Mark gwt enabled before making pages read only in case a + write page fault is triggered while we're still in this loop. + (kbase_gpu_vm_lock() doesn't prevent this!) + */ + kctx->gwt_enabled = true; + kctx->gwt_was_enabled = true; + + kbase_gpu_gwt_setup_pages(kctx, ~KBASE_REG_GPU_WR); + + kbase_gpu_vm_unlock(kctx); + return 0; +} + +int kbase_gpu_gwt_stop(struct kbase_context *kctx) +{ + struct kbasep_gwt_list_element *pos, *n; + + kbase_gpu_vm_lock(kctx); + if (!kctx->gwt_enabled) { + kbase_gpu_vm_unlock(kctx); + return -EINVAL; + } + + list_for_each_entry_safe(pos, n, &kctx->gwt_current_list, link) { + list_del(&pos->link); + kfree(pos); + } + + list_for_each_entry_safe(pos, n, &kctx->gwt_snapshot_list, link) { + list_del(&pos->link); + kfree(pos); + } + + kctx->kbdev->serialize_jobs = kctx->kbdev->backup_serialize_jobs; + + kbase_gpu_gwt_setup_pages(kctx, ~0UL); + + kctx->gwt_enabled = false; + kbase_gpu_vm_unlock(kctx); + return 0; +} + + +int list_cmp_function(void *priv, struct list_head *a, struct list_head *b) +{ + struct kbasep_gwt_list_element *elementA = container_of(a, + struct kbasep_gwt_list_element, link); + struct kbasep_gwt_list_element *elementB = container_of(b, + struct kbasep_gwt_list_element, link); + + CSTD_UNUSED(priv); + + if (elementA->handle > elementB->handle) + return 1; + else if ((elementA->handle == elementB->handle) && + (elementA->offset > elementB->offset)) + return 1; + else + return -1; +} + +void kbase_gpu_gwt_collate(struct kbase_context *kctx, + struct list_head *snapshot_list) +{ + struct kbasep_gwt_list_element *pos, *n; + struct kbasep_gwt_list_element *collated = NULL; + + /* sort the list */ + list_sort(NULL, snapshot_list, list_cmp_function); + + /* Combine contiguous areas from same region */ + list_for_each_entry_safe(pos, n, snapshot_list, link) { + if (NULL == collated || + collated->handle != pos->handle || + collated->offset + collated->num_pages != + pos->offset) { + /* This is the first time through, a new region or + * is not contiguous - start collating to this element + */ + collated = pos; + } else { + /* contiguous so merge */ + collated->num_pages += pos->num_pages; + /* remove element from list */ + list_del(&pos->link); + kfree(pos); + } + } +} + +int kbase_gpu_gwt_dump(struct kbase_context *kctx, + union kbase_ioctl_cinstr_gwt_dump *gwt_dump) +{ + const u32 ubuf_size = gwt_dump->in.len; + u32 ubuf_count = 0; + __user void *user_handles = (__user void *) + (uintptr_t)gwt_dump->in.handle_buffer; + __user void *user_offsets = (__user void *) + (uintptr_t)gwt_dump->in.offset_buffer; + __user void *user_sizes = (__user void *) + (uintptr_t)gwt_dump->in.size_buffer; + + kbase_gpu_vm_lock(kctx); + + if (!kctx->gwt_enabled) { + kbase_gpu_vm_unlock(kctx); + /* gwt_dump shouldn't be called when gwt is disabled */ + return -EPERM; + } + + if (!gwt_dump->in.len || !gwt_dump->in.handle_buffer + || !gwt_dump->in.offset_buffer + || !gwt_dump->in.size_buffer) { + kbase_gpu_vm_unlock(kctx); + /* We don't have any valid user space buffer to copy the + * write modified addresses. + */ + return -EINVAL; + } + + if (list_empty(&kctx->gwt_snapshot_list) && + !list_empty(&kctx->gwt_current_list)) { + + list_replace_init(&kctx->gwt_current_list, + &kctx->gwt_snapshot_list); + + /* We have collected all write faults so far + * and they will be passed on to user space. + * Reset the page flags state to allow collection of + * further write faults. + */ + kbase_gpu_gwt_setup_pages(kctx, ~KBASE_REG_GPU_WR); + + /* Sort and combine consecutive pages in the dump list*/ + kbase_gpu_gwt_collate(kctx, &kctx->gwt_snapshot_list); + } + + while ((!list_empty(&kctx->gwt_snapshot_list))) { + u64 handle_buffer[32]; + u64 offset_buffer[32]; + u64 num_page_buffer[32]; + u32 count = 0; + int err; + struct kbasep_gwt_list_element *dump_info, *n; + + list_for_each_entry_safe(dump_info, n, + &kctx->gwt_snapshot_list, link) { + handle_buffer[count] = dump_info->handle; + offset_buffer[count] = dump_info->offset; + num_page_buffer[count] = dump_info->num_pages; + count++; + list_del(&dump_info->link); + kfree(dump_info); + if (ARRAY_SIZE(handle_buffer) == count || + ubuf_size == (ubuf_count + count)) + break; + } + + if (count) { + err = copy_to_user((user_handles + + (ubuf_count * sizeof(u64))), + (void *)handle_buffer, + count * sizeof(u64)); + if (err) { + dev_err(kctx->kbdev->dev, "Copy to user failure\n"); + kbase_gpu_vm_unlock(kctx); + return err; + } + err = copy_to_user((user_offsets + + (ubuf_count * sizeof(u64))), + (void *)offset_buffer, + count * sizeof(u64)); + if (err) { + dev_err(kctx->kbdev->dev, "Copy to user failure\n"); + kbase_gpu_vm_unlock(kctx); + return err; + } + err = copy_to_user((user_sizes + + (ubuf_count * sizeof(u64))), + (void *)num_page_buffer, + count * sizeof(u64)); + if (err) { + dev_err(kctx->kbdev->dev, "Copy to user failure\n"); + kbase_gpu_vm_unlock(kctx); + return err; + } + + ubuf_count += count; + } + + if (ubuf_count == ubuf_size) + break; + } + + if (!list_empty(&kctx->gwt_snapshot_list)) + gwt_dump->out.more_data_available = 1; + else + gwt_dump->out.more_data_available = 0; + + gwt_dump->out.no_of_addr_collected = ubuf_count; + kbase_gpu_vm_unlock(kctx); + return 0; +} diff --git a/mali_kbase/mali_kbase_gwt.h b/mali_kbase/mali_kbase_gwt.h new file mode 100644 index 0000000..7e7746e --- /dev/null +++ b/mali_kbase/mali_kbase_gwt.h @@ -0,0 +1,55 @@ +/* + * + * (C) COPYRIGHT 2010-2017 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 licence. + * + * 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. + * + * SPDX-License-Identifier: GPL-2.0 + * + */ + +#if !defined(_KBASE_GWT_H) +#define _KBASE_GWT_H + +#include +#include + +/** + * kbase_gpu_gwt_start - Start the GPU write tracking + * @kctx: Pointer to kernel context + * + * @return 0 on success, error on failure. + */ +int kbase_gpu_gwt_start(struct kbase_context *kctx); + +/** + * kbase_gpu_gwt_stop - Stop the GPU write tracking + * @kctx: Pointer to kernel context + * + * @return 0 on success, error on failure. + */ +int kbase_gpu_gwt_stop(struct kbase_context *kctx); + +/** + * kbase_gpu_gwt_dump - Pass page address of faulting addresses to user space. + * @kctx: Pointer to kernel context + * @gwt_dump: User space data to be passed. + * + * @return 0 on success, error on failure. + */ +int kbase_gpu_gwt_dump(struct kbase_context *kctx, + union kbase_ioctl_cinstr_gwt_dump *gwt_dump); + +#endif /* _KBASE_GWT_H */ diff --git a/mali_kbase/mali_kbase_hw.c b/mali_kbase/mali_kbase_hw.c index 89342e1..286cc95 100644 --- a/mali_kbase/mali_kbase_hw.c +++ b/mali_kbase/mali_kbase_hw.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Run-time work-arounds helpers */ diff --git a/mali_kbase/mali_kbase_hw.h b/mali_kbase/mali_kbase_hw.h index 754250c..f386b16 100644 --- a/mali_kbase/mali_kbase_hw.h +++ b/mali_kbase/mali_kbase_hw.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file * Run-time work-arounds helpers diff --git a/mali_kbase/mali_kbase_hwaccess_backend.h b/mali_kbase/mali_kbase_hwaccess_backend.h index b09be99..dde4965 100644 --- a/mali_kbase/mali_kbase_hwaccess_backend.h +++ b/mali_kbase/mali_kbase_hwaccess_backend.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * HW access backend common APIs */ diff --git a/mali_kbase/mali_kbase_hwaccess_defs.h b/mali_kbase/mali_kbase_hwaccess_defs.h index 0acf297..dd25746 100644 --- a/mali_kbase/mali_kbase_hwaccess_defs.h +++ b/mali_kbase/mali_kbase_hwaccess_defs.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_hwaccess_gpu_defs.h * HW access common definitions diff --git a/mali_kbase/mali_kbase_hwaccess_gpuprops.h b/mali_kbase/mali_kbase_hwaccess_gpuprops.h index cf8a813..b8ab0dc 100644 --- a/mali_kbase/mali_kbase_hwaccess_gpuprops.h +++ b/mali_kbase/mali_kbase_hwaccess_gpuprops.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * Base kernel property query backend APIs */ diff --git a/mali_kbase/mali_kbase_hwaccess_instr.h b/mali_kbase/mali_kbase_hwaccess_instr.h index 5de2b75..d180e39 100644 --- a/mali_kbase/mali_kbase_hwaccess_instr.h +++ b/mali_kbase/mali_kbase_hwaccess_instr.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * HW Access instrumentation common APIs */ diff --git a/mali_kbase/mali_kbase_hwaccess_jm.h b/mali_kbase/mali_kbase_hwaccess_jm.h index 750fda2..8b3d7e2 100644 --- a/mali_kbase/mali_kbase_hwaccess_jm.h +++ b/mali_kbase/mali_kbase_hwaccess_jm.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * HW access job manager common APIs */ diff --git a/mali_kbase/mali_kbase_hwaccess_pm.h b/mali_kbase/mali_kbase_hwaccess_pm.h index 71c7d49..4598d80 100644 --- a/mali_kbase/mali_kbase_hwaccess_pm.h +++ b/mali_kbase/mali_kbase_hwaccess_pm.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_hwaccess_pm.h * HW access power manager common APIs diff --git a/mali_kbase/mali_kbase_hwaccess_time.h b/mali_kbase/mali_kbase_hwaccess_time.h index 89d26ea..7f64936 100644 --- a/mali_kbase/mali_kbase_hwaccess_time.h +++ b/mali_kbase/mali_kbase_hwaccess_time.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * */ diff --git a/mali_kbase/mali_kbase_hwcnt_reader.h b/mali_kbase/mali_kbase_hwcnt_reader.h index cf7bf1b..10706b8 100644 --- a/mali_kbase/mali_kbase_hwcnt_reader.h +++ b/mali_kbase/mali_kbase_hwcnt_reader.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_HWCNT_READER_H_ #define _KBASE_HWCNT_READER_H_ diff --git a/mali_kbase/mali_kbase_ioctl.h b/mali_kbase/mali_kbase_ioctl.h index 041c61a..a8fe9cd 100644 --- a/mali_kbase/mali_kbase_ioctl.h +++ b/mali_kbase/mali_kbase_ioctl.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_IOCTL_H_ #define _KBASE_IOCTL_H_ @@ -26,8 +31,21 @@ extern "C" { #define KBASE_IOCTL_TYPE 0x80 +/* + * 11.1: + * - Add BASE_MEM_TILER_ALIGN_TOP under base_mem_alloc_flags + * 11.2: + * - KBASE_MEM_QUERY_FLAGS can return KBASE_REG_PF_GROW and KBASE_REG_SECURE, + * which some user-side clients prior to 11.2 might fault if they received + * them + * 11.3: + * - New ioctls KBASE_IOCTL_STICKY_RESOURCE_MAP and + * KBASE_IOCTL_STICKY_RESOURCE_UNMAP + * 11.4: + * - New ioctl KBASE_IOCTL_MEM_FIND_GPU_START_AND_OFFSET + */ #define BASE_UK_VERSION_MAJOR 11 -#define BASE_UK_VERSION_MINOR 0 +#define BASE_UK_VERSION_MINOR 4 #ifdef ANDROID /* Android's definition of ioctl is incorrect, specifying the type argument as @@ -520,7 +538,106 @@ struct kbase_ioctl_soft_event_update { #define KBASE_IOCTL_SOFT_EVENT_UPDATE \ _IOW(KBASE_IOCTL_TYPE, 28, struct kbase_ioctl_soft_event_update) -/* IOCTLs 29-32 are reserved */ +/** + * struct kbase_ioctl_sticky_resource_map - Permanently map an external resource + * @count: Number of resources + * @address: Array of u64 GPU addresses of the external resources to map + */ +struct kbase_ioctl_sticky_resource_map { + __u64 count; + __u64 address; +}; + +#define KBASE_IOCTL_STICKY_RESOURCE_MAP \ + _IOW(KBASE_IOCTL_TYPE, 29, struct kbase_ioctl_sticky_resource_map) + +/** + * struct kbase_ioctl_sticky_resource_map - Unmap a resource mapped which was + * previously permanently mapped + * @count: Number of resources + * @address: Array of u64 GPU addresses of the external resources to unmap + */ +struct kbase_ioctl_sticky_resource_unmap { + __u64 count; + __u64 address; +}; + +#define KBASE_IOCTL_STICKY_RESOURCE_UNMAP \ + _IOW(KBASE_IOCTL_TYPE, 30, struct kbase_ioctl_sticky_resource_unmap) + +/** + * union kbase_ioctl_mem_find_gpu_start_and_offset - Find the start address of + * the GPU memory region for + * the given gpu address and + * the offset of that address + * into the region + * + * @gpu_addr: GPU virtual address + * @size: Size in bytes within the region + * @start: Address of the beginning of the memory region enclosing @gpu_addr + * for the length of @offset bytes + * @offset: The offset from the start of the memory region to @gpu_addr + * + * @in: Input parameters + * @out: Output parameters + */ +union kbase_ioctl_mem_find_gpu_start_and_offset { + struct { + __u64 gpu_addr; + __u64 size; + } in; + struct { + __u64 start; + __u64 offset; + } out; +}; + +#define KBASE_IOCTL_MEM_FIND_GPU_START_AND_OFFSET \ + _IOWR(KBASE_IOCTL_TYPE, 31, union kbase_ioctl_mem_find_gpu_start_and_offset) + +/* IOCTL 32 is free for use */ + +#define KBASE_IOCTL_CINSTR_GWT_START \ + _IO(KBASE_IOCTL_TYPE, 33) + +#define KBASE_IOCTL_CINSTR_GWT_STOP \ + _IO(KBASE_IOCTL_TYPE, 34) + +/** + * union kbase_ioctl_gwt_dump - Used to collect all GPU write fault addresses. + * @handle_buffer: Address of buffer to hold handles of modified areas. + * @offset_buffer: Address of buffer to hold offset size of modified areas + * (in pages) + * @size_buffer: Address of buffer to hold size of modified areas (in pages) + * @len: Number of addresses the buffers can hold. + * @more_data_available: Status indicating if more addresses are available. + * @no_of_addr_collected: Number of addresses collected into addr_buffer. + * + * @in: Input parameters + * @out: Output parameters + * This structure is used when performing a call to dump GPU write fault + * addresses. + */ +union kbase_ioctl_cinstr_gwt_dump { + struct { + __u64 handle_buffer; + __u64 offset_buffer; + __u64 size_buffer; + __u32 len; + __u32 padding; + + } in; + struct { + __u32 no_of_addr_collected; + __u8 more_data_available; + __u8 padding[27]; + } out; +}; + +#define KBASE_IOCTL_CINSTR_GWT_DUMP \ + _IOWR(KBASE_IOCTL_TYPE, 35, union kbase_ioctl_cinstr_gwt_dump) + +/* IOCTLs 36-41 are reserved */ /*************** * test ioctls * @@ -577,9 +694,9 @@ struct kbase_ioctl_tlstream_stats { #define KBASE_GPUPROP_VERSION_STATUS 2 #define KBASE_GPUPROP_MINOR_REVISION 3 #define KBASE_GPUPROP_MAJOR_REVISION 4 -#define KBASE_GPUPROP_GPU_SPEED_MHZ 5 +/* 5 previously used for GPU speed */ #define KBASE_GPUPROP_GPU_FREQ_KHZ_MAX 6 -#define KBASE_GPUPROP_GPU_FREQ_KHZ_MIN 7 +/* 7 previously used for minimum GPU speed */ #define KBASE_GPUPROP_LOG2_PROGRAM_COUNTER_SIZE 8 #define KBASE_GPUPROP_TEXTURE_FEATURES_0 9 #define KBASE_GPUPROP_TEXTURE_FEATURES_1 10 diff --git a/mali_kbase/mali_kbase_jd.c b/mali_kbase/mali_kbase_jd.c index aa545fd..91cfee7 100644 --- a/mali_kbase/mali_kbase_jd.c +++ b/mali_kbase/mali_kbase_jd.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #if defined(CONFIG_DMA_SHARED_BUFFER) #include #endif /* defined(CONFIG_DMA_SHARED_BUFFER) */ @@ -402,7 +407,7 @@ static inline void jd_resolve_dep(struct list_head *out_list, KBASE_DEBUG_ASSERT(dep_atom->status != KBASE_JD_ATOM_STATE_UNUSED); - if ((dep_atom->core_req & BASE_JD_REQ_SOFT_REPLAY) + if ((dep_atom->core_req & BASE_JD_REQ_SOFT_JOB_TYPE) != BASE_JD_REQ_SOFT_REPLAY) { dep_atom->will_fail_event_code = dep_atom->event_code; @@ -815,6 +820,7 @@ bool jd_submit_atom(struct kbase_context *kctx, const struct base_jd_atom_v2 *us katom->x_pre_dep = NULL; katom->x_post_dep = NULL; katom->will_fail_event_code = BASE_JD_EVENT_NOT_STARTED; + katom->softjob_data = NULL; /* Implicitly sets katom->protected_state.enter as well. */ katom->protected_state.exit = KBASE_ATOM_EXIT_PROTECTED_CHECK; @@ -997,6 +1003,16 @@ bool jd_submit_atom(struct kbase_context *kctx, const struct base_jd_atom_v2 *us goto out; } + /* Reject fence wait soft-job atoms accessing external resources */ + if ((katom->core_req & BASE_JD_REQ_EXTERNAL_RESOURCES) && + ((katom->core_req & BASE_JD_REQ_SOFT_JOB_TYPE) == BASE_JD_REQ_SOFT_FENCE_WAIT)) { + dev_warn(kctx->kbdev->dev, + "Rejecting fence wait soft-job atom accessing external resources"); + katom->event_code = BASE_JD_EVENT_JOB_INVALID; + ret = jd_done_nolock(katom, NULL); + goto out; + } + if (katom->core_req & BASE_JD_REQ_EXTERNAL_RESOURCES) { /* handle what we need to do to access the external resources */ if (kbase_jd_pre_external_resources(katom, user_atom) != 0) { diff --git a/mali_kbase/mali_kbase_jd_debugfs.c b/mali_kbase/mali_kbase_jd_debugfs.c index 25f1ed5..271daef 100644 --- a/mali_kbase/mali_kbase_jd_debugfs.c +++ b/mali_kbase/mali_kbase_jd_debugfs.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifdef CONFIG_DEBUG_FS #include diff --git a/mali_kbase/mali_kbase_jd_debugfs.h b/mali_kbase/mali_kbase_jd_debugfs.h index fae3291..ce0cb61 100644 --- a/mali_kbase/mali_kbase_jd_debugfs.h +++ b/mali_kbase/mali_kbase_jd_debugfs.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_jd_debugfs.h * Header file for job dispatcher-related entries in debugfs diff --git a/mali_kbase/mali_kbase_jm.c b/mali_kbase/mali_kbase_jm.c index 0c5c6a6..3b16e6f 100644 --- a/mali_kbase/mali_kbase_jm.c +++ b/mali_kbase/mali_kbase_jm.c @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * HW access job manager common APIs */ diff --git a/mali_kbase/mali_kbase_jm.h b/mali_kbase/mali_kbase_jm.h index a74ee24..c468ea4 100644 --- a/mali_kbase/mali_kbase_jm.h +++ b/mali_kbase/mali_kbase_jm.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Job manager common APIs */ diff --git a/mali_kbase/mali_kbase_js.c b/mali_kbase/mali_kbase_js.c index a3e8248..8f50b3c 100644 --- a/mali_kbase/mali_kbase_js.c +++ b/mali_kbase/mali_kbase_js.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Job Scheduler Implementation */ @@ -140,13 +145,11 @@ static void kbase_js_sync_timers(struct kbase_device *kbdev) bool kbasep_js_runpool_retain_ctx_nolock(struct kbase_device *kbdev, struct kbase_context *kctx) { - struct kbasep_js_device_data *js_devdata; bool result = false; int as_nr; KBASE_DEBUG_ASSERT(kbdev != NULL); KBASE_DEBUG_ASSERT(kctx != NULL); - js_devdata = &kbdev->js_data; lockdep_assert_held(&kbdev->hwaccess_lock); @@ -1093,9 +1096,6 @@ bool kbasep_js_add_job(struct kbase_context *kctx, KBASE_DEBUG_ASSERT(js_kctx_info->ctx.nr_jobs < U32_MAX); ++(js_kctx_info->ctx.nr_jobs); - /* Setup any scheduling information */ - kbasep_js_clear_job_retry_submit(atom); - /* Lock for state available during IRQ */ spin_lock_irqsave(&kbdev->hwaccess_lock, flags); @@ -1293,22 +1293,13 @@ static kbasep_js_release_result kbasep_js_run_jobs_after_ctx_and_atom_release( lockdep_assert_held(&js_devdata->runpool_mutex); lockdep_assert_held(&kbdev->hwaccess_lock); - if (js_devdata->nr_user_contexts_running != 0) { - bool retry_submit = false; - int retry_jobslot = 0; - - if (katom_retained_state) - retry_submit = kbasep_js_get_atom_retry_submit_slot( - katom_retained_state, &retry_jobslot); + if (js_devdata->nr_user_contexts_running != 0 && runpool_ctx_attr_change) { + /* A change in runpool ctx attributes might mean we can + * run more jobs than before */ + result = KBASEP_JS_RELEASE_RESULT_SCHED_ALL; - if (runpool_ctx_attr_change || retry_submit) { - /* A change in runpool ctx attributes might mean we can - * run more jobs than before */ - result = KBASEP_JS_RELEASE_RESULT_SCHED_ALL; - - KBASE_TRACE_ADD_SLOT(kbdev, JD_DONE_TRY_RUN_NEXT_JOB, - kctx, NULL, 0u, retry_jobslot); - } + KBASE_TRACE_ADD_SLOT(kbdev, JD_DONE_TRY_RUN_NEXT_JOB, + kctx, NULL, 0u, 0); } return result; } diff --git a/mali_kbase/mali_kbase_js.h b/mali_kbase/mali_kbase_js.h index ddada8e..aa930b9 100644 --- a/mali_kbase/mali_kbase_js.h +++ b/mali_kbase/mali_kbase_js.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_js.h * Job Scheduler APIs. @@ -666,37 +671,6 @@ static inline void kbasep_js_clear_submit_allowed(struct kbasep_js_device_data * js_devdata->runpool_irq.submit_allowed &= clear_mask; } -/** - * @brief Manage the 'retry_submit_on_slot' part of a kbase_jd_atom - */ -static inline void kbasep_js_clear_job_retry_submit(struct kbase_jd_atom *atom) -{ - atom->retry_submit_on_slot = KBASEP_JS_RETRY_SUBMIT_SLOT_INVALID; -} - -/** - * Mark a slot as requiring resubmission by carrying that information on a - * completing atom. - * - * @note This can ASSERT in debug builds if the submit slot has been set to - * something other than the current value for @a js. This is because you might - * be unintentionally stopping more jobs being submitted on the old submit - * slot, and that might cause a scheduling-hang. - * - * @note If you can guarantee that the atoms for the original slot will be - * submitted on some other slot, then call kbasep_js_clear_job_retry_submit() - * first to silence the ASSERT. - */ -static inline void kbasep_js_set_job_retry_submit_slot(struct kbase_jd_atom *atom, int js) -{ - KBASE_DEBUG_ASSERT(0 <= js && js <= BASE_JM_MAX_NR_SLOTS); - KBASE_DEBUG_ASSERT((atom->retry_submit_on_slot == - KBASEP_JS_RETRY_SUBMIT_SLOT_INVALID) - || (atom->retry_submit_on_slot == js)); - - atom->retry_submit_on_slot = js; -} - /** * Create an initial 'invalid' atom retained state, that requires no * atom-related work to be done on releasing with @@ -706,7 +680,6 @@ static inline void kbasep_js_atom_retained_state_init_invalid(struct kbasep_js_a { retained_state->event_code = BASE_JD_EVENT_NOT_STARTED; retained_state->core_req = KBASEP_JS_ATOM_RETAINED_STATE_CORE_REQ_INVALID; - retained_state->retry_submit_on_slot = KBASEP_JS_RETRY_SUBMIT_SLOT_INVALID; } /** @@ -717,7 +690,6 @@ static inline void kbasep_js_atom_retained_state_copy(struct kbasep_js_atom_reta { retained_state->event_code = katom->event_code; retained_state->core_req = katom->core_req; - retained_state->retry_submit_on_slot = katom->retry_submit_on_slot; retained_state->sched_priority = katom->sched_priority; retained_state->device_nr = katom->device_nr; } @@ -753,14 +725,6 @@ static inline bool kbasep_js_atom_retained_state_is_valid(const struct kbasep_js return (bool) (katom_retained_state->core_req != KBASEP_JS_ATOM_RETAINED_STATE_CORE_REQ_INVALID); } -static inline bool kbasep_js_get_atom_retry_submit_slot(const struct kbasep_js_atom_retained_state *katom_retained_state, int *res) -{ - int js = katom_retained_state->retry_submit_on_slot; - - *res = js; - return (bool) (js >= 0); -} - /** * @brief Variant of kbasep_js_runpool_lookup_ctx() that can be used when the * context is guaranteed to be already previously retained. diff --git a/mali_kbase/mali_kbase_js_ctx_attr.c b/mali_kbase/mali_kbase_js_ctx_attr.c index 321506a..6fd908a 100644 --- a/mali_kbase/mali_kbase_js_ctx_attr.c +++ b/mali_kbase/mali_kbase_js_ctx_attr.c @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include diff --git a/mali_kbase/mali_kbase_js_ctx_attr.h b/mali_kbase/mali_kbase_js_ctx_attr.h index ce91833..be781e6 100644 --- a/mali_kbase/mali_kbase_js_ctx_attr.h +++ b/mali_kbase/mali_kbase_js_ctx_attr.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_js_ctx_attr.h * Job Scheduler Context Attribute APIs diff --git a/mali_kbase/mali_kbase_js_defs.h b/mali_kbase/mali_kbase_js_defs.h index ba8b644..a54b6f3 100644 --- a/mali_kbase/mali_kbase_js_defs.h +++ b/mali_kbase/mali_kbase_js_defs.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_js.h * Job Scheduler Type Definitions @@ -334,8 +339,6 @@ struct kbasep_js_atom_retained_state { base_jd_core_req core_req; /* priority */ int sched_priority; - /** Job Slot to retry submitting to if submission from IRQ handler failed */ - int retry_submit_on_slot; /* Core group atom was executed on */ u32 device_nr; diff --git a/mali_kbase/mali_kbase_linux.h b/mali_kbase/mali_kbase_linux.h index 6d1e61f..003ac9e 100644 --- a/mali_kbase/mali_kbase_linux.h +++ b/mali_kbase/mali_kbase_linux.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_linux.h * Base kernel APIs, Linux implementation. diff --git a/mali_kbase/mali_kbase_mem.c b/mali_kbase/mali_kbase_mem.c index 375e484..a0897fb 100644 --- a/mali_kbase/mali_kbase_mem.c +++ b/mali_kbase/mali_kbase_mem.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_mem.c * Base kernel memory APIs @@ -31,6 +36,7 @@ #include #include #include +#include #include #include @@ -231,7 +237,10 @@ struct kbase_va_region *kbase_region_tracker_find_region_base_address(struct kba KBASE_EXPORT_TEST_API(kbase_region_tracker_find_region_base_address); /* Find region meeting given requirements */ -static struct kbase_va_region *kbase_region_tracker_find_region_meeting_reqs(struct kbase_context *kctx, struct kbase_va_region *reg_reqs, size_t nr_pages, size_t align) +static struct kbase_va_region *kbase_region_tracker_find_region_meeting_reqs( + struct kbase_context *kctx, struct kbase_va_region *reg_reqs, + size_t nr_pages, size_t align_offset, size_t align_mask, + u64 *out_start_pfn) { struct rb_node *rbnode = NULL; struct kbase_va_region *reg = NULL; @@ -239,7 +248,6 @@ static struct kbase_va_region *kbase_region_tracker_find_region_meeting_reqs(str /* Note that this search is a linear search, as we do not have a target address in mind, so does not benefit from the rbtree search */ - rbtree = kbase_reg_flags_to_rbtree(kctx, reg_reqs); rbnode = rb_first(rbtree); @@ -249,12 +257,23 @@ static struct kbase_va_region *kbase_region_tracker_find_region_meeting_reqs(str if ((reg->nr_pages >= nr_pages) && (reg->flags & KBASE_REG_FREE)) { /* Check alignment */ - u64 start_pfn = (reg->start_pfn + align - 1) & ~(align - 1); + u64 start_pfn = reg->start_pfn; + + /* When align_offset == align, this sequence is + * equivalent to: + * (start_pfn + align_mask) & ~(align_mask) + * + * Otherwise, it aligns to n*align + offset, for the + * lowest value n that makes this still >start_pfn */ + start_pfn += align_mask; + start_pfn -= (start_pfn - align_offset) & (align_mask); if ((start_pfn >= reg->start_pfn) && (start_pfn <= (reg->start_pfn + reg->nr_pages - 1)) && - ((start_pfn + nr_pages - 1) <= (reg->start_pfn + reg->nr_pages - 1))) + ((start_pfn + nr_pages - 1) <= (reg->start_pfn + reg->nr_pages - 1))) { + *out_start_pfn = start_pfn; return reg; + } } rbnode = rb_next(rbnode); } @@ -425,7 +444,7 @@ int kbase_add_va_region(struct kbase_context *kctx, align = 1; /* must be a power of 2 */ - KBASE_DEBUG_ASSERT((align & (align - 1)) == 0); + KBASE_DEBUG_ASSERT(is_power_of_2(align)); KBASE_DEBUG_ASSERT(nr_pages > 0); /* Path 1: Map a specific address. Find the enclosing region, which *must* be free. */ @@ -458,38 +477,44 @@ int kbase_add_va_region(struct kbase_context *kctx, goto exit; } - /* Path 2: Map any free address which meets the requirements. */ - { + /* Path 2: Map any free address which meets the requirements. + * + * Depending on the zone the allocation request is for + * we might need to retry it. */ + do { u64 start_pfn; + size_t align_offset = align; + size_t align_mask = align - 1; + + if ((reg->flags & KBASE_REG_TILER_ALIGN_TOP)) { + WARN(align > 1, + "kbase_add_va_region with align %lx might not be honored for KBASE_REG_TILER_ALIGN_TOP memory", + (unsigned long)align); + align_mask = reg->extent - 1; + align_offset = reg->extent - reg->initial_commit; + } + + tmp = kbase_region_tracker_find_region_meeting_reqs(kctx, reg, + nr_pages, align_offset, align_mask, + &start_pfn); + if (tmp) { + err = kbase_insert_va_region_nolock(kctx, reg, tmp, + start_pfn, nr_pages); + break; + } /* - * Depending on the zone the allocation request is for - * we might need to retry it. + * If the allocation is not from the same zone as JIT + * then don't retry, we're out of VA and there is + * nothing which can be done about it. */ - do { - tmp = kbase_region_tracker_find_region_meeting_reqs( - kctx, reg, nr_pages, align); - if (tmp) { - start_pfn = (tmp->start_pfn + align - 1) & - ~(align - 1); - err = kbase_insert_va_region_nolock(kctx, reg, - tmp, start_pfn, nr_pages); - break; - } - - /* - * If the allocation is not from the same zone as JIT - * then don't retry, we're out of VA and there is - * nothing which can be done about it. - */ - if ((reg->flags & KBASE_REG_ZONE_MASK) != - KBASE_REG_ZONE_CUSTOM_VA) - break; - } while (kbase_jit_evict(kctx)); + if ((reg->flags & KBASE_REG_ZONE_MASK) != + KBASE_REG_ZONE_CUSTOM_VA) + break; + } while (kbase_jit_evict(kctx)); - if (!tmp) - err = -ENOMEM; - } + if (!tmp) + err = -ENOMEM; exit: return err; @@ -829,6 +854,8 @@ struct kbase_va_region *kbase_alloc_free_region(struct kbase_context *kctx, u64 new_reg->start_pfn = start_pfn; new_reg->nr_pages = nr_pages; + INIT_LIST_HEAD(&new_reg->jit_node); + return new_reg; } @@ -902,6 +929,12 @@ int kbase_gpu_mmap(struct kbase_context *kctx, struct kbase_va_region *reg, u64 size_t i = 0; unsigned long attr; unsigned long mask = ~KBASE_REG_MEMATTR_MASK; + unsigned long gwt_mask = ~0; + +#ifdef CONFIG_MALI_JOB_DUMP + if (kctx->gwt_enabled) + gwt_mask = ~KBASE_REG_GPU_WR; +#endif if ((kctx->kbdev->system_coherency == COHERENCY_ACE) && (reg->flags & KBASE_REG_SHARE_BOTH)) @@ -929,7 +962,7 @@ int kbase_gpu_mmap(struct kbase_context *kctx, struct kbase_va_region *reg, u64 reg->start_pfn + (i * stride), alloc->imported.alias.aliased[i].alloc->pages + alloc->imported.alias.aliased[i].offset, alloc->imported.alias.aliased[i].length, - reg->flags); + reg->flags & gwt_mask); if (err) goto bad_insert; @@ -939,7 +972,7 @@ int kbase_gpu_mmap(struct kbase_context *kctx, struct kbase_va_region *reg, u64 reg->start_pfn + i * stride, kctx->aliasing_sink_page, alloc->imported.alias.aliased[i].length, - (reg->flags & mask) | attr); + (reg->flags & mask & gwt_mask) | attr); if (err) goto bad_insert; @@ -949,7 +982,7 @@ int kbase_gpu_mmap(struct kbase_context *kctx, struct kbase_va_region *reg, u64 err = kbase_mmu_insert_pages(kctx, reg->start_pfn, kbase_get_gpu_phy_pages(reg), kbase_reg_current_backed_size(reg), - reg->flags); + reg->flags & gwt_mask); if (err) goto bad_insert; kbase_mem_phy_alloc_gpu_mapped(reg->gpu_alloc); @@ -1085,6 +1118,36 @@ int kbasep_find_enclosing_cpu_mapping_offset( KBASE_EXPORT_TEST_API(kbasep_find_enclosing_cpu_mapping_offset); +int kbasep_find_enclosing_gpu_mapping_start_and_offset(struct kbase_context *kctx, + u64 gpu_addr, size_t size, u64 *start, u64 *offset) +{ + struct kbase_va_region *region; + + kbase_gpu_vm_lock(kctx); + + region = kbase_region_tracker_find_region_enclosing_address(kctx, gpu_addr); + + if (!region) { + kbase_gpu_vm_unlock(kctx); + return -EINVAL; + } + + *start = region->start_pfn << PAGE_SHIFT; + + *offset = gpu_addr - *start; + + if (((region->start_pfn + region->nr_pages) << PAGE_SHIFT) < (gpu_addr + size)) { + kbase_gpu_vm_unlock(kctx); + return -EINVAL; + } + + kbase_gpu_vm_unlock(kctx); + + return 0; +} + +KBASE_EXPORT_TEST_API(kbasep_find_enclosing_gpu_mapping_start_and_offset); + void kbase_sync_single(struct kbase_context *kctx, struct tagged_addr t_cpu_pa, struct tagged_addr t_gpu_pa, off_t offset, size_t size, enum kbase_sync_type sync_fn) @@ -1268,6 +1331,11 @@ int kbase_mem_free_region(struct kbase_context *kctx, struct kbase_va_region *re KBASE_DEBUG_ASSERT(NULL != reg); lockdep_assert_held(&kctx->reg_lock); + if (reg->flags & KBASE_REG_JIT) { + dev_warn(reg->kctx->kbdev->dev, "Attempt to free JIT memory!\n"); + return -EINVAL; + } + /* * Unlink the physical allocation before unmaking it evictable so * that the allocation isn't grown back to its last backed size @@ -1413,6 +1481,9 @@ int kbase_update_region_flags(struct kbase_context *kctx, reg->flags |= KBASE_REG_SHARE_IN; } + if (flags & BASE_MEM_TILER_ALIGN_TOP) + reg->flags |= KBASE_REG_TILER_ALIGN_TOP; + /* Set up default MEMATTR usage */ if (kctx->kbdev->system_coherency == COHERENCY_ACE && (reg->flags & KBASE_REG_SHARE_BOTH)) { @@ -1431,7 +1502,6 @@ int kbase_alloc_phy_pages_helper( size_t nr_pages_requested) { int new_page_count __maybe_unused; - size_t old_page_count = alloc->nents; size_t nr_left = nr_pages_requested; int res; struct kbase_context *kctx; @@ -1459,7 +1529,7 @@ int kbase_alloc_phy_pages_helper( * allocation is visible to the OOM killer */ kbase_process_page_usage_inc(kctx, nr_pages_requested); - tp = alloc->pages + old_page_count; + tp = alloc->pages + alloc->nents; #ifdef CONFIG_MALI_2MB_ALLOC /* Check if we have enough pages requested so we can allocate a large @@ -1569,15 +1639,6 @@ no_new_partial: goto alloc_failed; } - /* - * Request a zone cache update, this scans only the new pages an - * appends their information to the zone cache. if the update - * fails then clear the cache so we fall-back to doing things - * page by page. - */ - if (kbase_zone_cache_update(alloc, old_page_count) != 0) - kbase_zone_cache_clear(alloc); - KBASE_TLSTREAM_AUX_PAGESALLOC( kctx->id, (u64)new_page_count); @@ -1591,7 +1652,7 @@ alloc_failed: if (nr_left != nr_pages_requested) kbase_mem_pool_free_pages(&kctx->lp_mem_pool, nr_pages_requested - nr_left, - alloc->pages + old_page_count, + alloc->pages + alloc->nents, false, false); @@ -1656,15 +1717,6 @@ int kbase_free_phy_pages_helper( start_free++; } - /* - * Clear the zone cache, we don't expect JIT allocations to be - * shrunk in parts so there is no point trying to optimize for that - * by scanning for the changes caused by freeing this memory and - * updating the existing cache entries. - */ - kbase_zone_cache_clear(alloc); - - while (nr_pages_to_free) { if (is_huge_head(*start_free)) { /* This is a 2MB entry, so free all the 512 pages that @@ -1852,8 +1904,13 @@ bool kbase_check_alloc_flags(unsigned long flags) if ((flags & (BASE_MEM_PROT_CPU_WR | BASE_MEM_PROT_GPU_WR)) == 0) return false; - /* GPU cannot be writing to GPU executable memory and cannot grow the memory on page fault. */ - if ((flags & BASE_MEM_PROT_GPU_EX) && (flags & (BASE_MEM_PROT_GPU_WR | BASE_MEM_GROW_ON_GPF))) + /* GPU executable memory cannot: + * - Be written by the GPU + * - Be grown on GPU page fault + * - Have the top of its initial commit aligned to 'extent' */ + if ((flags & BASE_MEM_PROT_GPU_EX) && (flags & + (BASE_MEM_PROT_GPU_WR | BASE_MEM_GROW_ON_GPF | + BASE_MEM_TILER_ALIGN_TOP))) return false; /* GPU should have at least read or write access otherwise there is no @@ -1865,6 +1922,12 @@ bool kbase_check_alloc_flags(unsigned long flags) if ((flags & BASE_MEM_IMPORT_SHARED) == BASE_MEM_IMPORT_SHARED) return false; + /* Should not combine BASE_MEM_COHERENT_LOCAL with + * BASE_MEM_COHERENT_SYSTEM */ + if ((flags & (BASE_MEM_COHERENT_LOCAL | BASE_MEM_COHERENT_SYSTEM)) == + (BASE_MEM_COHERENT_LOCAL | BASE_MEM_COHERENT_SYSTEM)) + return false; + return true; } @@ -1886,6 +1949,10 @@ bool kbase_check_import_flags(unsigned long flags) if (flags & BASE_MEM_GROW_ON_GPF) return false; + /* Imported memory cannot be aligned to the end of its initial commit */ + if (flags & BASE_MEM_TILER_ALIGN_TOP) + return false; + /* GPU should have at least read or write access otherwise there is no reason for importing. */ if ((flags & (BASE_MEM_PROT_GPU_RD | BASE_MEM_PROT_GPU_WR)) == 0) @@ -1898,6 +1965,89 @@ bool kbase_check_import_flags(unsigned long flags) return true; } +int kbase_check_alloc_sizes(struct kbase_context *kctx, unsigned long flags, + u64 va_pages, u64 commit_pages, u64 large_extent) +{ + struct device *dev = kctx->kbdev->dev; + int gpu_pc_bits = kctx->kbdev->gpu_props.props.core_props.log2_program_counter_size; + u64 gpu_pc_pages_max = 1ULL << gpu_pc_bits >> PAGE_SHIFT; + struct kbase_va_region test_reg; + + /* kbase_va_region's extent member can be of variable size, so check against that type */ + test_reg.extent = large_extent; + +#define KBASE_MSG_PRE "GPU allocation attempted with " + + if (0 == va_pages) { + dev_warn(dev, KBASE_MSG_PRE "0 va_pages!"); + return -EINVAL; + } + + if (va_pages > (U64_MAX / PAGE_SIZE)) { + /* 64-bit address range is the max */ + dev_warn(dev, KBASE_MSG_PRE "va_pages==%lld larger than 64-bit address range!", + (unsigned long long)va_pages); + return -ENOMEM; + } + + /* Note: commit_pages is checked against va_pages during + * kbase_alloc_phy_pages() */ + + /* Limit GPU executable allocs to GPU PC size */ + if ((flags & BASE_MEM_PROT_GPU_EX) && (va_pages > gpu_pc_pages_max)) { + dev_warn(dev, KBASE_MSG_PRE "BASE_MEM_PROT_GPU_EX and va_pages==%lld larger than GPU PC range %lld", + (unsigned long long)va_pages, + (unsigned long long)gpu_pc_pages_max); + + return -EINVAL; + } + + if ((flags & (BASE_MEM_GROW_ON_GPF | BASE_MEM_TILER_ALIGN_TOP)) && + test_reg.extent == 0) { + dev_warn(dev, KBASE_MSG_PRE "BASE_MEM_GROW_ON_GPF or BASE_MEM_TILER_ALIGN_TOP but extent == 0\n"); + return -EINVAL; + } + + if (!(flags & (BASE_MEM_GROW_ON_GPF | BASE_MEM_TILER_ALIGN_TOP)) && + test_reg.extent != 0) { + dev_warn(dev, KBASE_MSG_PRE "neither BASE_MEM_GROW_ON_GPF nor BASE_MEM_TILER_ALIGN_TOP set but extent != 0\n"); + return -EINVAL; + } + + /* BASE_MEM_TILER_ALIGN_TOP memory has a number of restrictions */ + if (flags & BASE_MEM_TILER_ALIGN_TOP) { +#define KBASE_MSG_PRE_FLAG KBASE_MSG_PRE "BASE_MEM_TILER_ALIGN_TOP and " + unsigned long small_extent; + + if (large_extent > BASE_MEM_TILER_ALIGN_TOP_EXTENT_MAX_PAGES) { + dev_warn(dev, KBASE_MSG_PRE_FLAG "extent==%lld pages exceeds limit %lld", + (unsigned long long)large_extent, + BASE_MEM_TILER_ALIGN_TOP_EXTENT_MAX_PAGES); + return -EINVAL; + } + /* For use with is_power_of_2, which takes unsigned long, so + * must ensure e.g. on 32-bit kernel it'll fit in that type */ + small_extent = (unsigned long)large_extent; + + if (!is_power_of_2(small_extent)) { + dev_warn(dev, KBASE_MSG_PRE_FLAG "extent==%ld not a non-zero power of 2", + small_extent); + return -EINVAL; + } + + if (commit_pages > large_extent) { + dev_warn(dev, KBASE_MSG_PRE_FLAG "commit_pages==%ld exceeds extent==%ld", + (unsigned long)commit_pages, + (unsigned long)large_extent); + return -EINVAL; + } +#undef KBASE_MSG_PRE_FLAG + } + + return 0; +#undef KBASE_MSG_PRE +} + /** * @brief Acquire the per-context region list lock */ @@ -2126,6 +2276,7 @@ static void kbase_jit_destroy_worker(struct work_struct *work) mutex_unlock(&kctx->jit_evict_lock); kbase_gpu_vm_lock(kctx); + reg->flags &= ~KBASE_REG_JIT; kbase_mem_free_region(kctx, reg); kbase_gpu_vm_unlock(kctx); } while (1); @@ -2251,6 +2402,8 @@ struct kbase_va_region *kbase_jit_allocate(struct kbase_context *kctx, if (!reg) goto out_unlocked; + reg->flags |= KBASE_REG_JIT; + mutex_lock(&kctx->jit_evict_lock); list_add(®->jit_node, &kctx->jit_active_head); mutex_unlock(&kctx->jit_evict_lock); @@ -2322,8 +2475,10 @@ bool kbase_jit_evict(struct kbase_context *kctx) } mutex_unlock(&kctx->jit_evict_lock); - if (reg) + if (reg) { + reg->flags &= ~KBASE_REG_JIT; kbase_mem_free_region(kctx, reg); + } return (reg != NULL); } @@ -2348,6 +2503,7 @@ void kbase_jit_term(struct kbase_context *kctx) struct kbase_va_region, jit_node); list_del(&walker->jit_node); mutex_unlock(&kctx->jit_evict_lock); + walker->flags &= ~KBASE_REG_JIT; kbase_mem_free_region(kctx, walker); mutex_lock(&kctx->jit_evict_lock); } @@ -2358,6 +2514,7 @@ void kbase_jit_term(struct kbase_context *kctx) struct kbase_va_region, jit_node); list_del(&walker->jit_node); mutex_unlock(&kctx->jit_evict_lock); + walker->flags &= ~KBASE_REG_JIT; kbase_mem_free_region(kctx, walker); mutex_lock(&kctx->jit_evict_lock); } @@ -2379,6 +2536,7 @@ static int kbase_jd_user_buf_map(struct kbase_context *kctx, struct device *dev; unsigned long offset; unsigned long local_size; + unsigned long gwt_mask = ~0; alloc = reg->gpu_alloc; pa = kbase_get_gpu_phy_pages(reg); @@ -2447,10 +2605,14 @@ static int kbase_jd_user_buf_map(struct kbase_context *kctx, } alloc->nents = pinned_pages; +#ifdef CONFIG_MALI_JOB_DUMP + if (kctx->gwt_enabled) + gwt_mask = ~KBASE_REG_GPU_WR; +#endif err = kbase_mmu_insert_pages(kctx, reg->start_pfn, pa, kbase_reg_current_backed_size(reg), - reg->flags); + reg->flags & gwt_mask); if (err == 0) return 0; diff --git a/mali_kbase/mali_kbase_mem.h b/mali_kbase/mali_kbase_mem.h index 815fab4..36de381 100644 --- a/mali_kbase/mali_kbase_mem.h +++ b/mali_kbase/mali_kbase_mem.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_mem.h * Base kernel memory APIs @@ -126,8 +131,6 @@ struct kbase_mem_phy_alloc { unsigned long properties; - struct list_head zone_cache; - /* member in union valid based on @a type */ union { #ifdef CONFIG_UMP @@ -235,6 +238,9 @@ struct kbase_va_region { u64 start_pfn; /* The PFN in GPU space */ size_t nr_pages; + /* Initial commit, for aligning the start address and correctly growing + * KBASE_REG_TILER_ALIGN_TOP regions */ + size_t initial_commit; /* Free region */ #define KBASE_REG_FREE (1ul << 0) @@ -286,6 +292,13 @@ struct kbase_va_region { * Do not remove, use the next unreserved bit for new flags */ #define KBASE_REG_RESERVED_BIT_22 (1ul << 22) +/* The top of the initial commit is aligned to extent pages. + * Extent must be a power of 2 */ +#define KBASE_REG_TILER_ALIGN_TOP (1ul << 23) + +/* Memory is handled by JIT - user space should not be able to free it */ +#define KBASE_REG_JIT (1ul << 24) + #define KBASE_REG_ZONE_SAME_VA KBASE_REG_ZONE(0) /* only used with 32-bit clients */ @@ -400,7 +413,6 @@ static inline struct kbase_mem_phy_alloc *kbase_alloc_create(size_t nr_pages, en alloc->pages = (void *)(alloc + 1); INIT_LIST_HEAD(&alloc->mappings); alloc->type = type; - INIT_LIST_HEAD(&alloc->zone_cache); if (type == KBASE_MEM_TYPE_IMPORTED_USER_BUF) alloc->imported.user_buf.dma_addrs = @@ -435,7 +447,6 @@ static inline int kbase_reg_prepare_native(struct kbase_va_region *reg, reg->gpu_alloc = kbase_mem_phy_alloc_get(reg->cpu_alloc); } - INIT_LIST_HEAD(®->jit_node); reg->flags &= ~KBASE_REG_FREE; return 0; } @@ -668,6 +679,25 @@ int kbase_add_va_region(struct kbase_context *kctx, struct kbase_va_region *reg, bool kbase_check_alloc_flags(unsigned long flags); bool kbase_check_import_flags(unsigned long flags); +/** + * kbase_check_alloc_sizes - check user space sizes parameters for an + * allocation + * + * @kctx: kbase context + * @flags: The flags passed from user space + * @va_pages: The size of the requested region, in pages. + * @commit_pages: Number of pages to commit initially. + * @extent: Number of pages to grow by on GPU page fault and/or alignment + * (depending on flags) + * + * Makes checks on the size parameters passed in from user space for a memory + * allocation call, with respect to the flags requested. + * + * Return: 0 if sizes are valid for these flags, negative error code otherwise + */ +int kbase_check_alloc_sizes(struct kbase_context *kctx, unsigned long flags, + u64 va_pages, u64 commit_pages, u64 extent); + /** * kbase_update_region_flags - Convert user space flags to kernel region flags * @@ -704,6 +734,9 @@ int kbase_mmu_insert_single_page(struct kbase_context *kctx, u64 vpfn, unsigned long flags); int kbase_mmu_teardown_pages(struct kbase_context *kctx, u64 vpfn, size_t nr); +int kbase_mmu_update_pages_no_flush(struct kbase_context *kctx, u64 vpfn, + struct tagged_addr *phys, size_t nr, + unsigned long flags); int kbase_mmu_update_pages(struct kbase_context *kctx, u64 vpfn, struct tagged_addr *phys, size_t nr, unsigned long flags); @@ -858,6 +891,32 @@ int kbasep_find_enclosing_cpu_mapping_offset( struct kbase_context *kctx, unsigned long uaddr, size_t size, u64 *offset); +/** + * kbasep_find_enclosing_gpu_mapping_start_and_offset() - Find the address of + * the start of GPU virtual memory region which encloses @gpu_addr for the + * @size length in bytes + * + * Searches for the memory region in GPU virtual memory space which contains + * the region defined by the @gpu_addr and @size, where @gpu_addr is the + * beginning and @size the length in bytes of the provided region. If found, + * the location of the start address of the GPU virtual memory region is + * passed in @start pointer and the location of the offset of the region into + * the GPU virtual memory region is passed in @offset pointer. + * + * @kctx: The kernel base context within which the memory is searched. + * @gpu_addr: GPU virtual address for which the region is sought; defines + * the beginning of the provided region. + * @size: The length (in bytes) of the provided region for which the + * GPU virtual memory region is sought. + * @start: Pointer to the location where the address of the start of + * the found GPU virtual memory region is. + * @offset: Pointer to the location where the offset of @gpu_addr into + * the found GPU virtual memory region is. + */ +int kbasep_find_enclosing_gpu_mapping_start_and_offset( + struct kbase_context *kctx, + u64 gpu_addr, size_t size, u64 *start, u64 *offset); + enum hrtimer_restart kbasep_as_poke_timer_callback(struct hrtimer *timer); void kbase_as_poking_timer_retain_atom(struct kbase_device *kbdev, struct kbase_context *kctx, struct kbase_jd_atom *katom); void kbase_as_poking_timer_release_atom(struct kbase_device *kbdev, struct kbase_context *kctx, struct kbase_jd_atom *katom); @@ -1091,37 +1150,4 @@ bool kbase_sticky_resource_release(struct kbase_context *kctx, */ void kbase_sticky_resource_term(struct kbase_context *kctx); -/** - * kbase_zone_cache_update - Update the memory zone cache after new pages have - * been added. - * @alloc: The physical memory allocation to build the cache for. - * @start_offset: Offset to where the new pages start. - * - * Updates an existing memory zone cache, updating the counters for the - * various zones. - * If the memory allocation doesn't already have a zone cache assume that - * one isn't created and thus don't do anything. - * - * Return: Zero cache was updated, negative error code on error. - */ -int kbase_zone_cache_update(struct kbase_mem_phy_alloc *alloc, - size_t start_offset); - -/** - * kbase_zone_cache_build - Build the memory zone cache. - * @alloc: The physical memory allocation to build the cache for. - * - * Create a new zone cache for the provided physical memory allocation if - * one doesn't already exist, if one does exist then just return. - * - * Return: Zero if the zone cache was created, negative error code on error. - */ -int kbase_zone_cache_build(struct kbase_mem_phy_alloc *alloc); - -/** - * kbase_zone_cache_clear - Clear the memory zone cache. - * @alloc: The physical memory allocation to clear the cache on. - */ -void kbase_zone_cache_clear(struct kbase_mem_phy_alloc *alloc); - #endif /* _KBASE_MEM_H_ */ diff --git a/mali_kbase/mali_kbase_mem_linux.c b/mali_kbase/mali_kbase_mem_linux.c index 37f7a6a..4e6668e 100644 --- a/mali_kbase/mali_kbase_mem_linux.c +++ b/mali_kbase/mali_kbase_mem_linux.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_mem_linux.c * Base kernel memory APIs, Linux implementation. @@ -86,7 +91,6 @@ struct kbase_va_region *kbase_mem_alloc(struct kbase_context *kctx, u64 *gpu_va) { int zone; - int gpu_pc_bits; struct kbase_va_region *reg; struct device *dev; @@ -97,17 +101,6 @@ struct kbase_va_region *kbase_mem_alloc(struct kbase_context *kctx, dev = kctx->kbdev->dev; *gpu_va = 0; /* return 0 on failure */ - gpu_pc_bits = kctx->kbdev->gpu_props.props.core_props.log2_program_counter_size; - - if (0 == va_pages) { - dev_warn(dev, "kbase_mem_alloc called with 0 va_pages!"); - goto bad_size; - } - - if (va_pages > (U64_MAX / PAGE_SIZE)) - /* 64-bit address range is the max */ - goto bad_size; - if (!kbase_check_alloc_flags(*flags)) { dev_warn(dev, "kbase_mem_alloc called with bad flags (%llx)", @@ -126,10 +119,8 @@ struct kbase_va_region *kbase_mem_alloc(struct kbase_context *kctx, *flags &= ~BASE_MEM_COHERENT_SYSTEM; } - /* Limit GPU executable allocs to GPU PC size */ - if ((*flags & BASE_MEM_PROT_GPU_EX) && - (va_pages > (1ULL << gpu_pc_bits >> PAGE_SHIFT))) - goto bad_ex_size; + if (kbase_check_alloc_sizes(kctx, *flags, va_pages, commit_pages, extent)) + goto bad_sizes; /* find out which VA zone to use */ if (*flags & BASE_MEM_SAME_VA) @@ -153,13 +144,13 @@ struct kbase_va_region *kbase_mem_alloc(struct kbase_context *kctx, goto prepare_failed; } - if (*flags & BASE_MEM_GROW_ON_GPF) { + if (*flags & (BASE_MEM_GROW_ON_GPF|BASE_MEM_TILER_ALIGN_TOP)) { + /* kbase_check_alloc_sizes() already checks extent is valid for + * assigning to reg->extent */ reg->extent = extent; - if (reg->extent == 0) - goto invalid_extent; - } - else + } else { reg->extent = 0; + } if (kbase_alloc_phy_pages(reg, va_pages, commit_pages) != 0) { dev_warn(dev, "Failed to allocate %lld pages (va_pages=%lld)", @@ -167,6 +158,7 @@ struct kbase_va_region *kbase_mem_alloc(struct kbase_context *kctx, (unsigned long long)va_pages); goto no_mem; } + reg->initial_commit = commit_pages; kbase_gpu_vm_lock(kctx); @@ -239,16 +231,14 @@ struct kbase_va_region *kbase_mem_alloc(struct kbase_context *kctx, no_mmap: no_cookie: no_mem: -invalid_extent: kbase_mem_phy_alloc_put(reg->cpu_alloc); kbase_mem_phy_alloc_put(reg->gpu_alloc); invalid_flags: prepare_failed: kfree(reg); no_region: -bad_ex_size: +bad_sizes: bad_flags: -bad_size: return NULL; } KBASE_EXPORT_TEST_API(kbase_mem_alloc); @@ -308,6 +298,23 @@ int kbase_mem_query(struct kbase_context *kctx, u64 gpu_addr, int query, u64 * c *out |= BASE_MEM_COHERENT_SYSTEM; if (KBASE_REG_SHARE_IN & reg->flags) *out |= BASE_MEM_COHERENT_LOCAL; + if (kctx->api_version >= KBASE_API_VERSION(11, 2)) { + /* Prior to 11.2, these were known about by user-side + * but we did not return them. Returning some of these + * caused certain clients that were not expecting them + * to fail, so we omit all of them as a special-case + * for compatibility reasons */ + if (KBASE_REG_PF_GROW & reg->flags) + *out |= BASE_MEM_GROW_ON_GPF; + if (KBASE_REG_SECURE & reg->flags) + *out |= BASE_MEM_SECURE; + } + if (KBASE_REG_TILER_ALIGN_TOP & reg->flags) + *out |= BASE_MEM_TILER_ALIGN_TOP; + + WARN(*out & ~BASE_MEM_FLAGS_QUERYABLE, + "BASE_MEM_FLAGS_QUERYABLE needs updating\n"); + *out &= BASE_MEM_FLAGS_QUERYABLE; break; } default: @@ -460,100 +467,6 @@ void kbase_mem_evictable_deinit(struct kbase_context *kctx) unregister_shrinker(&kctx->reclaim); } -struct kbase_mem_zone_cache_entry { - /* List head used to link the cache entry to the memory allocation. */ - struct list_head zone_node; - /* The zone the cacheline is for. */ - struct zone *zone; - /* The number of pages in the allocation which belong to this zone. */ - u64 count; -}; - -static bool kbase_zone_cache_builder(struct kbase_mem_phy_alloc *alloc, - size_t start_offset) -{ - struct kbase_mem_zone_cache_entry *cache = NULL; - size_t i; - int ret = 0; - - for (i = start_offset; i < alloc->nents; i++) { - struct page *p = phys_to_page(as_phys_addr_t(alloc->pages[i])); - struct zone *zone = page_zone(p); - bool create = true; - - if (cache && (cache->zone == zone)) { - /* - * Fast path check as most of the time adjacent - * pages come from the same zone. - */ - create = false; - } else { - /* - * Slow path check, walk all the cache entries to see - * if we already know about this zone. - */ - list_for_each_entry(cache, &alloc->zone_cache, zone_node) { - if (cache->zone == zone) { - create = false; - break; - } - } - } - - /* This zone wasn't found in the cache, create an entry for it */ - if (create) { - cache = kmalloc(sizeof(*cache), GFP_KERNEL); - if (!cache) { - ret = -ENOMEM; - goto bail; - } - cache->zone = zone; - cache->count = 0; - list_add(&cache->zone_node, &alloc->zone_cache); - } - - cache->count++; - } - return 0; - -bail: - return ret; -} - -int kbase_zone_cache_update(struct kbase_mem_phy_alloc *alloc, - size_t start_offset) -{ - /* - * Bail if the zone cache is empty, only update the cache if it - * existed in the first place. - */ - if (list_empty(&alloc->zone_cache)) - return 0; - - return kbase_zone_cache_builder(alloc, start_offset); -} - -int kbase_zone_cache_build(struct kbase_mem_phy_alloc *alloc) -{ - /* Bail if the zone cache already exists */ - if (!list_empty(&alloc->zone_cache)) - return 0; - - return kbase_zone_cache_builder(alloc, 0); -} - -void kbase_zone_cache_clear(struct kbase_mem_phy_alloc *alloc) -{ - struct kbase_mem_zone_cache_entry *walker; - - while(!list_empty(&alloc->zone_cache)){ - walker = list_first_entry(&alloc->zone_cache, - struct kbase_mem_zone_cache_entry, zone_node); - list_del(&walker->zone_node); - kfree(walker); - } -} - /** * kbase_mem_evictable_mark_reclaim - Mark the pages as reclaimable. * @alloc: The physical allocation @@ -561,32 +474,7 @@ void kbase_zone_cache_clear(struct kbase_mem_phy_alloc *alloc) static void kbase_mem_evictable_mark_reclaim(struct kbase_mem_phy_alloc *alloc) { struct kbase_context *kctx = alloc->imported.kctx; - struct kbase_mem_zone_cache_entry *zone_cache; int __maybe_unused new_page_count; - int err; - - /* Attempt to build a zone cache of tracking */ - err = kbase_zone_cache_build(alloc); - if (err == 0) { - /* Bulk update all the zones */ - list_for_each_entry(zone_cache, &alloc->zone_cache, zone_node) { - zone_page_state_add(zone_cache->count, - zone_cache->zone, NR_SLAB_RECLAIMABLE); - } - } else { - /* Fall-back to page by page updates */ - int i; - - for (i = 0; i < alloc->nents; i++) { - struct page *p; - struct zone *zone; - - p = phys_to_page(as_phys_addr_t(alloc->pages[i])); - zone = page_zone(p); - - zone_page_state_add(1, zone, NR_SLAB_RECLAIMABLE); - } - } kbase_process_page_usage_dec(kctx, alloc->nents); new_page_count = kbase_atomic_sub_pages(alloc->nents, @@ -606,9 +494,7 @@ static void kbase_mem_evictable_unmark_reclaim(struct kbase_mem_phy_alloc *alloc) { struct kbase_context *kctx = alloc->imported.kctx; - struct kbase_mem_zone_cache_entry *zone_cache; int __maybe_unused new_page_count; - int err; new_page_count = kbase_atomic_add_pages(alloc->nents, &kctx->used_pages); @@ -616,31 +502,9 @@ void kbase_mem_evictable_unmark_reclaim(struct kbase_mem_phy_alloc *alloc) /* Increase mm counters so that the allocation is accounted for * against the process and thus is visible to the OOM killer, - * then remove it from the reclaimable accounting. */ + */ kbase_process_page_usage_inc(kctx, alloc->nents); - /* Attempt to build a zone cache of tracking */ - err = kbase_zone_cache_build(alloc); - if (err == 0) { - /* Bulk update all the zones */ - list_for_each_entry(zone_cache, &alloc->zone_cache, zone_node) { - zone_page_state_add(-zone_cache->count, - zone_cache->zone, NR_SLAB_RECLAIMABLE); - } - } else { - /* Fall-back to page by page updates */ - int i; - - for (i = 0; i < alloc->nents; i++) { - struct page *p; - struct zone *zone; - - p = phys_to_page(as_phys_addr_t(alloc->pages[i])); - zone = page_zone(p); - zone_page_state_add(-1, zone, NR_SLAB_RECLAIMABLE); - } - } - KBASE_TLSTREAM_AUX_PAGESALLOC( kctx->id, (u64)new_page_count); @@ -1445,10 +1309,9 @@ int kbase_mem_import(struct kbase_context *kctx, enum base_mem_import_type type, KBASE_DEBUG_ASSERT(va_pages); KBASE_DEBUG_ASSERT(flags); -#ifdef CONFIG_64BIT - if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) + if ((!kbase_ctx_flag(kctx, KCTX_COMPAT)) && + kbase_ctx_flag(kctx, KCTX_FORCE_SAME_VA)) *flags |= BASE_MEM_SAME_VA; -#endif if (!kbase_check_import_flags(*flags)) { dev_warn(kctx->kbdev->dev, @@ -2187,8 +2050,10 @@ int kbase_mmap(struct file *file, struct vm_area_struct *vma) dev_dbg(dev, "kbase_mmap\n"); - /* strip away corresponding VM_MAY% flags to the VM_% flags requested */ - vma->vm_flags &= ~((vma->vm_flags & (VM_READ | VM_WRITE)) << 4); + if (!(vma->vm_flags & VM_READ)) + vma->vm_flags &= ~VM_MAYREAD; + if (!(vma->vm_flags & VM_WRITE)) + vma->vm_flags &= ~VM_MAYWRITE; if (0 == nr_pages) { err = -EINVAL; @@ -2264,9 +2129,9 @@ int kbase_mmap(struct file *file, struct vm_area_struct *vma) } if ((vma->vm_flags & VM_READ && - !(reg->flags & KBASE_REG_CPU_RD)) || - (vma->vm_flags & VM_WRITE && - !(reg->flags & KBASE_REG_CPU_WR))) { + !(reg->flags & KBASE_REG_CPU_RD)) || + (vma->vm_flags & VM_WRITE && + !(reg->flags & KBASE_REG_CPU_WR))) { /* VM flags inconsistent with region flags */ err = -EPERM; dev_err(dev, "%s:%d inconsistent VM flags\n", @@ -2277,6 +2142,12 @@ int kbase_mmap(struct file *file, struct vm_area_struct *vma) #ifdef CONFIG_DMA_SHARED_BUFFER if (KBASE_MEM_TYPE_IMPORTED_UMM == reg->cpu_alloc->type) { + if (0 != (vma->vm_pgoff - reg->start_pfn)) { + err = -EINVAL; + dev_warn(dev, "%s:%d attempt to do a partial map in a dma_buf: non-zero offset to dma_buf mapping!\n", + __FILE__, __LINE__); + goto out_unlock; + } err = dma_buf_mmap( reg->cpu_alloc->imported.umm.dma_buf, vma, vma->vm_pgoff - reg->start_pfn); diff --git a/mali_kbase/mali_kbase_mem_linux.h b/mali_kbase/mali_kbase_mem_linux.h index db35f62..301fdc3 100644 --- a/mali_kbase/mali_kbase_mem_linux.h +++ b/mali_kbase/mali_kbase_mem_linux.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_mem_linux.h * Base kernel memory APIs, Linux implementation. diff --git a/mali_kbase/mali_kbase_mem_lowlevel.h b/mali_kbase/mali_kbase_mem_lowlevel.h index f4e8849..0c2b70b 100644 --- a/mali_kbase/mali_kbase_mem_lowlevel.h +++ b/mali_kbase/mali_kbase_mem_lowlevel.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_MEM_LOWLEVEL_H #define _KBASE_MEM_LOWLEVEL_H diff --git a/mali_kbase/mali_kbase_mem_pool.c b/mali_kbase/mali_kbase_mem_pool.c index 696730a..574f1d5 100644 --- a/mali_kbase/mali_kbase_mem_pool.c +++ b/mali_kbase/mali_kbase_mem_pool.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include @@ -70,8 +75,6 @@ static void kbase_mem_pool_add_locked(struct kbase_mem_pool *pool, list_add(&p->lru, &pool->page_list); pool->cur_size++; - zone_page_state_add(1, page_zone(p), NR_SLAB_RECLAIMABLE); - pool_dbg(pool, "added page\n"); } @@ -85,14 +88,8 @@ static void kbase_mem_pool_add(struct kbase_mem_pool *pool, struct page *p) static void kbase_mem_pool_add_list_locked(struct kbase_mem_pool *pool, struct list_head *page_list, size_t nr_pages) { - struct page *p; - lockdep_assert_held(&pool->pool_lock); - list_for_each_entry(p, page_list, lru) { - zone_page_state_add(1, page_zone(p), NR_SLAB_RECLAIMABLE); - } - list_splice(page_list, &pool->page_list); pool->cur_size += nr_pages; @@ -120,8 +117,6 @@ static struct page *kbase_mem_pool_remove_locked(struct kbase_mem_pool *pool) list_del_init(&p->lru); pool->cur_size--; - zone_page_state_add(-1, page_zone(p), NR_SLAB_RECLAIMABLE); - pool_dbg(pool, "removed page\n"); return p; @@ -639,10 +634,6 @@ void kbase_mem_pool_free_pages(struct kbase_mem_pool *pool, size_t nr_pages, p = phys_to_page(as_phys_addr_t(pages[i])); - if (reclaimed) - zone_page_state_add(-1, page_zone(p), - NR_SLAB_RECLAIMABLE); - kbase_mem_pool_free_page(pool, p); pages[i] = as_tagged(0); } diff --git a/mali_kbase/mali_kbase_mem_pool_debugfs.c b/mali_kbase/mali_kbase_mem_pool_debugfs.c index 319cf25..4b4eeb3 100644 --- a/mali_kbase/mali_kbase_mem_pool_debugfs.c +++ b/mali_kbase/mali_kbase_mem_pool_debugfs.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include diff --git a/mali_kbase/mali_kbase_mem_pool_debugfs.h b/mali_kbase/mali_kbase_mem_pool_debugfs.h index 496eaf3..990d91c 100644 --- a/mali_kbase/mali_kbase_mem_pool_debugfs.h +++ b/mali_kbase/mali_kbase_mem_pool_debugfs.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_MEM_POOL_DEBUGFS_H #define _KBASE_MEM_POOL_DEBUGFS_H diff --git a/mali_kbase/mali_kbase_mem_profile_debugfs.c b/mali_kbase/mali_kbase_mem_profile_debugfs.c index d58fd8d..d4f8433 100644 --- a/mali_kbase/mali_kbase_mem_profile_debugfs.c +++ b/mali_kbase/mali_kbase_mem_profile_debugfs.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #ifdef CONFIG_DEBUG_FS diff --git a/mali_kbase/mali_kbase_mem_profile_debugfs.h b/mali_kbase/mali_kbase_mem_profile_debugfs.h index a1dc2e0..1462247 100644 --- a/mali_kbase/mali_kbase_mem_profile_debugfs.h +++ b/mali_kbase/mali_kbase_mem_profile_debugfs.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_mem_profile_debugfs.h * Header file for mem profiles entries in debugfs diff --git a/mali_kbase/mali_kbase_mem_profile_debugfs_buf_size.h b/mali_kbase/mali_kbase_mem_profile_debugfs_buf_size.h index 82f0702..cb968f6 100644 --- a/mali_kbase/mali_kbase_mem_profile_debugfs_buf_size.h +++ b/mali_kbase/mali_kbase_mem_profile_debugfs_buf_size.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_mem_profile_debugfs_buf_size.h * Header file for the size of the buffer to accumulate the histogram report text in diff --git a/mali_kbase/mali_kbase_mmu.c b/mali_kbase/mali_kbase_mmu.c index 1694779..65b7da0 100644 --- a/mali_kbase/mali_kbase_mmu.c +++ b/mali_kbase/mali_kbase_mmu.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_mmu.c * Base kernel MMU management. @@ -100,32 +105,206 @@ static void kbase_mmu_report_fault_and_kill(struct kbase_context *kctx, /** - * make_multiple() - Calculate the nearest integral multiple of a given number. + * reg_grow_calc_extra_pages() - Calculate the number of backed pages to add to + * a region on a GPU page fault * - * @minimum: The number to round up. - * @multiple: The number of which the function shall calculate an integral multiple. - * @result: The number rounded up to the nearest integral multiple in case of success, - * or just the number itself in case of failure. + * @reg: The region that will be backed with more pages + * @fault_rel_pfn: PFN of the fault relative to the start of the region * - * Return: 0 in case of success, or -1 in case of failure. + * This calculates how much to increase the backing of a region by, based on + * where a GPU page fault occurred and the flags in the region. + * + * This can be more than the minimum number of pages that would reach + * @fault_rel_pfn, for example to reduce the overall rate of page fault + * interrupts on a region, or to ensure that the end address is aligned. + * + * Return: the number of backed pages to increase by */ -static int make_multiple(size_t minimum, size_t multiple, size_t *result) +static size_t reg_grow_calc_extra_pages(struct kbase_va_region *reg, size_t fault_rel_pfn) { - int err = -1; + size_t multiple = reg->extent; + size_t reg_current_size = kbase_reg_current_backed_size(reg); + size_t minimum_extra = fault_rel_pfn - reg_current_size + 1; + size_t remainder; + + if (!multiple) { + dev_warn(reg->kctx->kbdev->dev, + "VA Region 0x%llx extent was 0, allocator needs to set this properly for KBASE_REG_PF_GROW\n", + ((unsigned long long)reg->start_pfn) << PAGE_SHIFT); + return minimum_extra; + } + + /* Calculate the remainder to subtract from minimum_extra to make it + * the desired (rounded down) multiple of the extent. + * Depending on reg's flags, the base used for calculating multiples is + * different */ + if (reg->flags & KBASE_REG_TILER_ALIGN_TOP) { + /* multiple is based from the top of the initial commit, which + * has been allocated in such a way that (start_pfn + + * initial_commit) is already aligned to multiple. Hence the + * pfn for the end of committed memory will also be aligned to + * multiple */ + size_t initial_commit = reg->initial_commit; + + if (fault_rel_pfn < initial_commit) { + /* this case is just to catch in case it's been + * recommitted by userspace to be smaller than the + * initial commit */ + minimum_extra = initial_commit - reg_current_size; + remainder = 0; + } else { + /* same as calculating (fault_rel_pfn - initial_commit + 1) */ + size_t pages_after_initial = minimum_extra + reg_current_size - initial_commit; + + remainder = pages_after_initial % multiple; + } + } else { + /* multiple is based from the current backed size, even if the + * current backed size/pfn for end of committed memory are not + * themselves aligned to multiple */ + remainder = minimum_extra % multiple; + } + + if (remainder == 0) + return minimum_extra; + + return minimum_extra + multiple - remainder; +} + +#ifdef CONFIG_MALI_JOB_DUMP +static void kbase_gpu_mmu_handle_write_faulting_as(struct kbase_context *kctx, + struct kbase_device *kbdev, + struct kbase_as *faulting_as, + u64 start_pfn, size_t nr, u32 op) +{ + mutex_lock(&kbdev->mmu_hw_mutex); + + kbase_mmu_hw_clear_fault(kbdev, faulting_as, kctx, + KBASE_MMU_FAULT_TYPE_PAGE); + kbase_mmu_hw_do_operation(kbdev, faulting_as, kctx, start_pfn, + nr, op, 1); + + mutex_unlock(&kbdev->mmu_hw_mutex); + + kbase_mmu_hw_enable_fault(kbdev, faulting_as, kctx, + KBASE_MMU_FAULT_TYPE_PAGE); +} + +static void kbase_gpu_mmu_handle_write_fault(struct kbase_context *kctx, + struct kbase_as *faulting_as) +{ + struct kbasep_gwt_list_element *pos; + struct kbase_va_region *region; + struct kbase_device *kbdev; + u64 fault_pfn, pfn_offset; + u32 op; + int ret; + int as_no; - *result = minimum; + as_no = faulting_as->number; + kbdev = container_of(faulting_as, struct kbase_device, as[as_no]); + fault_pfn = faulting_as->fault_addr >> PAGE_SHIFT; - if (multiple > 0) { - size_t remainder = minimum % multiple; + kbase_gpu_vm_lock(kctx); - if (remainder != 0) - *result = minimum + multiple - remainder; - err = 0; + /* Find region and check if it should be writable. */ + region = kbase_region_tracker_find_region_enclosing_address(kctx, + faulting_as->fault_addr); + if (!region || region->flags & KBASE_REG_FREE) { + kbase_gpu_vm_unlock(kctx); + kbase_mmu_report_fault_and_kill(kctx, faulting_as, + "Memory is not mapped on the GPU"); + return; } - return err; + if (!(region->flags & KBASE_REG_GPU_WR)) { + kbase_gpu_vm_unlock(kctx); + kbase_mmu_report_fault_and_kill(kctx, faulting_as, + "Region does not have write permissions"); + return; + } + + /* Capture handle and offset of the faulting write location + * for job dumping if write tracking is enabled. + */ + if (kctx->gwt_enabled) { + u64 page_addr = faulting_as->fault_addr & PAGE_MASK; + u64 offset = (page_addr >> PAGE_SHIFT) - region->start_pfn; + u64 handle = region->start_pfn << PAGE_SHIFT; + bool found = false; + + if (KBASE_MEM_TYPE_IMPORTED_UMM == region->cpu_alloc->type) + handle |= BIT(0); + + /* Check if this write was already handled. */ + list_for_each_entry(pos, &kctx->gwt_current_list, link) { + if (handle == pos->handle && + offset >= pos->offset && + offset < pos->offset + pos->num_pages) { + found = true; + break; + } + } + + if (!found) { + pos = kmalloc(sizeof(*pos), GFP_KERNEL); + if (pos) { + pos->handle = handle; + pos->offset = offset; + pos->num_pages = 1; + list_add(&pos->link, &kctx->gwt_current_list); + } else { + dev_warn(kbdev->dev, "kmalloc failure"); + } + } + } + + pfn_offset = fault_pfn - region->start_pfn; + /* Now make this faulting page writable to GPU. */ + ret = kbase_mmu_update_pages_no_flush(kctx, fault_pfn, + &kbase_get_gpu_phy_pages(region)[pfn_offset], + 1, region->flags); + + /* flush L2 and unlock the VA (resumes the MMU) */ + if (kbase_hw_has_issue(kbdev, BASE_HW_ISSUE_6367)) + op = AS_COMMAND_FLUSH; + else + op = AS_COMMAND_FLUSH_PT; + + kbase_gpu_mmu_handle_write_faulting_as(kctx, kbdev, faulting_as, + fault_pfn, 1, op); + + kbase_gpu_vm_unlock(kctx); } +static void kbase_gpu_mmu_handle_permission_fault(struct kbase_context *kctx, + struct kbase_as *faulting_as) +{ + u32 fault_status; + + fault_status = faulting_as->fault_status; + + switch (fault_status & AS_FAULTSTATUS_ACCESS_TYPE_MASK) { + case AS_FAULTSTATUS_ACCESS_TYPE_ATOMIC: + case AS_FAULTSTATUS_ACCESS_TYPE_WRITE: + kbase_gpu_mmu_handle_write_fault(kctx, faulting_as); + break; + case AS_FAULTSTATUS_ACCESS_TYPE_EX: + kbase_mmu_report_fault_and_kill(kctx, faulting_as, + "Execute Permission fault"); + break; + case AS_FAULTSTATUS_ACCESS_TYPE_READ: + kbase_mmu_report_fault_and_kill(kctx, faulting_as, + "Read Permission fault"); + break; + default: + kbase_mmu_report_fault_and_kill(kctx, faulting_as, + "Unknown Permission fault"); + break; + } +} +#endif + void page_fault_worker(struct work_struct *data) { u64 fault_pfn; @@ -175,6 +354,17 @@ void page_fault_worker(struct work_struct *data) break; case AS_FAULTSTATUS_EXCEPTION_CODE_PERMISSION_FAULT: +#ifdef CONFIG_MALI_JOB_DUMP + /* If GWT was ever enabled then we need to handle + * write fault pages even if the feature was disabled later. + */ + if (kctx->gwt_was_enabled) { + kbase_gpu_mmu_handle_permission_fault(kctx, + faulting_as); + goto fault_done; + } +#endif + kbase_mmu_report_fault_and_kill(kctx, faulting_as, "Permission failure"); goto fault_done; @@ -283,10 +473,7 @@ void page_fault_worker(struct work_struct *data) goto fault_done; } - err = make_multiple(fault_rel_pfn - kbase_reg_current_backed_size(region) + 1, - region->extent, - &new_pages); - WARN_ON(err); + new_pages = reg_grow_calc_extra_pages(region, fault_rel_pfn); /* cap to max vsize */ new_pages = min(new_pages, region->nr_pages - kbase_reg_current_backed_size(region)); @@ -392,6 +579,25 @@ void page_fault_worker(struct work_struct *data) /* reenable this in the mask */ kbase_mmu_hw_enable_fault(kbdev, faulting_as, kctx, KBASE_MMU_FAULT_TYPE_PAGE); + +#ifdef CONFIG_MALI_JOB_DUMP + if (kctx->gwt_enabled) { + /* GWT also tracks growable regions. */ + struct kbasep_gwt_list_element *pos; + + pos = kmalloc(sizeof(*pos), GFP_KERNEL); + if (pos) { + pos->handle = region->start_pfn << PAGE_SHIFT; + pos->offset = pfn_offset; + pos->num_pages = new_pages; + list_add(&pos->link, + &kctx->gwt_current_list); + + } else { + dev_warn(kbdev->dev, "kmalloc failure"); + } + } +#endif kbase_gpu_vm_unlock(kctx); } else { /* failed to extend, handle as a normal PF */ @@ -853,9 +1059,16 @@ int kbase_mmu_insert_pages_no_flush(struct kbase_context *kctx, u64 *target = &pgd_page[ofs]; /* Fail if the current page is a valid ATE entry + * unless gwt_was_enabled as in that case all + * pages will be valid from when + * kbase_gpu_gwt_start() cleared the gpu + * write flag. */ - KBASE_DEBUG_ASSERT(0 == (*target & 1UL)); - +#ifdef CONFIG_MALI_JOB_DUMP + if (!kctx->gwt_was_enabled) +#endif + KBASE_DEBUG_ASSERT + (0 == (*target & 1UL)); kctx->kbdev->mmu_mode->entry_set_ate(target, phys[i], flags, cur_level); } @@ -1217,13 +1430,12 @@ KBASE_EXPORT_TEST_API(kbase_mmu_teardown_pages); * already held by the caller. Refer to kbasep_js_runpool_release_ctx() for more * information. */ -int kbase_mmu_update_pages(struct kbase_context *kctx, u64 vpfn, - struct tagged_addr *phys, size_t nr, - unsigned long flags) +int kbase_mmu_update_pages_no_flush(struct kbase_context *kctx, u64 vpfn, + struct tagged_addr *phys, size_t nr, + unsigned long flags) { phys_addr_t pgd; u64 *pgd_page; - size_t requested_nr = nr; struct kbase_mmu_mode const *mmu_mode; int err; @@ -1239,9 +1451,6 @@ int kbase_mmu_update_pages(struct kbase_context *kctx, u64 vpfn, mmu_mode = kctx->kbdev->mmu_mode; - dev_warn(kctx->kbdev->dev, "kbase_mmu_update_pages(): updating page share flags on GPU PFN 0x%llx from phys %p, %zu pages", - vpfn, phys, nr); - while (nr) { unsigned int i; unsigned int index = vpfn & 0x1FF; @@ -1293,12 +1502,21 @@ int kbase_mmu_update_pages(struct kbase_context *kctx, u64 vpfn, } mutex_unlock(&kctx->mmu_lock); - kbase_mmu_flush_invalidate(kctx, vpfn, requested_nr, true); return 0; fail_unlock: mutex_unlock(&kctx->mmu_lock); - kbase_mmu_flush_invalidate(kctx, vpfn, requested_nr, true); + return err; +} + +int kbase_mmu_update_pages(struct kbase_context *kctx, u64 vpfn, + struct tagged_addr *phys, size_t nr, + unsigned long flags) +{ + int err; + + err = kbase_mmu_update_pages_no_flush(kctx, vpfn, phys, nr, flags); + kbase_mmu_flush_invalidate(kctx, vpfn, nr, true); return err; } diff --git a/mali_kbase/mali_kbase_mmu_hw.h b/mali_kbase/mali_kbase_mmu_hw.h index 986e959..92aa55d 100644 --- a/mali_kbase/mali_kbase_mmu_hw.h +++ b/mali_kbase/mali_kbase_mmu_hw.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file * Interface file for accessing MMU hardware functionality diff --git a/mali_kbase/mali_kbase_mmu_mode_aarch64.c b/mali_kbase/mali_kbase_mmu_mode_aarch64.c index 0fb717b..4bb2628 100644 --- a/mali_kbase/mali_kbase_mmu_mode_aarch64.c +++ b/mali_kbase/mali_kbase_mmu_mode_aarch64.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include "mali_kbase.h" #include "mali_midg_regmap.h" #include "mali_kbase_defs.h" diff --git a/mali_kbase/mali_kbase_mmu_mode_lpae.c b/mali_kbase/mali_kbase_mmu_mode_lpae.c index f080fdc..bc8da63 100644 --- a/mali_kbase/mali_kbase_mmu_mode_lpae.c +++ b/mali_kbase/mali_kbase_mmu_mode_lpae.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include "mali_kbase.h" #include "mali_midg_regmap.h" #include "mali_kbase_defs.h" diff --git a/mali_kbase/mali_kbase_platform_fake.c b/mali_kbase/mali_kbase_platform_fake.c index 0152b35..fbb090e 100644 --- a/mali_kbase/mali_kbase_platform_fake.c +++ b/mali_kbase/mali_kbase_platform_fake.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/mali_kbase_pm.c b/mali_kbase/mali_kbase_pm.c index 97d5434..da56f0a 100644 --- a/mali_kbase/mali_kbase_pm.c +++ b/mali_kbase/mali_kbase_pm.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_pm.c * Base kernel power management APIs diff --git a/mali_kbase/mali_kbase_pm.h b/mali_kbase/mali_kbase_pm.h index 37fa247..8de17e1 100644 --- a/mali_kbase/mali_kbase_pm.h +++ b/mali_kbase/mali_kbase_pm.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_pm.h * Power management API definitions diff --git a/mali_kbase/mali_kbase_profiling_gator_api.h b/mali_kbase/mali_kbase_profiling_gator_api.h index 7fb674e..15bca79 100644 --- a/mali_kbase/mali_kbase_profiling_gator_api.h +++ b/mali_kbase/mali_kbase_profiling_gator_api.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_profiling_gator_api.h * Model interface diff --git a/mali_kbase/mali_kbase_regs_history_debugfs.c b/mali_kbase/mali_kbase_regs_history_debugfs.c index c970650..763740e 100644 --- a/mali_kbase/mali_kbase_regs_history_debugfs.c +++ b/mali_kbase/mali_kbase_regs_history_debugfs.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include "mali_kbase.h" #include "mali_kbase_regs_history_debugfs.h" diff --git a/mali_kbase/mali_kbase_regs_history_debugfs.h b/mali_kbase/mali_kbase_regs_history_debugfs.h index f108370..a0078cb 100644 --- a/mali_kbase/mali_kbase_regs_history_debugfs.h +++ b/mali_kbase/mali_kbase_regs_history_debugfs.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * Header file for register access history support via debugfs * diff --git a/mali_kbase/mali_kbase_replay.c b/mali_kbase/mali_kbase_replay.c index 203a065..3d93922 100644 --- a/mali_kbase/mali_kbase_replay.c +++ b/mali_kbase/mali_kbase_replay.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_replay.c * Replay soft job handlers diff --git a/mali_kbase/mali_kbase_smc.c b/mali_kbase/mali_kbase_smc.c index 43175c8..2176479 100644 --- a/mali_kbase/mali_kbase_smc.c +++ b/mali_kbase/mali_kbase_smc.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifdef CONFIG_ARM64 #include diff --git a/mali_kbase/mali_kbase_smc.h b/mali_kbase/mali_kbase_smc.h index 9bff3d2..221eb21 100644 --- a/mali_kbase/mali_kbase_smc.h +++ b/mali_kbase/mali_kbase_smc.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_SMC_H_ #define _KBASE_SMC_H_ diff --git a/mali_kbase/mali_kbase_softjobs.c b/mali_kbase/mali_kbase_softjobs.c index 127ada0..7cce3f8 100644 --- a/mali_kbase/mali_kbase_softjobs.c +++ b/mali_kbase/mali_kbase_softjobs.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #if defined(CONFIG_DMA_SHARED_BUFFER) @@ -521,8 +526,7 @@ static inline void free_user_buffer(struct kbase_debug_copy_buffer *buffer) static void kbase_debug_copy_finish(struct kbase_jd_atom *katom) { - struct kbase_debug_copy_buffer *buffers = - (struct kbase_debug_copy_buffer *)(uintptr_t)katom->jc; + struct kbase_debug_copy_buffer *buffers = katom->softjob_data; unsigned int i; unsigned int nr = katom->nr_extres; @@ -560,7 +564,7 @@ static void kbase_debug_copy_finish(struct kbase_jd_atom *katom) kbase_gpu_vm_unlock(katom->kctx); kfree(buffers); - katom->jc = 0; + katom->softjob_data = NULL; } static int kbase_debug_copy_prepare(struct kbase_jd_atom *katom) @@ -578,10 +582,9 @@ static int kbase_debug_copy_prepare(struct kbase_jd_atom *katom) buffers = kcalloc(nr, sizeof(*buffers), GFP_KERNEL); if (!buffers) { ret = -ENOMEM; - katom->jc = 0; goto out_cleanup; } - katom->jc = (u64)(uintptr_t)buffers; + katom->softjob_data = buffers; user_buffers = kmalloc_array(nr, sizeof(*user_buffers), GFP_KERNEL); @@ -853,10 +856,12 @@ out_unlock: static int kbase_debug_copy(struct kbase_jd_atom *katom) { - struct kbase_debug_copy_buffer *buffers = - (struct kbase_debug_copy_buffer *)(uintptr_t)katom->jc; + struct kbase_debug_copy_buffer *buffers = katom->softjob_data; unsigned int i; + if (WARN_ON(!buffers)) + return -EINVAL; + for (i = 0; i < katom->nr_extres; i++) { int res = kbase_mem_copy_from_extres(katom->kctx, &buffers[i]); @@ -910,8 +915,7 @@ static int kbase_jit_allocate_prepare(struct kbase_jd_atom *katom) goto free_info; } - /* Replace the user pointer with our kernel allocated info structure */ - katom->jc = (u64)(uintptr_t) info; + katom->softjob_data = info; katom->jit_blocked = false; lockdep_assert_held(&kctx->jctx.lock); @@ -933,7 +937,6 @@ static int kbase_jit_allocate_prepare(struct kbase_jd_atom *katom) free_info: kfree(info); fail: - katom->jc = 0; return ret; } @@ -958,7 +961,12 @@ static int kbase_jit_allocate_process(struct kbase_jd_atom *katom) katom->jit_blocked = false; } - info = (struct base_jit_alloc_info *) (uintptr_t) katom->jc; + info = katom->softjob_data; + + if (WARN_ON(!info)) { + katom->event_code = BASE_JD_EVENT_JOB_INVALID; + return 0; + } /* The JIT ID is still in use so fail the allocation */ if (kctx->jit_alloc[info->id]) { @@ -1061,7 +1069,7 @@ static void kbase_jit_allocate_finish(struct kbase_jd_atom *katom) katom->jit_blocked = false; } - info = (struct base_jit_alloc_info *) (uintptr_t) katom->jc; + info = katom->softjob_data; /* Free the info structure */ kfree(info); } @@ -1184,11 +1192,7 @@ static int kbase_ext_res_prepare(struct kbase_jd_atom *katom) */ ext_res->count = count; - /* - * Replace the user pointer with our kernel allocated - * ext_res structure. - */ - katom->jc = (u64)(uintptr_t) ext_res; + katom->softjob_data = ext_res; return 0; @@ -1204,7 +1208,7 @@ static void kbase_ext_res_process(struct kbase_jd_atom *katom, bool map) int i; bool failed = false; - ext_res = (struct base_external_resource_list *) (uintptr_t) katom->jc; + ext_res = katom->softjob_data; if (!ext_res) goto failed_jc; @@ -1260,7 +1264,7 @@ static void kbase_ext_res_finish(struct kbase_jd_atom *katom) { struct base_external_resource_list *ext_res; - ext_res = (struct base_external_resource_list *) (uintptr_t) katom->jc; + ext_res = katom->softjob_data; /* Free the info structure */ kfree(ext_res); } diff --git a/mali_kbase/mali_kbase_strings.c b/mali_kbase/mali_kbase_strings.c index c98762c..22caa4a 100644 --- a/mali_kbase/mali_kbase_strings.c +++ b/mali_kbase/mali_kbase_strings.c @@ -7,13 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include "mali_kbase_strings.h" #define KBASE_DRV_NAME "mali" diff --git a/mali_kbase/mali_kbase_strings.h b/mali_kbase/mali_kbase_strings.h index 41b8fdb..d2f1825 100644 --- a/mali_kbase/mali_kbase_strings.h +++ b/mali_kbase/mali_kbase_strings.h @@ -7,13 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - extern const char kbase_drv_name[]; extern const char kbase_timeline_name[]; diff --git a/mali_kbase/mali_kbase_sync.h b/mali_kbase/mali_kbase_sync.h index de72147..a7690b2 100644 --- a/mali_kbase/mali_kbase_sync.h +++ b/mali_kbase/mali_kbase_sync.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_kbase_sync.h * diff --git a/mali_kbase/mali_kbase_sync_android.c b/mali_kbase/mali_kbase_sync_android.c index d7349dc..75940fb 100644 --- a/mali_kbase/mali_kbase_sync_android.c +++ b/mali_kbase/mali_kbase_sync_android.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Code for supporting explicit Android fences (CONFIG_SYNC) * Known to be good for kernels 4.5 and earlier. diff --git a/mali_kbase/mali_kbase_sync_common.c b/mali_kbase/mali_kbase_sync_common.c index 457def2..9520f5a 100644 --- a/mali_kbase/mali_kbase_sync_common.c +++ b/mali_kbase/mali_kbase_sync_common.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * @file mali_kbase_sync_common.c * diff --git a/mali_kbase/mali_kbase_sync_file.c b/mali_kbase/mali_kbase_sync_file.c index ef5b7ce..8f8f3c8 100644 --- a/mali_kbase/mali_kbase_sync_file.c +++ b/mali_kbase/mali_kbase_sync_file.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* * Code for supporting explicit Linux fences (CONFIG_SYNC_FILE) * Introduced in kernel 4.9. diff --git a/mali_kbase/mali_kbase_tlstream.c b/mali_kbase/mali_kbase_tlstream.c index d01aa23..926d6b6 100644 --- a/mali_kbase/mali_kbase_tlstream.c +++ b/mali_kbase/mali_kbase_tlstream.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include @@ -144,7 +149,7 @@ enum tl_msg_id_obj { KBASE_TL_ATTRIB_ATOM_CONFIG, KBASE_TL_ATTRIB_ATOM_PRIORITY, KBASE_TL_ATTRIB_ATOM_STATE, - KBASE_TL_ATTRIB_ATOM_PRIORITY_CHANGE, + KBASE_TL_ATTRIB_ATOM_PRIORITIZED, KBASE_TL_ATTRIB_ATOM_JIT, KBASE_TL_ATTRIB_AS_CONFIG, KBASE_TL_EVENT_LPU_SOFTSTOP, @@ -453,8 +458,8 @@ static const struct tp_desc tp_desc_obj[] = { "atom,state" }, { - KBASE_TL_ATTRIB_ATOM_PRIORITY_CHANGE, - __stringify(KBASE_TL_ATTRIB_ATOM_PRIORITY_CHANGE), + KBASE_TL_ATTRIB_ATOM_PRIORITIZED, + __stringify(KBASE_TL_ATTRIB_ATOM_PRIORITIZED), "atom caused priority change", "@p", "atom" @@ -2208,9 +2213,9 @@ void __kbase_tlstream_tl_attrib_atom_state(void *atom, u32 state) kbasep_tlstream_msgbuf_release(TL_STREAM_TYPE_OBJ, flags); } -void __kbase_tlstream_tl_attrib_atom_priority_change(void *atom) +void __kbase_tlstream_tl_attrib_atom_prioritized(void *atom) { - const u32 msg_id = KBASE_TL_ATTRIB_ATOM_PRIORITY_CHANGE; + const u32 msg_id = KBASE_TL_ATTRIB_ATOM_PRIORITIZED; const size_t msg_size = sizeof(msg_id) + sizeof(u64) + sizeof(atom); unsigned long flags; diff --git a/mali_kbase/mali_kbase_tlstream.h b/mali_kbase/mali_kbase_tlstream.h index c0a1117..f436901 100644 --- a/mali_kbase/mali_kbase_tlstream.h +++ b/mali_kbase/mali_kbase_tlstream.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #if !defined(_KBASE_TLSTREAM_H) #define _KBASE_TLSTREAM_H @@ -134,7 +139,7 @@ void __kbase_tlstream_tl_attrib_atom_config( void *atom, u64 jd, u64 affinity, u32 config); void __kbase_tlstream_tl_attrib_atom_priority(void *atom, u32 prio); void __kbase_tlstream_tl_attrib_atom_state(void *atom, u32 state); -void __kbase_tlstream_tl_attrib_atom_priority_change(void *atom); +void __kbase_tlstream_tl_attrib_atom_prioritized(void *atom); void __kbase_tlstream_tl_attrib_atom_jit( void *atom, u64 edit_addr, u64 new_addr); void __kbase_tlstream_tl_attrib_as_config( @@ -480,13 +485,13 @@ extern atomic_t kbase_tlstream_enabled; __TRACE_IF_ENABLED_LATENCY(tl_attrib_atom_state, atom, state) /** - * KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITY_CHANGE - atom caused priority change + * KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITIZED - atom was prioritized * @atom: name of the atom object * * Function emits a timeline message signalling priority change */ -#define KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITY_CHANGE(atom) \ - __TRACE_IF_ENABLED_LATENCY(tl_attrib_atom_priority_change, atom) +#define KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITIZED(atom) \ + __TRACE_IF_ENABLED_LATENCY(tl_attrib_atom_prioritized, atom) /** * KBASE_TLSTREAM_TL_ATTRIB_ATOM_JIT - jit happened on atom diff --git a/mali_kbase/mali_kbase_trace_defs.h b/mali_kbase/mali_kbase_trace_defs.h index e2e0544..32fffe0 100644 --- a/mali_kbase/mali_kbase_trace_defs.h +++ b/mali_kbase/mali_kbase_trace_defs.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* ***** IMPORTANT: THIS IS NOT A NORMAL HEADER FILE ***** * ***** DO NOT INCLUDE DIRECTLY ***** * ***** THE LACK OF HEADER GUARDS IS INTENTIONAL ***** */ diff --git a/mali_kbase/mali_kbase_trace_timeline.c b/mali_kbase/mali_kbase_trace_timeline.c index 5830e87..ee6bdf8 100644 --- a/mali_kbase/mali_kbase_trace_timeline.c +++ b/mali_kbase/mali_kbase_trace_timeline.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/mali_kbase_trace_timeline.h b/mali_kbase/mali_kbase_trace_timeline.h index 619072f..c1a3dfc 100644 --- a/mali_kbase/mali_kbase_trace_timeline.h +++ b/mali_kbase/mali_kbase_trace_timeline.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #if !defined(_KBASE_TRACE_TIMELINE_H) #define _KBASE_TRACE_TIMELINE_H diff --git a/mali_kbase/mali_kbase_trace_timeline_defs.h b/mali_kbase/mali_kbase_trace_timeline_defs.h index 156a95a..114bcac 100644 --- a/mali_kbase/mali_kbase_trace_timeline_defs.h +++ b/mali_kbase/mali_kbase_trace_timeline_defs.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* ***** IMPORTANT: THIS IS NOT A NORMAL HEADER FILE ***** * ***** DO NOT INCLUDE DIRECTLY ***** * ***** THE LACK OF HEADER GUARDS IS INTENTIONAL ***** */ diff --git a/mali_kbase/mali_kbase_utility.c b/mali_kbase/mali_kbase_utility.c index be474ff..3ea234a 100644 --- a/mali_kbase/mali_kbase_utility.c +++ b/mali_kbase/mali_kbase_utility.c @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include bool kbasep_list_member_of(const struct list_head *base, struct list_head *entry) diff --git a/mali_kbase/mali_kbase_utility.h b/mali_kbase/mali_kbase_utility.h index fd7252d..d36285e 100644 --- a/mali_kbase/mali_kbase_utility.h +++ b/mali_kbase/mali_kbase_utility.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_UTILITY_H #define _KBASE_UTILITY_H diff --git a/mali_kbase/mali_kbase_vinstr.c b/mali_kbase/mali_kbase_vinstr.c index c0d4292..60308be 100644 --- a/mali_kbase/mali_kbase_vinstr.c +++ b/mali_kbase/mali_kbase_vinstr.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/mali_kbase_vinstr.h b/mali_kbase/mali_kbase_vinstr.h index 4dbf7ee..af7c7b6 100644 --- a/mali_kbase/mali_kbase_vinstr.h +++ b/mali_kbase/mali_kbase_vinstr.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_VINSTR_H_ #define _KBASE_VINSTR_H_ diff --git a/mali_kbase/mali_linux_kbase_trace.h b/mali_kbase/mali_linux_kbase_trace.h index 5d6b402..da2ffaf 100644 --- a/mali_kbase/mali_linux_kbase_trace.h +++ b/mali_kbase/mali_linux_kbase_trace.h @@ -7,15 +7,20 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #if !defined(_TRACE_MALI_KBASE_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_MALI_KBASE_H diff --git a/mali_kbase/mali_linux_trace.h b/mali_kbase/mali_linux_trace.h index 2be06a5..0741dfc 100644 --- a/mali_kbase/mali_linux_trace.h +++ b/mali_kbase/mali_linux_trace.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #if !defined(_TRACE_MALI_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_MALI_H diff --git a/mali_kbase/mali_malisw.h b/mali_kbase/mali_malisw.h index 9945293..f17bd5e 100644 --- a/mali_kbase/mali_malisw.h +++ b/mali_kbase/mali_malisw.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * Kernel-wide include for common macros and types. */ diff --git a/mali_kbase/mali_midg_coherency.h b/mali_kbase/mali_midg_coherency.h index a509cbd..29d5df3 100644 --- a/mali_kbase/mali_midg_coherency.h +++ b/mali_kbase/mali_midg_coherency.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _MIDG_COHERENCY_H_ #define _MIDG_COHERENCY_H_ diff --git a/mali_kbase/mali_midg_regmap.h b/mali_kbase/mali_midg_regmap.h index 59adfb8..5e83ee8 100644 --- a/mali_kbase/mali_midg_regmap.h +++ b/mali_kbase/mali_midg_regmap.h @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _MIDGARD_REGMAP_H_ #define _MIDGARD_REGMAP_H_ diff --git a/mali_kbase/mali_timeline.h b/mali_kbase/mali_timeline.h index bd5f661..d0deead 100644 --- a/mali_kbase/mali_timeline.h +++ b/mali_kbase/mali_timeline.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #undef TRACE_SYSTEM #define TRACE_SYSTEM mali_timeline diff --git a/mali_kbase/mali_uk.h b/mali_kbase/mali_uk.h index 841d03f..961a4a5 100644 --- a/mali_kbase/mali_uk.h +++ b/mali_kbase/mali_uk.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /** * @file mali_uk.h * Types and definitions that are common across OSs for both the user diff --git a/mali_kbase/platform/Kconfig b/mali_kbase/platform/Kconfig index 38835d3..ef9fb96 100644 --- a/mali_kbase/platform/Kconfig +++ b/mali_kbase/platform/Kconfig @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - diff --git a/mali_kbase/platform/devicetree/Kbuild b/mali_kbase/platform/devicetree/Kbuild index d40d798..ce637fb 100644 --- a/mali_kbase/platform/devicetree/Kbuild +++ b/mali_kbase/platform/devicetree/Kbuild @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - mali_kbase-y += \ $(MALI_PLATFORM_DIR)/mali_kbase_config_devicetree.o \ diff --git a/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c b/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c index 299d0e7..ccefddf 100644 --- a/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c +++ b/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c @@ -7,22 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include -int kbase_platform_early_init(void) -{ - /* Nothing needed at this stage */ - return 0; -} - static struct kbase_platform_config dummy_platform_config; struct kbase_platform_config *kbase_get_platform_config(void) diff --git a/mali_kbase/platform/devicetree/mali_kbase_config_platform.h b/mali_kbase/platform/devicetree/mali_kbase_config_platform.h index 2ceca34..5990313 100644 --- a/mali_kbase/platform/devicetree/mali_kbase_config_platform.h +++ b/mali_kbase/platform/devicetree/mali_kbase_config_platform.h @@ -7,52 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. * - */ - - - -/** - * Maximum frequency GPU will be clocked at. Given in kHz. - * This must be specified as there is no default value. - * - * Attached value: number in kHz - * Default value: NA - */ -#define GPU_FREQ_KHZ_MAX (5000) -/** - * Minimum frequency GPU will be clocked at. Given in kHz. - * This must be specified as there is no default value. - * - * Attached value: number in kHz - * Default value: NA - */ -#define GPU_FREQ_KHZ_MIN (5000) - -/** - * CPU_SPEED_FUNC - A pointer to a function that calculates the CPU clock - * - * CPU clock speed of the platform is in MHz - see kbase_cpu_clk_speed_func - * for the function prototype. - * - * Attached value: A kbase_cpu_clk_speed_func. - * Default Value: NA - */ -#define CPU_SPEED_FUNC (NULL) - -/** - * GPU_SPEED_FUNC - A pointer to a function that calculates the GPU clock + * 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. * - * GPU clock speed of the platform in MHz - see kbase_gpu_clk_speed_func - * for the function prototype. + * SPDX-License-Identifier: GPL-2.0 * - * Attached value: A kbase_gpu_clk_speed_func. - * Default Value: NA */ -#define GPU_SPEED_FUNC (NULL) /** * Power management configuration diff --git a/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c b/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c index 372420a..c5f3ad7 100644 --- a/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c +++ b/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/platform/mali_kbase_platform_common.h b/mali_kbase/platform/mali_kbase_platform_common.h deleted file mode 100644 index 7cb3be7..0000000 --- a/mali_kbase/platform/mali_kbase_platform_common.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * (C) COPYRIGHT 2010-2013 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 licence. - * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - - - -/** - * @brief Entry point to transfer control to a platform for early initialization - * - * This function is called early on in the initialization during execution of - * @ref kbase_driver_init. - * - * @return Zero to indicate success non-zero for failure. - */ -int kbase_platform_early_init(void); diff --git a/mali_kbase/platform/vexpress/Kbuild b/mali_kbase/platform/vexpress/Kbuild index d9d5e90..6780e4c 100644 --- a/mali_kbase/platform/vexpress/Kbuild +++ b/mali_kbase/platform/vexpress/Kbuild @@ -6,14 +6,19 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - mali_kbase-y += \ $(MALI_PLATFORM_DIR)/mali_kbase_config_vexpress.o \ - $(MALI_PLATFORM_DIR)/mali_kbase_cpu_vexpress.o \ mali_kbase_platform_fake.o diff --git a/mali_kbase/platform/vexpress/mali_kbase_config_platform.h b/mali_kbase/platform/vexpress/mali_kbase_config_platform.h index 02835f1..fac3cd5 100644 --- a/mali_kbase/platform/vexpress/mali_kbase_config_platform.h +++ b/mali_kbase/platform/vexpress/mali_kbase_config_platform.h @@ -7,54 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. * - */ - - - -#include "mali_kbase_cpu_vexpress.h" - -/** - * Maximum frequency GPU will be clocked at. Given in kHz. - * This must be specified as there is no default value. - * - * Attached value: number in kHz - * Default value: NA - */ -#define GPU_FREQ_KHZ_MAX kbase_get_platform_max_freq() -/** - * Minimum frequency GPU will be clocked at. Given in kHz. - * This must be specified as there is no default value. - * - * Attached value: number in kHz - * Default value: NA - */ -#define GPU_FREQ_KHZ_MIN kbase_get_platform_min_freq() - -/** - * CPU_SPEED_FUNC - A pointer to a function that calculates the CPU clock - * - * CPU clock speed of the platform is in MHz - see kbase_cpu_clk_speed_func - * for the function prototype. - * - * Attached value: A kbase_cpu_clk_speed_func. - * Default Value: NA - */ -#define CPU_SPEED_FUNC (&kbase_get_vexpress_cpu_clock_speed) - -/** - * GPU_SPEED_FUNC - A pointer to a function that calculates the GPU clock + * 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. * - * GPU clock speed of the platform in MHz - see kbase_gpu_clk_speed_func - * for the function prototype. + * SPDX-License-Identifier: GPL-2.0 * - * Attached value: A kbase_gpu_clk_speed_func. - * Default Value: NA */ -#define GPU_SPEED_FUNC (NULL) /** * Power management configuration diff --git a/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c b/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c index 745884f..d165ce2 100644 --- a/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c +++ b/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c @@ -7,21 +7,25 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include #include -#include "mali_kbase_cpu_vexpress.h" #include "mali_kbase_config_platform.h" #ifndef CONFIG_OF @@ -63,10 +67,3 @@ struct kbase_platform_config *kbase_get_platform_config(void) { return &versatile_platform_config; } - - -int kbase_platform_early_init(void) -{ - /* Nothing needed at this stage */ - return 0; -} diff --git a/mali_kbase/platform/vexpress/mali_kbase_cpu_vexpress.c b/mali_kbase/platform/vexpress/mali_kbase_cpu_vexpress.c deleted file mode 100644 index 4665f98..0000000 --- a/mali_kbase/platform/vexpress/mali_kbase_cpu_vexpress.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * - * (C) COPYRIGHT 2011-2016 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 licence. - * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - - - -#include -#include -#include "mali_kbase_cpu_vexpress.h" - -#define HZ_IN_MHZ (1000000) - -#define CORETILE_EXPRESS_A9X4_SCC_START (0x100E2000) -#define MOTHERBOARD_SYS_CFG_START (0x10000000) -#define SYS_CFGDATA_OFFSET (0x000000A0) -#define SYS_CFGCTRL_OFFSET (0x000000A4) -#define SYS_CFGSTAT_OFFSET (0x000000A8) - -#define SYS_CFGCTRL_START_BIT_VALUE (1 << 31) -#define READ_REG_BIT_VALUE (0 << 30) -#define DCC_DEFAULT_BIT_VALUE (0 << 26) -#define SYS_CFG_OSC_FUNC_BIT_VALUE (1 << 20) -#define SITE_DEFAULT_BIT_VALUE (1 << 16) -#define BOARD_STACK_POS_DEFAULT_BIT_VALUE (0 << 12) -#define DEVICE_DEFAULT_BIT_VALUE (2 << 0) -#define SYS_CFG_COMPLETE_BIT_VALUE (1 << 0) -#define SYS_CFG_ERROR_BIT_VALUE (1 << 1) - -#define FEED_REG_BIT_MASK (0x0F) -#define FCLK_PA_DIVIDE_BIT_SHIFT (0x03) -#define FCLK_PB_DIVIDE_BIT_SHIFT (0x07) -#define FCLK_PC_DIVIDE_BIT_SHIFT (0x0B) -#define AXICLK_PA_DIVIDE_BIT_SHIFT (0x0F) -#define AXICLK_PB_DIVIDE_BIT_SHIFT (0x13) - -/* the following three values used for reading - * HBI value of the LogicTile daughterboard */ -#define VE_MOTHERBOARD_PERIPHERALS_SMB_CS7 (0x10000000) -#define VE_SYS_PROC_ID1_OFFSET (0x00000088) -#define VE_LOGIC_TILE_HBI_MASK (0x00000FFF) - -#define IS_SINGLE_BIT_SET(val, pos) (val&(1<> - FCLK_PA_DIVIDE_BIT_SHIFT); - /* CFGRW0[10:7] */ - pb_divide = ((reg_val & (FEED_REG_BIT_MASK << - FCLK_PB_DIVIDE_BIT_SHIFT)) >> - FCLK_PB_DIVIDE_BIT_SHIFT); - *cpu_clock = osc2_value * (pa_divide + 1) / (pb_divide + 1); - } else if (IS_SINGLE_BIT_SET(reg_val, 1)) { - /* CFGRW0[1] - CLKOC */ - /* CFGRW0[6:3] */ - pa_divide = ((reg_val & (FEED_REG_BIT_MASK << - FCLK_PA_DIVIDE_BIT_SHIFT)) >> - FCLK_PA_DIVIDE_BIT_SHIFT); - /* CFGRW0[14:11] */ - pc_divide = ((reg_val & (FEED_REG_BIT_MASK << - FCLK_PC_DIVIDE_BIT_SHIFT)) >> - FCLK_PC_DIVIDE_BIT_SHIFT); - *cpu_clock = osc2_value * (pa_divide + 1) / (pc_divide + 1); - } else if (IS_SINGLE_BIT_SET(reg_val, 2)) { - /* CFGRW0[2] - FACLK */ - /* CFGRW0[18:15] */ - pa_divide = ((reg_val & (FEED_REG_BIT_MASK << - AXICLK_PA_DIVIDE_BIT_SHIFT)) >> - AXICLK_PA_DIVIDE_BIT_SHIFT); - /* CFGRW0[22:19] */ - pb_divide = ((reg_val & (FEED_REG_BIT_MASK << - AXICLK_PB_DIVIDE_BIT_SHIFT)) >> - AXICLK_PB_DIVIDE_BIT_SHIFT); - *cpu_clock = osc2_value * (pa_divide + 1) / (pb_divide + 1); - } else { - err = -EIO; - } - -set_reg_error: -ongoing_request: - raw_spin_unlock(&syscfg_lock); - *cpu_clock /= HZ_IN_MHZ; - - if (!err) - cpu_clock_speed = *cpu_clock; - - iounmap(scc_reg); - -scc_reg_map_failed: - iounmap(syscfg_reg); - -syscfg_reg_map_failed: - - return err; -} - -/** - * kbase_get_platform_logic_tile_type - determines which LogicTile type - * is used by Versatile Express - * - * When platform_config build parameter is specified as vexpress, i.e., - * platform_config=vexpress, GPU frequency may vary dependent on the - * particular platform. The GPU frequency depends on the LogicTile type. - * - * This function determines which LogicTile type is used by the platform by - * reading the HBI value of the daughterboard which holds the LogicTile: - * - * 0x217 HBI0217 Virtex-6 - * 0x192 HBI0192 Virtex-5 - * 0x247 HBI0247 Virtex-7 - * - * Return: HBI value of the logic tile daughterboard, zero if not accessible - */ -static u32 kbase_get_platform_logic_tile_type(void) -{ - void __iomem *syscfg_reg = NULL; - u32 sys_procid1 = 0; - - syscfg_reg = ioremap(VE_MOTHERBOARD_PERIPHERALS_SMB_CS7 + VE_SYS_PROC_ID1_OFFSET, 4); - if (NULL != syscfg_reg) { - sys_procid1 = readl(syscfg_reg); - iounmap(syscfg_reg); - } - - return sys_procid1 & VE_LOGIC_TILE_HBI_MASK; -} - -u32 kbase_get_platform_min_freq(void) -{ - u32 ve_logic_tile = kbase_get_platform_logic_tile_type(); - - switch (ve_logic_tile) { - case 0x217: - /* Virtex 6, HBI0217 */ - return VE_VIRTEX6_GPU_FREQ_MIN; - case 0x247: - /* Virtex 7, HBI0247 */ - return VE_VIRTEX7_GPU_FREQ_MIN; - default: - /* all other logic tiles, i.e., Virtex 5 HBI0192 - * or unsuccessful reading from the platform - - * fall back to some default value */ - return VE_DEFAULT_GPU_FREQ_MIN; - } -} - -u32 kbase_get_platform_max_freq(void) -{ - u32 ve_logic_tile = kbase_get_platform_logic_tile_type(); - - switch (ve_logic_tile) { - case 0x217: - /* Virtex 6, HBI0217 */ - return VE_VIRTEX6_GPU_FREQ_MAX; - case 0x247: - /* Virtex 7, HBI0247 */ - return VE_VIRTEX7_GPU_FREQ_MAX; - default: - /* all other logic tiles, i.e., Virtex 5 HBI0192 - * or unsuccessful reading from the platform - - * fall back to some default value */ - return VE_DEFAULT_GPU_FREQ_MAX; - } -} diff --git a/mali_kbase/platform/vexpress/mali_kbase_cpu_vexpress.h b/mali_kbase/platform/vexpress/mali_kbase_cpu_vexpress.h deleted file mode 100644 index da86569..0000000 --- a/mali_kbase/platform/vexpress/mali_kbase_cpu_vexpress.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * (C) COPYRIGHT 2012-2013, 2015-2016 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 licence. - * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - - - - - -#ifndef _KBASE_CPU_VEXPRESS_H_ -#define _KBASE_CPU_VEXPRESS_H_ - -/** - * Versatile Express implementation of @ref kbase_cpu_clk_speed_func. - */ -int kbase_get_vexpress_cpu_clock_speed(u32 *cpu_clock); - -/** - * Get the minimum GPU frequency for the attached logic tile - */ -u32 kbase_get_platform_min_freq(void); - -/** - * Get the maximum GPU frequency for the attached logic tile - */ -u32 kbase_get_platform_max_freq(void); - -#endif /* _KBASE_CPU_VEXPRESS_H_ */ diff --git a/mali_kbase/platform/vexpress_1xv7_a57/Kbuild b/mali_kbase/platform/vexpress_1xv7_a57/Kbuild index df87c74..51b408e 100644 --- a/mali_kbase/platform/vexpress_1xv7_a57/Kbuild +++ b/mali_kbase/platform/vexpress_1xv7_a57/Kbuild @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - mali_kbase-y += \ $(MALI_PLATFORM_DIR)/mali_kbase_config_vexpress.o \ diff --git a/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h b/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h index 0efbf39..fac3cd5 100644 --- a/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h +++ b/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h @@ -7,52 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. * - */ - - - -/** - * Maximum frequency GPU will be clocked at. Given in kHz. - * This must be specified as there is no default value. - * - * Attached value: number in kHz - * Default value: NA - */ -#define GPU_FREQ_KHZ_MAX 5000 -/** - * Minimum frequency GPU will be clocked at. Given in kHz. - * This must be specified as there is no default value. - * - * Attached value: number in kHz - * Default value: NA - */ -#define GPU_FREQ_KHZ_MIN 5000 - -/** - * CPU_SPEED_FUNC - A pointer to a function that calculates the CPU clock - * - * CPU clock speed of the platform is in MHz - see kbase_cpu_clk_speed_func - * for the function prototype. - * - * Attached value: A kbase_cpu_clk_speed_func. - * Default Value: NA - */ -#define CPU_SPEED_FUNC (&kbase_cpuprops_get_default_clock_speed) - -/** - * GPU_SPEED_FUNC - A pointer to a function that calculates the GPU clock + * 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. * - * GPU clock speed of the platform in MHz - see kbase_gpu_clk_speed_func - * for the function prototype. + * SPDX-License-Identifier: GPL-2.0 * - * Attached value: A kbase_gpu_clk_speed_func. - * Default Value: NA */ -#define GPU_SPEED_FUNC (NULL) /** * Power management configuration diff --git a/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c b/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c index 5a69758..efca0a5 100644 --- a/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c +++ b/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include @@ -58,9 +63,3 @@ struct kbase_platform_config *kbase_get_platform_config(void) { return &versatile_platform_config; } - -int kbase_platform_early_init(void) -{ - /* Nothing needed at this stage */ - return 0; -} diff --git a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild index d9d5e90..e07709c 100644 --- a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild +++ b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - mali_kbase-y += \ $(MALI_PLATFORM_DIR)/mali_kbase_config_vexpress.o \ diff --git a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h index dbdf21e..fac3cd5 100644 --- a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h +++ b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h @@ -7,54 +7,18 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. * - */ - - - -#include "mali_kbase_cpu_vexpress.h" - -/** - * Maximum frequency GPU will be clocked at. Given in kHz. - * This must be specified as there is no default value. - * - * Attached value: number in kHz - * Default value: NA - */ -#define GPU_FREQ_KHZ_MAX 10000 -/** - * Minimum frequency GPU will be clocked at. Given in kHz. - * This must be specified as there is no default value. - * - * Attached value: number in kHz - * Default value: NA - */ -#define GPU_FREQ_KHZ_MIN 10000 - -/** - * CPU_SPEED_FUNC - A pointer to a function that calculates the CPU clock - * - * CPU clock speed of the platform is in MHz - see kbase_cpu_clk_speed_func - * for the function prototype. - * - * Attached value: A kbase_cpu_clk_speed_func. - * Default Value: NA - */ -#define CPU_SPEED_FUNC (&kbase_get_vexpress_cpu_clock_speed) - -/** - * GPU_SPEED_FUNC - A pointer to a function that calculates the GPU clock + * 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. * - * GPU clock speed of the platform in MHz - see kbase_gpu_clk_speed_func - * for the function prototype. + * SPDX-License-Identifier: GPL-2.0 * - * Attached value: A kbase_gpu_clk_speed_func. - * Default Value: NA */ -#define GPU_SPEED_FUNC (NULL) /** * Power management configuration diff --git a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c index 5d8ec2d..b6714b9 100644 --- a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c +++ b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c @@ -7,21 +7,25 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include #include -#include "mali_kbase_cpu_vexpress.h" #ifndef CONFIG_OF static struct kbase_io_resources io_resources = { @@ -61,10 +65,3 @@ struct kbase_platform_config *kbase_get_platform_config(void) { return &versatile_platform_config; } - -int kbase_platform_early_init(void) -{ - /* Nothing needed at this stage */ - return 0; -} - diff --git a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.c b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.c deleted file mode 100644 index 816dff4..0000000 --- a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * (C) COPYRIGHT 2011-2013 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 licence. - * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - - - - - -#include -#include -#include "mali_kbase_cpu_vexpress.h" - -#define HZ_IN_MHZ (1000000) - -#define CORETILE_EXPRESS_A9X4_SCC_START (0x100E2000) -#define MOTHERBOARD_SYS_CFG_START (0x10000000) -#define SYS_CFGDATA_OFFSET (0x000000A0) -#define SYS_CFGCTRL_OFFSET (0x000000A4) -#define SYS_CFGSTAT_OFFSET (0x000000A8) - -#define SYS_CFGCTRL_START_BIT_VALUE (1 << 31) -#define READ_REG_BIT_VALUE (0 << 30) -#define DCC_DEFAULT_BIT_VALUE (0 << 26) -#define SYS_CFG_OSC_FUNC_BIT_VALUE (1 << 20) -#define SITE_DEFAULT_BIT_VALUE (1 << 16) -#define BOARD_STACK_POS_DEFAULT_BIT_VALUE (0 << 12) -#define DEVICE_DEFAULT_BIT_VALUE (2 << 0) -#define SYS_CFG_COMPLETE_BIT_VALUE (1 << 0) -#define SYS_CFG_ERROR_BIT_VALUE (1 << 1) - -#define FEED_REG_BIT_MASK (0x0F) -#define FCLK_PA_DIVIDE_BIT_SHIFT (0x03) -#define FCLK_PB_DIVIDE_BIT_SHIFT (0x07) -#define FCLK_PC_DIVIDE_BIT_SHIFT (0x0B) -#define AXICLK_PA_DIVIDE_BIT_SHIFT (0x0F) -#define AXICLK_PB_DIVIDE_BIT_SHIFT (0x13) - -#define IS_SINGLE_BIT_SET(val, pos) (val&(1< diff --git a/mali_kbase/tests/kutf/kutf_helpers_user.c b/mali_kbase/tests/kutf/kutf_helpers_user.c index 9e8ab99..108fa82 100644 --- a/mali_kbase/tests/kutf/kutf_helpers_user.c +++ b/mali_kbase/tests/kutf/kutf_helpers_user.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* Kernel UTF test helpers that mirror those for kutf-userside */ #include #include @@ -22,6 +27,7 @@ #include #include +#include const char *valtype_names[] = { "INVALID", diff --git a/mali_kbase/tests/kutf/kutf_mem.c b/mali_kbase/tests/kutf/kutf_mem.c index a75e15f..fd98bea 100644 --- a/mali_kbase/tests/kutf/kutf_mem.c +++ b/mali_kbase/tests/kutf/kutf_mem.c @@ -7,18 +7,24 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* Kernel UTF memory management functions */ #include #include +#include #include diff --git a/mali_kbase/tests/kutf/kutf_resultset.c b/mali_kbase/tests/kutf/kutf_resultset.c index 41645a4..94ecfa4 100644 --- a/mali_kbase/tests/kutf/kutf_resultset.c +++ b/mali_kbase/tests/kutf/kutf_resultset.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* Kernel UTF result management functions */ #include diff --git a/mali_kbase/tests/kutf/kutf_suite.c b/mali_kbase/tests/kutf/kutf_suite.c index 4968f24..1c350bb 100644 --- a/mali_kbase/tests/kutf/kutf_suite.c +++ b/mali_kbase/tests/kutf/kutf_suite.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* Kernel UTF suite, test and fixture management including user to kernel * interaction */ @@ -181,26 +186,6 @@ static void kutf_set_result(struct kutf_context *context, static void kutf_set_expected_result(struct kutf_context *context, enum kutf_result_status expected_status); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) -/* Pre 3.4.0 kernels don't have the simple_open helper */ - -/** - * simple_open() - Helper for file opening which stores the inode private data - * into the file private data - * @inode: File entry representation - * @file: A specific opening of the file - * - * Return: always 0; if inode private data do not exist, the file will not - * be assigned private data - */ -static int simple_open(struct inode *inode, struct file *file) -{ - if (inode->i_private) - file->private_data = inode->i_private; - return 0; -} -#endif - /** * kutf_result_to_string() - Converts a KUTF result into a string * @result_str: Output result string diff --git a/mali_kbase/tests/kutf/kutf_utils.c b/mali_kbase/tests/kutf/kutf_utils.c index a429a2d..7f5ac51 100644 --- a/mali_kbase/tests/kutf/kutf_utils.c +++ b/mali_kbase/tests/kutf/kutf_utils.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - /* Kernel UTF utility functions */ #include diff --git a/mali_kbase/tests/kutf/sconscript b/mali_kbase/tests/kutf/sconscript index d7f1124..98f6446 100644 --- a/mali_kbase/tests/kutf/sconscript +++ b/mali_kbase/tests/kutf/sconscript @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - Import('kutf_env') diff --git a/mali_kbase/tests/mali_kutf_irq_test/Kbuild b/mali_kbase/tests/mali_kutf_irq_test/Kbuild index 0cd9ceb..ca8c512 100644 --- a/mali_kbase/tests/mali_kutf_irq_test/Kbuild +++ b/mali_kbase/tests/mali_kutf_irq_test/Kbuild @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - ccflags-y += -I$(src)/../include -I$(src)/../../../ -I$(src)/../../ -I$(src)/../../backend/gpu -I$(srctree)/drivers/staging/android diff --git a/mali_kbase/tests/mali_kutf_irq_test/Kconfig b/mali_kbase/tests/mali_kutf_irq_test/Kconfig index f4553d3..4a3863a 100644 --- a/mali_kbase/tests/mali_kutf_irq_test/Kconfig +++ b/mali_kbase/tests/mali_kutf_irq_test/Kconfig @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - config MALI_IRQ_LATENCY tristate "Mali GPU IRQ latency measurement" diff --git a/mali_kbase/tests/mali_kutf_irq_test/Makefile b/mali_kbase/tests/mali_kutf_irq_test/Makefile index 2ac4f97..e3dc5eb 100644 --- a/mali_kbase/tests/mali_kutf_irq_test/Makefile +++ b/mali_kbase/tests/mali_kutf_irq_test/Makefile @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - # linux build system bootstrap for out-of-tree module diff --git a/mali_kbase/tests/mali_kutf_irq_test/mali_kutf_irq_test_main.c b/mali_kbase/tests/mali_kutf_irq_test/mali_kutf_irq_test_main.c index c9cc444..5013a9d 100644 --- a/mali_kbase/tests/mali_kutf_irq_test/mali_kutf_irq_test_main.c +++ b/mali_kbase/tests/mali_kutf_irq_test/mali_kutf_irq_test_main.c @@ -7,14 +7,19 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * 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. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #include #include #include diff --git a/mali_kbase/tests/mali_kutf_irq_test/sconscript b/mali_kbase/tests/mali_kutf_irq_test/sconscript index 280fa98..be69514 100644 --- a/mali_kbase/tests/mali_kutf_irq_test/sconscript +++ b/mali_kbase/tests/mali_kutf_irq_test/sconscript @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - import os Import('env') diff --git a/mali_kbase/tests/sconscript b/mali_kbase/tests/sconscript index 0458411..0bd24a5 100644 --- a/mali_kbase/tests/sconscript +++ b/mali_kbase/tests/sconscript @@ -6,12 +6,18 @@ # Foundation, and any use by you of this program is subject to the terms # of such GNU licence. # -# A copy of the licence is included with the program, and can also be obtained -# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# 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. +# +# SPDX-License-Identifier: GPL-2.0 # # - Import ('env') diff --git a/mali_kbase/thirdparty/mali_kbase_mmap.c b/mali_kbase/thirdparty/mali_kbase_mmap.c new file mode 100644 index 0000000..1690da4 --- /dev/null +++ b/mali_kbase/thirdparty/mali_kbase_mmap.c @@ -0,0 +1,321 @@ +/* + * + * (C) COPYRIGHT 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 licence. + * + * 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. + * + * SPDX-License-Identifier: GPL-2.0 + * + *//* + * 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 licence. + * + * A copy of the licence is included with the program, and can also be obtained + * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "linux/mman.h" +#include "../mali_kbase.h" + +/* mali_kbase_mmap.c + * + * This file contains Linux specific implementation of + * kbase_get_unmapped_area() interface. + */ + + +/** + * align_and_check() - Align the specified pointer to the provided alignment and + * check that it is still in range. + * @gap_end: Highest possible start address for allocation (end of gap in + * address space) + * @gap_start: Start address of current memory area / gap in address space + * @info: vm_unmapped_area_info structure passed to caller, containing + * alignment, length and limits for the allocation + * @is_shader_code: True if the allocation is for shader code (which has + * additional alignment requirements) + * + * Return: true if gap_end is now aligned correctly and is still in range, + * false otherwise + */ +static bool align_and_check(unsigned long *gap_end, unsigned long gap_start, + struct vm_unmapped_area_info *info, bool is_shader_code) +{ + /* Compute highest gap address at the desired alignment */ + (*gap_end) -= info->length; + (*gap_end) -= (*gap_end - info->align_offset) & info->align_mask; + + if (is_shader_code) { + /* Check for 4GB boundary */ + if (0 == (*gap_end & BASE_MEM_MASK_4GB)) + (*gap_end) -= (info->align_offset ? info->align_offset : + info->length); + if (0 == ((*gap_end + info->length) & BASE_MEM_MASK_4GB)) + (*gap_end) -= (info->align_offset ? info->align_offset : + info->length); + + if (!(*gap_end & BASE_MEM_MASK_4GB) || !((*gap_end + + info->length) & BASE_MEM_MASK_4GB)) + return false; + } + + + if ((*gap_end < info->low_limit) || (*gap_end < gap_start)) + return false; + + + return true; +} + +/** + * kbase_unmapped_area_topdown() - allocates new areas top-down from + * below the stack limit. + * @info: Information about the memory area to allocate. + * @is_shader_code: Boolean which denotes whether the allocated area is + * intended for the use by shader core in which case a + * special alignment requirements apply. + * + * The unmapped_area_topdown() function in the Linux kernel is not exported + * using EXPORT_SYMBOL_GPL macro. To allow us to call this function from a + * module and also make use of the fact that some of the requirements for + * the unmapped area are known in advance, we implemented an extended version + * of this function and prefixed it with 'kbase_'. + * + * The difference in the call parameter list comes from the fact that + * kbase_unmapped_area_topdown() is called with additional parameter which + * is provided to denote whether the allocation is for a shader core memory + * or not. This is significant since the executable shader core memory has + * additional alignment requirements. + * + * The modification of the original Linux function lies in how the computation + * of the highest gap address at the desired alignment is performed once the + * gap with desirable properties is found. For this purpose a special function + * is introduced (@ref align_and_check()) which beside computing the gap end + * at the desired alignment also performs additional alignment check for the + * case when the memory is executable shader core memory. For such case, it is + * ensured that the gap does not end on a 4GB boundary. + * + * Return: address of the found gap end (high limit) if area is found; + * -ENOMEM if search is unsuccessful +*/ + +static unsigned long kbase_unmapped_area_topdown(struct vm_unmapped_area_info + *info, bool is_shader_code) +{ + struct mm_struct *mm = current->mm; + struct vm_area_struct *vma; + unsigned long length, low_limit, high_limit, gap_start, gap_end; + + /* Adjust search length to account for worst case alignment overhead */ + length = info->length + info->align_mask; + if (length < info->length) + return -ENOMEM; + + /* + * Adjust search limits by the desired length. + * See implementation comment at top of unmapped_area(). + */ + gap_end = info->high_limit; + if (gap_end < length) + return -ENOMEM; + high_limit = gap_end - length; + + if (info->low_limit > high_limit) + return -ENOMEM; + low_limit = info->low_limit + length; + + /* Check highest gap, which does not precede any rbtree node */ + gap_start = mm->highest_vm_end; + if (gap_start <= high_limit) { + if (align_and_check(&gap_end, gap_start, info, is_shader_code)) + return gap_end; + } + + /* Check if rbtree root looks promising */ + if (RB_EMPTY_ROOT(&mm->mm_rb)) + return -ENOMEM; + vma = rb_entry(mm->mm_rb.rb_node, struct vm_area_struct, vm_rb); + if (vma->rb_subtree_gap < length) + return -ENOMEM; + + while (true) { + /* Visit right subtree if it looks promising */ + gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; + if (gap_start <= high_limit && vma->vm_rb.rb_right) { + struct vm_area_struct *right = + rb_entry(vma->vm_rb.rb_right, + struct vm_area_struct, vm_rb); + if (right->rb_subtree_gap >= length) { + vma = right; + continue; + } + } + +check_current: + /* Check if current node has a suitable gap */ + gap_end = vma->vm_start; + if (gap_end < low_limit) + return -ENOMEM; + if (gap_start <= high_limit && gap_end - gap_start >= length) { + /* We found a suitable gap. Clip it with the original + * high_limit. */ + if (gap_end > info->high_limit) + gap_end = info->high_limit; + + if (align_and_check(&gap_end, gap_start, info, + is_shader_code)) + return gap_end; + } + + /* Visit left subtree if it looks promising */ + if (vma->vm_rb.rb_left) { + struct vm_area_struct *left = + rb_entry(vma->vm_rb.rb_left, + struct vm_area_struct, vm_rb); + if (left->rb_subtree_gap >= length) { + vma = left; + continue; + } + } + + /* Go back up the rbtree to find next candidate node */ + while (true) { + struct rb_node *prev = &vma->vm_rb; + + if (!rb_parent(prev)) + return -ENOMEM; + vma = rb_entry(rb_parent(prev), + struct vm_area_struct, vm_rb); + if (prev == vma->vm_rb.rb_right) { + gap_start = vma->vm_prev ? + vma->vm_prev->vm_end : 0; + goto check_current; + } + } + } + + return -ENOMEM; +} + + +/* This function is based on Linux kernel's arch_get_unmapped_area, but + * simplified slightly. Modifications come from the fact that some values + * about the memory area are known in advance. + */ +unsigned long kbase_get_unmapped_area(struct file *filp, + const unsigned long addr, const unsigned long len, + const unsigned long pgoff, const unsigned long flags) +{ + struct kbase_context *kctx = filp->private_data; + struct mm_struct *mm = current->mm; + struct vm_unmapped_area_info info; + unsigned long align_offset = 0; + unsigned long align_mask = 0; + unsigned long high_limit = mm->mmap_base; + unsigned long low_limit = PAGE_SIZE; + int cpu_va_bits = BITS_PER_LONG; + int gpu_pc_bits = + kctx->kbdev->gpu_props.props.core_props.log2_program_counter_size; + bool is_shader_code = false; + unsigned long ret; + + /* err on fixed address */ + if ((flags & MAP_FIXED) || addr) + return -EINVAL; + +#ifdef CONFIG_64BIT + /* too big? */ + if (len > TASK_SIZE - SZ_2M) + return -ENOMEM; + + if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) { + + if (kbase_hw_has_feature(kctx->kbdev, + BASE_HW_FEATURE_33BIT_VA)) { + high_limit = kctx->same_va_end << PAGE_SHIFT; + } else { + high_limit = min_t(unsigned long, mm->mmap_base, + (kctx->same_va_end << PAGE_SHIFT)); + if (len >= SZ_2M) { + align_offset = SZ_2M; + align_mask = SZ_2M - 1; + } + } + + low_limit = SZ_2M; + } else { + cpu_va_bits = 32; + } +#endif /* CONFIG_64BIT */ + if ((PFN_DOWN(BASE_MEM_COOKIE_BASE) <= pgoff) && + (PFN_DOWN(BASE_MEM_FIRST_FREE_ADDRESS) > pgoff)) { + int cookie = pgoff - PFN_DOWN(BASE_MEM_COOKIE_BASE); + struct kbase_va_region *reg = + kctx->pending_regions[cookie]; + + if (!reg) + return -EINVAL; + + if (!(reg->flags & KBASE_REG_GPU_NX)) { + if (cpu_va_bits > gpu_pc_bits) { + align_offset = 1ULL << gpu_pc_bits; + align_mask = align_offset - 1; + is_shader_code = true; + } + } else if (reg->flags & KBASE_REG_TILER_ALIGN_TOP) { + unsigned long extent_bytes = + (unsigned long)(reg->extent << PAGE_SHIFT); + /* kbase_check_alloc_sizes() already satisfies + * these checks, but they're here to avoid + * maintenance hazards due to the assumptions + * involved */ + WARN_ON(reg->extent > (ULONG_MAX >> PAGE_SHIFT)); + WARN_ON(reg->initial_commit > (ULONG_MAX >> PAGE_SHIFT)); + WARN_ON(!is_power_of_2(extent_bytes)); + align_mask = extent_bytes - 1; + align_offset = + extent_bytes - (reg->initial_commit << PAGE_SHIFT); + } +#ifndef CONFIG_64BIT + } else { + return current->mm->get_unmapped_area(filp, addr, len, pgoff, + flags); +#endif + } + + info.flags = 0; + info.length = len; + info.low_limit = low_limit; + info.high_limit = high_limit; + info.align_offset = align_offset; + info.align_mask = align_mask; + + ret = kbase_unmapped_area_topdown(&info, is_shader_code); + + if (IS_ERR_VALUE(ret) && high_limit == mm->mmap_base && + high_limit < (kctx->same_va_end << PAGE_SHIFT)) { + /* Retry above mmap_base */ + info.low_limit = mm->mmap_base; + info.high_limit = min_t(u64, TASK_SIZE, + (kctx->same_va_end << PAGE_SHIFT)); + + ret = kbase_unmapped_area_topdown(&info, is_shader_code); + } + + return ret; +} -- cgit v1.2.3