diff options
author | Sidath Senanayake <sidaths@google.com> | 2021-04-20 15:26:53 +0100 |
---|---|---|
committer | Sidath Senanayake <sidaths@google.com> | 2021-04-20 15:26:53 +0100 |
commit | c83c70ba70ef485dfa4337da1a651cc86124598b (patch) | |
tree | 4cdfc1dd12e5076d7d33499accba3ba24ef49e30 /mali_kbase | |
parent | ceb3ef011c8ef7ff646f48a10188ebcb53c14cde (diff) | |
parent | 8037b534570814775d79aeddd06b76e5ee941f59 (diff) | |
download | gpu-c83c70ba70ef485dfa4337da1a651cc86124598b.tar.gz |
Merge r30p0 from upstream into android-gs-pixel-5.10
This commit updates the Mali KMD to version r30p0 from
commit 8037b534570814775d79aeddd06b76e5ee941f59
Bug: 180379272
Signed-off-by: Sidath Senanayake <sidaths@google.com>
Change-Id: I703f1da43913fab5cb5ac704630418b72655dc41
Diffstat (limited to 'mali_kbase')
353 files changed, 3154 insertions, 6175 deletions
diff --git a/mali_kbase/Kbuild b/mali_kbase/Kbuild index 49ef1fb..7dd7ed6 100644 --- a/mali_kbase/Kbuild +++ b/mali_kbase/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # -# (C) COPYRIGHT 2012-2020 ARM Limited. All rights reserved. +# (C) COPYRIGHT 2012-2021 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,13 +16,11 @@ # 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 ?= "r29p0-01eac0" +MALI_RELEASE_NAME ?= "r30p0-01eac0" # Append pixel to release name for debugging MALI_RELEASE_NAME := $(MALI_RELEASE_NAME)-pixel @@ -36,11 +35,8 @@ UMP_PATH = $(src)/../../../base # Set up defaults if not defined by build system MALI_CUSTOMER_RELEASE ?= 1 -MALI_USE_CSF ?= 0 MALI_UNIT_TEST ?= 0 -MALI_KERNEL_TEST_API ?= 0 MALI_COVERAGE ?= 0 -MALI_JIT_PRESSURE_LIMIT_BASE ?= 1 CONFIG_MALI_PLATFORM_NAME ?= "devicetree" # Experimental features (corresponding -D definition should be appended to # DEFINES below, e.g. for MALI_EXPERIMENTAL_FEATURE, @@ -50,6 +46,20 @@ CONFIG_MALI_PLATFORM_NAME ?= "devicetree" # MALI_EXPERIMENTAL_FEATURE ?= 0 MALI_INCREMENTAL_RENDERING ?= 0 +ifeq ($(CONFIG_MALI_CSF_SUPPORT),y) +MALI_JIT_PRESSURE_LIMIT_BASE = 0 +MALI_USE_CSF = 1 +else +MALI_JIT_PRESSURE_LIMIT_BASE ?= 1 +MALI_USE_CSF ?= 0 +endif + +ifneq ($(CONFIG_MALI_KUTF), n) +MALI_KERNEL_TEST_API ?= 1 +else +MALI_KERNEL_TEST_API ?= 0 +endif + # Set up our defines, which will be passed to gcc DEFINES = \ -DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \ @@ -63,11 +73,11 @@ DEFINES = \ # Pixel integration defines DEFINES += \ - -DCONFIG_MALI_MIDGARD_DVFS=y \ - -DCONFIG_MALI_PIXEL_GPU_QOS=y \ - -DCONFIG_MALI_PIXEL_GPU_BTS=y \ - -DCONFIG_MALI_PIXEL_GPU_THERMAL=y \ - -DCONFIG_MALI_PIXEL_GPU_SECURE_RENDERING=y + -DCONFIG_MALI_MIDGARD_DVFS=$(CONFIG_MALI_MIDGARD_DVFS) \ + -DCONFIG_MALI_PIXEL_GPU_QOS=$(CONFIG_MALI_PIXEL_GPU_QOS) \ + -DCONFIG_MALI_PIXEL_GPU_BTS=$(CONFIG_MALI_PIXEL_GPU_BTS) \ + -DCONFIG_MALI_PIXEL_GPU_THERMAL=$(CONFIG_MALI_PIXEL_GPU_THERMAL) \ + -DCONFIG_MALI_PIXEL_GPU_SECURE_RENDERING=$(CONFIG_MALI_PIXEL_GPU_SECURE_RENDERING) ifeq ($(KBUILD_EXTMOD),) # in-tree diff --git a/mali_kbase/Kconfig b/mali_kbase/Kconfig index 06f428f..098424f 100644 --- a/mali_kbase/Kconfig +++ b/mali_kbase/Kconfig @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # -# (C) COPYRIGHT 2012-2020 ARM Limited. All rights reserved. +# (C) COPYRIGHT 2012-2021 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 -# # @@ -31,6 +30,13 @@ menuconfig MALI_MIDGARD To compile this driver as a module, choose M here: this will generate a single module, called mali_kbase. +config MALI_CSF_SUPPORT + bool "Mali CSF based GPU support" + depends on MALI_MIDGARD=m + default n + help + Enables support for CSF based GPUs. + config MALI_GATOR_SUPPORT bool "Enable Streamline tracing support" depends on MALI_MIDGARD diff --git a/mali_kbase/Makefile b/mali_kbase/Makefile index ced6c64..0cf7ac8 100644 --- a/mali_kbase/Makefile +++ b/mali_kbase/Makefile @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # -# (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. +# (C) COPYRIGHT 2010-2021 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,30 +16,54 @@ # 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 -# # - +# Handle Android Common Kernel source naming KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build +KDIR ?= $(KERNEL_SRC) + +# Ensure build intermediates are in OUT_DIR instead of alongside the source M ?= $(shell pwd) -BUSLOG_PATH_RELATIVE = $(M)/../../../.. -KBASE_PATH_RELATIVE = $(M) +# out-of-tree +ifeq ($(KBUILD_EXTMOD),) +export CONFIG_MALI_MIDGARD?=m + +ifneq ($(CONFIG_MALI_MIDGARD),n) +export CONFIG_MALI_CSF_SUPPORT?=n +export CONFIG_MALI_KUTF?=n +export CONFIG_MALI_REAL_HW?=y -KBUILD_OPTIONS += CONFIG_MALI_MIDGARD=m -KBUILD_OPTIONS += MALI_DEVFREQ=n -KBUILD_OPTIONS += CONFIG_MALI_EXPERT=y +# Handle default y/m in Kconfig +export CONFIG_MALI_GATOR_SUPPORT?=y +export CONFIG_MALI_DEVFREQ?=n +ifneq ($(CONFIG_PM_DEVFREQ),n) +export CONFIG_MALI_DEVFREQ?=y +endif + +DEFINES += -DCONFIG_MALI_MIDGARD=$(CONFIG_MALI_MIDGARD) \ + -DCONFIF_MALI_CSF_SUPPORT=$(CONFIF_MALI_CSF_SUPPORT) \ + -DCONFIG_MALI_KUTF=$(CONFIG_MALI_KUTF) \ + -DCONFIG_MALI_REAL_HW=$(CONFIG_MALI_REAL_HW) \ + -DCONFIG_MALI_GATOR_SUPPORT=$(CONFIG_MALI_GATOR_SUPPORT) \ + -DCONFIG_MALI_DEVFREQ=$(CONFIG_MALI_DEVFREQ) + +export DEFINES + +# Pixel integration exports +export CONFIG_MALI_EXPERT=y +export CONFIG_MALI_MIDGARD_DVFS=y +export CONFIG_MALI_PLATFORM_NAME="pixel" +export CONFIG_MALI_PIXEL_GPU_QOS=y +export CONFIG_MALI_PIXEL_GPU_BTS=y +export CONFIG_MALI_PIXEL_GPU_THERMAL=y +export CONFIG_MALI_PIXEL_GPU_SECURE_RENDERING=y -# Pixel integration Kbuild options -KBUILD_OPTIONS += CONFIG_MALI_PLATFORM_NAME="pixel" -KBUILD_OPTIONS += CONFIG_MALI_MIDGARD_DVFS=y -KBUILD_OPTIONS += CONFIG_MALI_PIXEL_GPU_QOS=y -KBUILD_OPTIONS += CONFIG_MALI_PIXEL_GPU_QOS=y -KBUILD_OPTIONS += CONFIG_MALI_PIXEL_GPU_THERMAL=y -KBUILD_OPTIONS += CONFIG_MALI_PIXEL_GPU_SECURE_RENDERING=y +endif +endif -KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any +BUSLOG_PATH_RELATIVE = $(M)/../../../.. +KBASE_PATH_RELATIVE = $(M) ifeq ($(CONFIG_MALI_BUSLOG),y) #Add bus logger symbols @@ -47,10 +72,10 @@ endif # we get the symbols from modules using KBUILD_EXTRA_SYMBOLS to prevent warnings about unknown functions modules: - $(MAKE) -C $(KERNEL_SRC) M=$(M) W=1 KCFLAGS=-Wno-error EXTRA_CFLAGS="-I$(M) -I$(M)/../common/include -I$(M)/../../../../tests/include $(SCONS_CFLAGS)" $(SCONS_CONFIGS) KBUILD_EXTRA_SYMBOLS="$(EXTRA_SYMBOLS)" modules $(KBUILD_OPTIONS) $(@) + $(MAKE) -C $(KDIR) M=$(M) W=1 KCFLAGS=-Wno-error EXTRA_CFLAGS="-I$(M) -I$(M)/../common/include -I$(M)/../../../../tests/include $(SCONS_CFLAGS)" $(SCONS_CONFIGS) KBUILD_EXTRA_SYMBOLS="$(EXTRA_SYMBOLS)" modules $(@) modules_install: - $(MAKE) -C $(KERNEL_SRC) M=$(M) modules_install + $(MAKE) -C $(KDIR) M=$(M) modules_install clean: - $(MAKE) -C $(KERNEL_SRC) M=$(M) clean + $(MAKE) -C $(KDIR) M=$(M) clean diff --git a/mali_kbase/Makefile.kbase b/mali_kbase/Makefile.kbase index 74a9763..6d97f19 100644 --- a/mali_kbase/Makefile.kbase +++ b/mali_kbase/Makefile.kbase @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2010, 2013, 2018-2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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$(KBASE_PATH)/platform_$(PLATFORM) diff --git a/mali_kbase/Mconfig b/mali_kbase/Mconfig index d7a5569..cbb61d6 100644 --- a/mali_kbase/Mconfig +++ b/mali_kbase/Mconfig @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 # -# (C) COPYRIGHT 2012-2020 ARM Limited. All rights reserved. +# (C) COPYRIGHT 2012-2021 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 @@ -27,6 +27,13 @@ menuconfig MALI_MIDGARD To compile this driver as a module, choose M here: this will generate a single module, called mali_kbase. +config MALI_CSF_SUPPORT + bool "Mali CSF based GPU support" + depends on MALI_MIDGARD + default n + help + Enables support for CSF based GPUs. + config MALI_GATOR_SUPPORT bool "Enable Streamline tracing support" depends on MALI_MIDGARD && !BACKEND_USER diff --git a/mali_kbase/arbiter/Kbuild b/mali_kbase/arbiter/Kbuild index 98e47be..f81aa75 100644 --- a/mali_kbase/arbiter/Kbuild +++ b/mali_kbase/arbiter/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2019-2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 += \ diff --git a/mali_kbase/arbiter/mali_kbase_arbif.c b/mali_kbase/arbiter/mali_kbase_arbif.c index 8e03466..5ed5f80 100644 --- a/mali_kbase/arbiter/mali_kbase_arbif.c +++ b/mali_kbase/arbiter/mali_kbase_arbif.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,13 +17,10 @@ * 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_arbif.c - * Mali arbiter interface APIs to share GPU between Virtual Machines + * DOC: Mali arbiter interface APIs to share GPU between Virtual Machines */ #include <mali_kbase.h> diff --git a/mali_kbase/arbiter/mali_kbase_arbif.h b/mali_kbase/arbiter/mali_kbase_arbif.h index ff082ef..c6a2031 100644 --- a/mali_kbase/arbiter/mali_kbase_arbif.h +++ b/mali_kbase/arbiter/mali_kbase_arbif.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file - * Mali arbiter interface APIs to share GPU between Virtual Machines + * DOC: Mali arbiter interface APIs to share GPU between Virtual Machines */ #ifndef _MALI_KBASE_ARBIF_H_ diff --git a/mali_kbase/arbiter/mali_kbase_arbiter_defs.h b/mali_kbase/arbiter/mali_kbase_arbiter_defs.h index 071d5ee..c754b6e 100644 --- a/mali_kbase/arbiter/mali_kbase_arbiter_defs.h +++ b/mali_kbase/arbiter/mali_kbase_arbiter_defs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/arbiter/mali_kbase_arbiter_interface.h b/mali_kbase/arbiter/mali_kbase_arbiter_interface.h index 59a51d9..958b0a1 100644 --- a/mali_kbase/arbiter/mali_kbase_arbiter_interface.h +++ b/mali_kbase/arbiter/mali_kbase_arbiter_interface.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/arbiter/mali_kbase_arbiter_pm.c b/mali_kbase/arbiter/mali_kbase_arbiter_pm.c index f3893b6..08a6872 100644 --- a/mali_kbase/arbiter/mali_kbase_arbiter_pm.c +++ b/mali_kbase/arbiter/mali_kbase_arbiter_pm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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/arbiter/mali_kbase_arbiter_pm.h b/mali_kbase/arbiter/mali_kbase_arbiter_pm.h index b029c62..ef82271 100644 --- a/mali_kbase/arbiter/mali_kbase_arbiter_pm.h +++ b/mali_kbase/arbiter/mali_kbase_arbiter_pm.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/Kbuild b/mali_kbase/backend/gpu/Kbuild index 9a25b38..d2df00e 100644 --- a/mali_kbase/backend/gpu/Kbuild +++ b/mali_kbase/backend/gpu/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # -# (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. +# (C) COPYRIGHT 2014-2021 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 += \ diff --git a/mali_kbase/backend/gpu/mali_kbase_backend_config.h b/mali_kbase/backend/gpu/mali_kbase_backend_config.h index 1e9fbcb..a6bbdbb 100644 --- a/mali_kbase/backend/gpu/mali_kbase_backend_config.h +++ b/mali_kbase/backend/gpu/mali_kbase_backend_config.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2018, 2020 ARM Limited. All rights reserved. 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 b58518a..fee9464 100644 --- a/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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" 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 1d63098..84fb1fc 100644 --- a/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.h +++ b/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2016, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.c b/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.c index 8d82295..dcd1b02 100644 --- a/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.c +++ b/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_clk_rate_trace_mgr.h b/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.h index 2e65b6a..ba250be 100644 --- a/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.h +++ b/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 @@ -42,10 +22,10 @@ #ifndef _KBASE_CLK_RATE_TRACE_MGR_ #define _KBASE_CLK_RATE_TRACE_MGR_ -/** The index of top clock domain in kbase_clk_rate_trace_manager:clks. */ +/* The index of top clock domain in kbase_clk_rate_trace_manager:clks. */ #define KBASE_CLOCK_DOMAIN_TOP (0) -/** The index of shader-cores clock domain in +/* The index of shader-cores clock domain in * kbase_clk_rate_trace_manager:clks. */ #define KBASE_CLOCK_DOMAIN_SHADER_CORES (1) @@ -158,7 +138,7 @@ static inline void kbase_clk_rate_trace_manager_unsubscribe( * rate listeners. * * @clk_rtm: Clock rate manager instance. - * @clk_index: Clock index. + * @clock_index: Clock index. * @new_rate: New clock frequency(Hz) * * kbase_clk_rate_trace_manager:lock must be locked. 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 7a5bfb8..b5ca79d 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 @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/backend/gpu/mali_kbase_devfreq.c b/mali_kbase/backend/gpu/mali_kbase_devfreq.c index 2f9015d..07767c2 100644 --- a/mali_kbase/backend/gpu/mali_kbase_devfreq.c +++ b/mali_kbase/backend/gpu/mali_kbase_devfreq.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/backend/gpu/mali_kbase_devfreq.h b/mali_kbase/backend/gpu/mali_kbase_devfreq.h index ab731b9..cfff483 100644 --- a/mali_kbase/backend/gpu/mali_kbase_devfreq.h +++ b/mali_kbase/backend/gpu/mali_kbase_devfreq.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014, 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c b/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c index 7e92ffe..4254a64 100644 --- a/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -41,19 +39,12 @@ int kbase_backend_gpuprops_get(struct kbase_device *kbdev, registers.l2_features = kbase_reg_read(kbdev, GPU_CONTROL_REG(L2_FEATURES)); + registers.core_features = 0; #if !MALI_USE_CSF /* TGOx */ registers.core_features = kbase_reg_read(kbdev, GPU_CONTROL_REG(CORE_FEATURES)); #else /* !MALI_USE_CSF */ - if (((registers.gpu_id & GPU_ID2_PRODUCT_MODEL) == - GPU_ID2_PRODUCT_TGRX) || - ((registers.gpu_id & GPU_ID2_PRODUCT_MODEL) == - GPU_ID2_PRODUCT_TVAX)) - registers.core_features = - kbase_reg_read(kbdev, GPU_CONTROL_REG(CORE_FEATURES)); - else - registers.core_features = 0; #endif /* MALI_USE_CSF */ registers.tiler_features = kbase_reg_read(kbdev, GPU_CONTROL_REG(TILER_FEATURES)); diff --git a/mali_kbase/backend/gpu/mali_kbase_instr_backend.c b/mali_kbase/backend/gpu/mali_kbase_instr_backend.c index f366265..9cc425e 100644 --- a/mali_kbase/backend/gpu/mali_kbase_instr_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_instr_backend.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_instr_defs.h b/mali_kbase/backend/gpu/mali_kbase_instr_defs.h index 1344262..39b009d 100644 --- a/mali_kbase/backend/gpu/mali_kbase_instr_defs.h +++ b/mali_kbase/backend/gpu/mali_kbase_instr_defs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014, 2016, 2018, 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014, 2016, 2018, 2019-2021 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 diff --git a/mali_kbase/backend/gpu/mali_kbase_instr_internal.h b/mali_kbase/backend/gpu/mali_kbase_instr_internal.h index 0716fd4..c0472fa 100644 --- a/mali_kbase/backend/gpu/mali_kbase_instr_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_instr_internal.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014, 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_irq_internal.h b/mali_kbase/backend/gpu/mali_kbase_irq_internal.h index f5ad27b..bad249c 100644 --- a/mali_kbase/backend/gpu/mali_kbase_irq_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_irq_internal.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2015, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_irq_linux.c b/mali_kbase/backend/gpu/mali_kbase_irq_linux.c index 07ab5df..0306003 100644 --- a/mali_kbase/backend/gpu/mali_kbase_irq_linux.c +++ b/mali_kbase/backend/gpu/mali_kbase_irq_linux.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_as.c b/mali_kbase/backend/gpu/mali_kbase_jm_as.c index 87c4bd1..57ff67b 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_as.c +++ b/mali_kbase/backend/gpu/mali_kbase_jm_as.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_jm_defs.h b/mali_kbase/backend/gpu/mali_kbase_jm_defs.h index c6fad21..97663c7 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_defs.h +++ b/mali_kbase/backend/gpu/mali_kbase_jm_defs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_hw.c b/mali_kbase/backend/gpu/mali_kbase_jm_hw.c index d1f2eef..7cfca97 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_hw.c +++ b/mali_kbase/backend/gpu/mali_kbase_jm_hw.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -857,7 +855,7 @@ void kbase_jm_wait_for_zero_jobs(struct kbase_context *kctx) if (kbase_prepare_to_reset_gpu(kbdev)) { dev_err(kbdev->dev, - "Issueing GPU soft-reset because jobs failed to be killed (within %d ms) as part of context termination (e.g. process exit)\n", + "Issuing GPU soft-reset because jobs failed to be killed (within %d ms) as part of context termination (e.g. process exit)\n", ZAP_TIMEOUT); kbase_reset_gpu(kbdev); } diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_internal.h b/mali_kbase/backend/gpu/mali_kbase_jm_internal.h index cfb26ee..6761cbd 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_jm_internal.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2011-2016, 2018-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_rb.c b/mali_kbase/backend/gpu/mali_kbase_jm_rb.c index 26247f1..7e5d30e 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_rb.c +++ b/mali_kbase/backend/gpu/mali_kbase_jm_rb.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_jm_rb.h b/mali_kbase/backend/gpu/mali_kbase_jm_rb.h index 1633d6e..14da981 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_rb.h +++ b/mali_kbase/backend/gpu/mali_kbase_jm_rb.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_js_backend.c b/mali_kbase/backend/gpu/mali_kbase_js_backend.c index fb38510..d28e7b0 100644 --- a/mali_kbase/backend/gpu/mali_kbase_js_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_js_backend.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -257,7 +255,7 @@ static enum hrtimer_restart timer_callback(struct hrtimer *timer) } } if (reset_needed) { - dev_err(kbdev->dev, "JS: Job has been on the GPU for too long (JS_RESET_TICKS_SS/DUMPING timeout hit). Issueing GPU soft-reset to resolve."); + dev_err(kbdev->dev, "JS: Job has been on the GPU for too long (JS_RESET_TICKS_SS/DUMPING timeout hit). Issuing GPU soft-reset to resolve."); if (kbase_prepare_to_reset_gpu_locked(kbdev)) kbase_reset_gpu_locked(kbdev); diff --git a/mali_kbase/backend/gpu/mali_kbase_js_internal.h b/mali_kbase/backend/gpu/mali_kbase_js_internal.h index a48b4ea..e15528d 100644 --- a/mali_kbase/backend/gpu/mali_kbase_js_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_js_internal.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2015, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.c b/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.c index d5526ca..884cbd6 100644 --- a/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.c +++ b/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.h b/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.h index 3d277ac..2dfeadb 100644 --- a/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.h +++ b/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. 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 aab6d1c..2b371a0 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_pm_always_on.h b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h index 332c09d..e500d46 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2011-2015, 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_backend.c b/mali_kbase/backend/gpu/mali_kbase_pm_backend.c index 1e90c6a..921849b 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_backend.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_backend.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_pm_ca.c b/mali_kbase/backend/gpu/mali_kbase_pm_ca.c index 975f42d..c546766 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_ca.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_pm_ca.h b/mali_kbase/backend/gpu/mali_kbase_pm_ca.h index af91624..c20bf6f 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_ca.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2011-2018, 2020 ARM Limited. All rights reserved. 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 49a964c..d24bccd 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved. 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 24f5742..0a1dbf5 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_pm_coarse_demand.h b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h index fe17fd3..f1a0e3a 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2012-2015, 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_defs.h b/mali_kbase/backend/gpu/mali_kbase_pm_defs.h index 61cae4c..1e838f8 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_defs.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_defs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2021 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 @@ -192,6 +172,8 @@ enum kbase_shader_core_state { * the GPU was busy 100% during this period. * @time_idle: the amount of time the GPU was not executing jobs since the * time_period_start timestamp, measured in units of 256ns. + * @time_in_protm: The amount of time the GPU has spent in protected mode since + * the time_period_start timestamp, measured in units of 256ns. * @busy_cl: the amount of time the GPU was busy executing CL jobs. Note that * if two CL jobs were active for 256ns, this value would be updated * with 2 (2x256ns). @@ -203,10 +185,6 @@ struct kbasep_pm_metrics { u32 time_busy; u32 time_idle; #if MALI_USE_CSF - /* - * The amount of time the GPU has spent in protected mode since - * the time_period_start timestamp, measured in units of 256ns. - */ u32 time_in_protm; #else u32 busy_cl[2]; @@ -218,6 +196,10 @@ struct kbasep_pm_metrics { * struct kbasep_pm_metrics_state - State required to collect the metrics in * struct kbasep_pm_metrics * @time_period_start: time at which busy/idle measurements started + * @ipa_control_client: Handle returned on registering DVFS as a + * kbase_ipa_control client + * @skip_gpu_active_sanity_check: Decide whether to skip GPU_ACTIVE sanity + * check in DVFS utilisation calculation * @gpu_active: true when the GPU is executing jobs. false when * not. Updated when the job scheduler informs us a job in submitted * or removed from a GPU slot. @@ -239,11 +221,7 @@ struct kbasep_pm_metrics { struct kbasep_pm_metrics_state { ktime_t time_period_start; #if MALI_USE_CSF - /* Handle returned on registering DVFS as a kbase_ipa_control client */ void *ipa_control_client; - /* Decide whether to skip GPU_ACTIVE sanity check in DVFS utilisation - * calculation - */ bool skip_gpu_active_sanity_check; #else bool gpu_active; @@ -376,6 +354,8 @@ union kbase_pm_policy_data { * @callback_soft_reset: Optional callback to software reset the GPU. See * &struct kbase_pm_callback_conf * @ca_cores_enabled: Cores that are currently available + * @mcu_state: The current state of the micro-control unit, only applicable + * to GPUs that have such a component * @l2_state: The current state of the L2 cache state machine. See * &enum kbase_l2_core_state * @l2_desired: True if the L2 cache should be powered on by the L2 cache state @@ -400,6 +380,16 @@ union kbase_pm_policy_data { * cores may be different, but there should be transitions in * progress that will eventually achieve this state (assuming * that the policy doesn't change its mind in the mean time). + * @mcu_desired: True if the micro-control unit should be powered on + * @policy_change_clamp_state_to_off: Signaling the backend is in PM policy + * change transition, needs the mcu/L2 to be brought back to the + * off state and remain in that state until the flag is cleared. + * @csf_pm_sched_flags: CSF Dynamic PM control flags in accordance to the + * current active PM policy. This field is updated whenever a + * new policy is activated. + * @policy_change_lock: Used to serialize the policy change calls. In CSF case, + * the change of policy may involve the scheduler to + * suspend running CSGs and then reconfigure the MCU. * @in_reset: True if a GPU is resetting and normal power manager operation is * suspended * @partial_shaderoff: True if we want to partial power off shader cores, @@ -490,9 +480,6 @@ struct kbase_pm_backend_data { u64 ca_cores_enabled; #if MALI_USE_CSF - /* The current state of the micro-control unit, only applicable - * to GPUs that has such a component - */ enum kbase_mcu_state mcu_state; #endif enum kbase_l2_core_state l2_state; @@ -500,22 +487,9 @@ struct kbase_pm_backend_data { u64 shaders_avail; u64 shaders_desired_mask; #if MALI_USE_CSF - /* True if the micro-control unit should be powered on */ bool mcu_desired; - /* Signaling the backend is in PM policy change transition, needs the - * mcu/L2 to be brought back to the off state and remain in that state - * until the flag is cleared. - */ bool policy_change_clamp_state_to_off; - /* CSF Dynamic PM control flags in accordance to the current active PM - * policy. This field is updated whenever a new policy is activated. - */ unsigned int csf_pm_sched_flags; - /* Used to serialize the policy change calls. In CSF case, the change - * of policy may involve the scheduler to suspend running CSGs and - * then reconfigure the MCU. This mutex lock is to serialize such - * sequence. - */ struct mutex policy_change_lock; #endif bool l2_desired; @@ -616,11 +590,15 @@ enum kbase_pm_policy_event { * necessarily the same as its index in the list returned * by kbase_pm_list_policies(). * It is used purely for debugging. + * @pm_sched_flags: Policy associated with CSF PM scheduling operational flags. + * Pre-defined required flags exist for each of the + * ARM released policies, such as 'always_on', 'coarse_demand' + * and etc. */ struct kbase_pm_policy { char *name; - /** + /* * Function called when the policy is selected * * This should initialize the kbdev->pm.pm_policy_data structure. It @@ -634,7 +612,7 @@ struct kbase_pm_policy { */ void (*init)(struct kbase_device *kbdev); - /** + /* * Function called when the policy is unselected. * * @kbdev: The kbase device structure for the device (must be a @@ -642,7 +620,7 @@ struct kbase_pm_policy { */ void (*term)(struct kbase_device *kbdev); - /** + /* * Function called to find out if shader cores are needed * * This needs to at least satisfy kbdev->pm.backend.shaders_desired, @@ -655,7 +633,7 @@ struct kbase_pm_policy { */ bool (*shaders_needed)(struct kbase_device *kbdev); - /** + /* * Function called to get the current overall GPU power state * * This function must meet or exceed the requirements for power diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_driver.c b/mali_kbase/backend/gpu/mali_kbase_pm_driver.c index c634e34..563be4b 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_driver.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_driver.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -2736,12 +2734,21 @@ kbase_pm_request_gpu_cycle_counter_do_request(struct kbase_device *kbdev) spin_lock_irqsave(&kbdev->pm.backend.gpu_cycle_counter_requests_lock, flags); - ++kbdev->pm.backend.gpu_cycle_counter_requests; if (kbdev->pm.backend.gpu_cycle_counter_requests == 1) kbase_reg_write(kbdev, GPU_CONTROL_REG(GPU_COMMAND), GPU_COMMAND_CYCLE_COUNT_START); + else { + /* This might happen after GPU reset. + * Then counter needs to be kicked. + */ + if (!(kbase_reg_read(kbdev, GPU_CONTROL_REG(GPU_STATUS)) & + GPU_STATUS_CYCLE_COUNT_ACTIVE)) { + kbase_reg_write(kbdev, GPU_CONTROL_REG(GPU_COMMAND), + GPU_COMMAND_CYCLE_COUNT_START); + } + } spin_unlock_irqrestore( &kbdev->pm.backend.gpu_cycle_counter_requests_lock, @@ -2757,6 +2764,8 @@ void kbase_pm_request_gpu_cycle_counter(struct kbase_device *kbdev) KBASE_DEBUG_ASSERT(kbdev->pm.backend.gpu_cycle_counter_requests < INT_MAX); + kbase_pm_wait_for_l2_powered(kbdev); + kbase_pm_request_gpu_cycle_counter_do_request(kbdev); } diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_internal.h b/mali_kbase/backend/gpu/mali_kbase_pm_internal.h index 304ecda..f6b8485 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_internal.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_l2_states.h b/mali_kbase/backend/gpu/mali_kbase_pm_l2_states.h index 90a46fa..b9bd364 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_l2_states.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_l2_states.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_mcu_states.h b/mali_kbase/backend/gpu/mali_kbase_pm_mcu_states.h index 95e68df..c03adf3 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_mcu_states.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_mcu_states.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c b/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c index 5c42c0a..e5c7c71 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_pm_policy.c b/mali_kbase/backend/gpu/mali_kbase_pm_policy.c index cf3fdc0..bfb6a6a 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_policy.c +++ b/mali_kbase/backend/gpu/mali_kbase_pm_policy.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_pm_policy.h b/mali_kbase/backend/gpu/mali_kbase_pm_policy.h index d566d9b..a513a26 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_policy.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_policy.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2010-2015, 2018-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_shader_states.h b/mali_kbase/backend/gpu/mali_kbase_pm_shader_states.h index dafb117..766bf1d 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_shader_states.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_shader_states.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/backend/gpu/mali_kbase_time.c b/mali_kbase/backend/gpu/mali_kbase_time.c index 557b595..f964af0 100644 --- a/mali_kbase/backend/gpu/mali_kbase_time.c +++ b/mali_kbase/backend/gpu/mali_kbase_time.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2014-2016,2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2016, 2018-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> @@ -68,14 +66,44 @@ void kbase_backend_get_gpu_time_norequest(struct kbase_device *kbdev, #endif } +#if !MALI_USE_CSF +/** + * timedwait_cycle_count_active() - Timed wait till CYCLE_COUNT_ACTIVE is active + * + * @kbdev: Kbase device + * + * Return: true if CYCLE_COUNT_ACTIVE is active within the timeout. + */ +static bool timedwait_cycle_count_active(struct kbase_device *kbdev) +{ + bool success = false; + const unsigned int timeout = 100; + const unsigned long remaining = jiffies + msecs_to_jiffies(timeout); + + while (time_is_after_jiffies(remaining)) { + if ((kbase_reg_read(kbdev, GPU_CONTROL_REG(GPU_STATUS)) & + GPU_STATUS_CYCLE_COUNT_ACTIVE)) { + success = true; + break; + } + } + + return success; +} +#endif + void kbase_backend_get_gpu_time(struct kbase_device *kbdev, u64 *cycle_counter, u64 *system_time, struct timespec64 *ts) { #if !MALI_USE_CSF kbase_pm_request_gpu_cycle_counter(kbdev); + WARN_ONCE(kbdev->pm.backend.l2_state != KBASE_L2_ON, + "L2 not powered up"); + WARN_ONCE((!timedwait_cycle_count_active(kbdev)), + "Timed out on CYCLE_COUNT_ACTIVE"); #endif - kbase_backend_get_gpu_time_norequest( - kbdev, cycle_counter, system_time, ts); + kbase_backend_get_gpu_time_norequest(kbdev, cycle_counter, system_time, + ts); #if !MALI_USE_CSF kbase_pm_release_gpu_cycle_counter(kbdev); #endif diff --git a/mali_kbase/build.bp b/mali_kbase/build.bp index 3afd42b..13b4d8f 100644 --- a/mali_kbase/build.bp +++ b/mali_kbase/build.bp @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* * - * (C) COPYRIGHT 2017-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2017-2021 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 @@ -172,6 +172,7 @@ bob_kernel_module { ], }, gpu_has_csf: { + kbuild_options: ["CONFIG_MALI_CSF_SUPPORT=y"], srcs: [ "context/backend/*_csf.c", "csf/*.c", diff --git a/mali_kbase/context/backend/mali_kbase_context_csf.c b/mali_kbase/context/backend/mali_kbase_context_csf.c index da8cfc1..c660247 100644 --- a/mali_kbase/context/backend/mali_kbase_context_csf.c +++ b/mali_kbase/context/backend/mali_kbase_context_csf.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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/context/backend/mali_kbase_context_jm.c b/mali_kbase/context/backend/mali_kbase_context_jm.c index b01a1fa..649ba7a 100644 --- a/mali_kbase/context/backend/mali_kbase_context_jm.c +++ b/mali_kbase/context/backend/mali_kbase_context_jm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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/context/mali_kbase_context.c b/mali_kbase/context/mali_kbase_context.c index 9ab254c..fa4970b 100644 --- a/mali_kbase/context/mali_kbase_context.c +++ b/mali_kbase/context/mali_kbase_context.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -283,11 +281,9 @@ void kbase_context_mem_pool_group_term(struct kbase_context *kctx) int kbase_context_mmu_init(struct kbase_context *kctx) { - kbase_mmu_init(kctx->kbdev, - &kctx->mmu, kctx, + return kbase_mmu_init( + kctx->kbdev, &kctx->mmu, kctx, base_context_mmu_group_id_get(kctx->create_flags)); - - return 0; } void kbase_context_mmu_term(struct kbase_context *kctx) diff --git a/mali_kbase/context/mali_kbase_context.h b/mali_kbase/context/mali_kbase_context.h index 895ca4b..f18f64b 100644 --- a/mali_kbase/context/mali_kbase_context.h +++ b/mali_kbase/context/mali_kbase_context.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2011-2017, 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/context/mali_kbase_context_internal.h b/mali_kbase/context/mali_kbase_context_internal.h index 5a901d2..fd009b8 100644 --- a/mali_kbase/context/mali_kbase_context_internal.h +++ b/mali_kbase/context/mali_kbase_context_internal.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/Kbuild b/mali_kbase/csf/Kbuild index d55084a..c82b21a 100644 --- a/mali_kbase/csf/Kbuild +++ b/mali_kbase/csf/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2018-2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 += \ diff --git a/mali_kbase/csf/ipa_control/Kbuild b/mali_kbase/csf/ipa_control/Kbuild index 5d00d1c..cbff4dd 100644 --- a/mali_kbase/csf/ipa_control/Kbuild +++ b/mali_kbase/csf/ipa_control/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 += \ diff --git a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c index ad14cb5..7b0845c 100644 --- a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c +++ b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> @@ -238,7 +236,7 @@ static inline void calc_prfcnt_delta(struct kbase_device *kbdev, delta_value *= prfcnt->scaling_factor; - if (!WARN_ON(kbdev->csf.ipa_control.cur_gpu_rate == 0)) + if (!WARN_ON_ONCE(kbdev->csf.ipa_control.cur_gpu_rate == 0)) if (prfcnt->gpu_norm) delta_value /= kbdev->csf.ipa_control.cur_gpu_rate; diff --git a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.h b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.h index 441c2bd..a828e01 100644 --- a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.h +++ b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_base_csf_kernel.h b/mali_kbase/csf/mali_base_csf_kernel.h index d9ea65e..9a13760 100644 --- a/mali_kbase/csf/mali_base_csf_kernel.h +++ b/mali_kbase/csf/mali_base_csf_kernel.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 @@ -322,6 +302,18 @@ typedef u32 base_context_create_flags; /** * enum base_kcpu_command_type - Kernel CPU queue command type. + * @BASE_KCPU_COMMAND_TYPE_FENCE_SIGNAL: fence_signal, + * @BASE_KCPU_COMMAND_TYPE_FENCE_WAIT: fence_wait, + * @BASE_KCPU_COMMAND_TYPE_CQS_WAIT: cqs_wait, + * @BASE_KCPU_COMMAND_TYPE_CQS_SET: cqs_set, + * @BASE_KCPU_COMMAND_TYPE_MAP_IMPORT: map_import, + * @BASE_KCPU_COMMAND_TYPE_UNMAP_IMPORT: unmap_import, + * @BASE_KCPU_COMMAND_TYPE_UNMAP_IMPORT_FORCE: unmap_import_force, + * @BASE_KCPU_COMMAND_TYPE_JIT_ALLOC: jit_alloc, + * @BASE_KCPU_COMMAND_TYPE_JIT_FREE: jit_free, + * @BASE_KCPU_COMMAND_TYPE_GROUP_SUSPEND: group_suspend, + * @BASE_KCPU_COMMAND_TYPE_ERROR_BARRIER: error_barrier, + * @BASE_KCPU_COMMAND_TYPE_SAMPLE_TIME: sample_time, */ enum base_kcpu_command_type { BASE_KCPU_COMMAND_TYPE_FENCE_SIGNAL, @@ -335,6 +327,9 @@ enum base_kcpu_command_type { BASE_KCPU_COMMAND_TYPE_JIT_FREE, BASE_KCPU_COMMAND_TYPE_GROUP_SUSPEND, BASE_KCPU_COMMAND_TYPE_ERROR_BARRIER, +#if MALI_UNIT_TEST + BASE_KCPU_COMMAND_TYPE_SAMPLE_TIME, +#endif /* MALI_UNIT_TEST */ }; /** @@ -371,7 +366,7 @@ struct base_kcpu_command_fence_info { u64 fence; }; -struct base_cqs_wait { +struct base_cqs_wait_info { u64 addr; u32 val; u32 padding; @@ -448,13 +443,27 @@ struct base_kcpu_command_group_suspend_info { u8 padding[3]; }; +#if MALI_UNIT_TEST +struct base_kcpu_command_sample_time_info { + u64 time; +}; +#endif /* MALI_UNIT_TEST */ + /** * struct base_kcpu_command - kcpu command. - * * @type: type of the kcpu command, one enum base_kcpu_command_type + * @padding: padding to a multiple of 64 bits * @info: structure which contains information about the kcpu command; * actual type is determined by @p type - * @padding: padding to a multiple of 64 bits + * @info.fence: Fence + * @info.cqs_wait: CQS wait + * @info.cqs_set: CQS set + * @info.import: import + * @info.jit_alloc: jit allocation + * @info.jit_free: jit deallocation + * @info.suspend_buf_copy: suspend buffer copy + * @info.sample_time: sample time + * @info.padding: padding */ struct base_kcpu_command { u8 type; @@ -467,6 +476,9 @@ struct base_kcpu_command { struct base_kcpu_command_jit_alloc_info jit_alloc; struct base_kcpu_command_jit_free_info jit_free; struct base_kcpu_command_group_suspend_info suspend_buf_copy; +#if MALI_UNIT_TEST + struct base_kcpu_command_sample_time_info sample_time; +#endif /* MALI_UNIT_TEST */ u64 padding[2]; /* No sub-struct should be larger */ } info; }; @@ -558,15 +570,13 @@ enum base_gpu_queue_group_error_type { /** * struct base_gpu_queue_group_error - Unrecoverable fault information - * - * @error_type: Error type of @base_gpu_queue_group_error_type - * indicating which field in union payload is filled - * @padding: Unused bytes for 64bit boundary - * @fatal_group: Unrecoverable fault error associated with - * GPU command queue group - * @fatal_queue: Unrecoverable fault error associated with command queue - * - * @payload: Input Payload + * @error_type: Error type of @base_gpu_queue_group_error_type + * indicating which field in union payload is filled + * @padding: Unused bytes for 64bit boundary + * @payload: Input Payload + * @payload.fatal_group: Unrecoverable fault error associated with + * GPU command queue group + * @payload.fatal_queue: Unrecoverable fault error associated with command queue */ struct base_gpu_queue_group_error { u8 error_type; @@ -599,13 +609,16 @@ enum base_csf_notification_type { /** * struct base_csf_notification - Event or error notification * - * @type: Notification type of @base_csf_notification_type - * @padding: Padding for 64bit boundary - * @handle: Handle of GPU command queue group associated with fatal error - * @error: Unrecoverable fault error - * @align: To fit the struct into a 64-byte cache line + * @type: Notification type of @base_csf_notification_type + * @padding: Padding for 64bit boundary + * @payload: Input Payload + * @payload.align: To fit the struct into a 64-byte cache line + * @payload.csg_error: CSG error + * @payload.csg_error.handle: Handle of GPU command queue group associated with + * fatal error + * @payload.csg_error.padding: Padding + * @payload.csg_error.error: Unrecoverable fault error * - * @payload: Input Payload */ struct base_csf_notification { u8 type; diff --git a/mali_kbase/csf/mali_gpu_csf_control_registers.h b/mali_kbase/csf/mali_gpu_csf_control_registers.h index 9b8a9bf..8c4fc82 100644 --- a/mali_kbase/csf/mali_gpu_csf_control_registers.h +++ b/mali_kbase/csf/mali_gpu_csf_control_registers.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_gpu_csf_registers.h b/mali_kbase/csf/mali_gpu_csf_registers.h index d06b38d..d37b9cc 100644 --- a/mali_kbase/csf/mali_gpu_csf_registers.h +++ b/mali_kbase/csf/mali_gpu_csf_registers.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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 @@ -1114,6 +1094,16 @@ #define GLB_REQ_PING_GET(reg_val) (((reg_val)&GLB_REQ_PING_MASK) >> GLB_REQ_PING_SHIFT) #define GLB_REQ_PING_SET(reg_val, value) \ (((reg_val) & ~GLB_REQ_PING_MASK) | (((value) << GLB_REQ_PING_SHIFT) & GLB_REQ_PING_MASK)) +#define GLB_REQ_FIRMWARE_CONFIG_UPDATE_SHIFT 9 +#define GLB_REQ_FIRMWARE_CONFIG_UPDATE_MASK \ + (0x1 << GLB_REQ_FIRMWARE_CONFIG_UPDATE_SHIFT) +#define GLB_REQ_FIRMWARE_CONFIG_UPDATE_GET(reg_val) \ + (((reg_val)&GLB_REQ_FIRMWARE_CONFIG_UPDATE_MASK) >> \ + GLB_REQ_FIRMWARE_CONFIG_UPDATE_SHIFT) +#define GLB_REQ_FIRMWARE_CONFIG_UPDATE_SET(reg_val, value) \ + (((reg_val) & ~GLB_REQ_FIRMWARE_CONFIG_UPDATE_MASK) | \ + (((value) << GLB_REQ_FIRMWARE_CONFIG_UPDATE_SHIFT) & \ + GLB_REQ_FIRMWARE_CONFIG_UPDATE_MASK)) #define GLB_REQ_INACTIVE_COMPUTE_SHIFT 20 #define GLB_REQ_INACTIVE_COMPUTE_MASK (0x1 << GLB_REQ_INACTIVE_COMPUTE_SHIFT) #define GLB_REQ_INACTIVE_COMPUTE_GET(reg_val) \ @@ -1227,6 +1217,16 @@ #define GLB_ACK_IRQ_MASK_PING_SET(reg_val, value) \ (((reg_val) & ~GLB_ACK_IRQ_MASK_PING_MASK) | \ (((value) << GLB_ACK_IRQ_MASK_PING_SHIFT) & GLB_ACK_IRQ_MASK_PING_MASK)) +#define GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_SHIFT 9 +#define GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_MASK \ + (0x1 << GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_SHIFT) +#define GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_GET(reg_val) \ + (((reg_val)&GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_MASK) >> \ + GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_SHIFT) +#define GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_SET(reg_val, value) \ + (((reg_val) & ~GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_MASK) | \ + (((value) << GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_SHIFT) & \ + GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_MASK)) #define GLB_ACK_IRQ_MASK_INACTIVE_COMPUTE_SHIFT 20 #define GLB_ACK_IRQ_MASK_INACTIVE_COMPUTE_MASK (0x1 << GLB_ACK_IRQ_MASK_INACTIVE_COMPUTE_SHIFT) #define GLB_ACK_IRQ_MASK_INACTIVE_COMPUTE_GET(reg_val) \ diff --git a/mali_kbase/csf/mali_kbase_csf.c b/mali_kbase/csf/mali_kbase_csf.c index 4c6bb06..e35c570 100644 --- a/mali_kbase/csf/mali_kbase_csf.c +++ b/mali_kbase/csf/mali_kbase_csf.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> @@ -279,6 +277,7 @@ unlock: return ret; } +static void term_queue_group(struct kbase_queue_group *group); static void get_queue(struct kbase_queue *queue); static void release_queue(struct kbase_queue *queue); @@ -454,6 +453,7 @@ static void release_queue(struct kbase_queue *queue) } static void oom_event_worker(struct work_struct *data); +static void fatal_event_worker(struct work_struct *data); int kbase_csf_queue_register(struct kbase_context *kctx, struct kbase_ioctl_cs_queue_register *reg) @@ -524,6 +524,7 @@ int kbase_csf_queue_register(struct kbase_context *kctx, INIT_LIST_HEAD(&queue->link); INIT_LIST_HEAD(&queue->error.link); INIT_WORK(&queue->oom_event_work, oom_event_worker); + INIT_WORK(&queue->fatal_event_work, fatal_event_worker); list_add(&queue->link, &kctx->csf.queue_list); region->flags |= KBASE_REG_NO_USER_FREE; @@ -838,7 +839,24 @@ void kbase_csf_queue_unbind(struct kbase_queue *queue) lockdep_assert_held(&kctx->csf.lock); - unbind_queue(kctx, queue); + /* As the process itself is exiting, the termination of queue group can + * be done which would be much faster than stopping of individual + * queues. This would ensure a faster exit for the process especially + * in the case where CSI gets stuck. + * The CSI STOP request will wait for the in flight work to drain + * whereas CSG TERM request would result in an immediate abort or + * cancellation of the pending work. + */ + if (current->flags & PF_EXITING) { + struct kbase_queue_group *group = get_bound_queue_group(queue); + + if (group) + term_queue_group(group); + + WARN_ON(queue->bind_state != KBASE_CSF_QUEUE_UNBOUND); + } else { + unbind_queue(kctx, queue); + } /* Free the resources, if allocated for this queue. */ if (queue->reg) @@ -1073,6 +1091,7 @@ phy_alloc_failed: return err; } +static void timer_event_worker(struct work_struct *data); static void protm_event_worker(struct work_struct *data); static void term_normal_suspend_buffer(struct kbase_context *const kctx, struct kbase_normal_suspend_buffer *s_buf); @@ -1164,6 +1183,7 @@ static int create_queue_group(struct kbase_context *const kctx, INIT_LIST_HEAD(&group->error_fatal.link); INIT_LIST_HEAD(&group->error_timeout.link); INIT_LIST_HEAD(&group->error_tiler_oom.link); + INIT_WORK(&group->timer_event_work, timer_event_worker); INIT_WORK(&group->protm_event_work, protm_event_worker); bitmap_zero(group->protm_pending_bitmap, MAX_SUPPORTED_STREAMS_PER_GROUP); @@ -1358,6 +1378,7 @@ static void term_queue_group(struct kbase_queue_group *group) static void cancel_queue_group_events(struct kbase_queue_group *group) { + cancel_work_sync(&group->timer_event_work); cancel_work_sync(&group->protm_event_work); } @@ -2124,14 +2145,11 @@ static void oom_event_worker(struct work_struct *data) } /** - * handle_progress_timer_event - Progress timer timeout event handler. + * report_group_timeout_error - Report the timeout error for the group to userspace. * - * @group: Pointer to GPU queue group for which the timeout event is received. - * - * Notify the event notification thread of progress timeout fault - * for the GPU command queue group. + * @group: Pointer to the group for which timeout error occurred */ -static void handle_progress_timer_event(struct kbase_queue_group *const group) +static void report_group_timeout_error(struct kbase_queue_group *const group) { struct base_csf_notification const error = { .type = BASE_CSF_NOTIFICATION_GPU_QUEUE_GROUP_ERROR, @@ -2142,16 +2160,59 @@ static void handle_progress_timer_event(struct kbase_queue_group *const group) .error_type = BASE_GPU_QUEUE_GROUP_ERROR_TIMEOUT, } } } }; + + dev_warn(group->kctx->kbdev->dev, + "Notify the event notification thread, forward progress timeout (%llu cycles)\n", + kbase_csf_timeout_get(group->kctx->kbdev)); + + add_error(group->kctx, &group->error_timeout, &error); + kbase_event_wakeup(group->kctx); +} + +/** + * timer_event_worker - Handle the progress timeout error for the group + * + * @data: Pointer to a work_struct embedded in GPU command queue group data. + * + * Terminate the CSG and report the error to userspace + */ +static void timer_event_worker(struct work_struct *data) +{ + struct kbase_queue_group *const group = + container_of(data, struct kbase_queue_group, timer_event_work); struct kbase_context *const kctx = group->kctx; + bool reset_prevented = false; + int err = kbase_reset_gpu_prevent_and_wait(kctx->kbdev); + + if (err) + dev_warn( + kctx->kbdev->dev, + "Unsuccessful GPU reset detected when terminating group %d on progress timeout, attempting to terminate regardless", + group->handle); + else + reset_prevented = true; - kbase_csf_scheduler_spin_lock_assert_held(kctx->kbdev); + mutex_lock(&kctx->csf.lock); - dev_warn(kctx->kbdev->dev, - "Notify the event notification thread, forward progress timeout (%llu cycles)\n", - kbase_csf_timeout_get(kctx->kbdev)); + term_queue_group(group); + report_group_timeout_error(group); - add_error(kctx, &group->error_timeout, &error); - kbase_event_wakeup(kctx); + mutex_unlock(&kctx->csf.lock); + if (reset_prevented) + kbase_reset_gpu_allow(kctx->kbdev); +} + +/** + * handle_progress_timer_event - Progress timer timeout event handler. + * + * @group: Pointer to GPU queue group for which the timeout event is received. + * + * Enqueue a work item to terminate the group and notify the event notification + * thread of progress timeout fault for the GPU command queue group. + */ +static void handle_progress_timer_event(struct kbase_queue_group *const group) +{ + queue_work(group->kctx->csf.wq, &group->timer_event_work); } /** @@ -2219,14 +2280,15 @@ handle_fault_event(struct kbase_queue *const queue, queue, GPU_EXCEPTION_TYPE_SW_FAULT_2, 0); } -void kbase_csf_add_queue_fatal_error(struct kbase_queue *const queue, - u32 cs_fatal, u64 cs_fatal_info) +static void report_queue_fatal_error(struct kbase_queue *const queue, + u32 cs_fatal, u64 cs_fatal_info, + u8 group_handle) { struct base_csf_notification error = { .type = BASE_CSF_NOTIFICATION_GPU_QUEUE_GROUP_ERROR, .payload = { .csg_error = { - .handle = queue->group->handle, + .handle = group_handle, .error = { .error_type = BASE_GPU_QUEUE_GROUP_QUEUE_ERROR_FATAL, @@ -2242,27 +2304,76 @@ void kbase_csf_add_queue_fatal_error(struct kbase_queue *const queue, } }; - kbase_csf_scheduler_spin_lock_assert_held(queue->kctx->kbdev); add_error(queue->kctx, &queue->error, &error); kbase_event_wakeup(queue->kctx); } +void kbase_csf_add_queue_fatal_error(struct kbase_queue *const queue, + u32 cs_fatal, u64 cs_fatal_info) +{ + report_queue_fatal_error(queue, cs_fatal, cs_fatal_info, + queue->group->handle); +} + +/** + * fatal_event_worker - Handle the fatal error for the GPU queue + * + * @data: Pointer to a work_struct embedded in GPU command queue. + * + * Terminate the CSG and report the error to userspace. + */ +static void fatal_event_worker(struct work_struct *const data) +{ + struct kbase_queue *const queue = + container_of(data, struct kbase_queue, fatal_event_work); + struct kbase_context *const kctx = queue->kctx; + struct kbase_device *const kbdev = kctx->kbdev; + struct kbase_queue_group *group; + u8 group_handle; + bool reset_prevented = false; + int err = kbase_reset_gpu_prevent_and_wait(kbdev); + + if (err) + dev_warn( + kbdev->dev, + "Unsuccessful GPU reset detected when terminating group to handle fatal event, attempting to terminate regardless"); + else + reset_prevented = true; + + mutex_lock(&kctx->csf.lock); + + group = get_bound_queue_group(queue); + if (!group) { + dev_warn(kbdev->dev, "queue not bound when handling fatal event"); + goto unlock; + } + + group_handle = group->handle; + term_queue_group(group); + report_queue_fatal_error(queue, queue->cs_fatal, queue->cs_fatal_info, + group_handle); + +unlock: + release_queue(queue); + mutex_unlock(&kctx->csf.lock); + if (reset_prevented) + kbase_reset_gpu_allow(kbdev); +} + /** * handle_fatal_event - Handler for CS fatal. * * @queue: Pointer to queue for which fatal event was received. * @stream: Pointer to the structure containing info provided by the * firmware about the CSI. - * @fw_error: Return true if internal firmware fatal is handled * * Prints meaningful CS fatal information. - * Report queue fatal error to user space. - * + * Enqueue a work item to terminate the group and report the fatal error + * to user space. */ static void handle_fatal_event(struct kbase_queue *const queue, - struct kbase_csf_cmd_stream_info const *const stream, - bool *fw_error) + struct kbase_csf_cmd_stream_info const *const stream) { const u32 cs_fatal = kbase_csf_firmware_cs_output(stream, CS_FATAL); const u64 cs_fatal_info = @@ -2290,10 +2401,15 @@ handle_fatal_event(struct kbase_queue *const queue, cs_fatal_exception_data, cs_fatal_info_exception_data); if (cs_fatal_exception_type == - CS_FATAL_EXCEPTION_TYPE_FIRMWARE_INTERNAL_ERROR) - *fw_error = true; - else - kbase_csf_add_queue_fatal_error(queue, cs_fatal, cs_fatal_info); + CS_FATAL_EXCEPTION_TYPE_FIRMWARE_INTERNAL_ERROR) { + queue_work(system_wq, &kbdev->csf.fw_error_work); + } else { + get_queue(queue); + queue->cs_fatal = cs_fatal; + queue->cs_fatal_info = cs_fatal_info; + if (!queue_work(queue->kctx->csf.wq, &queue->fatal_event_work)) + release_queue(queue); + } } /** @@ -2313,7 +2429,6 @@ static void handle_queue_exception_event(struct kbase_queue *const queue, struct kbase_queue_group *group = queue->group; int csi_index = queue->csi_index; int slot_num = group->csg_nr; - bool internal_fw_error = false; kbase_csf_scheduler_spin_lock_assert_held(kbdev); @@ -2321,7 +2436,7 @@ static void handle_queue_exception_event(struct kbase_queue *const queue, stream = &ginfo->streams[csi_index]; if ((cs_ack & CS_ACK_FATAL_MASK) != (cs_req & CS_REQ_FATAL_MASK)) { - handle_fatal_event(queue, stream, &internal_fw_error); + handle_fatal_event(queue, stream); kbase_csf_firmware_cs_input_mask(stream, CS_REQ, cs_ack, CS_REQ_FATAL_MASK); } @@ -2332,9 +2447,6 @@ static void handle_queue_exception_event(struct kbase_queue *const queue, CS_REQ_FAULT_MASK); kbase_csf_ring_cs_kernel_doorbell(kbdev, csi_index, slot_num, true); } - - if (internal_fw_error) - queue_work(system_wq, &kbdev->csf.fw_error_work); } /** @@ -2521,9 +2633,9 @@ static void process_csg_interrupts(struct kbase_device *const kbdev, kbase_csf_firmware_csg_input_mask(ginfo, CSG_REQ, ack, CSG_REQ_PROGRESS_TIMER_EVENT_MASK); - dev_dbg(kbdev->dev, - "Timeout notification received for Group %u on slot %d\n", - group->handle, csg_nr); + dev_info(kbdev->dev, + "Timeout notification received for group %u of ctx %d_%d on slot %d\n", + group->handle, group->kctx->tgid, group->kctx->id, csg_nr); handle_progress_timer_event(group); } diff --git a/mali_kbase/csf/mali_kbase_csf.h b/mali_kbase/csf/mali_kbase_csf.h index 7eed90d..6252515 100644 --- a/mali_kbase/csf/mali_kbase_csf.h +++ b/mali_kbase/csf/mali_kbase_csf.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.c b/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.c index 166c1b4..fb3a718 100644 --- a/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.c +++ b/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_csf_cpu_queue_debugfs.h" diff --git a/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.h b/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.h index 4ba0b8c..3633649 100644 --- a/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.h +++ b/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 @@ -74,7 +54,7 @@ void kbase_csf_cpu_queue_debugfs_init(struct kbase_context *kctx); * @kctx: The kbase_context which cpu queue dumpped belongs to * @req: Notification with cpu queue dump request. * - * @return: If dumping is requested, it is true or false. + * Return: true if needs CPU queue dump, or false otherwise. */ bool kbase_csf_cpu_queue_read_dump_req(struct kbase_context *kctx, struct base_csf_notification *req); @@ -84,7 +64,7 @@ bool kbase_csf_cpu_queue_read_dump_req(struct kbase_context *kctx, * * @kctx: The kbase_context which cpu queue dumpped belongs to * - * @return: If it needs cpu queue dump, returns true, or returns false. + * Return: true if it needs cpu queue dump, or false otherwise. */ static inline bool kbase_csf_cpu_queue_dump_needed(struct kbase_context *kctx) { @@ -103,7 +83,7 @@ static inline bool kbase_csf_cpu_queue_dump_needed(struct kbase_context *kctx) * @buffer: Buffer containing the cpu queue information. * @buf_size: Buffer size. * - * @return: Return 0 for dump successfully, or error code. + * Return: Return 0 for dump successfully, or error code. */ int kbase_csf_cpu_queue_dump(struct kbase_context *kctx, u64 buffer, size_t buf_size); diff --git a/mali_kbase/csf/mali_kbase_csf_csg_debugfs.c b/mali_kbase/csf/mali_kbase_csf_csg_debugfs.c index 86f359a..3894683 100644 --- a/mali_kbase/csf/mali_kbase_csf_csg_debugfs.c +++ b/mali_kbase/csf/mali_kbase_csf_csg_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_csf_csg_debugfs.h" diff --git a/mali_kbase/csf/mali_kbase_csf_csg_debugfs.h b/mali_kbase/csf/mali_kbase_csf_csg_debugfs.h index 68e9ce0..c6a86b6 100644 --- a/mali_kbase/csf/mali_kbase_csf_csg_debugfs.h +++ b/mali_kbase/csf/mali_kbase_csf_csg_debugfs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_defs.h b/mali_kbase/csf/mali_kbase_csf_defs.h index 968895f..a6f1958 100644 --- a/mali_kbase/csf/mali_kbase_csf_defs.h +++ b/mali_kbase/csf/mali_kbase_csf_defs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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 @@ -65,6 +45,14 @@ */ #define MAX_TILER_HEAPS (128) +#define CSF_FIRMWARE_ENTRY_READ (1ul << 0) +#define CSF_FIRMWARE_ENTRY_WRITE (1ul << 1) +#define CSF_FIRMWARE_ENTRY_EXECUTE (1ul << 2) +#define CSF_FIRMWARE_ENTRY_CACHE_MODE (3ul << 3) +#define CSF_FIRMWARE_ENTRY_PROTECTED (1ul << 5) +#define CSF_FIRMWARE_ENTRY_SHARED (1ul << 30) +#define CSF_FIRMWARE_ENTRY_ZERO (1ul << 31) + /** * enum kbase_csf_bind_state - bind state of the queue * @@ -327,6 +315,10 @@ struct kbase_csf_notification { * @blocked_reason: Value shows if the queue is blocked, and if so, * the reason why it is blocked * @error: GPU command queue fatal information to pass to user space. + * @fatal_event_work: Work item to handle the CS fatal event reported for this + * queue. + * @cs_fatal_info: Records additional information about the CS fatal event. + * @cs_fatal: Records information about the CS fatal event. */ struct kbase_queue { struct kbase_context *kctx; @@ -353,6 +345,9 @@ struct kbase_queue { u32 sb_status; u32 blocked_reason; struct kbase_csf_notification error; + struct work_struct fatal_event_work; + u64 cs_fatal_info; + u32 cs_fatal; }; /** @@ -415,6 +410,10 @@ struct kbase_protected_suspend_buffer { * @run_state: Current state of the queue group. * @prepared_seq_num: Indicates the position of queue group in the list of * prepared groups to be scheduled. + * @scan_seq_num: Scan out sequence number before adjusting for dynamic + * idle conditions. It is used for setting a group's + * onslot priority. It could differ from prepared_seq_number + * when there are idle groups. * @faulted: Indicates that a GPU fault occurred for the queue group. * This flag persists until the fault has been queued to be * reported to userspace. @@ -431,6 +430,8 @@ struct kbase_protected_suspend_buffer { * to be returned to userspace if such an error has occurred. * @error_tiler_oom: An error of type BASE_GPU_QUEUE_GROUP_ERROR_TILER_HEAP_OOM * to be returned to userspace if such an error has occurred. + * @timer_event_work: Work item to handle the progress timeout fatal event + * for the group. */ struct kbase_queue_group { struct kbase_context *kctx; @@ -452,6 +453,7 @@ struct kbase_queue_group { struct list_head link_to_schedule; enum kbase_csf_group_state run_state; u32 prepared_seq_num; + u32 scan_seq_num; bool faulted; struct kbase_queue *bound_queues[MAX_SUPPORTED_STREAMS_PER_GROUP]; @@ -463,6 +465,8 @@ struct kbase_queue_group { struct kbase_csf_notification error_fatal; struct kbase_csf_notification error_timeout; struct kbase_csf_notification error_tiler_oom; + + struct work_struct timer_event_work; }; /** @@ -499,7 +503,7 @@ struct kbase_csf_kcpu_queue_context { * struct kbase_csf_cpu_queue_context - Object representing the cpu queue * information. * - * @bufffer: Buffer containing CPU queue information provided by Userspace. + * @buffer: Buffer containing CPU queue information provided by Userspace. * @buffer_size: The size of @buffer. * @dump_req_status: Indicates the current status for CPU queues dump request. * @dump_cmp: Dumping cpu queue completion event. @@ -733,6 +737,9 @@ struct kbase_csf_csg_slot { * @num_csg_slots_for_tick: Number of CSG slots that can be * active in the given tick/tock. This depends on the * value of @num_active_address_spaces. + * @remaining_tick_slots: Tracking the number of remaining available slots + * for @num_csg_slots_for_tick during the scheduling + * operation in a tick/tock. * @idle_groups_to_schedule: List of runnable queue groups, in which all GPU * command queues became idle or are waiting for * synchronization object, prepared on every @@ -740,6 +747,9 @@ struct kbase_csf_csg_slot { * appended to the tail of @groups_to_schedule list * after the scan out so that the idle groups aren't * preferred for scheduling over the non-idle ones. + * @csg_scan_count_for_tick: CSG scanout count for assign the scan_seq_num for + * each scanned out group during scheduling operation + * in a tick/tock. * @total_runnable_grps: Total number of runnable groups across all KCTXs. * @csgs_events_enable_mask: Use for temporary masking off asynchronous events * from firmware (such as OoM events) before a group @@ -775,11 +785,6 @@ struct kbase_csf_csg_slot { * @top_grp. * @top_grp: Pointer to queue group inside @groups_to_schedule * list that was assigned the highest slot priority. - * @head_slot_priority: The dynamic slot priority to be used for the - * queue group at the head of @groups_to_schedule - * list. Once the queue group is assigned a CSG slot, - * it is removed from the list and priority is - * decremented. * @tock_pending_request: A "tock" request is pending: a group that is not * currently on the GPU demands to be scheduled. * @active_protm_grp: Indicates if firmware has been permitted to let GPU @@ -826,7 +831,9 @@ struct kbase_csf_scheduler { u32 ngrp_to_schedule; u32 num_active_address_spaces; u32 num_csg_slots_for_tick; + u32 remaining_tick_slots; struct list_head idle_groups_to_schedule; + u32 csg_scan_count_for_tick; u32 total_runnable_grps; DECLARE_BITMAP(csgs_events_enable_mask, MAX_SUPPORTED_CSGS); DECLARE_BITMAP(csg_slots_idle_mask, MAX_SUPPORTED_CSGS); @@ -840,7 +847,6 @@ struct kbase_csf_scheduler { struct delayed_work ping_work; struct kbase_context *top_ctx; struct kbase_queue_group *top_grp; - u8 head_slot_priority; bool tock_pending_request; struct kbase_queue_group *active_protm_grp; bool gpu_idle_fw_timer_enabled; @@ -1021,6 +1027,35 @@ struct kbase_ipa_control { }; /** + * struct kbase_csf_firmware_interface - Interface in the MCU firmware + * + * @node: Interface objects are on the kbase_device:csf.firmware_interfaces + * list using this list_head to link them + * @phys: Array of the physical (tagged) addresses making up this interface + * @name: NULL-terminated string naming the interface + * @num_pages: Number of entries in @phys and @pma (and length of the interface) + * @virtual: Starting GPU virtual address this interface is mapped at + * @flags: bitmask of CSF_FIRMWARE_ENTRY_* conveying the interface attributes + * @data_start: Offset into firmware image at which the interface data starts + * @data_end: Offset into firmware image at which the interface data ends + * @kernel_map: A kernel mapping of the memory or NULL if not required to be + * mapped in the kernel + * @pma: Array of pointers to protected memory allocations. + */ +struct kbase_csf_firmware_interface { + struct list_head node; + struct tagged_addr *phys; + char *name; + u32 num_pages; + u32 virtual; + u32 flags; + u32 data_start; + u32 data_end; + void *kernel_map; + struct protected_memory_allocation **pma; +}; + +/** * struct kbase_csf_hwcnt - Object containing members for handling the dump of * HW counters. * @@ -1035,8 +1070,8 @@ struct kbase_csf_hwcnt { }; /** - * struct kbase_csf - Object representing CSF for an instance of GPU - * platform device. + * struct kbase_csf_device - Object representing CSF for an instance of GPU + * platform device. * * @mcu_mmu: MMU page tables for the MCU firmware * @firmware_interfaces: List of interfaces defined in the firmware image diff --git a/mali_kbase/csf/mali_kbase_csf_firmware.c b/mali_kbase/csf/mali_kbase_csf_firmware.c index 22f162f..ae039aa 100644 --- a/mali_kbase/csf/mali_kbase_csf_firmware.c +++ b/mali_kbase/csf/mali_kbase_csf_firmware.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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" @@ -71,14 +69,6 @@ MODULE_PARM_DESC(fw_debug, #define FIRMWARE_HEADER_VERSION (0ul) #define FIRMWARE_HEADER_LENGTH (0x14ul) -#define CSF_FIRMWARE_ENTRY_READ (1ul << 0) -#define CSF_FIRMWARE_ENTRY_WRITE (1ul << 1) -#define CSF_FIRMWARE_ENTRY_EXECUTE (1ul << 2) -#define CSF_FIRMWARE_ENTRY_CACHE_MODE (3ul << 3) -#define CSF_FIRMWARE_ENTRY_PROTECTED (1ul << 5) -#define CSF_FIRMWARE_ENTRY_SHARED (1ul << 30) -#define CSF_FIRMWARE_ENTRY_ZERO (1ul << 31) - #define CSF_FIRMWARE_ENTRY_SUPPORTED_FLAGS \ (CSF_FIRMWARE_ENTRY_READ | \ CSF_FIRMWARE_ENTRY_WRITE | \ @@ -149,41 +139,17 @@ static unsigned int entry_size(u32 header) { return (header >> 8) & 0xFF; } +static bool entry_update(u32 header) +{ + return (header >> 30) & 0x1; +} static bool entry_optional(u32 header) { return (header >> 31) & 0x1; } /** - * struct firmware_interface - Represents an interface in the MCU firmware - * - * @node: Interface objects are on the kbase_device:csf.firmware_interfaces - * list using this list_head to link them - * @phys: Array of the physical (tagged) addresses making up this interface - * @name: NUL-terminated string naming the interface - * @num_pages: Number of entries in @phys (and length of the interface) - * @virtual: Virtual address that this interface is mapped at for the GPU - * @flags: bitmask of CSF_FIRMWARE_ENTRY_* conveying the interface attributes - * @data_start: Offset into firmware image at which the interface data starts - * @data_end: Offset into firmware image at which the interface data ends - * @kernel_map: A kernel mapping of the memory or NULL if not required to be - * mapped in the kernel - * @pma: Array of pointers to protected memory allocations. - */ -struct firmware_interface { - struct list_head node; - struct tagged_addr *phys; - char *name; - u32 num_pages; - u32 virtual; - u32 flags; - u32 data_start; - u32 data_end; - void *kernel_map; - struct protected_memory_allocation **pma; -}; - -/** + * struct firmware_timeline_metadata - * Timeline metadata item within the MCU firmware * * @node: List head linking all timeline metadata to @@ -207,7 +173,8 @@ struct firmware_timeline_metadata { */ static int setup_shared_iface_static_region(struct kbase_device *kbdev) { - struct firmware_interface *interface = kbdev->csf.shared_interface; + struct kbase_csf_firmware_interface *interface = + kbdev->csf.shared_interface; struct kbase_va_region *reg; int ret = -ENOMEM; @@ -441,7 +408,7 @@ static void load_fw_image_section(struct kbase_device *kbdev, const u8 *data, static int reload_fw_data_sections(struct kbase_device *kbdev) { const u32 magic = FIRMWARE_HEADER_MAGIC; - struct firmware_interface *interface; + struct kbase_csf_firmware_interface *interface; const struct firmware *firmware; int ret = 0; @@ -510,7 +477,7 @@ static int parse_memory_setup_entry(struct kbase_device *kbdev, u32 num_pages; char *name; struct tagged_addr *phys = NULL; - struct firmware_interface *interface = NULL; + struct kbase_csf_firmware_interface *interface = NULL; bool allocated_pages = false, protected_mode = false; unsigned long mem_flags = 0; u32 cache_mode = 0; @@ -580,7 +547,7 @@ static int parse_memory_setup_entry(struct kbase_device *kbdev, load_fw_image_section(kbdev, fw->data, phys, num_pages, flags, data_start, data_end); - /* Allocate enough memory for the struct firmware_interface and + /* Allocate enough memory for the struct kbase_csf_firmware_interface and * the name of the interface. An extra byte is allocated to place a * NUL-terminator in. This should already be included according to the * specification but here we add it anyway to be robust against a @@ -767,6 +734,11 @@ static int load_firmware_entry(struct kbase_device *kbdev, const unsigned int type = entry_type(header); unsigned int size = entry_size(header); const bool optional = entry_optional(header); + /* Update is used with configuration and tracebuffer entries to + * initiate a FIRMWARE_CONFIG_UPDATE, instead of triggering a + * silent reset. + */ + const bool updatable = entry_update(header); const u32 *entry = (void *)(fw->data + offset); if ((offset % sizeof(*entry)) || (size % sizeof(*entry))) { @@ -801,7 +773,7 @@ static int load_firmware_entry(struct kbase_device *kbdev, return -EINVAL; } return kbase_csf_firmware_cfg_option_entry_parse( - kbdev, fw, entry, size); + kbdev, fw, entry, size, updatable); case CSF_FIRMWARE_ENTRY_TYPE_FUTF_TEST: #ifndef MALI_KBASE_BUILD /* FW UTF option */ @@ -822,7 +794,7 @@ static int load_firmware_entry(struct kbase_device *kbdev, return -EINVAL; } return kbase_csf_firmware_parse_trace_buffer_entry( - kbdev, entry, size); + kbdev, entry, size, updatable); case CSF_FIRMWARE_ENTRY_TYPE_TIMELINE_METADATA: /* Meta data section */ if (size < TL_METADATA_ENTRY_NAME_OFFSET + sizeof(*entry)) { @@ -869,7 +841,8 @@ static void free_global_iface(struct kbase_device *kbdev) */ static inline void *iface_gpu_va_to_cpu(struct kbase_device *kbdev, u32 gpu_va) { - struct firmware_interface *interface = kbdev->csf.shared_interface; + struct kbase_csf_firmware_interface *interface = + kbdev->csf.shared_interface; u8 *kernel_base = interface->kernel_map; if (gpu_va < interface->virtual || @@ -964,7 +937,8 @@ static int parse_cmd_stream_group_info(struct kbase_device *kbdev, static u32 get_firmware_version(struct kbase_device *kbdev) { - struct firmware_interface *interface = kbdev->csf.shared_interface; + struct kbase_csf_firmware_interface *interface = + kbdev->csf.shared_interface; u32 *shared_info = interface->kernel_map; return shared_info[GLB_VERSION/4]; @@ -972,7 +946,8 @@ static u32 get_firmware_version(struct kbase_device *kbdev) static int parse_capabilities(struct kbase_device *kbdev) { - struct firmware_interface *interface = kbdev->csf.shared_interface; + struct kbase_csf_firmware_interface *interface = + kbdev->csf.shared_interface; u32 *shared_info = interface->kernel_map; struct kbase_csf_global_iface *iface = &kbdev->csf.global_iface; unsigned int gid; @@ -1049,7 +1024,7 @@ static int parse_capabilities(struct kbase_device *kbdev) static inline void access_firmware_memory(struct kbase_device *kbdev, u32 gpu_addr, u32 *value, const bool read) { - struct firmware_interface *interface; + struct kbase_csf_firmware_interface *interface; list_for_each_entry(interface, &kbdev->csf.firmware_interfaces, node) { if ((gpu_addr >= interface->virtual) && @@ -1390,22 +1365,6 @@ static void set_timeout_global( set_global_request(global_iface, GLB_REQ_CFG_PROGRESS_TIMER_MASK); } -static void set_coherency_mode(struct kbase_device *const kbdev) -{ - const struct kbase_csf_global_iface *const global_iface = - &kbdev->csf.global_iface; - u32 protected_mode_coherency = kbdev->system_coherency; - - /* GPU is supposed to use ACE-Lite coherency mode on a fully coherent - * system during protected mode execution. - */ - if (kbdev->system_coherency == COHERENCY_ACE) - protected_mode_coherency = COHERENCY_ACE_LITE; - - kbase_csf_firmware_global_input(global_iface, GLB_PROTM_COHERENCY, - protected_mode_coherency); -} - static void global_init(struct kbase_device *const kbdev, u64 core_mask) { u32 const ack_irq_mask = GLB_ACK_IRQ_MASK_CFG_ALLOC_EN_MASK | @@ -1413,6 +1372,7 @@ static void global_init(struct kbase_device *const kbdev, u64 core_mask) GLB_ACK_IRQ_MASK_CFG_PROGRESS_TIMER_MASK | GLB_ACK_IRQ_MASK_PROTM_ENTER_MASK | GLB_ACK_IRQ_MASK_PROTM_EXIT_MASK | + GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_MASK | GLB_ACK_IRQ_MASK_CFG_PWROFF_TIMER_MASK | GLB_ACK_IRQ_MASK_IDLE_EVENT_MASK; @@ -1422,8 +1382,10 @@ static void global_init(struct kbase_device *const kbdev, u64 core_mask) kbase_csf_scheduler_spin_lock(kbdev, &flags); - /* Set the cohereny mode for protected mode execution */ - set_coherency_mode(kbdev); + /* Set the coherency mode for protected mode execution */ + WARN_ON(kbdev->system_coherency == COHERENCY_ACE); + kbase_csf_firmware_global_input(global_iface, GLB_PROTM_COHERENCY, + kbdev->system_coherency); /* Update shader core allocation enable mask */ enable_endpoints_global(global_iface, core_mask); @@ -1514,6 +1476,10 @@ bool kbase_csf_firmware_core_attr_updated(struct kbase_device *kbdev) } /** + * kbase_csf_firmware_reload_worker() - + * reload the fw image and re-enable the MCU + * @work: CSF Work item for reloading the firmware. + * * This helper function will reload the firmware image and re-enable the MCU. * It is supposed to be called after MCU(GPU) has been reset. * Unlike the initial boot the firmware binary image is not parsed completely. @@ -1774,8 +1740,8 @@ int kbase_csf_firmware_init(struct kbase_device *kbdev) goto error; } - version_major = firmware->data[4]; - version_minor = firmware->data[5]; + version_minor = firmware->data[4]; + version_major = firmware->data[5]; if (version_major != FIRMWARE_HEADER_VERSION) { dev_err(kbdev->dev, @@ -1926,10 +1892,12 @@ void kbase_csf_firmware_term(struct kbase_device *kbdev) kbase_csf_firmware_trace_buffers_term(kbdev); while (!list_empty(&kbdev->csf.firmware_interfaces)) { - struct firmware_interface *interface; + struct kbase_csf_firmware_interface *interface; - interface = list_first_entry(&kbdev->csf.firmware_interfaces, - struct firmware_interface, node); + interface = + list_first_entry(&kbdev->csf.firmware_interfaces, + struct kbase_csf_firmware_interface, + node); list_del(&interface->node); vunmap(interface->kernel_map); @@ -2061,14 +2029,10 @@ void kbase_csf_enter_protected_mode(struct kbase_device *kbdev) { struct kbase_csf_global_iface *global_iface = &kbdev->csf.global_iface; unsigned long flags; - unsigned int value; int err; kbase_csf_scheduler_spin_lock(kbdev, &flags); - value = kbase_csf_firmware_global_output(global_iface, GLB_ACK); - value ^= GLB_REQ_PROTM_ENTER_MASK; - kbase_csf_firmware_global_input_mask(global_iface, GLB_REQ, value, - GLB_REQ_PROTM_ENTER_MASK); + set_global_request(global_iface, GLB_REQ_PROTM_ENTER_MASK); dev_dbg(kbdev->dev, "Sending request to enter protected mode"); kbase_csf_ring_doorbell(kbdev, CSF_KERNEL_DOORBELL_NR); kbase_csf_scheduler_spin_unlock(kbdev, flags); @@ -2089,18 +2053,42 @@ void kbase_csf_firmware_trigger_mcu_halt(struct kbase_device *kbdev) { struct kbase_csf_global_iface *global_iface = &kbdev->csf.global_iface; unsigned long flags; - unsigned int value; kbase_csf_scheduler_spin_lock(kbdev, &flags); - value = kbase_csf_firmware_global_output(global_iface, GLB_ACK); - value ^= GLB_REQ_HALT_MASK; - kbase_csf_firmware_global_input_mask(global_iface, GLB_REQ, value, - GLB_REQ_HALT_MASK); + set_global_request(global_iface, GLB_REQ_HALT_MASK); dev_dbg(kbdev->dev, "Sending request to HALT MCU"); kbase_csf_ring_doorbell(kbdev, CSF_KERNEL_DOORBELL_NR); kbase_csf_scheduler_spin_unlock(kbdev, flags); } +int kbase_csf_trigger_firmware_config_update(struct kbase_device *kbdev) +{ + struct kbase_csf_global_iface *global_iface = &kbdev->csf.global_iface; + unsigned long flags; + int err = 0; + + /* Ensure GPU is powered-up until we complete config update.*/ + kbase_pm_context_active(kbdev); + + /* The 'reg_lock' is also taken and is held till the update is + * complete, to ensure the config update gets serialized. + */ + mutex_lock(&kbdev->csf.reg_lock); + kbase_csf_scheduler_spin_lock(kbdev, &flags); + + set_global_request(global_iface, GLB_REQ_FIRMWARE_CONFIG_UPDATE_MASK); + dev_dbg(kbdev->dev, "Sending request for FIRMWARE_CONFIG_UPDATE"); + kbase_csf_ring_doorbell(kbdev, CSF_KERNEL_DOORBELL_NR); + kbase_csf_scheduler_spin_unlock(kbdev, flags); + + err = wait_for_global_request(kbdev, + GLB_REQ_FIRMWARE_CONFIG_UPDATE_MASK); + mutex_unlock(&kbdev->csf.reg_lock); + + kbase_pm_context_idle(kbdev); + return err; +} + /** * copy_grp_and_stm - Copy CS and/or group data * diff --git a/mali_kbase/csf/mali_kbase_csf_firmware.h b/mali_kbase/csf/mali_kbase_csf_firmware.h index baee9da..a2dc4fd 100644 --- a/mali_kbase/csf/mali_kbase_csf_firmware.h +++ b/mali_kbase/csf/mali_kbase_csf_firmware.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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 @@ -796,4 +776,17 @@ static inline u32 kbase_csf_interface_version(u32 major, u32 minor, u32 patch) (patch << GLB_VERSION_PATCH_SHIFT)); } +/** + * kbase_csf_trigger_firmware_config_update - Send a firmware config update. + * + * @kbdev: Instance of a GPU platform device that implements a CSF interface. + * + * Any changes done to firmware configuration entry or tracebuffer entry + * requires a GPU silent reset to reflect the configuration changes + * requested, but if Firmware.header.entry.bit(30) is set then we can request a + * FIRMWARE_CONFIG_UPDATE rather than doing a silent reset. + * + * Return: 0 if success, or negative error code on failure. + */ +int kbase_csf_trigger_firmware_config_update(struct kbase_device *kbdev); #endif diff --git a/mali_kbase/csf/mali_kbase_csf_firmware_cfg.c b/mali_kbase/csf/mali_kbase_csf_firmware_cfg.c index 6a4bfda..10bc419 100644 --- a/mali_kbase/csf/mali_kbase_csf_firmware_cfg.c +++ b/mali_kbase/csf/mali_kbase_csf_firmware_cfg.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> @@ -42,6 +40,8 @@ * inside CSF_FIRMWARE_CFG_SYSFS_DIR_NAME directory, * representing the configuration option @name. * @kobj_inited: kobject initialization state + * @updatable: Indicates whether config items can be updated with + * FIRMWARE_CONFIG_UPDATE * @name: NUL-terminated string naming the option * @address: The address in the firmware image of the configuration option * @min: The lowest legal value of the configuration option @@ -53,6 +53,7 @@ struct firmware_config { struct kbase_device *kbdev; struct kobject kobj; bool kobj_inited; + bool updatable; char *name; u32 address; u32 min; @@ -143,14 +144,20 @@ static ssize_t store_fw_cfg(struct kobject *kobj, return count; } - /* - * If there is already a GPU reset pending then inform - * the User to retry the write. + /* If configuration update cannot be performed with + * FIRMWARE_CONFIG_UPDATE then we need to do a + * silent reset before we update the memory. */ - if (kbase_reset_gpu_silent(kbdev)) { - spin_unlock_irqrestore( - &kbdev->hwaccess_lock, flags); - return -EAGAIN; + if (!config->updatable) { + /* + * If there is already a GPU reset pending then inform + * the User to retry the write. + */ + if (kbase_reset_gpu_silent(kbdev)) { + spin_unlock_irqrestore(&kbdev->hwaccess_lock, + flags); + return -EAGAIN; + } } /* @@ -166,10 +173,21 @@ static ssize_t store_fw_cfg(struct kobject *kobj, kbdev, config->address, val); config->cur_val = val; + spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags); + /* If we can update the config without firmware reset then + * we need to just trigger FIRMWARE_CONFIG_UPDATE. + */ + if (config->updatable) { + ret = kbase_csf_trigger_firmware_config_update(kbdev); + if (ret) + return ret; + } + /* Wait for the config update to take effect */ - kbase_reset_gpu_wait(kbdev); + if (!config->updatable) + kbase_reset_gpu_wait(kbdev); } else { dev_warn(kbdev->dev, "Unexpected write to entry %s/%s", @@ -255,8 +273,9 @@ void kbase_csf_firmware_cfg_term(struct kbase_device *kbdev) } int kbase_csf_firmware_cfg_option_entry_parse(struct kbase_device *kbdev, - const struct firmware *fw, - const u32 *entry, unsigned int size) + const struct firmware *fw, + const u32 *entry, + unsigned int size, bool updatable) { const char *name = (char *)&entry[3]; struct firmware_config *config; @@ -271,6 +290,7 @@ int kbase_csf_firmware_cfg_option_entry_parse(struct kbase_device *kbdev, return -ENOMEM; config->kbdev = kbdev; + config->updatable = updatable; config->name = (char *)(config+1); config->address = entry[0]; config->min = entry[1]; diff --git a/mali_kbase/csf/mali_kbase_csf_firmware_cfg.h b/mali_kbase/csf/mali_kbase_csf_firmware_cfg.h index 542e3b9..36883ab 100644 --- a/mali_kbase/csf/mali_kbase_csf_firmware_cfg.h +++ b/mali_kbase/csf/mali_kbase_csf_firmware_cfg.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 @@ -80,12 +60,15 @@ void kbase_csf_firmware_cfg_term(struct kbase_device *kbdev); * * Return: 0 if successful, negative error code on failure * - * @kbdev: Kbase device structure - * @fw: Firmware image containing the section - * @entry: Pointer to the section - * @size: Size (in bytes) of the section + * @kbdev: Kbase device structure + * @fw: Firmware image containing the section + * @entry: Pointer to the section + * @size: Size (in bytes) of the section + * @updatable: Indicates if entry can be updated with FIRMWARE_CONFIG_UPDATE */ int kbase_csf_firmware_cfg_option_entry_parse(struct kbase_device *kbdev, - const struct firmware *fw, - const u32 *entry, unsigned int size); + const struct firmware *fw, + const u32 *entry, + unsigned int size, + bool updatable); #endif /* _KBASE_CSF_FIRMWARE_CFG_H_ */ diff --git a/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c b/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c index d82139a..6349917 100644 --- a/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c +++ b/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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" @@ -595,6 +593,7 @@ static void global_init(struct kbase_device *const kbdev, u64 core_mask) GLB_ACK_IRQ_MASK_PING_MASK | GLB_ACK_IRQ_MASK_CFG_PROGRESS_TIMER_MASK | GLB_ACK_IRQ_MASK_PROTM_ENTER_MASK | + GLB_ACK_IRQ_MASK_FIRMWARE_CONFIG_UPDATE_MASK | GLB_ACK_IRQ_MASK_PROTM_EXIT_MASK | GLB_ACK_IRQ_MASK_CFG_PWROFF_TIMER_MASK | GLB_ACK_IRQ_MASK_IDLE_EVENT_MASK; @@ -1075,13 +1074,9 @@ void kbase_csf_enter_protected_mode(struct kbase_device *kbdev) { struct kbase_csf_global_iface *global_iface = &kbdev->csf.global_iface; unsigned long flags; - unsigned int value; kbase_csf_scheduler_spin_lock(kbdev, &flags); - value = kbase_csf_firmware_global_output(global_iface, GLB_ACK); - value ^= GLB_REQ_PROTM_ENTER_MASK; - kbase_csf_firmware_global_input_mask(global_iface, GLB_REQ, value, - GLB_REQ_PROTM_ENTER_MASK); + set_global_request(global_iface, GLB_REQ_PROTM_ENTER_MASK); dev_dbg(kbdev->dev, "Sending request to enter protected mode"); kbase_csf_ring_doorbell(kbdev, CSF_KERNEL_DOORBELL_NR); kbase_csf_scheduler_spin_unlock(kbdev, flags); @@ -1093,18 +1088,37 @@ void kbase_csf_firmware_trigger_mcu_halt(struct kbase_device *kbdev) { struct kbase_csf_global_iface *global_iface = &kbdev->csf.global_iface; unsigned long flags; - unsigned int value; kbase_csf_scheduler_spin_lock(kbdev, &flags); - value = kbase_csf_firmware_global_output(global_iface, GLB_ACK); - value ^= GLB_REQ_HALT_MASK; - kbase_csf_firmware_global_input_mask(global_iface, GLB_REQ, value, - GLB_REQ_HALT_MASK); + set_global_request(global_iface, GLB_REQ_HALT_MASK); dev_dbg(kbdev->dev, "Sending request to HALT MCU"); kbase_csf_ring_doorbell(kbdev, CSF_KERNEL_DOORBELL_NR); kbase_csf_scheduler_spin_unlock(kbdev, flags); } +int kbase_csf_trigger_firmware_config_update(struct kbase_device *kbdev) +{ + struct kbase_csf_global_iface *global_iface = &kbdev->csf.global_iface; + unsigned long flags; + int err = 0; + + /* The 'reg_lock' is also taken and is held till the update is + * complete, to ensure the config update gets serialized. + */ + mutex_lock(&kbdev->csf.reg_lock); + kbase_csf_scheduler_spin_lock(kbdev, &flags); + + set_global_request(global_iface, GLB_REQ_FIRMWARE_CONFIG_UPDATE_MASK); + dev_dbg(kbdev->dev, "Sending request for FIRMWARE_CONFIG_UPDATE"); + kbase_csf_ring_doorbell(kbdev, CSF_KERNEL_DOORBELL_NR); + kbase_csf_scheduler_spin_unlock(kbdev, flags); + + err = wait_for_global_request(kbdev, + GLB_REQ_FIRMWARE_CONFIG_UPDATE_MASK); + mutex_unlock(&kbdev->csf.reg_lock); + return err; +} + /** * copy_grp_and_stm - Copy CS and/or group data * diff --git a/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.c b/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.c index 4dc1ac1..6c6d181 100644 --- a/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.c +++ b/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.h b/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.h index ecb0852..a39ee92 100644 --- a/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.h +++ b/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_ioctl.h b/mali_kbase/csf/mali_kbase_csf_ioctl.h index 0bbc96c..8c63e1c 100644 --- a/mali_kbase/csf/mali_kbase_csf_ioctl.h +++ b/mali_kbase/csf/mali_kbase_csf_ioctl.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 @@ -110,16 +90,14 @@ struct kbase_ioctl_cs_queue_kick { /** * union kbase_ioctl_cs_queue_bind - Bind a GPU command queue to a group * - * @buffer_gpu_addr: GPU address of the buffer backing the queue - * @group_handle: Handle of the group to which the queue should be bound - * @csi_index: Index of the CSF interface the queue should be bound to - * @padding: Currently unused, must be zero - * @mmap_handle: Handle to be used for creating the mapping of CS - * input/output pages - * - * @in: Input parameters - * @out: Output parameters - * + * @in: Input parameters + * @in.buffer_gpu_addr: GPU address of the buffer backing the queue + * @in.group_handle: Handle of the group to which the queue should be bound + * @in.csi_index: Index of the CSF interface the queue should be bound to + * @in.padding: Currently unused, must be zero + * @out: Output parameters + * @out.mmap_handle: Handle to be used for creating the mapping of CS + * input/output pages */ union kbase_ioctl_cs_queue_bind { struct { @@ -152,24 +130,22 @@ struct kbase_ioctl_cs_queue_terminate { /** * union kbase_ioctl_cs_queue_group_create - Create a GPU command queue group - * - * @tiler_mask: Mask of tiler endpoints the group is allowed to use. - * @fragment_mask: Mask of fragment endpoints the group is allowed to use. - * @compute_mask: Mask of compute endpoints the group is allowed to use. - * @cs_min: Minimum number of CSs required. - * @priority: Queue group's priority within a process. - * @tiler_max: Maximum number of tiler endpoints the group is allowed - * to use. - * @fragment_max: Maximum number of fragment endpoints the group is - * allowed to use. - * @compute_max: Maximum number of compute endpoints the group is allowed - * to use. - * @padding: Currently unused, must be zero - * @group_handle: Handle of a newly created queue group. - * - * @in: Input parameters - * @out: Output parameters - * + * @in: Input parameters + * @in.tiler_mask: Mask of tiler endpoints the group is allowed to use. + * @in.fragment_mask: Mask of fragment endpoints the group is allowed to use. + * @in.compute_mask: Mask of compute endpoints the group is allowed to use. + * @in.cs_min: Minimum number of CSs required. + * @in.priority: Queue group's priority within a process. + * @in.tiler_max: Maximum number of tiler endpoints the group is allowed + * to use. + * @in.fragment_max: Maximum number of fragment endpoints the group is + * allowed to use. + * @in.compute_max: Maximum number of compute endpoints the group is allowed + * to use. + * @in.padding: Currently unused, must be zero + * @out: Output parameters + * @out.group_handle: Handle of a newly created queue group. + * @out.padding: Currently unused, must be zero */ union kbase_ioctl_cs_queue_group_create { struct { @@ -260,23 +236,21 @@ struct kbase_ioctl_kcpu_queue_enqueue { /** * union kbase_ioctl_cs_tiler_heap_init - Initialize chunked tiler memory heap - * - * @chunk_size: Size of each chunk. - * @initial_chunks: Initial number of chunks that heap will be created with. - * @max_chunks: Maximum number of chunks that the heap is allowed to use. - * @target_in_flight: Number of render-passes that the driver should attempt to - * keep in flight for which allocation of new chunks is - * allowed. - * @group_id: Group ID to be used for physical allocations. - * @gpu_heap_va: GPU VA (virtual address) of Heap context that was set up for - * the heap. - * @first_chunk_va: GPU VA of the first chunk allocated for the heap, actually - * points to the header of heap chunk and not to the low - * address of free memory in the chunk. - * - * @in: Input parameters - * @out: Output parameters - * + * @in: Input parameters + * @in.chunk_size: Size of each chunk. + * @in.initial_chunks: Initial number of chunks that heap will be created with. + * @in.max_chunks: Maximum number of chunks that the heap is allowed to use. + * @in.target_in_flight: Number of render-passes that the driver should attempt to + * keep in flight for which allocation of new chunks is + * allowed. + * @in.group_id: Group ID to be used for physical allocations. + * @in.padding: Padding + * @out: Output parameters + * @out.gpu_heap_va: GPU VA (virtual address) of Heap context that was set up + * for the heap. + * @out.first_chunk_va: GPU VA of the first chunk allocated for the heap, + * actually points to the header of heap chunk and not to + * the low address of free memory in the chunk. */ union kbase_ioctl_cs_tiler_heap_init { struct { @@ -313,25 +287,25 @@ struct kbase_ioctl_cs_tiler_heap_term { * union kbase_ioctl_cs_get_glb_iface - Request the global control block * of CSF interface capabilities * - * @max_group_num: The maximum number of groups to be read. Can be 0, in - * which case groups_ptr is unused. - * @max_total_stream_num: The maximum number of CSs to be read. Can be 0, in - * which case streams_ptr is unused. - * @groups_ptr: Pointer where to store all the group data (sequentially). - * @streams_ptr: Pointer where to store all the CS data (sequentially). - * @glb_version: Global interface version. - * @features: Bit mask of features (e.g. whether certain types of job - * can be suspended). - * @group_num: Number of CSGs supported. - * @prfcnt_size: Size of CSF performance counters, in bytes. Bits 31:16 - * hold the size of firmware performance counter data - * and 15:0 hold the size of hardware performance counter - * data. - * @total_stream_num: Total number of CSs, summed across all groups. - * @padding: Will be zeroed. + * @in: Input parameters + * @in.max_group_num: The maximum number of groups to be read. Can be 0, in + * which case groups_ptr is unused. + * @in.max_total_stream_num: The maximum number of CSs to be read. Can be 0, in + * which case streams_ptr is unused. + * @in.groups_ptr: Pointer where to store all the group data (sequentially). + * @in.streams_ptr: Pointer where to store all the CS data (sequentially). + * @out: Output parameters + * @out.glb_version: Global interface version. + * @out.features: Bit mask of features (e.g. whether certain types of job + * can be suspended). + * @out.group_num: Number of CSGs supported. + * @out.prfcnt_size: Size of CSF performance counters, in bytes. Bits 31:16 + * hold the size of firmware performance counter data + * and 15:0 hold the size of hardware performance counter + * data. + * @out.total_stream_num: Total number of CSs, summed across all groups. + * @out.padding: Will be zeroed. * - * @in: Input parameters - * @out: Output parameters * */ union kbase_ioctl_cs_get_glb_iface { @@ -387,12 +361,11 @@ struct kbase_ioctl_cs_event_memory_write { /** * union kbase_ioctl_cs_event_memory_read - Read an event memory address - * @cpu_addr: Memory address to read - * @value: Value read - * @padding: Currently unused, must be zero - * * @in: Input parameters + * @in.cpu_addr: Memory address to read * @out: Output parameters + * @out.value: Value read + * @out.padding: Currently unused, must be zero */ union kbase_ioctl_cs_event_memory_read { struct { diff --git a/mali_kbase/csf/mali_kbase_csf_kcpu.c b/mali_kbase/csf/mali_kbase_csf_kcpu.c index b073d05..e5aee61 100644 --- a/mali_kbase/csf/mali_kbase_csf_kcpu.c +++ b/mali_kbase/csf/mali_kbase_csf_kcpu.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> @@ -243,7 +241,7 @@ static int kbase_kcpu_jit_allocate_process( u8 const*const free_ids = jit_cmd->info.jit_free.ids; if (free_ids && *free_ids && kctx->jit_alloc[*free_ids]) { - /** + /* * A JIT free which is active * and submitted before this * command. @@ -255,7 +253,7 @@ static int kbase_kcpu_jit_allocate_process( } if (!can_block) { - /** + /* * No prior JIT_FREE command is active. Roll * back previous allocations and fail. */ @@ -401,7 +399,7 @@ static void kbase_kcpu_jit_allocate_finish( /* Remove this command from the jit_cmds_head list */ list_del(&cmd->info.jit_alloc.node); - /** + /* * If we get to this point we must have already cleared the blocked * flag, otherwise it'd be a bug. */ @@ -424,7 +422,7 @@ static void kbase_kcpu_jit_retry_pending_allocs(struct kbase_context *kctx) lockdep_assert_held(&kctx->csf.kcpu_queues.lock); - /** + /* * Reschedule all queues blocked by JIT_ALLOC commands. * NOTE: This code traverses the list of blocked queues directly. It * only works as long as the queued works are not executed at the same @@ -485,7 +483,7 @@ static int kbase_kcpu_jit_free_process(struct kbase_kcpu_command_queue *queue, /* Free the list of ids */ kfree(ids); - /** + /* * Remove this command from the jit_cmds_head list and retry pending * allocations. */ @@ -648,6 +646,7 @@ static int kbase_csf_queue_group_suspend_prepare( } sus_buf->cpu_alloc = kbase_mem_phy_alloc_get(reg->cpu_alloc); + kbase_mem_phy_alloc_kernel_mapped(reg->cpu_alloc); page_array = kbase_get_cpu_phy_pages(reg); page_array += start; @@ -782,7 +781,7 @@ static int kbase_kcpu_cqs_wait_prepare(struct kbase_kcpu_command_queue *queue, struct base_kcpu_command_cqs_wait_info *cqs_wait_info, struct kbase_kcpu_command *current_command) { - struct base_cqs_wait *objs; + struct base_cqs_wait_info *objs; unsigned int nr_objs = cqs_wait_info->nr_objs; lockdep_assert_held(&queue->kctx->csf.kcpu_queues.lock); @@ -1491,6 +1490,8 @@ static void kcpu_queue_process(struct kbase_kcpu_command_queue *queue, for (i = 0; i < sus_buf->nr_pages; i++) put_page(sus_buf->pages[i]); } else { + kbase_mem_phy_alloc_kernel_unmapped( + sus_buf->cpu_alloc); kbase_mem_phy_alloc_put(sus_buf->cpu_alloc); } @@ -1498,6 +1499,26 @@ static void kcpu_queue_process(struct kbase_kcpu_command_queue *queue, kfree(sus_buf); break; } +#if MALI_UNIT_TEST + case BASE_KCPU_COMMAND_TYPE_SAMPLE_TIME: { + u64 time = ktime_get_raw_ns(); + void *target_page = kmap(*cmd->info.sample_time.page); + + if (target_page) { + memcpy(target_page + + cmd->info.sample_time.page_offset, + &time, sizeof(time)); + kunmap(*cmd->info.sample_time.page); + } else { + dev_warn(kbdev->dev, + "Could not kmap target page\n"); + queue->has_error = true; + } + put_page(*cmd->info.sample_time.page); + kfree(cmd->info.sample_time.page); + break; + } +#endif /* MALI_UNIT_TEST */ default: dev_warn(kbdev->dev, "Unrecognized command type\n"); @@ -1547,14 +1568,15 @@ static void KBASE_TLSTREAM_TL_KBASE_KCPUQUEUE_ENQUEUE_COMMAND( break; case BASE_KCPU_COMMAND_TYPE_CQS_WAIT: { - const struct base_cqs_wait *waits = cmd->info.cqs_wait.objs; + const struct base_cqs_wait_info *waits = + cmd->info.cqs_wait.objs; u32 inherit_err_flags = cmd->info.cqs_wait.inherit_err_flags; unsigned int i; for (i = 0; i < cmd->info.cqs_wait.nr_objs; i++) { KBASE_TLSTREAM_TL_KBASE_KCPUQUEUE_ENQUEUE_CQS_WAIT( kbdev, queue, waits[i].addr, waits[i].val, - inherit_err_flags & ((u32)1 << i)); + (inherit_err_flags & ((u32)1 << i)) ? 1 : 0); } break; } @@ -1625,6 +1647,14 @@ static void KBASE_TLSTREAM_TL_KBASE_KCPUQUEUE_ENQUEUE_COMMAND( kbdev, queue, cmd->info.suspend_buf_copy.sus_buf, cmd->info.suspend_buf_copy.group_handle); break; +#if MALI_UNIT_TEST + case BASE_KCPU_COMMAND_TYPE_SAMPLE_TIME: + /* + * This is test-only KCPU command, no need to have a timeline + * entry + */ + break; +#endif /* MALI_UNIT_TEST */ } } @@ -1757,7 +1787,37 @@ int kbase_csf_kcpu_queue_enqueue(struct kbase_context *kctx, &command.info.suspend_buf_copy, kcpu_cmd); break; +#if MALI_UNIT_TEST + case BASE_KCPU_COMMAND_TYPE_SAMPLE_TIME: { + int const page_cnt = 1; + + kcpu_cmd->type = BASE_KCPU_COMMAND_TYPE_SAMPLE_TIME; + kcpu_cmd->info.sample_time.page_addr = + command.info.sample_time.time & PAGE_MASK; + kcpu_cmd->info.sample_time.page_offset = + command.info.sample_time.time & ~PAGE_MASK; + kcpu_cmd->info.sample_time.page = kcalloc( + page_cnt, sizeof(struct page *), GFP_KERNEL); + if (!kcpu_cmd->info.sample_time.page) { + ret = -ENOMEM; + } else { + int pinned_pages = get_user_pages_fast( + kcpu_cmd->info.sample_time.page_addr, + page_cnt, 1, + kcpu_cmd->info.sample_time.page); + + if (pinned_pages < 0) { + ret = pinned_pages; + kfree(kcpu_cmd->info.sample_time.page); + } else if (pinned_pages != page_cnt) { + ret = -EINVAL; + kfree(kcpu_cmd->info.sample_time.page); + } + } + break; + } +#endif /* MALI_UNIT_TEST */ default: dev_warn(queue->kctx->kbdev->dev, "Unknown command type %u\n", command.type); diff --git a/mali_kbase/csf/mali_kbase_csf_kcpu.h b/mali_kbase/csf/mali_kbase_csf_kcpu.h index cf506ea..a528572 100644 --- a/mali_kbase/csf/mali_kbase_csf_kcpu.h +++ b/mali_kbase/csf/mali_kbase_csf_kcpu.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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 @@ -67,9 +47,9 @@ struct kbase_kcpu_command_import_info { * struct kbase_kcpu_command_fence_info - Structure which holds information * about the fence object enqueued in the kcpu command queue * - * @fence_cb: - * @fence: - * @kcpu_queue: + * @fence_cb: Fence callback + * @fence: Fence + * @kcpu_queue: kcpu command queue */ struct kbase_kcpu_command_fence_info { #if (KERNEL_VERSION(4, 10, 0) > LINUX_VERSION_CODE) @@ -112,7 +92,7 @@ struct kbase_kcpu_command_cqs_set_info { * queue's error-state. */ struct kbase_kcpu_command_cqs_wait_info { - struct base_cqs_wait *objs; + struct base_cqs_wait_info *objs; unsigned long *signaled; unsigned int nr_objs; u32 inherit_err_flags; @@ -122,7 +102,7 @@ struct kbase_kcpu_command_cqs_wait_info { * struct kbase_kcpu_command_jit_alloc_info - Structure which holds information * needed for the kcpu command for jit allocations * - * @node Used to keep track of all JIT free/alloc commands in submission + * @node: Used to keep track of all JIT free/alloc commands in submission * order. This must be located in the front of this struct to * match that of kbase_kcpu_command_jit_free_info. * @info: Array of objects of the struct base_jit_alloc_info type which @@ -187,6 +167,14 @@ struct kbase_kcpu_command_group_suspend_info { u8 group_handle; }; +#if MALI_UNIT_TEST +struct kbase_kcpu_command_sample_time_info { + u64 page_addr; + u64 page_offset; + struct page **page; +}; +#endif /* MALI_UNIT_TEST */ + /** * struct kbase_cpu_command - Command which is to be part of the kernel * command queue @@ -196,6 +184,14 @@ struct kbase_kcpu_command_group_suspend_info { * indicates that it has been enqueued earlier. * @info: Structure which holds information about the command * dependent on the command type. + * @info.fence: Fence + * @info.cqs_wait: CQS wait + * @info.cqs_set: CQS set + * @info.import: import + * @info.jit_alloc: jit allocation + * @info.jit_free: jit deallocation + * @info.suspend_buf_copy: suspend buffer copy + * @info.sample_time: sample time */ struct kbase_kcpu_command { enum base_kcpu_command_type type; @@ -208,6 +204,9 @@ struct kbase_kcpu_command { struct kbase_kcpu_command_jit_alloc_info jit_alloc; struct kbase_kcpu_command_jit_free_info jit_free; struct kbase_kcpu_command_group_suspend_info suspend_buf_copy; +#if MALI_UNIT_TEST + struct kbase_kcpu_command_sample_time_info sample_time; +#endif /* MALI_UNIT_TEST */ } info; }; diff --git a/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.c b/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.c index 004fc89..5c2e8e3 100644 --- a/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.c +++ b/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_csf_kcpu_debugfs.h" diff --git a/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.h b/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.h index 11ee381..58b8e34 100644 --- a/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.h +++ b/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_protected_memory.c b/mali_kbase/csf/mali_kbase_csf_protected_memory.c index 0ace25a..09e7271 100644 --- a/mali_kbase/csf/mali_kbase_csf_protected_memory.c +++ b/mali_kbase/csf/mali_kbase_csf_protected_memory.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_csf_protected_memory.h" diff --git a/mali_kbase/csf/mali_kbase_csf_protected_memory.h b/mali_kbase/csf/mali_kbase_csf_protected_memory.h index ba9411d..95f507f 100644 --- a/mali_kbase/csf/mali_kbase_csf_protected_memory.h +++ b/mali_kbase/csf/mali_kbase_csf_protected_memory.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_reset_gpu.c b/mali_kbase/csf/mali_kbase_csf_reset_gpu.c index 8418320..b59ffd4 100644 --- a/mali_kbase/csf/mali_kbase_csf_reset_gpu.c +++ b/mali_kbase/csf/mali_kbase_csf_reset_gpu.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/csf/mali_kbase_csf_scheduler.c b/mali_kbase/csf/mali_kbase_csf_scheduler.c index e78b912..b9dc59c 100644 --- a/mali_kbase/csf/mali_kbase_csf_scheduler.c +++ b/mali_kbase/csf/mali_kbase_csf_scheduler.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> @@ -96,6 +94,7 @@ static struct kbase_queue_group *get_tock_top_group( static void scheduler_enable_tick_timer_nolock(struct kbase_device *kbdev); static int suspend_active_queue_groups(struct kbase_device *kbdev, unsigned long *slot_mask); +static void schedule_in_cycle(struct kbase_queue_group *group, bool force); #define kctx_as_enabled(kctx) (!kbase_ctx_flag(kctx, KCTX_AS_DISABLED_ON_FAULT)) @@ -492,12 +491,18 @@ static void update_idle_suspended_group_state(struct kbase_queue_group *group) remove_group_from_idle_wait(group); insert_group_to_runnable(scheduler, group, KBASE_CSF_GROUP_SUSPENDED); - } else { - if (group->run_state == KBASE_CSF_GROUP_SUSPENDED_ON_IDLE) - group->run_state = KBASE_CSF_GROUP_SUSPENDED; - else - return; - } + } else if (group->run_state == KBASE_CSF_GROUP_SUSPENDED_ON_IDLE) { + group->run_state = KBASE_CSF_GROUP_SUSPENDED; + + /* If scheduler is not suspended and the given group's + * static priority (reflected by the scan_seq_num) is inside + * the current tick slot-range, schedules an async tock. + */ + if (scheduler->state != SCHED_SUSPENDED && + group->scan_seq_num < scheduler->num_csg_slots_for_tick) + schedule_in_cycle(group, true); + } else + return; atomic_inc(&scheduler->non_idle_offslot_grps); } @@ -1522,6 +1527,17 @@ static void deschedule_idle_wait_group(struct kbase_csf_scheduler *scheduler, insert_group_to_idle_wait(group); } +static void update_offslot_non_idle_cnt_for_faulty_grp(struct kbase_queue_group *group) +{ + struct kbase_device *kbdev = group->kctx->kbdev; + struct kbase_csf_scheduler *const scheduler = &kbdev->csf.scheduler; + + lockdep_assert_held(&scheduler->lock); + + if (group->prepared_seq_num < scheduler->non_idle_scanout_grps) + atomic_dec(&scheduler->non_idle_offslot_grps); +} + static void update_offslot_non_idle_cnt_for_onslot_grp(struct kbase_queue_group *group) { struct kbase_device *kbdev = group->kctx->kbdev; @@ -2180,6 +2196,67 @@ static inline void count_active_address_space(struct kbase_device *kbdev, } } +/* Two schemes are used in assigning the priority to CSG slots for a given + * CSG from the 'groups_to_schedule' list. + * This is needed as an idle on-slot group is deprioritized by moving it to + * the tail of 'groups_to_schedule' list. As a result it can either get + * evicted from the CSG slot in current tick/tock dealing, or its position + * can be after the lower priority non-idle groups in the 'groups_to_schedule' + * list. The latter case can result in the on-slot subset containing both + * non-idle and idle CSGs, and is handled through the 2nd scheme described + * below. + * + * First scheme :- If all the slots are going to be occupied by the non-idle or + * idle groups, then a simple assignment of the priority is done as per the + * position of a group in the 'groups_to_schedule' list. So maximum priority + * gets assigned to the slot of a group which is at the head of the list. + * Here the 'groups_to_schedule' list would effectively be ordered as per the + * static priority of groups. + * + * Second scheme :- If the slots are going to be occupied by a mix of idle and + * non-idle groups then the priority assignment needs to ensure that the + * priority of a slot belonging to a higher priority idle group will always be + * greater than the priority of a slot belonging to a lower priority non-idle + * group, reflecting the original position of a group in the scan order (i.e + * static priority) 'scan_seq_num', which is set during the prepare phase of a + * tick/tock before the group is moved to 'idle_groups_to_schedule' list if it + * is idle. + * The priority range [MAX_CSG_SLOT_PRIORITY, 0] is partitioned with the first + * 'slots_for_tick' groups in the original scan order are assigned a priority in + * the subrange [MAX_CSG_SLOT_PRIORITY, MAX_CSG_SLOT_PRIORITY - slots_for_tick), + * whereas rest of the groups are assigned the priority in the subrange + * [MAX_CSG_SLOT_PRIORITY - slots_for_tick, 0]. This way even if an idle higher + * priority group ends up after the non-idle lower priority groups in the + * 'groups_to_schedule' list, it will get a higher slot priority. And this will + * enable the FW to quickly start the execution of higher priority group when it + * gets de-idled. + */ +static u8 get_slot_priority(struct kbase_queue_group *group) +{ + struct kbase_csf_scheduler *scheduler = + &group->kctx->kbdev->csf.scheduler; + u8 slot_prio; + u32 slots_for_tick = scheduler->num_csg_slots_for_tick; + u32 used_slots = slots_for_tick - scheduler->remaining_tick_slots; + /* Check if all the slots are going to be occupied by the non-idle or + * idle groups. + */ + if (scheduler->non_idle_scanout_grps >= slots_for_tick || + !scheduler->non_idle_scanout_grps) { + slot_prio = (u8)(MAX_CSG_SLOT_PRIORITY - used_slots); + } else { + /* There will be a mix of idle and non-idle groups. */ + if (group->scan_seq_num < slots_for_tick) + slot_prio = (u8)(MAX_CSG_SLOT_PRIORITY - + group->scan_seq_num); + else if (MAX_CSG_SLOT_PRIORITY > (slots_for_tick + used_slots)) + slot_prio = (u8)(MAX_CSG_SLOT_PRIORITY - (slots_for_tick + used_slots)); + else + slot_prio = 0; + } + return slot_prio; +} + /** * update_resident_groups_priority() - Update the priority of resident groups * @@ -2189,7 +2266,7 @@ static inline void count_active_address_space(struct kbase_device *kbdev, * that are at the head of groups_to_schedule list, preceding the first * non-resident group. * - * This function will also adjust kbase_csf_scheduler.head_slot_priority on + * This function will also adjust kbase_csf_scheduler.remaining_tick_slots on * the priority update. */ static void update_resident_groups_priority(struct kbase_device *kbdev) @@ -2210,11 +2287,11 @@ static void update_resident_groups_priority(struct kbase_device *kbdev) break; update_csg_slot_priority(group, - scheduler->head_slot_priority); + get_slot_priority(group)); /* Drop the head group from the list */ remove_scheduled_group(kbdev, group); - scheduler->head_slot_priority--; + scheduler->remaining_tick_slots--; } } @@ -2229,7 +2306,7 @@ static void update_resident_groups_priority(struct kbase_device *kbdev) * CSG slot, provided the initial position of the non-resident * group in the list is less than the number of CSG slots and there is * an available GPU address space slot. - * kbase_csf_scheduler.head_slot_priority would also be adjusted after + * kbase_csf_scheduler.remaining_tick_slots would also be adjusted after * programming the slot. */ static void program_group_on_vacant_csg_slot(struct kbase_device *kbdev, @@ -2249,17 +2326,19 @@ static void program_group_on_vacant_csg_slot(struct kbase_device *kbdev, if (!WARN_ON(ret)) { if (kctx_as_enabled(group->kctx) && !group->faulted) { - program_csg_slot(group, - slot, - scheduler->head_slot_priority); + program_csg_slot(group, slot, + get_slot_priority(group)); if (likely(csg_slot_in_use(kbdev, slot))) { /* Drop the head group from the list */ remove_scheduled_group(kbdev, group); - scheduler->head_slot_priority--; + scheduler->remaining_tick_slots--; } - } else + } else { + update_offslot_non_idle_cnt_for_faulty_grp( + group); remove_scheduled_group(kbdev, group); + } } } } @@ -2277,7 +2356,7 @@ static void program_group_on_vacant_csg_slot(struct kbase_device *kbdev, * group slot with the non-resident group. Finally update the priority of all * resident queue groups following the non-resident group. * - * kbase_csf_scheduler.head_slot_priority would also be adjusted. + * kbase_csf_scheduler.remaining_tick_slots would also be adjusted. */ static void program_vacant_csg_slot(struct kbase_device *kbdev, s8 slot) { @@ -2440,6 +2519,8 @@ static void program_suspending_csg_slots(struct kbase_device *kbdev) */ clear_bit(i, slot_mask); set_bit(i, scheduler->csgs_events_enable_mask); + update_offslot_non_idle_cnt_for_onslot_grp( + group); } suspend_wait_failed = true; @@ -2454,8 +2535,7 @@ static void program_suspending_csg_slots(struct kbase_device *kbdev) u32 i; while (scheduler->ngrp_to_schedule && - (scheduler->head_slot_priority > (MAX_CSG_SLOT_PRIORITY - - scheduler->num_csg_slots_for_tick))) { + scheduler->remaining_tick_slots) { i = find_first_zero_bit(scheduler->csg_inuse_bitmap, num_groups); if (WARN_ON(i == num_groups)) @@ -2899,6 +2979,9 @@ static void scheduler_apply(struct kbase_device *kbdev) } } + /* Initialize the remaining avialable csg slots for the tick/tock */ + scheduler->remaining_tick_slots = available_csg_slots; + /* If there are spare slots, apply heads in the list */ spare = (available_csg_slots > resident_cnt) ? (available_csg_slots - resident_cnt) : 0; @@ -2911,7 +2994,7 @@ static void scheduler_apply(struct kbase_device *kbdev) group->prepared_seq_num < available_csg_slots) { /* One of the resident remainders */ update_csg_slot_priority(group, - scheduler->head_slot_priority); + get_slot_priority(group)); } else if (spare != 0) { s8 slot = (s8)find_first_zero_bit( kbdev->csf.scheduler.csg_inuse_bitmap, @@ -2922,11 +3005,13 @@ static void scheduler_apply(struct kbase_device *kbdev) if (!kctx_as_enabled(group->kctx) || group->faulted) { /* Drop the head group and continue */ + update_offslot_non_idle_cnt_for_faulty_grp( + group); remove_scheduled_group(kbdev, group); continue; } program_csg_slot(group, slot, - scheduler->head_slot_priority); + get_slot_priority(group)); if (unlikely(!csg_slot_in_use(kbdev, slot))) break; @@ -2936,8 +3021,8 @@ static void scheduler_apply(struct kbase_device *kbdev) /* Drop the head csg from the list */ remove_scheduled_group(kbdev, group); - if (scheduler->head_slot_priority) - scheduler->head_slot_priority--; + if (!WARN_ON(!scheduler->remaining_tick_slots)) + scheduler->remaining_tick_slots--; } /* Dealing with groups currently going through suspend */ @@ -2967,6 +3052,9 @@ static void scheduler_ctx_scan_groups(struct kbase_device *kbdev, if (unlikely(group->faulted)) continue; + /* Set the scanout sequence number, starting from 0 */ + group->scan_seq_num = scheduler->csg_scan_count_for_tick++; + if (queue_group_idle_locked(group)) { list_add_tail(&group->link_to_schedule, &scheduler->idle_groups_to_schedule); @@ -3324,17 +3412,6 @@ static bool scheduler_idle_suspendable(struct kbase_device *kbdev) if (scheduler->state == SCHED_SUSPENDED) return false; - /* Work around for TTUX, skip scheduler suspend on idle-groups. - * ToDo: GPUCORE-26768, or its descendants after root cause - * investigation, needs to revert this WA. - */ - if (scheduler->total_runnable_grps && - (kbdev->gpu_props.props.raw_props.gpu_id & - GPU_ID2_PRODUCT_MODEL) == GPU_ID2_PRODUCT_TTUX) { - dev_dbg(kbdev->dev, "GPU: TTUX, skipping idle suspend"); - return false; - } - spin_lock_irqsave(&kbdev->hwaccess_lock, flags); if (scheduler->total_runnable_grps) { spin_lock(&scheduler->interrupt_lock); @@ -3359,6 +3436,10 @@ static void gpu_idle_worker(struct work_struct *work) work, struct kbase_device, csf.scheduler.gpu_idle_work); struct kbase_csf_scheduler *const scheduler = &kbdev->csf.scheduler; + if (kbase_reset_gpu_try_prevent(kbdev)) { + dev_warn(kbdev->dev, "Quit idle for failing to prevent gpu reset.\n"); + return; + } mutex_lock(&scheduler->lock); /* Cycle completed, disable the firmware idle timer */ @@ -3380,6 +3461,7 @@ static void gpu_idle_worker(struct work_struct *work) } mutex_unlock(&scheduler->lock); + kbase_reset_gpu_allow(kbdev); } static int scheduler_prepare(struct kbase_device *kbdev) @@ -3404,7 +3486,7 @@ static int scheduler_prepare(struct kbase_device *kbdev) scheduler->ngrp_to_schedule = 0; scheduler->top_ctx = NULL; scheduler->top_grp = NULL; - scheduler->head_slot_priority = MAX_CSG_SLOT_PRIORITY; + scheduler->csg_scan_count_for_tick = 0; WARN_ON(!list_empty(&scheduler->idle_groups_to_schedule)); scheduler->num_active_address_spaces = 0; scheduler->num_csg_slots_for_tick = 0; @@ -3432,6 +3514,9 @@ static int scheduler_prepare(struct kbase_device *kbdev) /* Adds those idle but runnable groups to the scanout list */ scheduler_scan_idle_groups(kbdev); + /* After adding the idle CSGs, the two counts should be the same */ + WARN_ON(scheduler->csg_scan_count_for_tick != scheduler->ngrp_to_schedule); + KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_TOP_GRP, scheduler->top_grp, scheduler->num_active_address_spaces | (((u64)scheduler->ngrp_to_schedule) << 32)); @@ -4453,6 +4538,12 @@ void kbase_csf_scheduler_pm_suspend(struct kbase_device *kbdev) cancel_work_sync(&scheduler->tick_work); cancel_delayed_work_sync(&scheduler->tock_work); + if (kbase_reset_gpu_prevent_and_wait(kbdev)) { + dev_warn(kbdev->dev, + "Stop PM suspending for failing to prevent gpu reset.\n"); + return; + } + mutex_lock(&scheduler->lock); disable_gpu_idle_fw_timer(kbdev); @@ -4464,6 +4555,8 @@ void kbase_csf_scheduler_pm_suspend(struct kbase_device *kbdev) cancel_tick_timer(kbdev); } mutex_unlock(&scheduler->lock); + + kbase_reset_gpu_allow(kbdev); } KBASE_EXPORT_TEST_API(kbase_csf_scheduler_pm_suspend); diff --git a/mali_kbase/csf/mali_kbase_csf_scheduler.h b/mali_kbase/csf/mali_kbase_csf_scheduler.h index 6e42c6e..20d1bc9 100644 --- a/mali_kbase/csf/mali_kbase_csf_scheduler.h +++ b/mali_kbase/csf/mali_kbase_csf_scheduler.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap.c b/mali_kbase/csf/mali_kbase_csf_tiler_heap.c index 2da7a7d..0b4fb5a 100644 --- a/mali_kbase/csf/mali_kbase_csf_tiler_heap.c +++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <tl/mali_kbase_tracepoints.h> diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap.h b/mali_kbase/csf/mali_kbase_csf_tiler_heap.h index 13d0564..683aeca 100644 --- a/mali_kbase/csf/mali_kbase_csf_tiler_heap.h +++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.c b/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.c index e38863c..0f69500 100644 --- a/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.c +++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_csf_tiler_heap_debugfs.h" diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.h b/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.h index c8f37fd..65dfaf7 100644 --- a/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.h +++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap_def.h b/mali_kbase/csf/mali_kbase_csf_tiler_heap_def.h index fa94dcb..0bf6551 100644 --- a/mali_kbase/csf/mali_kbase_csf_tiler_heap_def.h +++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap_def.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_timeout.c b/mali_kbase/csf/mali_kbase_csf_timeout.c index 1396899..854aad5 100644 --- a/mali_kbase/csf/mali_kbase_csf_timeout.c +++ b/mali_kbase/csf/mali_kbase_csf_timeout.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/kernel.h> @@ -31,6 +29,7 @@ #include "mali_kbase_config_defaults.h" #include "mali_kbase_csf_firmware.h" #include "mali_kbase_csf_timeout.h" +#include "mali_kbase_reset_gpu.h" #include "backend/gpu/mali_kbase_pm_internal.h" /** @@ -66,6 +65,9 @@ static int set_timeout(struct kbase_device *const kbdev, u64 const timeout) * * This function is called when the progress_timeout sysfs file is written to. * It checks the data written, and if valid updates the progress timeout value. + * The function also checks gpu reset status, if the gpu is in reset process, + * the function will return an error code (-EBUSY), and no change for timeout + * value. * * Return: @count if the function succeeded. An error code on failure. */ @@ -80,15 +82,21 @@ static ssize_t progress_timeout_store(struct device * const dev, if (!kbdev) return -ENODEV; - err = kstrtou64(buf, 0, &timeout); + err = kbase_reset_gpu_try_prevent(kbdev); if (err) { + dev_warn(kbdev->dev, + "Couldn't process progress_timeout write operation for GPU reset.\n"); + return -EBUSY; + } + + err = kstrtou64(buf, 0, &timeout); + if (err) dev_err(kbdev->dev, "Couldn't process progress_timeout write operation.\n" "Use format <progress_timeout>\n"); - return err; - } + else + err = set_timeout(kbdev, timeout); - err = set_timeout(kbdev, timeout); if (!err) { kbase_csf_scheduler_pm_active(kbdev); @@ -99,6 +107,7 @@ static ssize_t progress_timeout_store(struct device * const dev, kbase_csf_scheduler_pm_idle(kbdev); } + kbase_reset_gpu_allow(kbdev); if (err) return err; diff --git a/mali_kbase/csf/mali_kbase_csf_timeout.h b/mali_kbase/csf/mali_kbase_csf_timeout.h index 4ec113d..48c7181 100644 --- a/mali_kbase/csf/mali_kbase_csf_timeout.h +++ b/mali_kbase/csf/mali_kbase_csf_timeout.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/csf/mali_kbase_csf_tl_reader.c b/mali_kbase/csf/mali_kbase_csf_tl_reader.c index d7006e6..fb7e86a 100644 --- a/mali_kbase/csf/mali_kbase_csf_tl_reader.c +++ b/mali_kbase/csf/mali_kbase_csf_tl_reader.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_csf_tl_reader.h" @@ -46,13 +44,13 @@ #endif #endif -/** Name of the CSFFW timeline tracebuffer. */ +/* Name of the CSFFW timeline tracebuffer. */ #define KBASE_CSFFW_TRACEBUFFER_NAME "timeline" -/** Name of the timeline header metatadata */ +/* Name of the timeline header metatadata */ #define KBASE_CSFFW_TIMELINE_HEADER_NAME "timeline_header" /** - * CSFFW timeline message. + * struct kbase_csffw_tl_message - CSFFW timeline message. * * @msg_id: Message ID. * @timestamp: Timestamp of the event. @@ -131,6 +129,7 @@ static void get_cpu_gpu_time( * kbase_ts_converter_init() - Initialize system timestamp converter. * * @self: System Timestamp Converter instance. + * @kbdev: Kbase device pointer * * Return: Zero on success, -1 otherwise. */ @@ -254,8 +253,9 @@ static void tl_reader_reset(struct kbase_csf_tl_reader *self) self->tl_header.btc = 0; } -void kbase_csf_tl_reader_flush_buffer(struct kbase_csf_tl_reader *self) +int kbase_csf_tl_reader_flush_buffer(struct kbase_csf_tl_reader *self) { + int ret = 0; struct kbase_device *kbdev = self->kbdev; struct kbase_tlstream *stream = self->stream; @@ -274,7 +274,7 @@ void kbase_csf_tl_reader_flush_buffer(struct kbase_csf_tl_reader *self) /* If not running, early exit. */ if (!self->is_active) { spin_unlock_irqrestore(&self->read_lock, flags); - return; + return -EBUSY; } /* Copying the whole buffer in a single shot. We assume @@ -298,6 +298,7 @@ void kbase_csf_tl_reader_flush_buffer(struct kbase_csf_tl_reader *self) dev_warn( kbdev->dev, "Unable to parse CSFFW tracebuffer event header."); + ret = -EBUSY; break; } @@ -318,6 +319,7 @@ void kbase_csf_tl_reader_flush_buffer(struct kbase_csf_tl_reader *self) dev_warn(kbdev->dev, "event_id: %u, can't read with event_size: %u.", event_id, event_size); + ret = -EBUSY; break; } @@ -339,6 +341,7 @@ void kbase_csf_tl_reader_flush_buffer(struct kbase_csf_tl_reader *self) } spin_unlock_irqrestore(&self->read_lock, flags); + return ret; } static void kbasep_csf_tl_reader_read_callback(struct timer_list *timer) @@ -421,39 +424,18 @@ static int tl_reader_init_late( * Update the first bit of a CSFFW tracebufer and then reset the GPU. * This is to make these changes visible to the MCU. * - * Return: 0 on success, -EAGAIN if a GPU reset was in progress. + * Return: 0 on success, or negative error code for failure. */ static int tl_reader_update_enable_bit( struct kbase_csf_tl_reader *self, bool value) { - struct kbase_device *kbdev = self->kbdev; - unsigned long flags; + int err = 0; - spin_lock_irqsave(&kbdev->hwaccess_lock, flags); - - /* If there is already a GPU reset pending then inform - * the User to retry the update. - */ - if (kbase_reset_gpu_silent(kbdev)) { - spin_unlock_irqrestore( - &kbdev->hwaccess_lock, flags); - dev_warn( - kbdev->dev, - "GPU reset already in progress when enabling firmware timeline."); - return -EAGAIN; - } - - /* GPU reset request has been placed, now update the - * firmware image. GPU reset will take place only after - * hwaccess_lock is released. - */ - kbase_csf_firmware_trace_buffer_update_trace_enable_bit( + err = kbase_csf_firmware_trace_buffer_update_trace_enable_bit( self->trace_buffer, 0, value); - spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags); - - return 0; + return err; } void kbase_csf_tl_reader_init(struct kbase_csf_tl_reader *self, diff --git a/mali_kbase/csf/mali_kbase_csf_tl_reader.h b/mali_kbase/csf/mali_kbase_csf_tl_reader.h index 14175b3..c691871 100644 --- a/mali_kbase/csf/mali_kbase_csf_tl_reader.h +++ b/mali_kbase/csf/mali_kbase_csf_tl_reader.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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 @@ -46,13 +26,13 @@ #include <linux/timer.h> #include <asm/page.h> -/** The number of pages used for CSFFW trace buffer. Can be tweaked. */ +/* The number of pages used for CSFFW trace buffer. Can be tweaked. */ #define KBASE_CSF_TL_BUFFER_NR_PAGES 128 -/** CSFFW Timeline read polling minimum period in milliseconds. */ +/* CSFFW Timeline read polling minimum period in milliseconds. */ #define KBASE_CSF_TL_READ_INTERVAL_MIN 20 -/** CSFFW Timeline read polling default period in milliseconds. */ +/* CSFFW Timeline read polling default period in milliseconds. */ #define KBASE_CSF_TL_READ_INTERVAL_DEFAULT 200 -/** CSFFW Timeline read polling maximum period in milliseconds. */ +/* CSFFW Timeline read polling maximum period in milliseconds. */ #define KBASE_CSF_TL_READ_INTERVAL_MAX (60*1000) struct firmware_trace_buffer; @@ -60,6 +40,7 @@ struct kbase_tlstream; struct kbase_device; /** + * struct kbase_ts_converter - * System timestamp to CPU timestamp converter state. * * @multiplier: Numerator of the converter's fraction. @@ -99,6 +80,7 @@ struct kbase_ts_converter { * is copied. * @kbdev: KBase device. * @trace_buffer: CSF Firmware timeline tracebuffer. + * @tl_header: CSFFW Timeline header * @tl_header.data: CSFFW Timeline header content. * @tl_header.size: CSFFW Timeline header size. * @tl_header.btc: CSFFW Timeline header remaining bytes to copy to @@ -111,6 +93,7 @@ struct kbase_ts_converter { * is only valid when got_first_event is true. * @read_buffer: Temporary buffer used for CSFFW timeline data * reading from the tracebufer. + * @read_lock: CSFFW timeline reader lock. */ struct kbase_csf_tl_reader { struct timer_list read_timer; @@ -155,9 +138,11 @@ void kbase_csf_tl_reader_term(struct kbase_csf_tl_reader *self); * Flush trace from buffer into CSFFW timeline stream. * * @self: CSFFW TL Reader instance. + * + * Return: Zero on success, negative error code (EBUSY) otherwise */ -void kbase_csf_tl_reader_flush_buffer(struct kbase_csf_tl_reader *self); +int kbase_csf_tl_reader_flush_buffer(struct kbase_csf_tl_reader *self); /** * kbase_csf_tl_reader_start() - diff --git a/mali_kbase/csf/mali_kbase_csf_trace_buffer.c b/mali_kbase/csf/mali_kbase_csf_trace_buffer.c index 8eb0408..7e9eb75 100644 --- a/mali_kbase/csf/mali_kbase_csf_trace_buffer.c +++ b/mali_kbase/csf/mali_kbase_csf_trace_buffer.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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" @@ -50,25 +48,28 @@ * @node: List head linking all trace buffers to * kbase_device:csf.firmware_trace_buffers * @data_mapping: MCU shared memory mapping used for the data buffer. + * @updatable: Indicates whether config items can be updated with + * FIRMWARE_CONFIG_UPDATE * @type: The type of the trace buffer. * @trace_enable_entry_count: Number of Trace Enable bits. - * @gpu_va: Structure containing all the Firmware addresses - * that are accessed by the MCU. - * @size_address: The address where the MCU shall read the size of - * the data buffer. - * @insert_address: The address that shall be dereferenced by the MCU - * to write the Insert offset. - * @extract_address: The address that shall be dereferenced by the MCU - * to read the Extract offset. - * @data_address: The address that shall be dereferenced by the MCU - * to write the Trace Buffer. - * @trace_enable: The address where the MCU shall read the array of - * Trace Enable bits describing which trace points - * and features shall be enabled. - * @cpu_va: Structure containing CPU addresses of variables which - * are permanently mapped on the CPU address space. - * @insert_cpu_va: CPU virtual address of the Insert variable. - * @extract_cpu_va: CPU virtual address of the Extract variable. + * @gpu_va: Structure containing all the Firmware addresses + * that are accessed by the MCU. + * @gpu_va.size_address: The address where the MCU shall read the size of + * the data buffer. + * @gpu_va.insert_address: The address that shall be dereferenced by the MCU + * to write the Insert offset. + * @gpu_va.extract_address: The address that shall be dereferenced by the MCU + * to read the Extract offset. + * @gpu_va.data_address: The address that shall be dereferenced by the MCU + * to write the Trace Buffer. + * @gpu_va.trace_enable: The address where the MCU shall read the array of + * Trace Enable bits describing which trace points + * and features shall be enabled. + * @cpu_va: Structure containing CPU addresses of variables + * which are permanently mapped on the CPU address + * space. + * @cpu_va.insert_cpu_va: CPU virtual address of the Insert variable. + * @cpu_va.extract_cpu_va: CPU virtual address of the Extract variable. * @num_pages: Size of the data buffer, in pages. * @trace_enable_init_mask: Initial value for the trace enable bit mask. * @name: NULL terminated string which contains the name of the trace buffer. @@ -77,6 +78,7 @@ struct firmware_trace_buffer { struct kbase_device *kbdev; struct list_head node; struct kbase_csf_mapping data_mapping; + bool updatable; u32 type; u32 trace_enable_entry_count; struct gpu_va { @@ -113,7 +115,7 @@ struct firmware_trace_buffer_data { size_t size; }; -/** +/* * Table of configuration data for trace buffers. * * This table contains the configuration data for the trace buffers that are @@ -251,7 +253,9 @@ void kbase_csf_firmware_trace_buffers_term(struct kbase_device *kbdev) } int kbase_csf_firmware_parse_trace_buffer_entry(struct kbase_device *kbdev, - const u32 *entry, unsigned int size) + const u32 *entry, + unsigned int size, + bool updatable) { const char *name = (char *)&entry[7]; const unsigned int name_len = size - TRACE_BUFFER_ENTRY_NAME_OFFSET; @@ -275,6 +279,7 @@ int kbase_csf_firmware_parse_trace_buffer_entry(struct kbase_device *kbdev, unsigned int j; trace_buffer->kbdev = kbdev; + trace_buffer->updatable = updatable; trace_buffer->type = entry[0]; trace_buffer->gpu_va.size_address = entry[1]; trace_buffer->gpu_va.insert_address = entry[2]; @@ -284,6 +289,10 @@ int kbase_csf_firmware_parse_trace_buffer_entry(struct kbase_device *kbdev, trace_buffer->trace_enable_entry_count = entry[6]; trace_buffer->num_pages = trace_buffer_data[i].size; + /* Temporary workaround until handled by GPUCORE-27330 */ + if (!strcmp(trace_buffer_data[i].name, "timeline")) + trace_buffer->updatable = 0; + for (j = 0; j < CSF_FIRMWARE_TRACE_ENABLE_INIT_MASK_MAX; j++) { trace_buffer->trace_enable_init_mask[j] = trace_buffer_data[i].trace_enable_init_mask[j]; @@ -393,9 +402,13 @@ unsigned int kbase_csf_firmware_trace_buffer_get_trace_enable_bits_count( } EXPORT_SYMBOL(kbase_csf_firmware_trace_buffer_get_trace_enable_bits_count); -void kbase_csf_firmware_trace_buffer_update_trace_enable_bit( +static void kbasep_csf_firmware_trace_buffer_update_trace_enable_bit( struct firmware_trace_buffer *tb, unsigned int bit, bool value) { + struct kbase_device *kbdev = tb->kbdev; + + lockdep_assert_held(&kbdev->hwaccess_lock); + if (bit < tb->trace_enable_entry_count) { unsigned int trace_enable_reg_offset = bit >> 5; u32 trace_enable_bit_mask = 1u << (bit & 0x1F); @@ -415,11 +428,47 @@ void kbase_csf_firmware_trace_buffer_update_trace_enable_bit( * trace buffers, since firmware could continue to use the * value of bitmask it cached after the boot. */ - kbase_csf_update_firmware_memory(tb->kbdev, - tb->gpu_va.trace_enable + trace_enable_reg_offset*4, + kbase_csf_update_firmware_memory( + kbdev, + tb->gpu_va.trace_enable + trace_enable_reg_offset * 4, tb->trace_enable_init_mask[trace_enable_reg_offset]); } } + +int kbase_csf_firmware_trace_buffer_update_trace_enable_bit( + struct firmware_trace_buffer *tb, unsigned int bit, bool value) +{ + struct kbase_device *kbdev = tb->kbdev; + int err = 0; + unsigned long flags; + + spin_lock_irqsave(&kbdev->hwaccess_lock, flags); + + /* If trace buffer update cannot be performed with + * FIRMWARE_CONFIG_UPDATE then we need to do a + * silent reset before we update the memory. + */ + if (!tb->updatable) { + /* If there is already a GPU reset pending then inform + * the User to retry the update. + */ + if (kbase_reset_gpu_silent(kbdev)) { + dev_warn( + kbdev->dev, + "GPU reset already in progress when enabling firmware timeline."); + return -EAGAIN; + } + } + + kbasep_csf_firmware_trace_buffer_update_trace_enable_bit(tb, bit, + value); + spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags); + + if (tb->updatable) + err = kbase_csf_trigger_firmware_config_update(kbdev); + + return err; +} EXPORT_SYMBOL(kbase_csf_firmware_trace_buffer_update_trace_enable_bit); bool kbase_csf_firmware_trace_buffer_is_empty( @@ -486,8 +535,8 @@ static void update_trace_buffer_active_mask64(struct firmware_trace_buffer *tb, unsigned int i; for (i = 0; i < tb->trace_enable_entry_count; i++) - kbase_csf_firmware_trace_buffer_update_trace_enable_bit(tb, i, - (mask >> i) & 1); + kbasep_csf_firmware_trace_buffer_update_trace_enable_bit( + tb, i, (mask >> i) & 1); } static int set_trace_buffer_active_mask64(struct firmware_trace_buffer *tb, @@ -497,13 +546,25 @@ static int set_trace_buffer_active_mask64(struct firmware_trace_buffer *tb, unsigned long flags; int err = 0; - spin_lock_irqsave(&kbdev->hwaccess_lock, flags); - /* If there is already a GPU reset pending, need a retry */ - if (kbase_reset_gpu_silent(kbdev)) - err = -EAGAIN; - else + if (!tb->updatable) { + /* If there is already a GPU reset pending, need a retry */ + spin_lock_irqsave(&kbdev->hwaccess_lock, flags); + if (kbase_reset_gpu_silent(kbdev)) + err = -EAGAIN; + spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags); + } + + if (!err) { + spin_lock_irqsave(&kbdev->hwaccess_lock, flags); update_trace_buffer_active_mask64(tb, mask); - spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags); + spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags); + + /* if we can update the config we need to just trigger + * FIRMWARE_CONFIG_UPDATE. + */ + if (tb->updatable) + err = kbase_csf_trigger_firmware_config_update(kbdev); + } return err; } diff --git a/mali_kbase/csf/mali_kbase_csf_trace_buffer.h b/mali_kbase/csf/mali_kbase_csf_trace_buffer.h index 887a5e7..e6babef 100644 --- a/mali_kbase/csf/mali_kbase_csf_trace_buffer.h +++ b/mali_kbase/csf/mali_kbase_csf_trace_buffer.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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 @@ -95,12 +75,15 @@ void kbase_csf_firmware_trace_buffers_term(struct kbase_device *kbdev); * * Return: 0 if successful, negative error code on failure. * - * @kbdev: Kbase device structure - * @entry: Pointer to the section - * @size: Size (in bytes) of the section + * @kbdev: Kbase device structure + * @entry: Pointer to the section + * @size: Size (in bytes) of the section + * @updatable: Indicates whether config items can be updated with FIRMWARE_CONFIG_UPDATE */ int kbase_csf_firmware_parse_trace_buffer_entry(struct kbase_device *kbdev, - const u32 *entry, unsigned int size); + const u32 *entry, + unsigned int size, + bool updatable); /** * kbase_csf_firmware_reload_trace_buffers_data - @@ -153,9 +136,12 @@ unsigned int kbase_csf_firmware_trace_buffer_get_trace_enable_bits_count( * @trace_buffer: Trace buffer handle * @bit: Bit to update * @value: New value for the given bit + * + * Return: 0 if successful, negative error code on failure. */ -void kbase_csf_firmware_trace_buffer_update_trace_enable_bit( - struct firmware_trace_buffer *trace_buffer, unsigned int bit, bool value); +int kbase_csf_firmware_trace_buffer_update_trace_enable_bit( + struct firmware_trace_buffer *trace_buffer, unsigned int bit, + bool value); /** * kbase_csf_firmware_trace_buffer_is_empty - Empty trace buffer predicate diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h index 51ab2f5..7ed62aa 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h +++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h index 8e846ad..a616f2b 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h +++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2011-2015, 2018-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c index 93a082a..9183520 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c +++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h index a229333..2b8ff85 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h +++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h index 426218b..ef75afa 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h +++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 @@ -81,26 +61,29 @@ (KBASE_KTRACE_FLAG_CSF_GROUP | KBASE_KTRACE_FLAG_CSF_QUEUE | \ KBASE_KTRACE_FLAG_CSF_KCPU) - /** * union kbase_ktrace_backend - backend specific part of a trace message - * - * @code: Identifies the event, refer to enum kbase_ktrace_code. - * @flags: indicates information about the trace message itself. Used + * @kcpu: kcpu union member + * @kcpu.code: Identifies the event, refer to enum kbase_ktrace_code. + * @kcpu.flags: indicates information about the trace message itself. Used * during dumping of the message. - * @id: ID of the KCPU queue. - * @extra_info_val: value specific to the type of KCPU event being traced. + * @kcpu.id: ID of the KCPU queue. + * @kcpu.extra_info_val: value specific to the type of KCPU event being traced. * Refer to the KPU specific code in enum kbase_ktrace_code in * mali_kbase_debug_ktrace_codes_csf.h - * @group_handle: Handle identifying the associated queue group. Only valid + * @gpu: gpu union member + * @gpu.code: Identifies the event, refer to enum kbase_ktrace_code. + * @gpu.flags: indicates information about the trace message itself. Used + * during dumping of the message. + * @gpu.group_handle: Handle identifying the associated queue group. Only valid * when @flags contains KBASE_KTRACE_FLAG_CSF_GROUP. - * @csg_nr: Number/index of the associated queue group's CS - * group to which it is mapped, or negative if none associated. - * Only valid when @flags contains KBASE_KTRACE_FLAG_CSF_GROUP. - * @slot_prio: The priority of the slot for the associated group, if it was - * scheduled. Hence, only valid when @csg_nr >=0 and @flags - * contains KBASE_KTRACE_FLAG_CSF_GROUP. - * @csi_index: ID of the associated queue's CS HW interface. + * @gpu.csg_nr: Number/index of the associated queue group's CS group to + * which it is mapped, or negative if none associated. Only + * valid when @flags contains KBASE_KTRACE_FLAG_CSF_GROUP. + * @gpu.slot_prio: The priority of the slot for the associated group, if it + * was scheduled. Hence, only valid when @csg_nr >=0 and + * @flags contains KBASE_KTRACE_FLAG_CSF_GROUP. + * @gpu.csi_index: ID of the associated queue's CS HW interface. * Only valid when @flags contains KBASE_KTRACE_FLAG_CSF_QUEUE. */ diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_jm.h index 4b4cefc..abd35ff 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_jm.h +++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_jm.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 @@ -94,18 +74,20 @@ * Contains only a struct but is a union such that it is compatible with * generic JM and CSF KTrace calls. * - * @atom_udata: Copy of the user data sent for the atom in base_jd_submit. - * Only valid if KBASE_KTRACE_FLAG_JM_ATOM is set in @flags - * @gpu_addr: GPU address, usually of the job-chain represented by an atom. - * @atom_number: id of the atom for which trace message was added. Only valid - * if KBASE_KTRACE_FLAG_JM_ATOM is set in @flags - * @code: Identifies the event, refer to enum kbase_ktrace_code. - * @flags: indicates information about the trace message itself. Used - * during dumping of the message. - * @jobslot: job-slot for which trace message was added, valid only for - * job-slot management events. - * @refcount: reference count for the context, valid for certain events - * related to scheduler core and policy. + * @gpu: gpu union member + * @gpu.atom_udata: Copy of the user data sent for the atom in base_jd_submit. + * Only valid if KBASE_KTRACE_FLAG_JM_ATOM is set in @flags + * @gpu.gpu_addr: GPU address, usually of the job-chain represented by an + * atom. + * @gpu.atom_number: id of the atom for which trace message was added. Only + * valid if KBASE_KTRACE_FLAG_JM_ATOM is set in @flags + * @gpu.code: Identifies the event, refer to enum kbase_ktrace_code. + * @gpu.flags: indicates information about the trace message itself. Used + * during dumping of the message. + * @gpu.jobslot: job-slot for which trace message was added, valid only for + * job-slot management events. + * @gpu.refcount: reference count for the context, valid for certain events + * related to scheduler core and policy. */ union kbase_ktrace_backend { struct { diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c index 55e4391..2762909 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c +++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h index 43f5526..38ea753 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h +++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h index bb5db30..4ed175e 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h +++ b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h index b0722f9..b368a85 100644 --- a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h +++ b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014, 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace.c b/mali_kbase/debug/mali_kbase_debug_ktrace.c index a38a656..443b048 100644 --- a/mali_kbase/debug/mali_kbase_debug_ktrace.c +++ b/mali_kbase/debug/mali_kbase_debug_ktrace.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace.h b/mali_kbase/debug/mali_kbase_debug_ktrace.h index 71f0fd7..d8c1beb 100644 --- a/mali_kbase/debug/mali_kbase_debug_ktrace.h +++ b/mali_kbase/debug/mali_kbase_debug_ktrace.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h b/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h index fa842f9..c5ca08e 100644 --- a/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h +++ b/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2011-2015, 2018-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h b/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h index 841f11b..5ed32ae 100644 --- a/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h +++ b/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h b/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h index 02b90ab..1f0fa5e 100644 --- a/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h +++ b/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/debug/mali_kbase_debug_linux_ktrace.h b/mali_kbase/debug/mali_kbase_debug_linux_ktrace.h index 86efdc4..4a73da5 100644 --- a/mali_kbase/debug/mali_kbase_debug_linux_ktrace.h +++ b/mali_kbase/debug/mali_kbase_debug_linux_ktrace.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014, 2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014, 2018, 2020-2021 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 @@ -125,9 +105,9 @@ DEFINE_MALI_ADD_EVENT(ARB_VM_EVT); #endif #if MALI_USE_CSF -#include "mali_kbase_debug_linux_ktrace_csf.h" +#include "backend/mali_kbase_debug_linux_ktrace_csf.h" #else -#include "mali_kbase_debug_linux_ktrace_jm.h" +#include "backend/mali_kbase_debug_linux_ktrace_jm.h" #endif #undef DEFINE_MALI_ADD_EVENT diff --git a/mali_kbase/device/backend/mali_kbase_device_csf.c b/mali_kbase/device/backend/mali_kbase_device_csf.c index c70df70..f657bcb 100644 --- a/mali_kbase/device/backend/mali_kbase_device_csf.c +++ b/mali_kbase/device/backend/mali_kbase_device_csf.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_device_internal.h" @@ -192,6 +190,8 @@ static const struct kbase_device_init dev_init[] = { "Populating max frequency failed"}, {kbase_device_misc_init, kbase_device_misc_term, "Miscellaneous device initialization failed"}, + {kbase_device_pcm_dev_init, kbase_device_pcm_dev_term, + "Priority control manager initialization failed"}, {kbase_ctx_sched_init, kbase_ctx_sched_term, "Context scheduler initialization failed"}, {kbase_mem_init, kbase_mem_term, diff --git a/mali_kbase/device/backend/mali_kbase_device_hw_csf.c b/mali_kbase/device/backend/mali_kbase_device_hw_csf.c index 1ae311a..4d11a82 100644 --- a/mali_kbase/device/backend/mali_kbase_device_hw_csf.c +++ b/mali_kbase/device/backend/mali_kbase_device_hw_csf.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/device/backend/mali_kbase_device_hw_jm.c b/mali_kbase/device/backend/mali_kbase_device_hw_jm.c index a11d778..33ebe09 100644 --- a/mali_kbase/device/backend/mali_kbase_device_hw_jm.c +++ b/mali_kbase/device/backend/mali_kbase_device_hw_jm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/device/backend/mali_kbase_device_jm.c b/mali_kbase/device/backend/mali_kbase_device_jm.c index 082f16c..055e2f2 100644 --- a/mali_kbase/device/backend/mali_kbase_device_jm.c +++ b/mali_kbase/device/backend/mali_kbase_device_jm.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/sched/rt.h> #include <uapi/linux/sched/types.h> @@ -168,6 +166,8 @@ static const struct kbase_device_init dev_init[] = { "Populating max frequency failed"}, {kbase_device_misc_init, kbase_device_misc_term, "Miscellaneous device initialization failed"}, + {kbase_device_pcm_dev_init, kbase_device_pcm_dev_term, + "Priority control manager initialization failed"}, {kbase_ctx_sched_init, kbase_ctx_sched_term, "Context scheduler initialization failed"}, {kbase_mem_init, kbase_mem_term, diff --git a/mali_kbase/device/mali_kbase_device.c b/mali_kbase/device/mali_kbase_device.c index 6178cc8..a90c8cd 100644 --- a/mali_kbase/device/mali_kbase_device.c +++ b/mali_kbase/device/mali_kbase_device.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -38,6 +36,7 @@ #include <mali_kbase_hwaccess_instr.h> #include <mali_kbase_hw.h> #include <mali_kbase_config_defaults.h> +#include <linux/priority_control_manager.h> #include <tl/mali_kbase_timeline.h> #include "mali_kbase_vinstr.h" @@ -110,15 +109,61 @@ static void kbase_device_all_as_term(struct kbase_device *kbdev) kbase_mmu_as_term(kbdev, i); } +int kbase_device_pcm_dev_init(struct kbase_device *const kbdev) +{ + int err = 0; + +#ifdef CONFIG_OF + struct device_node *prio_ctrl_node; + + /* Check to see whether or not a platform specific priority control manager + * is available. + */ + prio_ctrl_node = of_parse_phandle(kbdev->dev->of_node, + "priority-control-manager", 0); + if (!prio_ctrl_node) { + dev_info(kbdev->dev, + "No priority control manager is configured"); + } else { + struct platform_device *const pdev = + of_find_device_by_node(prio_ctrl_node); + + if (!pdev) { + dev_err(kbdev->dev, + "The configured priority control manager was not found"); + } else { + struct priority_control_manager_device *pcm_dev = + platform_get_drvdata(pdev); + if (!pcm_dev) { + dev_info(kbdev->dev, "Priority control manager is not ready"); + err = -EPROBE_DEFER; + } else if (!try_module_get(pcm_dev->owner)) { + dev_err(kbdev->dev, "Failed to get priority control manager module"); + err = -ENODEV; + } else { + dev_info(kbdev->dev, "Priority control manager successfully loaded"); + kbdev->pcm_dev = pcm_dev; + } + } + of_node_put(prio_ctrl_node); + } +#endif /* CONFIG_OF */ + + return err; +} + +void kbase_device_pcm_dev_term(struct kbase_device *const kbdev) +{ + if (kbdev->pcm_dev) + module_put(kbdev->pcm_dev->owner); +} + int kbase_device_misc_init(struct kbase_device * const kbdev) { int err; #ifdef CONFIG_ARM64 struct device_node *np = NULL; #endif /* CONFIG_ARM64 */ -#ifdef CONFIG_OF - struct device_node *prio_ctrl_node = NULL; -#endif spin_lock_init(&kbdev->mmu_mask_change); mutex_init(&kbdev->mmu_hw_mutex); @@ -143,33 +188,6 @@ int kbase_device_misc_init(struct kbase_device * const kbdev) } } #endif /* CONFIG_ARM64 */ - kbdev->pcm_dev = NULL; -#ifdef CONFIG_OF - /* Check to see whether or not a platform specific priority control manager - * is available. - */ - prio_ctrl_node = of_parse_phandle(kbdev->dev->of_node, - "priority-control-manager", 0); - if (!prio_ctrl_node) { - dev_info(kbdev->dev, - "No priority control manager is configured\n"); - } else { - struct platform_device *const pdev = - of_find_device_by_node(prio_ctrl_node); - if (!pdev) { - dev_err(kbdev->dev, - "The configured priority control manager was not found\n"); - } else { - kbdev->pcm_dev = platform_get_drvdata(pdev); - if (!kbdev->pcm_dev) { - dev_info(kbdev->dev, - "Priority control manager is not ready\n"); - err = -EPROBE_DEFER; - } - } - of_node_put(prio_ctrl_node); - } -#endif /* CONFIG_OF */ /* Get the list of workarounds for issues on the current HW * (identified by the GPU_ID register) diff --git a/mali_kbase/device/mali_kbase_device.h b/mali_kbase/device/mali_kbase_device.h index 32e85fd..3a774fc 100644 --- a/mali_kbase/device/mali_kbase_device.h +++ b/mali_kbase/device/mali_kbase_device.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/device/mali_kbase_device_hw.c b/mali_kbase/device/mali_kbase_device_hw.c index ba8ce29..5ea2890 100644 --- a/mali_kbase/device/mali_kbase_device_hw.c +++ b/mali_kbase/device/mali_kbase_device_hw.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/device/mali_kbase_device_internal.h b/mali_kbase/device/mali_kbase_device_internal.h index b07b22c..2705e67 100644 --- a/mali_kbase/device/mali_kbase_device_internal.h +++ b/mali_kbase/device/mali_kbase_device_internal.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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 diff --git a/mali_kbase/gpu/backend/mali_kbase_gpu_fault_csf.c b/mali_kbase/gpu/backend/mali_kbase_gpu_fault_csf.c index a9f9cb8..fa70afc 100644 --- a/mali_kbase/gpu/backend/mali_kbase_gpu_fault_csf.c +++ b/mali_kbase/gpu/backend/mali_kbase_gpu_fault_csf.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/gpu/backend/mali_kbase_gpu_fault_jm.c b/mali_kbase/gpu/backend/mali_kbase_gpu_fault_jm.c index 6015062..110e5b3 100644 --- a/mali_kbase/gpu/backend/mali_kbase_gpu_fault_jm.c +++ b/mali_kbase/gpu/backend/mali_kbase_gpu_fault_jm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/gpu/backend/mali_kbase_gpu_regmap_csf.h b/mali_kbase/gpu/backend/mali_kbase_gpu_regmap_csf.h index 04ee612..65a06d2 100644 --- a/mali_kbase/gpu/backend/mali_kbase_gpu_regmap_csf.h +++ b/mali_kbase/gpu/backend/mali_kbase_gpu_regmap_csf.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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 diff --git a/mali_kbase/gpu/backend/mali_kbase_gpu_regmap_jm.h b/mali_kbase/gpu/backend/mali_kbase_gpu_regmap_jm.h index 57d567b..1669d5a 100644 --- a/mali_kbase/gpu/backend/mali_kbase_gpu_regmap_jm.h +++ b/mali_kbase/gpu/backend/mali_kbase_gpu_regmap_jm.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/gpu/mali_kbase_gpu.c b/mali_kbase/gpu/mali_kbase_gpu.c index 4cc8750..92aa593 100644 --- a/mali_kbase/gpu/mali_kbase_gpu.c +++ b/mali_kbase/gpu/mali_kbase_gpu.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/gpu/mali_kbase_gpu.h b/mali_kbase/gpu/mali_kbase_gpu.h index 0594cd3..dba0e28 100644 --- a/mali_kbase/gpu/mali_kbase_gpu.h +++ b/mali_kbase/gpu/mali_kbase_gpu.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/gpu/mali_kbase_gpu_coherency.h b/mali_kbase/gpu/mali_kbase_gpu_coherency.h index 00991dd..a075ed0 100644 --- a/mali_kbase/gpu/mali_kbase_gpu_coherency.h +++ b/mali_kbase/gpu/mali_kbase_gpu_coherency.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2015-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/gpu/mali_kbase_gpu_fault.h b/mali_kbase/gpu/mali_kbase_gpu_fault.h index a09c3ba..9f4dc66 100644 --- a/mali_kbase/gpu/mali_kbase_gpu_fault.h +++ b/mali_kbase/gpu/mali_kbase_gpu_fault.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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 @@ -42,8 +22,9 @@ #ifndef _KBASE_GPU_FAULT_H_ #define _KBASE_GPU_FAULT_H_ -/** Returns the name associated with a Mali exception code - * +/** + * kbase_gpu_exception_name() - + * Returns the name associated with a Mali exception code * @exception_code: exception code * * This function is called from the interrupt handler when a GPU fault occurs. diff --git a/mali_kbase/gpu/mali_kbase_gpu_id.h b/mali_kbase/gpu/mali_kbase_gpu_id.h index fda52e6..8d687c4 100644 --- a/mali_kbase/gpu/mali_kbase_gpu_id.h +++ b/mali_kbase/gpu/mali_kbase_gpu_id.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2015-2020 ARM Limited. All rights reserved. @@ -124,11 +104,7 @@ #define GPU_ID2_PRODUCT_TBAX GPU_ID2_MODEL_MAKE(9, 5) #define GPU_ID2_PRODUCT_TDUX GPU_ID2_MODEL_MAKE(10, 1) #define GPU_ID2_PRODUCT_TODX GPU_ID2_MODEL_MAKE(10, 2) -#define GPU_ID2_PRODUCT_TGRX GPU_ID2_MODEL_MAKE(10, 3) -#define GPU_ID2_PRODUCT_TVAX GPU_ID2_MODEL_MAKE(10, 4) #define GPU_ID2_PRODUCT_LODX GPU_ID2_MODEL_MAKE(10, 7) -#define GPU_ID2_PRODUCT_TTUX GPU_ID2_MODEL_MAKE(11, 2) -#define GPU_ID2_PRODUCT_LTUX GPU_ID2_MODEL_MAKE(11, 3) /* Helper macro to create a GPU_ID assuming valid values for id, major, * minor, status diff --git a/mali_kbase/gpu/mali_kbase_gpu_regmap.h b/mali_kbase/gpu/mali_kbase_gpu_regmap.h index 8c1e41c..b7a566f 100644 --- a/mali_kbase/gpu/mali_kbase_gpu_regmap.h +++ b/mali_kbase/gpu/mali_kbase_gpu_regmap.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. @@ -367,6 +347,7 @@ /* GPU_STATUS values */ #define GPU_STATUS_PRFCNT_ACTIVE (1 << 2) /* Set if the performance counters are active. */ +#define GPU_STATUS_CYCLE_COUNT_ACTIVE (1 << 6) /* Set if the cycle counter is active. */ #define GPU_STATUS_PROTECTED_MODE_ACTIVE (1 << 7) /* Set if protected mode is active */ /* PRFCNT_CONFIG register values */ diff --git a/mali_kbase/ipa/Kbuild b/mali_kbase/ipa/Kbuild index 91bb48e..287f797 100644 --- a/mali_kbase/ipa/Kbuild +++ b/mali_kbase/ipa/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2016-2018, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 += \ diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.c b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.c index b7c861c..89bba49 100644 --- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.c +++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_counter_common_csf.h" diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.h b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.h index 9383dc2..8e29931 100644 --- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.h +++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.c b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.c index fe01f78..076dcd0 100644 --- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.c +++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_counter_common_jm.h" diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.h b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.h index 0147f18..24602be 100644 --- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.h +++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2017-2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2017-2018, 2020-2021 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 @@ -66,6 +46,7 @@ typedef u32 (*kbase_ipa_get_active_cycles_callback)(struct kbase_ipa_model_vinst /** * struct kbase_ipa_model_vinstr_data - IPA context per device * @kbdev: pointer to kbase device + * @group_values: values of coefficients for IPA groups * @groups_def: Array of IPA groups. * @groups_def_num: Number of elements in the array of IPA groups. * @get_active_cycles: Callback to return number of active cycles during @@ -121,7 +102,7 @@ struct kbase_ipa_group { * @model_data: pointer to model data * @coeff: model coefficient. Unity is ~2^20, so range approx * +/- 4.0: -2^22 < coeff < 2^22 - * @counter offset in bytes of the counter used to calculate energy + * @counter: offset in bytes of the counter used to calculate energy * for IPA group * * Calculate energy estimation based on hardware counter `counter' @@ -168,7 +149,7 @@ s64 kbase_ipa_single_counter( /** * attach_vinstr() - attach a vinstr_buffer to an IPA model. - * @model_data pointer to model data + * @model_data: pointer to model data * * Attach a vinstr_buffer to an IPA model. The vinstr_buffer * allows access to the hardware counters used to calculate @@ -180,7 +161,7 @@ int kbase_ipa_attach_vinstr(struct kbase_ipa_model_vinstr_data *model_data); /** * detach_vinstr() - detach a vinstr_buffer from an IPA model. - * @model_data pointer to model data + * @model_data: pointer to model data * * Detach a vinstr_buffer from an IPA model. */ diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_csf.c b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_csf.c index 1f21a85..9326b01 100644 --- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_csf.c +++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_csf.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,36 +17,28 @@ * 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_counter_common_csf.h" #include "mali_kbase.h" -/* CSHW counter block offsets */ -#define MESSAGES_RECEIVED (9) -#define CEU_ACTIVE (40) - /* MEMSYS counter block offsets */ -#define L2_RD_MSG_IN (16) -#define L2_WR_MSG_IN_STALL (19) -#define L2_SNP_MSG_IN (20) -#define L2_ANY_LOOKUP (25) -#define L2_EXT_READ_BEATS (32) -#define L2_EXT_AR_CNT_Q3 (36) -#define L2_EXT_AW_CNT_Q2 (50) +#define L2_RD_MSG_IN (16) +#define L2_EXT_WRITE_NOSNP_FULL (43) /* SC counter block offsets */ -#define FRAG_FPK_ACTIVE (7) -#define COMPUTE_ACTIVE (22) -#define EXEC_CORE_ACTIVE (26) -#define EXEC_STARVE_ARITH (33) -#define TEX_FILT_NUM_OPS (39) -#define BEATS_RD_TEX_EXT (59) +#define FRAG_QUADS_EZS_UPDATE (13) +#define EXEC_INSTR_FMA (27) +#define TEX_FILT_NUM_OPS (39) +#define LS_MEM_READ_SHORT (45) +#define LS_MEM_WRITE_SHORT (47) +#define VARY_SLOT_16 (51) /* Tiler counter block offsets */ -#define PRIM_SAT_CULLED (14) +#define IDVS_POS_SHAD_STALL (23) +#define PREFETCH_STALL (25) +#define VFETCH_POS_READ_WAIT (29) +#define IDVS_VAR_SHAD_STALL (38) #define COUNTER_DEF(cnt_name, coeff, cnt_idx, block_type) \ { \ @@ -68,36 +60,31 @@ #define TILER_COUNTER_DEF(cnt_name, coeff, cnt_idx) \ COUNTER_DEF(cnt_name, coeff, cnt_idx, KBASE_IPA_CORE_TYPE_TILER) -/** Table of description of HW counters used by IPA counter model. +/* Table of description of HW counters used by IPA counter model. * * This table provides a description of each performance counter * used by the top level counter model for energy estimation. */ static const struct kbase_ipa_counter ipa_top_level_cntrs_def_todx[] = { - CSHW_COUNTER_DEF("messages_received", 925749, MESSAGES_RECEIVED), - CSHW_COUNTER_DEF("ceu_active", 25611, CEU_ACTIVE), - - MEMSYS_COUNTER_DEF("l2_ext_read_beats", 3413, L2_EXT_READ_BEATS), - MEMSYS_COUNTER_DEF("l2_ext_ar_cnt_q3", 8141, L2_EXT_AR_CNT_Q3), - MEMSYS_COUNTER_DEF("l2_rd_msg_in", 3231, L2_RD_MSG_IN), - MEMSYS_COUNTER_DEF("l2_ext_aw_cnt_q2", 21714, L2_EXT_AW_CNT_Q2), - MEMSYS_COUNTER_DEF("l2_any_lookup", 110567, L2_ANY_LOOKUP), - MEMSYS_COUNTER_DEF("l2_wr_msg_in_stall", -370971, L2_WR_MSG_IN_STALL), - MEMSYS_COUNTER_DEF("l2_snp_msg_in", 270337, L2_SNP_MSG_IN), - - TILER_COUNTER_DEF("prim_sat_culled", -1094458, PRIM_SAT_CULLED), + MEMSYS_COUNTER_DEF("l2_rd_msg_in", 295631, L2_RD_MSG_IN), + MEMSYS_COUNTER_DEF("l2_ext_write_nosnp_ull", 325168, L2_EXT_WRITE_NOSNP_FULL), + + TILER_COUNTER_DEF("prefetch_stall", 145435, PREFETCH_STALL), + TILER_COUNTER_DEF("idvs_var_shad_stall", -171917, IDVS_VAR_SHAD_STALL), + TILER_COUNTER_DEF("idvs_pos_shad_stall", 109980, IDVS_POS_SHAD_STALL), + TILER_COUNTER_DEF("vfetch_pos_read_wait", -119118, VFETCH_POS_READ_WAIT), }; /* This table provides a description of each performance counter * used by the shader cores counter model for energy estimation. */ -static const struct kbase_ipa_counter ipa_shader_core_cntrs_def_todx[] = { - SC_COUNTER_DEF("frag_fpk_active", -91312, FRAG_FPK_ACTIVE), - SC_COUNTER_DEF("exec_core_active", 485012, EXEC_CORE_ACTIVE), - SC_COUNTER_DEF("beats_rd_tex_ext", 174174, BEATS_RD_TEX_EXT), - SC_COUNTER_DEF("tex_filt_num_operations", 164419, TEX_FILT_NUM_OPS), - SC_COUNTER_DEF("exec_starve_arith", -59107, EXEC_STARVE_ARITH), - SC_COUNTER_DEF("compute_active", -277940, COMPUTE_ACTIVE), + static const struct kbase_ipa_counter ipa_shader_core_cntrs_def_todx[] = { + SC_COUNTER_DEF("exec_instr_fma", 505449, EXEC_INSTR_FMA), + SC_COUNTER_DEF("tex_filt_num_operations", 574869, TEX_FILT_NUM_OPS), + SC_COUNTER_DEF("ls_mem_read_short", 60917, LS_MEM_READ_SHORT), + SC_COUNTER_DEF("frag_quads_ezs_update", 694555, FRAG_QUADS_EZS_UPDATE), + SC_COUNTER_DEF("ls_mem_write_short", 698290, LS_MEM_WRITE_SHORT), + SC_COUNTER_DEF("vary_slot_16", 181069, VARY_SLOT_16), }; #define IPA_POWER_MODEL_OPS(gpu, init_token) \ @@ -174,4 +161,4 @@ const char *kbase_ipa_counter_model_name_from_id(u32 gpu_id) default: return NULL; } -}
\ No newline at end of file +} diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_jm.c b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_jm.c index 233e6d5..d7648cd 100644 --- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_jm.c +++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_jm.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2016-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2016-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/thermal.h> @@ -180,7 +178,7 @@ static u32 kbase_g7x_get_active_cycles( return kbase_ipa_single_counter(model_data, 1, counter); } -/** Table of IPA group definitions. +/* Table of IPA group definitions. * * For each IPA group, this table defines a function to access the given performance block counter (or counters, * if the operation needs to be iterated on multiple blocks) and calculate energy estimation. @@ -555,4 +553,4 @@ const char *kbase_ipa_counter_model_name_from_id(u32 gpu_id) default: return NULL; } -}
\ No newline at end of file +} diff --git a/mali_kbase/ipa/mali_kbase_ipa.c b/mali_kbase/ipa/mali_kbase_ipa.c index 848ea93..180dcb9 100644 --- a/mali_kbase/ipa/mali_kbase_ipa.c +++ b/mali_kbase/ipa/mali_kbase_ipa.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/thermal.h> @@ -479,6 +477,7 @@ static u32 get_static_power_locked(struct kbase_device *kbdev, return power; } +#if KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE #if defined(CONFIG_MALI_PWRSOFT_765) || \ KERNEL_VERSION(4, 10, 0) <= LINUX_VERSION_CODE static unsigned long kbase_get_static_power(struct devfreq *df, @@ -513,6 +512,7 @@ static unsigned long kbase_get_static_power(unsigned long voltage) return power; } +#endif /* KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE */ /** * opp_translate_freq_voltage() - Translate nominal OPP frequency from @@ -562,6 +562,7 @@ static void opp_translate_freq_voltage(struct kbase_device *kbdev, #endif } +#if KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE #if defined(CONFIG_MALI_PWRSOFT_765) || \ KERNEL_VERSION(4, 10, 0) <= LINUX_VERSION_CODE static unsigned long kbase_get_dynamic_power(struct devfreq *df, @@ -625,6 +626,7 @@ static unsigned long kbase_get_dynamic_power(unsigned long freq, return power; } +#endif /* KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE */ int kbase_get_real_power_locked(struct kbase_device *kbdev, u32 *power, unsigned long freq, @@ -725,8 +727,10 @@ int kbase_get_real_power(struct devfreq *df, u32 *power, KBASE_EXPORT_TEST_API(kbase_get_real_power); struct devfreq_cooling_power kbase_ipa_power_model_ops = { +#if KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE .get_static_power = &kbase_get_static_power, .get_dynamic_power = &kbase_get_dynamic_power, +#endif /* KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE */ #if defined(CONFIG_MALI_PWRSOFT_765) || \ KERNEL_VERSION(4, 10, 0) <= LINUX_VERSION_CODE .get_real_power = &kbase_get_real_power, diff --git a/mali_kbase/ipa/mali_kbase_ipa.h b/mali_kbase/ipa/mali_kbase_ipa.h index d979540..006b31c 100644 --- a/mali_kbase/ipa/mali_kbase_ipa.h +++ b/mali_kbase/ipa/mali_kbase_ipa.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2016-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/ipa/mali_kbase_ipa_debugfs.c b/mali_kbase/ipa/mali_kbase_ipa_debugfs.c index 82288fd..2672146 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_debugfs.c +++ b/mali_kbase/ipa/mali_kbase_ipa_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/debugfs.h> diff --git a/mali_kbase/ipa/mali_kbase_ipa_debugfs.h b/mali_kbase/ipa/mali_kbase_ipa_debugfs.h index 6641f1e..189b43c 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_debugfs.h +++ b/mali_kbase/ipa/mali_kbase_ipa_debugfs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2017, 2020-2021 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 @@ -82,6 +62,9 @@ static inline int kbase_ipa_model_param_add(struct kbase_ipa_model *model, static inline void kbase_ipa_model_param_free_all(struct kbase_ipa_model *model) { } +static inline void kbase_ipa_model_param_set_s32(struct kbase_ipa_model *model, + const char *name, s32 val) +{ } #endif /* CONFIG_DEBUG_FS */ #endif /* _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 c55daa1..55d44e9 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_simple.c +++ b/mali_kbase/ipa/mali_kbase_ipa_simple.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <uapi/linux/thermal.h> diff --git a/mali_kbase/ipa/mali_kbase_ipa_simple.h b/mali_kbase/ipa/mali_kbase_ipa_simple.h index f5f8609..c338b01 100644 --- a/mali_kbase/ipa/mali_kbase_ipa_simple.h +++ b/mali_kbase/ipa/mali_kbase_ipa_simple.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/jm/mali_base_jm_kernel.h b/mali_kbase/jm/mali_base_jm_kernel.h index de317eb..a72819e 100644 --- a/mali_kbase/jm/mali_base_jm_kernel.h +++ b/mali_kbase/jm/mali_base_jm_kernel.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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 @@ -936,6 +916,109 @@ enum { * Such codes are never returned to * user-space. * @BASE_JD_EVENT_RANGE_KERNEL_ONLY_END: End of kernel-only status codes. + * @BASE_JD_EVENT_DONE: atom has completed successfull + * @BASE_JD_EVENT_JOB_CONFIG_FAULT: Atom dependencies configuration error which + * shall result in a failed atom + * @BASE_JD_EVENT_JOB_POWER_FAULT: The job could not be executed because the + * part of the memory system required to access + * job descriptors was not powered on + * @BASE_JD_EVENT_JOB_READ_FAULT: Reading a job descriptor into the Job + * manager failed + * @BASE_JD_EVENT_JOB_WRITE_FAULT: Writing a job descriptor from the Job + * manager failed + * @BASE_JD_EVENT_JOB_AFFINITY_FAULT: The job could not be executed because the + * specified affinity mask does not intersect + * any available cores + * @BASE_JD_EVENT_JOB_BUS_FAULT: A bus access failed while executing a job + * @BASE_JD_EVENT_INSTR_INVALID_PC: A shader instruction with an illegal program + * counter was executed. + * @BASE_JD_EVENT_INSTR_INVALID_ENC: A shader instruction with an illegal + * encoding was executed. + * @BASE_JD_EVENT_INSTR_TYPE_MISMATCH: A shader instruction was executed where + * the instruction encoding did not match the + * instruction type encoded in the program + * counter. + * @BASE_JD_EVENT_INSTR_OPERAND_FAULT: A shader instruction was executed that + * contained invalid combinations of operands. + * @BASE_JD_EVENT_INSTR_TLS_FAULT: A shader instruction was executed that tried + * to access the thread local storage section + * of another thread. + * @BASE_JD_EVENT_INSTR_ALIGN_FAULT: A shader instruction was executed that + * tried to do an unsupported unaligned memory + * access. + * @BASE_JD_EVENT_INSTR_BARRIER_FAULT: A shader instruction was executed that + * failed to complete an instruction barrier. + * @BASE_JD_EVENT_DATA_INVALID_FAULT: Any data structure read as part of the job + * contains invalid combinations of data. + * @BASE_JD_EVENT_TILE_RANGE_FAULT: Tile or fragment shading was asked to + * process a tile that is entirely outside the + * bounding box of the frame. + * @BASE_JD_EVENT_STATE_FAULT: Matches ADDR_RANGE_FAULT. A virtual address + * has been found that exceeds the virtual + * address range. + * @BASE_JD_EVENT_OUT_OF_MEMORY: The tiler ran out of memory when executing a job. + * @BASE_JD_EVENT_UNKNOWN: If multiple jobs in a job chain fail, only + * the first one the reports an error will set + * and return full error information. + * Subsequent failing jobs will not update the + * error status registers, and may write an + * error status of UNKNOWN. + * @BASE_JD_EVENT_DELAYED_BUS_FAULT: The GPU received a bus fault for access to + * physical memory where the original virtual + * address is no longer available. + * @BASE_JD_EVENT_SHAREABILITY_FAULT: Matches GPU_SHAREABILITY_FAULT. A cache + * has detected that the same line has been + * accessed as both shareable and non-shareable + * memory from inside the GPU. + * @BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL1: A memory access hit an invalid table + * entry at level 1 of the translation table. + * @BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL2: A memory access hit an invalid table + * entry at level 2 of the translation table. + * @BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL3: A memory access hit an invalid table + * entry at level 3 of the translation table. + * @BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL4: A memory access hit an invalid table + * entry at level 4 of the translation table. + * @BASE_JD_EVENT_PERMISSION_FAULT: A memory access could not be allowed due to + * the permission flags set in translation + * table + * @BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL1: A bus fault occurred while reading + * level 0 of the translation tables. + * @BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL2: A bus fault occurred while reading + * level 1 of the translation tables. + * @BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL3: A bus fault occurred while reading + * level 2 of the translation tables. + * @BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL4: A bus fault occurred while reading + * level 3 of the translation tables. + * @BASE_JD_EVENT_ACCESS_FLAG: Matches ACCESS_FLAG_0. A memory access hit a + * translation table entry with the ACCESS_FLAG + * bit set to zero in level 0 of the + * page table, and the DISABLE_AF_FAULT flag + * was not set. + * @BASE_JD_EVENT_MEM_GROWTH_FAILED: raised for JIT_ALLOC atoms that failed to + * grow memory on demand + * @BASE_JD_EVENT_JOB_CANCELLED: raised when this atom was hard-stopped or its + * dependencies failed + * @BASE_JD_EVENT_JOB_INVALID: raised for many reasons, including invalid data + * in the atom which overlaps with + * BASE_JD_EVENT_JOB_CONFIG_FAULT, or if the + * platform doesn't support the feature specified in + * the atom. + * @BASE_JD_EVENT_PM_EVENT: TODO: remove as it's not used + * @BASE_JD_EVENT_TIMED_OUT: TODO: remove as it's not used + * @BASE_JD_EVENT_BAG_INVALID: TODO: remove as it's not used + * @BASE_JD_EVENT_PROGRESS_REPORT: TODO: remove as it's not used + * @BASE_JD_EVENT_BAG_DONE: TODO: remove as it's not used + * @BASE_JD_EVENT_DRV_TERMINATED: this is a special event generated to indicate + * to userspace that the KBase context has been + * destroyed and Base should stop listening for + * further events + * @BASE_JD_EVENT_REMOVED_FROM_NEXT: raised when an atom that was configured in + * the GPU has to be retried (but it has not + * started) due to e.g., GPU reset + * @BASE_JD_EVENT_END_RP_DONE: this is used for incremental rendering to signal + * the completion of a renderpass. This value + * shouldn't be returned to userspace but I haven't + * seen where it is reset back to JD_EVENT_DONE. * * HW and low-level SW events are represented by event codes. * The status of jobs which succeeded are also represented by @@ -1082,6 +1165,11 @@ struct base_jd_event_v2 { * struct base_dump_cpu_gpu_counters - Structure for * BASE_JD_REQ_SOFT_DUMP_CPU_GPU_COUNTERS * jobs. + * @system_time: gpu timestamp + * @cycle_counter: gpu cycle count + * @sec: cpu time(sec) + * @usec: cpu time(usec) + * @padding: padding * * This structure is stored into the memory pointed to by the @jc field * of &struct base_jd_atom. diff --git a/mali_kbase/jm/mali_kbase_jm_defs.h b/mali_kbase/jm/mali_kbase_jm_defs.h index dcfab82..0dd5035 100644 --- a/mali_kbase/jm/mali_kbase_jm_defs.h +++ b/mali_kbase/jm/mali_kbase_jm_defs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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 @@ -434,6 +414,16 @@ struct kbase_ext_res { * sync through soft jobs and for the implicit * synchronization required on access to external * resources. + * @dma_fence.fence_in: Input fence + * @dma_fence.fence: Points to the dma-buf output fence for this atom. + * @dma_fence.context: The dma-buf fence context number for this atom. A + * unique context number is allocated to each katom in + * the context on context creation. + * @dma_fence.seqno: The dma-buf fence sequence number for this atom. This + * is increased every time this katom uses dma-buf fence + * @dma_fence.callbacks: List of all callbacks set up to wait on other fences + * @dma_fence.dep_count: Atomic counter of number of outstandind dma-buf fence + * dependencies for this atom. * @event_code: Event code for the job chain represented by the atom, * both HW and low-level SW events are represented by * event codes. @@ -468,6 +458,8 @@ struct kbase_ext_res { * @blocked: flag indicating that atom's resubmission to GPU is * blocked till the work item is scheduled to return the * atom to JS. + * @seq_nr: user-space sequence number, to order atoms in some + * temporal order * @pre_dep: Pointer to atom that this atom has same-slot * dependency on * @post_dep: Pointer to atom that has same-slot dependency on @@ -502,11 +494,19 @@ struct kbase_ext_res { * when transitioning into or out of protected mode. * Atom will be either entering or exiting the * protected mode. + * @protected_state.enter: entering the protected mode. + * @protected_state.exit: exiting the protected mode. * @runnable_tree_node: The node added to context's job slot specific rb tree * when the atom becomes runnable. * @age: Age of atom relative to other atoms in the context, * is snapshot of the age_count counter in kbase * context. + * @jobslot: Job slot to use when BASE_JD_REQ_JOB_SLOT is specified. + * @renderpass_id:Renderpass identifier used to associate an atom that has + * BASE_JD_REQ_START_RENDERPASS set in its core requirements + * with an atom that has BASE_JD_REQ_END_RENDERPASS set. + * @jc_fragment: Set of GPU fragment job chains + * @retry_count: TODO: Not used,to be removed */ struct kbase_jd_atom { struct kthread_work work; @@ -541,7 +541,6 @@ struct kbase_jd_atom { * when working with this sub struct */ #if defined(CONFIG_SYNC_FILE) - /* Input fence */ #if (KERNEL_VERSION(4, 10, 0) > LINUX_VERSION_CODE) struct fence *fence_in; #else @@ -564,14 +563,7 @@ struct kbase_jd_atom { #else struct dma_fence *fence; #endif - /* The dma-buf fence context number for this atom. A unique - * context number is allocated to each katom in the context on - * context creation. - */ unsigned int context; - /* The dma-buf fence sequence number for this atom. This is - * increased every time this katom uses dma-buf fence. - */ atomic_t seqno; /* This contains a list of all callbacks set up to wait on * other fences. This atom must be held back from JS until all @@ -633,7 +625,6 @@ struct kbase_jd_atom { atomic_t blocked; - /* user-space sequence number, to order atoms in some temporal order */ u64 seq_nr; struct kbase_jd_atom *pre_dep; diff --git a/mali_kbase/jm/mali_kbase_jm_ioctl.h b/mali_kbase/jm/mali_kbase_jm_ioctl.h index 7e2515b..93c9c44 100644 --- a/mali_kbase/jm/mali_kbase_jm_ioctl.h +++ b/mali_kbase/jm/mali_kbase_jm_ioctl.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/jm/mali_kbase_jm_js.h b/mali_kbase/jm/mali_kbase_jm_js.h index 6978b56..06adb36 100644 --- a/mali_kbase/jm/mali_kbase_jm_js.h +++ b/mali_kbase/jm/mali_kbase_jm_js.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved. @@ -51,6 +31,7 @@ /** * kbasep_js_devdata_init - Initialize the Job Scheduler + * @kbdev: The kbase_device to operate on * * The struct kbasep_js_device_data sub-structure of kbdev must be zero * initialized before passing to the kbasep_js_devdata_init() function. This is @@ -60,6 +41,7 @@ int kbasep_js_devdata_init(struct kbase_device * const kbdev); /** * kbasep_js_devdata_halt - Halt the Job Scheduler. + * @kbdev: The kbase_device to operate on * * It is safe to call this on kbdev even if it the kbasep_js_device_data * sub-structure was never initialized/failed initialization, to give efficient @@ -77,6 +59,7 @@ void kbasep_js_devdata_halt(struct kbase_device *kbdev); /** * kbasep_js_devdata_term - Terminate the Job Scheduler + * @kbdev: The kbase_device to operate on * * It is safe to call this on kbdev even if it the kbasep_js_device_data * sub-structure was never initialized/failed initialization, to give efficient @@ -94,6 +77,7 @@ void kbasep_js_devdata_term(struct kbase_device *kbdev); /** * kbasep_js_kctx_init - Initialize the Scheduling Component of a * struct kbase_context on the Job Scheduler. + * @kctx: The kbase_context to operate on * * This effectively registers a struct kbase_context with a Job Scheduler. * @@ -108,6 +92,7 @@ int kbasep_js_kctx_init(struct kbase_context *const kctx); /** * kbasep_js_kctx_term - Terminate the Scheduling Component of a * struct kbase_context on the Job Scheduler + * @kctx: The kbase_context to operate on * * This effectively de-registers a struct kbase_context from its Job Scheduler * @@ -127,6 +112,8 @@ void kbasep_js_kctx_term(struct kbase_context *kctx); * kbasep_js_add_job - Add a job chain to the Job Scheduler, * and take necessary actions to * schedule the context/run the job. + * @kctx: The kbase_context to operate on + * @atom: Atom to add * * This atomically does the following: * * Update the numbers of jobs information @@ -170,7 +157,10 @@ bool kbasep_js_add_job(struct kbase_context *kctx, struct kbase_jd_atom *atom); /** * kbasep_js_remove_job - Remove a job chain from the Job Scheduler, * except for its 'retained state'. - * + * @kbdev: The kbase_device to operate on + * @kctx: The kbase_context to operate on + * @atom: Atom to remove +* * Completely removing a job requires several calls: * * kbasep_js_copy_atom_retained_state(), to capture the 'retained state' of * the atom @@ -204,6 +194,9 @@ void kbasep_js_remove_job(struct kbase_device *kbdev, * kbasep_js_remove_cancelled_job - Completely remove a job chain from the * Job Scheduler, in the case * where the job chain was cancelled. + * @kbdev: The kbase_device to operate on + * @kctx: The kbase_context to operate on + * @katom: Atom to remove * * This is a variant of kbasep_js_remove_job() that takes care of removing all * of the retained state too. This is generally useful for cancelled atoms, @@ -234,6 +227,9 @@ bool kbasep_js_remove_cancelled_job(struct kbase_device *kbdev, * kbasep_js_runpool_requeue_or_kill_ctx - Handling the requeuing/killing of a * context that was evicted from the * policy queue or runpool. + * @kbdev: The kbase_device to operate on + * @kctx: The kbase_context to operate on + * @has_pm_ref: tells whether to release Power Manager active reference * * This should be used whenever handing off a context that has been evicted * from the policy queue or the runpool: @@ -261,6 +257,8 @@ void kbasep_js_runpool_requeue_or_kill_ctx(struct kbase_device *kbdev, /** * kbasep_js_runpool_release_ctx - Release a refcount of a context being busy, * allowing it to be scheduled out. + * @kbdev: The kbase_device to operate on + * @kctx: The kbase_context to operate on * * When the refcount reaches zero and the context might be scheduled out * (depending on whether the Scheduling Policy has deemed it so, or if it has @@ -315,6 +313,9 @@ void kbasep_js_runpool_release_ctx(struct kbase_device *kbdev, * kbasep_js_runpool_release_ctx_and_katom_retained_state - Variant of * kbasep_js_runpool_release_ctx() that handles additional * actions from completing an atom. + * @kbdev: KBase device + * @kctx: KBase context + * @katom_retained_state: Retained state from the atom * * This is usually called as part of completing an atom and releasing the * refcount on the context held by the atom. @@ -334,8 +335,12 @@ void kbasep_js_runpool_release_ctx_and_katom_retained_state( struct kbasep_js_atom_retained_state *katom_retained_state); /** - * kbasep_js_runpool_release_ctx_nolock - Variant of - * kbase_js_runpool_release_ctx() that assumes that + * kbasep_js_runpool_release_ctx_nolock - + * Variant of kbase_js_runpool_release_ctx() w/out locks + * @kbdev: KBase device + * @kctx: KBase context + * + * Variant of kbase_js_runpool_release_ctx() that assumes that * kbasep_js_device_data::runpool_mutex and * kbasep_js_kctx_info::ctx::jsctx_mutex are held by the caller, and does not * attempt to schedule new contexts. @@ -345,6 +350,8 @@ void kbasep_js_runpool_release_ctx_nolock(struct kbase_device *kbdev, /** * kbasep_js_schedule_privileged_ctx - Schedule in a privileged context + * @kbdev: KBase device + * @kctx: KBase context * * This schedules a context in regardless of the context priority. * If the runpool is full, a context will be forced out of the runpool and the @@ -370,6 +377,8 @@ void kbasep_js_schedule_privileged_ctx(struct kbase_device *kbdev, /** * kbasep_js_release_privileged_ctx - Release a privileged context, * allowing it to be scheduled out. + * @kbdev: KBase device + * @kctx: KBase context * * See kbasep_js_runpool_release_ctx for potential side effects. * @@ -387,6 +396,7 @@ void kbasep_js_release_privileged_ctx(struct kbase_device *kbdev, /** * kbase_js_try_run_jobs - Try to submit the next job on each slot + * @kbdev: KBase device * * The following locks may be used: * * kbasep_js_device_data::runpool_mutex @@ -397,6 +407,7 @@ void kbase_js_try_run_jobs(struct kbase_device *kbdev); /** * kbasep_js_suspend - Suspend the job scheduler during a Power Management * Suspend event. + * @kbdev: KBase device * * Causes all contexts to be removed from the runpool, and prevents any * contexts from (re)entering the runpool. @@ -420,6 +431,7 @@ void kbasep_js_suspend(struct kbase_device *kbdev); /** * kbasep_js_resume - Resume the Job Scheduler after a Power Management * Resume event. + * @kbdev: KBase device * * This restores the actions from kbasep_js_suspend(): * * Schedules contexts back into the runpool @@ -431,7 +443,7 @@ void kbasep_js_resume(struct kbase_device *kbdev); * kbase_js_dep_resolved_submit - Submit an atom to the job scheduler. * * @kctx: Context pointer - * @atom: Pointer to the atom to submit + * @katom: Pointer to the atom to submit * * The atom is enqueued on the context's ringbuffer. The caller must have * ensured that all dependencies can be represented in the ringbuffer. @@ -476,7 +488,7 @@ struct kbase_jd_atom *kbase_js_pull(struct kbase_context *kctx, int js); * kbase_js_unpull - Return an atom to the job scheduler ringbuffer. * * @kctx: Context pointer - * @atom: Pointer to the atom to unpull + * @katom: Pointer to the atom to unpull * * An atom is 'unpulled' if execution is stopped but intended to be returned to * later. The most common reason for this is that the atom has been @@ -621,6 +633,8 @@ void kbase_js_update_ctx_priority(struct kbase_context *kctx); /** * kbasep_js_is_submit_allowed - Check that a context is allowed to submit * jobs on this policy + * @js_devdata: KBase Job Scheduler Device Data + * @kctx: KBase context * * The purpose of this abstraction is to hide the underlying data size, * and wrap up the long repeated line of code. @@ -650,6 +664,8 @@ static inline bool kbasep_js_is_submit_allowed( /** * kbasep_js_set_submit_allowed - Allow a context to submit jobs on this policy + * @js_devdata: KBase Job Scheduler Device Data + * @kctx: KBase context * * The purpose of this abstraction is to hide the underlying data size, * and wrap up the long repeated line of code. @@ -677,6 +693,8 @@ static inline void kbasep_js_set_submit_allowed( /** * kbasep_js_clear_submit_allowed - Prevent a context from submitting more * jobs on this policy + * @js_devdata: KBase Job Scheduler Device Data + * @kctx: KBase context * * The purpose of this abstraction is to hide the underlying data size, * and wrap up the long repeated line of code. @@ -704,6 +722,10 @@ static inline void kbasep_js_clear_submit_allowed( } /** + * kbasep_js_atom_retained_state_init_invalid - + * Create an initial 'invalid' atom retained state + * @retained_state: pointer where to create and initialize the state + * * Create an initial 'invalid' atom retained state, that requires no * atom-related work to be done on releasing with * kbasep_js_runpool_release_ctx_and_katom_retained_state() @@ -717,6 +739,10 @@ static inline void kbasep_js_atom_retained_state_init_invalid( } /** + * kbasep_js_atom_retained_state_copy() - Copy atom state + * @retained_state: where to copy + * @katom: where to copy from + * * Copy atom state that can be made available after jd_done_nolock() is called * on that atom. */ @@ -761,7 +787,7 @@ static inline bool kbasep_js_has_atom_finished( * kbasep_js_atom_retained_state_is_valid - Determine whether a struct * kbasep_js_atom_retained_state * is valid - * @katom_retained_state the atom's retained state to check + * @katom_retained_state: the atom's retained state to check * * An invalid struct kbasep_js_atom_retained_state is allowed, and indicates * that the code should just ignore it. @@ -777,6 +803,8 @@ static inline bool kbasep_js_atom_retained_state_is_valid( /** * kbase_js_runpool_inc_context_count - Increment number of running contexts. + * @kbdev: KBase device + * @kctx: KBase context * * The following locking conditions are made on the caller: * * The caller must hold the kbasep_js_kctx_info::ctx::jsctx_mutex. @@ -813,6 +841,8 @@ static inline void kbase_js_runpool_inc_context_count( /** * kbase_js_runpool_dec_context_count - decrement number of running contexts. * + * @kbdev: KBase device + * @kctx: KBase context * The following locking conditions are made on the caller: * * The caller must hold the kbasep_js_kctx_info::ctx::jsctx_mutex. * * The caller must hold the kbasep_js_device_data::runpool_mutex diff --git a/mali_kbase/jm/mali_kbase_js_defs.h b/mali_kbase/jm/mali_kbase_js_defs.h index 7a68f7a..997cd49 100644 --- a/mali_kbase/jm/mali_kbase_js_defs.h +++ b/mali_kbase/jm/mali_kbase_js_defs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2011-2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2018, 2020-2021 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 @@ -40,27 +20,12 @@ */ /** - * @file mali_kbase_js.h - * Job Scheduler Type Definitions + * DOC: Job Scheduler Type Definitions */ #ifndef _KBASE_JS_DEFS_H_ #define _KBASE_JS_DEFS_H_ -/** - * @addtogroup base_api - * @{ - */ - -/** - * @addtogroup base_kbase_api - * @{ - */ - -/** - * @addtogroup kbase_js - * @{ - */ /* Forward decls */ struct kbase_device; struct kbase_jd_atom; @@ -68,12 +33,14 @@ struct kbase_jd_atom; typedef u32 kbase_context_flags; -/** Callback function run on all of a context's jobs registered with the Job - * Scheduler +/* + * typedef kbasep_js_ctx_job_cb - Callback function run on all of a context's + * jobs registered with the Job Scheduler */ -typedef void (*kbasep_js_ctx_job_cb)(struct kbase_device *kbdev, struct kbase_jd_atom *katom); +typedef void (*kbasep_js_ctx_job_cb)(struct kbase_device *kbdev, + struct kbase_jd_atom *katom); -/** +/* * @brief Maximum number of jobs that can be submitted to a job slot whilst * inside the IRQ handler. * @@ -84,7 +51,15 @@ typedef void (*kbasep_js_ctx_job_cb)(struct kbase_device *kbdev, struct kbase_jd #define KBASE_JS_MAX_JOB_SUBMIT_PER_SLOT_PER_IRQ 2 /** - * @brief Context attributes + * enum kbasep_js_ctx_attr - Context attributes + * @KBASEP_JS_CTX_ATTR_COMPUTE: Attribute indicating a context that contains + * Compute jobs. + * @KBASEP_JS_CTX_ATTR_NON_COMPUTE: Attribute indicating a context that contains + * Non-Compute jobs. + * @KBASEP_JS_CTX_ATTR_COMPUTE_ALL_CORES: Attribute indicating that a context + * contains compute-job atoms that aren't restricted to a coherent group, + * and can run on all cores. + * @KBASEP_JS_CTX_ATTR_COUNT: Must be the last in the enum * * Each context attribute can be thought of as a boolean value that caches some * state information about either the runpool, or the context: @@ -101,61 +76,70 @@ typedef void (*kbasep_js_ctx_job_cb)(struct kbase_device *kbdev, struct kbase_jd * - The runpool holds a refcount of how many contexts in the runpool have this * attribute. * - The context holds a refcount of how many atoms have this attribute. + * + * KBASEP_JS_CTX_ATTR_COMPUTE: + * Attribute indicating a context that contains Compute jobs. That is, + * the context has jobs of type @ref BASE_JD_REQ_ONLY_COMPUTE + * + * @note A context can be both 'Compute' and 'Non Compute' if it contains + * both types of jobs. + * + * KBASEP_JS_CTX_ATTR_NON_COMPUTE: + * Attribute indicating a context that contains Non-Compute jobs. That is, + * the context has some jobs that are \b not of type @ref + * BASE_JD_REQ_ONLY_COMPUTE. + * + * @note A context can be both 'Compute' and 'Non Compute' if it contains + * both types of jobs. + * + * KBASEP_JS_CTX_ATTR_COMPUTE_ALL_CORES: + * Attribute indicating that a context contains compute-job atoms that + * aren't restricted to a coherent group, and can run on all cores. + * + * Specifically, this is when the atom's \a core_req satisfy: + * - (\a core_req & (BASE_JD_REQ_CS | BASE_JD_REQ_ONLY_COMPUTE | BASE_JD_REQ_T) // uses slot 1 or slot 2 + * - && !(\a core_req & BASE_JD_REQ_COHERENT_GROUP) // not restricted to coherent groups + * + * Such atoms could be blocked from running if one of the coherent groups + * is being used by another job slot, so tracking this context attribute + * allows us to prevent such situations. + * + * @note This doesn't take into account the 1-coregroup case, where all + * compute atoms would effectively be able to run on 'all cores', but + * contexts will still not always get marked with this attribute. Instead, + * it is the caller's responsibility to take into account the number of + * coregroups when interpreting this attribute. + * + * @note Whilst Tiler atoms are normally combined with + * BASE_JD_REQ_COHERENT_GROUP, it is possible to send such atoms without + * BASE_JD_REQ_COHERENT_GROUP set. This is an unlikely case, but it's easy + * enough to handle anyway. + * + * */ enum kbasep_js_ctx_attr { - /** Attribute indicating a context that contains Compute jobs. That is, - * the context has jobs of type @ref BASE_JD_REQ_ONLY_COMPUTE - * - * @note A context can be both 'Compute' and 'Non Compute' if it contains - * both types of jobs. - */ KBASEP_JS_CTX_ATTR_COMPUTE, - - /** Attribute indicating a context that contains Non-Compute jobs. That is, - * the context has some jobs that are \b not of type @ref - * BASE_JD_REQ_ONLY_COMPUTE. - * - * @note A context can be both 'Compute' and 'Non Compute' if it contains - * both types of jobs. - */ KBASEP_JS_CTX_ATTR_NON_COMPUTE, - - /** Attribute indicating that a context contains compute-job atoms that - * aren't restricted to a coherent group, and can run on all cores. - * - * Specifically, this is when the atom's \a core_req satisfy: - * - (\a core_req & (BASE_JD_REQ_CS | BASE_JD_REQ_ONLY_COMPUTE | BASE_JD_REQ_T) // uses slot 1 or slot 2 - * - && !(\a core_req & BASE_JD_REQ_COHERENT_GROUP) // not restricted to coherent groups - * - * Such atoms could be blocked from running if one of the coherent groups - * is being used by another job slot, so tracking this context attribute - * allows us to prevent such situations. - * - * @note This doesn't take into account the 1-coregroup case, where all - * compute atoms would effectively be able to run on 'all cores', but - * contexts will still not always get marked with this attribute. Instead, - * it is the caller's responsibility to take into account the number of - * coregroups when interpreting this attribute. - * - * @note Whilst Tiler atoms are normally combined with - * BASE_JD_REQ_COHERENT_GROUP, it is possible to send such atoms without - * BASE_JD_REQ_COHERENT_GROUP set. This is an unlikely case, but it's easy - * enough to handle anyway. - */ KBASEP_JS_CTX_ATTR_COMPUTE_ALL_CORES, - - /** Must be the last in the enum */ KBASEP_JS_CTX_ATTR_COUNT }; enum { - /** Bit indicating that new atom should be started because this atom completed */ + /* + * Bit indicating that new atom should be started because this atom + * completed + */ KBASE_JS_ATOM_DONE_START_NEW_ATOMS = (1u << 0), - /** Bit indicating that the atom was evicted from the JS_NEXT registers */ + /* + * Bit indicating that the atom was evicted from the JS_NEXT registers + */ KBASE_JS_ATOM_DONE_EVICTED_FROM_NEXT = (1u << 1) }; -/** Combination of KBASE_JS_ATOM_DONE_<...> bits */ +/** + * typedef kbasep_js_atom_done_code - Combination of KBASE_JS_ATOM_DONE_<...> + * bits + */ typedef u32 kbasep_js_atom_done_code; /* @@ -203,7 +187,70 @@ enum { #define KBASE_JS_ATOM_SCHED_PRIO_DEFAULT KBASE_JS_ATOM_SCHED_PRIO_MED /** - * @brief KBase Device Data Job Scheduler sub-structure + * struct kbasep_js_device_data - KBase Device Data Job Scheduler sub-structure + * @runpool_irq: Sub-structure to collect together Job Scheduling data used in + * IRQ context. The hwaccess_lock must be held when accessing. + * @runpool_irq.submit_allowed: Bitvector indicating whether a currently + * scheduled context is allowed to submit jobs. When bit 'N' is set in + * this, it indicates whether the context bound to address space 'N' is + * allowed to submit jobs. + * @runpool_irq.ctx_attr_ref_count: Array of Context Attributes Ref_counters: + * Each is large enough to hold a refcount of the number of contexts + * that can fit into the runpool. This is currently BASE_MAX_NR_AS. + * Note that when BASE_MAX_NR_AS==16 we need 5 bits (not 4) to store + * the refcount. Hence, it's not worthwhile reducing this to + * bit-manipulation on u32s to save space (where in contrast, 4 bit + * sub-fields would be easy to do and would save space). + * Whilst this must not become negative, the sign bit is used for: + * - error detection in debug builds + * - Optimization: it is undefined for a signed int to overflow, and so + * the compiler can optimize for that never happening (thus, no masking + * is required on updating the variable) + * @runpool_irq.slot_affinities: Affinity management and tracking. Bitvector + * to aid affinity checking. Element 'n' bit 'i' indicates that slot 'n' + * is using core i (i.e. slot_affinity_refcount[n][i] > 0) + * @runpool_irq.slot_affinity_refcount: Array of fefcount for each core owned + * by each slot. Used to generate the slot_affinities array of bitvectors. + * The value of the refcount will not exceed BASE_JM_SUBMIT_SLOTS, + * because it is refcounted only when a job is definitely about to be + * submitted to a slot, and is de-refcounted immediately after a job + * finishes + * @schedule_sem: Scheduling semaphore. This must be held when calling + * kbase_jm_kick() + * @ctx_list_pullable: List of contexts that can currently be pulled from + * @ctx_list_unpullable: List of contexts that can not currently be pulled + * from, but have jobs currently running. + * @nr_user_contexts_running: Number of currently scheduled user contexts + * (excluding ones that are not submitting jobs) + * @nr_all_contexts_running: Number of currently scheduled contexts (including + * ones that are not submitting jobs) + * @js_reqs: Core Requirements to match up with base_js_atom's core_req memeber + * @note This is a write-once member, and so no locking is required to + * read + * @scheduling_period_ns: Value for JS_SCHEDULING_PERIOD_NS + * @soft_stop_ticks: Value for JS_SOFT_STOP_TICKS + * @soft_stop_ticks_cl: Value for JS_SOFT_STOP_TICKS_CL + * @hard_stop_ticks_ss: Value for JS_HARD_STOP_TICKS_SS + * @hard_stop_ticks_cl: Value for JS_HARD_STOP_TICKS_CL + * @hard_stop_ticks_dumping: Value for JS_HARD_STOP_TICKS_DUMPING + * @gpu_reset_ticks_ss: Value for JS_RESET_TICKS_SS + * @gpu_reset_ticks_cl: Value for JS_RESET_TICKS_CL + * @gpu_reset_ticks_dumping: Value for JS_RESET_TICKS_DUMPING + * @ctx_timeslice_ns: Value for JS_CTX_TIMESLICE_NS + * @suspended_soft_jobs_list: List of suspended soft jobs + * @softstop_always: Support soft-stop on a single context + * @init_status:The initialized-flag is placed at the end, to avoid + * cache-pollution (we should only be using this during init/term paths). + * @note This is a write-once member, and so no locking is required to + * read + * @nr_contexts_pullable:Number of contexts that can currently be pulled from + * @nr_contexts_runnable:Number of contexts that can either be pulled from or + * arecurrently running + * @soft_job_timeout_ms:Value for JS_SOFT_JOB_TIMEOUT + * @queue_mutex: Queue Lock, used to access the Policy's queue of contexts + * independently of the Run Pool. + * Of course, you don't need the Run Pool lock to access this. + * @runpool_mutex: Run Pool mutex, for managing contexts within the runpool. * * This encapsulates the current context of the Job Scheduler on a particular * device. This context is global to the device, and is not tied to any @@ -211,131 +258,49 @@ enum { * * nr_contexts_running and as_free are optimized for packing together (by making * them smaller types than u32). The operations on them should rarely involve - * masking. The use of signed types for arithmetic indicates to the compiler that - * the value will not rollover (which would be undefined behavior), and so under - * the Total License model, it is free to make optimizations based on that (i.e. - * to remove masking). + * masking. The use of signed types for arithmetic indicates to the compiler + * that the value will not rollover (which would be undefined behavior), and so + * under the Total License model, it is free to make optimizations based on + * that (i.e. to remove masking). */ struct kbasep_js_device_data { - /* Sub-structure to collect together Job Scheduling data used in IRQ - * context. The hwaccess_lock must be held when accessing. - */ struct runpool_irq { - /** Bitvector indicating whether a currently scheduled context is allowed to submit jobs. - * When bit 'N' is set in this, it indicates whether the context bound to address space - * 'N' is allowed to submit jobs. - */ u16 submit_allowed; - - /** Context Attributes: - * Each is large enough to hold a refcount of the number of contexts - * that can fit into the runpool. This is currently BASE_MAX_NR_AS - * - * Note that when BASE_MAX_NR_AS==16 we need 5 bits (not 4) to store - * the refcount. Hence, it's not worthwhile reducing this to - * bit-manipulation on u32s to save space (where in contrast, 4 bit - * sub-fields would be easy to do and would save space). - * - * Whilst this must not become negative, the sign bit is used for: - * - error detection in debug builds - * - Optimization: it is undefined for a signed int to overflow, and so - * the compiler can optimize for that never happening (thus, no masking - * is required on updating the variable) - */ s8 ctx_attr_ref_count[KBASEP_JS_CTX_ATTR_COUNT]; - - /* - * Affinity management and tracking - */ - /** Bitvector to aid affinity checking. Element 'n' bit 'i' indicates - * that slot 'n' is using core i (i.e. - * slot_affinity_refcount[n][i] > 0) - */ u64 slot_affinities[BASE_JM_MAX_NR_SLOTS]; - /** Refcount for each core owned by each slot. Used to generate the - * slot_affinities array of bitvectors - * - * The value of the refcount will not exceed BASE_JM_SUBMIT_SLOTS, - * because it is refcounted only when a job is definitely about to be - * submitted to a slot, and is de-refcounted immediately after a job - * finishes - */ s8 slot_affinity_refcount[BASE_JM_MAX_NR_SLOTS][64]; } runpool_irq; - - /** - * Scheduling semaphore. This must be held when calling - * kbase_jm_kick() - */ struct semaphore schedule_sem; - - /** - * List of contexts that can currently be pulled from - */ - struct list_head ctx_list_pullable[BASE_JM_MAX_NR_SLOTS][KBASE_JS_ATOM_SCHED_PRIO_COUNT]; - /** - * List of contexts that can not currently be pulled from, but have - * jobs currently running. - */ - struct list_head ctx_list_unpullable[BASE_JM_MAX_NR_SLOTS][KBASE_JS_ATOM_SCHED_PRIO_COUNT]; - - /** Number of currently scheduled user contexts (excluding ones that are not submitting jobs) */ + struct list_head ctx_list_pullable[BASE_JM_MAX_NR_SLOTS] + [KBASE_JS_ATOM_SCHED_PRIO_COUNT]; + struct list_head ctx_list_unpullable[BASE_JM_MAX_NR_SLOTS] + [KBASE_JS_ATOM_SCHED_PRIO_COUNT]; s8 nr_user_contexts_running; - /** Number of currently scheduled contexts (including ones that are not submitting jobs) */ s8 nr_all_contexts_running; - - /** Core Requirements to match up with base_js_atom's core_req memeber - * @note This is a write-once member, and so no locking is required to - * read - */ base_jd_core_req js_reqs[BASE_JM_MAX_NR_SLOTS]; - u32 scheduling_period_ns; /*< Value for JS_SCHEDULING_PERIOD_NS */ - u32 soft_stop_ticks; /*< Value for JS_SOFT_STOP_TICKS */ - u32 soft_stop_ticks_cl; /*< Value for JS_SOFT_STOP_TICKS_CL */ - u32 hard_stop_ticks_ss; /*< Value for JS_HARD_STOP_TICKS_SS */ - u32 hard_stop_ticks_cl; /*< Value for JS_HARD_STOP_TICKS_CL */ - u32 hard_stop_ticks_dumping; /*< Value for JS_HARD_STOP_TICKS_DUMPING */ - u32 gpu_reset_ticks_ss; /*< Value for JS_RESET_TICKS_SS */ - u32 gpu_reset_ticks_cl; /*< Value for JS_RESET_TICKS_CL */ - u32 gpu_reset_ticks_dumping; /*< Value for JS_RESET_TICKS_DUMPING */ - u32 ctx_timeslice_ns; /**< Value for JS_CTX_TIMESLICE_NS */ + u32 scheduling_period_ns; + u32 soft_stop_ticks; + u32 soft_stop_ticks_cl; + u32 hard_stop_ticks_ss; + u32 hard_stop_ticks_cl; + u32 hard_stop_ticks_dumping; + u32 gpu_reset_ticks_ss; + u32 gpu_reset_ticks_cl; + u32 gpu_reset_ticks_dumping; + u32 ctx_timeslice_ns; - /** List of suspended soft jobs */ struct list_head suspended_soft_jobs_list; #ifdef CONFIG_MALI_DEBUG - /* Support soft-stop on a single context */ bool softstop_always; #endif /* CONFIG_MALI_DEBUG */ - - /** The initialized-flag is placed at the end, to avoid cache-pollution - * (we should only be using this during init/term paths). - * @note This is a write-once member, and so no locking is required to - * read - */ int init_status; - - /* Number of contexts that can currently be pulled from */ u32 nr_contexts_pullable; - - /* Number of contexts that can either be pulled from or are currently - * running - */ atomic_t nr_contexts_runnable; - - /** Value for JS_SOFT_JOB_TIMEOUT */ atomic_t soft_job_timeout_ms; - - /** - * Queue Lock, used to access the Policy's queue of contexts - * independently of the Run Pool. - * - * Of course, you don't need the Run Pool lock to access this. - */ struct mutex queue_mutex; - - /** + /* * Run Pool mutex, for managing contexts within the runpool. * Unless otherwise specified, you must hold this lock whilst accessing * any members that follow @@ -347,64 +312,59 @@ struct kbasep_js_device_data { }; /** - * @brief KBase Context Job Scheduling information structure + * struct kbasep_js_kctx_info - KBase Context Job Scheduling information + * structure + * @ctx: Job Scheduler Context information sub-structure.Its members are + * accessed regardless of whether the context is: + * - In the Policy's Run Pool + * - In the Policy's Queue + * - Not queued nor in the Run Pool. + * You must obtain the @ctx.jsctx_mutex before accessing any other members + * of this substructure. + * You may not access any of its members from IRQ context. + * @ctx.jsctx_mutex: Job Scheduler Context lock + * @ctx.nr_jobs: Number of jobs <b>ready to run</b> - does \em not include + * the jobs waiting in the dispatcher, and dependency-only + * jobs. See kbase_jd_context::job_nr for such jobs + * @ctx.ctx_attr_ref_count: Context Attributes ref count. Each is large enough + * to hold a refcount of the number of atoms on the context. + * @ctx.is_scheduled_wait: Wait queue to wait for KCTX_SHEDULED flag state + * changes. + * @ctx.ctx_list_entry: Link implementing JS queues. Context can be present on + * one list per job slot. + * @init_status: The initalized-flag is placed at the end, to avoid + * cache-pollution (we should only be using this during init/term paths) * * This is a substructure in the struct kbase_context that encapsulates all the * scheduling information. */ struct kbasep_js_kctx_info { - - /** - * Job Scheduler Context information sub-structure. These members are - * accessed regardless of whether the context is: - * - In the Policy's Run Pool - * - In the Policy's Queue - * - Not queued nor in the Run Pool. - * - * You must obtain the jsctx_mutex before accessing any other members of - * this substructure. - * - * You may not access any of these members from IRQ context. - */ struct kbase_jsctx { - struct mutex jsctx_mutex; /**< Job Scheduler Context lock */ + struct mutex jsctx_mutex; - /** Number of jobs <b>ready to run</b> - does \em not include - * the jobs waiting in the dispatcher, and dependency-only - * jobs. See kbase_jd_context::job_nr for such jobs - */ u32 nr_jobs; - - /** Context Attributes: - * Each is large enough to hold a refcount of the number of atoms on - * the context. **/ u32 ctx_attr_ref_count[KBASEP_JS_CTX_ATTR_COUNT]; - - /** - * Wait queue to wait for KCTX_SHEDULED flag state changes. - */ wait_queue_head_t is_scheduled_wait; - - /** Link implementing JS queues. Context can be present on one - * list per job slot - */ struct list_head ctx_list_entry[BASE_JM_MAX_NR_SLOTS]; } ctx; - - /* The initalized-flag is placed at the end, to avoid cache-pollution (we should - * only be using this during init/term paths) - */ int init_status; }; -/** Subset of atom state that can be available after jd_done_nolock() is called +/** + * struct kbasep_js_atom_retained_state - Subset of atom state. + * @event_code: to determine whether the atom has finished + * @core_req: core requirements + * @sched_priority: priority + * @device_nr: Core group atom was executed on + * + * Subset of atom state that can be available after jd_done_nolock() is called * on that atom. A copy must be taken via kbasep_js_atom_retained_state_copy(), * because the original atom could disappear. */ struct kbasep_js_atom_retained_state { - /** Event code - to determine whether the atom has finished */ + /* Event code - to determine whether the atom has finished */ enum base_jd_event_code event_code; - /** core requirements */ + /* core requirements */ base_jd_core_req core_req; /* priority */ int sched_priority; @@ -413,30 +373,23 @@ struct kbasep_js_atom_retained_state { }; -/** +/* * Value signifying 'no retry on a slot required' for: * - kbase_js_atom_retained_state::retry_submit_on_slot * - kbase_jd_atom::retry_submit_on_slot */ #define KBASEP_JS_RETRY_SUBMIT_SLOT_INVALID (-1) -/** - * base_jd_core_req value signifying 'invalid' for a kbase_jd_atom_retained_state. - * - * @see kbase_atom_retained_state_is_valid() +/* + * base_jd_core_req value signifying 'invalid' for a + * kbase_jd_atom_retained_state. See kbase_atom_retained_state_is_valid() */ #define KBASEP_JS_ATOM_RETAINED_STATE_CORE_REQ_INVALID BASE_JD_REQ_DEP -/** - * @brief The JS timer resolution, in microseconds - * +/* + * The JS timer resolution, in microseconds * Any non-zero difference in time will be at least this size. */ #define KBASEP_JS_TICK_RESOLUTION_US 1 - - /** @} *//* end group kbase_js */ - /** @} *//* end group base_kbase_api */ - /** @} *//* end group base_api */ - -#endif /* _KBASE_JS_DEFS_H_ */ +#endif /* _KBASE_JS_DEFS_H_ */ diff --git a/mali_kbase/mali_base_hwconfig_features.h b/mali_kbase/mali_base_hwconfig_features.h index ebbe6bf..d6f31cf 100644 --- a/mali_kbase/mali_base_hwconfig_features.h +++ b/mali_kbase/mali_base_hwconfig_features.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. @@ -26,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -419,89 +399,5 @@ static const enum base_hw_feature base_hw_features_tODx[] = { BASE_HW_FEATURE_END }; -static const enum base_hw_feature base_hw_features_tGRx[] = { - 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_FLUSH_REDUCTION, - BASE_HW_FEATURE_PROTECTED_DEBUG_MODE, - BASE_HW_FEATURE_COHERENCY_REG, - BASE_HW_FEATURE_AARCH64_MMU, - BASE_HW_FEATURE_L2_CONFIG, - BASE_HW_FEATURE_CLEAN_ONLY_SAFE, - BASE_HW_FEATURE_END -}; - -static const enum base_hw_feature base_hw_features_tVAx[] = { - 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_FLUSH_REDUCTION, - BASE_HW_FEATURE_PROTECTED_DEBUG_MODE, - BASE_HW_FEATURE_COHERENCY_REG, - BASE_HW_FEATURE_AARCH64_MMU, - BASE_HW_FEATURE_L2_CONFIG, - BASE_HW_FEATURE_CLEAN_ONLY_SAFE, - BASE_HW_FEATURE_END -}; - -static const enum base_hw_feature base_hw_features_tTUx[] = { - 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_FLUSH_REDUCTION, - BASE_HW_FEATURE_PROTECTED_DEBUG_MODE, - BASE_HW_FEATURE_COHERENCY_REG, - BASE_HW_FEATURE_AARCH64_MMU, - BASE_HW_FEATURE_L2_CONFIG, - BASE_HW_FEATURE_CLEAN_ONLY_SAFE, - BASE_HW_FEATURE_ASN_HASH, - 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 603c8cd..0afabb1 100644 --- a/mali_kbase/mali_base_hwconfig_issues.h +++ b/mali_kbase/mali_base_hwconfig_issues.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. @@ -627,49 +607,5 @@ static const enum base_hw_issue base_hw_issues_model_tODx[] = { BASE_HW_ISSUE_END }; -static const enum base_hw_issue base_hw_issues_tGRx_r0p0[] = { - BASE_HW_ISSUE_9435, - BASE_HW_ISSUE_TSIX_2033, - BASE_HW_ISSUE_TTRX_1337, - BASE_HW_ISSUE_END -}; - -static const enum base_hw_issue base_hw_issues_model_tGRx[] = { - BASE_HW_ISSUE_5736, - BASE_HW_ISSUE_9435, - BASE_HW_ISSUE_TSIX_2033, - BASE_HW_ISSUE_TTRX_1337, - BASE_HW_ISSUE_END -}; - -static const enum base_hw_issue base_hw_issues_tVAx_r0p0[] = { - BASE_HW_ISSUE_9435, - BASE_HW_ISSUE_TSIX_2033, - BASE_HW_ISSUE_TTRX_1337, - BASE_HW_ISSUE_END -}; - -static const enum base_hw_issue base_hw_issues_model_tVAx[] = { - BASE_HW_ISSUE_5736, - BASE_HW_ISSUE_9435, - BASE_HW_ISSUE_TSIX_2033, - BASE_HW_ISSUE_TTRX_1337, - BASE_HW_ISSUE_END -}; - -static const enum base_hw_issue base_hw_issues_tTUx_r0p0[] = { - BASE_HW_ISSUE_9435, - BASE_HW_ISSUE_TSIX_2033, - BASE_HW_ISSUE_TTRX_1337, - BASE_HW_ISSUE_END -}; - -static const enum base_hw_issue base_hw_issues_model_tTUx[] = { - BASE_HW_ISSUE_5736, - BASE_HW_ISSUE_9435, - BASE_HW_ISSUE_TSIX_2033, - BASE_HW_ISSUE_TTRX_1337, - 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 49a9e3a..821c59d 100644 --- a/mali_kbase/mali_base_kernel.h +++ b/mali_kbase/mali_base_kernel.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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 @@ -138,7 +118,7 @@ typedef u32 base_mem_alloc_flags; */ enum base_mem_import_type { BASE_MEM_IMPORT_TYPE_INVALID = 0, - /** + /* * Import type with value 1 is deprecated. */ BASE_MEM_IMPORT_TYPE_UMM = 2, @@ -180,7 +160,7 @@ struct base_mem_import_user_buffer { /* Maximum size allowed in a single KBASE_IOCTL_MEM_ALLOC call */ #define KBASE_MEM_ALLOC_MAX_SIZE ((8ull << 30) >> PAGE_SHIFT) /* 8 GB */ -/** +/* * struct base_fence - Cross-device synchronisation fence. * * A fence is used to signal when the GPU has finished accessing a resource that @@ -486,74 +466,49 @@ struct base_jd_debug_copy_buffer { #define BASE_GPU_NUM_TEXTURE_FEATURES_REGISTERS 4 #define BASE_MAX_COHERENT_GROUPS 16 - +/** + * struct mali_base_gpu_core_props - GPU core props info + * @product_id: Pro specific value. + * @version_status: Status of the GPU release. No defined values, but starts at + * 0 and increases by one for each release status (alpha, beta, EAC, etc.). + * 4 bit values (0-15). + * @minor_revision: Minor release number of the GPU. "P" part of an "RnPn" + * release number. + * 8 bit values (0-255). + * @major_revision: Major release number of the GPU. "R" part of an "RnPn" + * release number. + * 4 bit values (0-15). + * @padding: padding to allign to 8-byte + * @gpu_freq_khz_max: The maximum GPU frequency. Reported to applications by + * clGetDeviceInfo() + * @log2_program_counter_size: Size of the shader program counter, in bits. + * @texture_features: TEXTURE_FEATURES_x registers, as exposed by the GPU. This + * is a bitpattern where a set bit indicates that the format is supported. + * Before using a texture format, it is recommended that the corresponding + * bit be checked. + * @gpu_available_memory_size: Theoretical maximum memory available to the GPU. + * It is unlikely that a client will be able to allocate all of this memory + * for their own purposes, but this at least provides an upper bound on the + * memory available to the GPU. + * This is required for OpenCL's clGetDeviceInfo() call when + * CL_DEVICE_GLOBAL_MEM_SIZE is requested, for OpenCL GPU devices. The + * client will not be expecting to allocate anywhere near this value. + * @num_exec_engines: The number of execution engines. + */ struct mali_base_gpu_core_props { - /** - * Product specific value. - */ u32 product_id; - - /** - * Status of the GPU release. - * No defined values, but starts at 0 and increases by one for each - * release status (alpha, beta, EAC, etc.). - * 4 bit values (0-15). - */ u16 version_status; - - /** - * Minor release number of the GPU. "P" part of an "RnPn" release number. - * 8 bit values (0-255). - */ u16 minor_revision; - - /** - * Major release number of the GPU. "R" part of an "RnPn" release number. - * 4 bit values (0-15). - */ u16 major_revision; - u16 padding; - - /* The maximum GPU frequency. Reported to applications by - * clGetDeviceInfo() - */ u32 gpu_freq_khz_max; - - /** - * Size of the shader program counter, in bits. - */ u32 log2_program_counter_size; - - /** - * TEXTURE_FEATURES_x registers, as exposed by the GPU. This is a - * bitpattern where a set bit indicates that the format is supported. - * - * Before using a texture format, it is recommended that the corresponding - * bit be checked. - */ u32 texture_features[BASE_GPU_NUM_TEXTURE_FEATURES_REGISTERS]; - - /** - * Theoretical maximum memory available to the GPU. It is unlikely that a - * client will be able to allocate all of this memory for their own - * purposes, but this at least provides an upper bound on the memory - * available to the GPU. - * - * This is required for OpenCL's clGetDeviceInfo() call when - * CL_DEVICE_GLOBAL_MEM_SIZE is requested, for OpenCL GPU devices. The - * client will not be expecting to allocate anywhere near this value. - */ u64 gpu_available_memory_size; - - /** - * The number of execution engines. - */ u8 num_exec_engines; }; -/** - * +/* * More information is possible - but associativity and bus width are not * required by upper-level apis. */ @@ -570,41 +525,70 @@ struct mali_base_gpu_tiler_props { }; /** - * GPU threading system details. + * struct mali_base_gpu_thread_props - GPU threading system details. + * @max_threads: Max. number of threads per core + * @max_workgroup_size: Max. number of threads per workgroup + * @max_barrier_size: Max. number of threads that can synchronize on a + * simple barrier + * @max_registers: Total size [1..65535] of the register file available + * per core. + * @max_task_queue: Max. tasks [1..255] which may be sent to a core + * before it becomes blocked. + * @max_thread_group_split: Max. allowed value [1..15] of the Thread Group Split + * field. + * @impl_tech: 0 = Not specified, 1 = Silicon, 2 = FPGA, + * 3 = SW Model/Emulation + * @padding: padding to allign to 8-byte + * @tls_alloc: Number of threads per core that TLS must be + * allocated for */ struct mali_base_gpu_thread_props { - u32 max_threads; /* Max. number of threads per core */ - u32 max_workgroup_size; /* Max. number of threads per workgroup */ - u32 max_barrier_size; /* Max. number of threads that can synchronize on a simple barrier */ - u16 max_registers; /* Total size [1..65535] of the register file available per core. */ - u8 max_task_queue; /* Max. tasks [1..255] which may be sent to a core before it becomes blocked. */ - u8 max_thread_group_split; /* Max. allowed value [1..15] of the Thread Group Split field. */ - u8 impl_tech; /* 0 = Not specified, 1 = Silicon, 2 = FPGA, 3 = SW Model/Emulation */ + u32 max_threads; + u32 max_workgroup_size; + u32 max_barrier_size; + u16 max_registers; + u8 max_task_queue; + u8 max_thread_group_split; + u8 impl_tech; u8 padding[3]; - u32 tls_alloc; /* Number of threads per core that TLS must - * be allocated for - */ + u32 tls_alloc; }; /** * struct mali_base_gpu_coherent_group - descriptor for a coherent group + * @core_mask: Core restriction mask required for the group + * @num_cores: Number of cores in the group + * @padding: padding to allign to 8-byte * * \c core_mask exposes all cores in that coherent group, and \c num_cores - * provides a cached population-count for that mask. + * provides a cached population-count for that mask. * * @note Whilst all cores are exposed in the mask, not all may be available to - * the application, depending on the Kernel Power policy. + * the application, depending on the Kernel Power policy. * - * @note if u64s must be 8-byte aligned, then this structure has 32-bits of wastage. + * @note if u64s must be 8-byte aligned, then this structure has 32-bits of + * wastage. */ struct mali_base_gpu_coherent_group { - u64 core_mask; /**< Core restriction mask required for the group */ - u16 num_cores; /**< Number of cores in the group */ + u64 core_mask; + u16 num_cores; u16 padding[3]; }; /** * struct mali_base_gpu_coherent_group_info - Coherency group information + * @num_groups: Number of coherent groups in the GPU. + * @num_core_groups: Number of core groups (coherent or not) in the GPU. + * Equivalent to the number of L2 Caches. + * The GPU Counter dumping writes 2048 bytes per core group, regardless + * of whether the core groups are coherent or not. Hence this member is + * needed to calculate how much memory is required for dumping. + * @note Do not use it to work out how many valid elements are in the + * group[] member. Use num_groups instead. + * @coherency: Coherency features of the memory, accessed by gpu_mem_features + * methods + * @padding: padding to allign to 8-byte + * @group: Descriptors of coherent groups * * Note that the sizes of the members could be reduced. However, the \c group * member might be 8-byte aligned to ensure the u64 core_mask is 8-byte @@ -615,36 +599,37 @@ struct mali_base_gpu_coherent_group { */ struct mali_base_gpu_coherent_group_info { u32 num_groups; - - /** - * Number of core groups (coherent or not) in the GPU. Equivalent to the number of L2 Caches. - * - * The GPU Counter dumping writes 2048 bytes per core group, regardless of - * whether the core groups are coherent or not. Hence this member is needed - * to calculate how much memory is required for dumping. - * - * @note Do not use it to work out how many valid elements are in the - * group[] member. Use num_groups instead. - */ u32 num_core_groups; - - /** - * Coherency features of the memory, accessed by gpu_mem_features - * methods - */ u32 coherency; - u32 padding; - - /** - * Descriptors of coherent groups - */ struct mali_base_gpu_coherent_group group[BASE_MAX_COHERENT_GROUPS]; }; /** * struct gpu_raw_gpu_props - A complete description of the GPU's Hardware * Configuration Discovery registers. + * @shader_present: Shader core present bitmap + * @tiler_present: Tiler core present bitmap + * @l2_present: Level 2 cache present bitmap + * @stack_present: Core stack present bitmap + * @l2_features: L2 features + * @core_features: Core features + * @mem_features: Mem features + * @mmu_features: Mmu features + * @as_present: Bitmap of address spaces present + * @js_present: Job slots present + * @js_features: Array of job slot features. + * @tiler_features: Tiler features + * @texture_features: TEXTURE_FEATURES_x registers, as exposed by the GPU + * @gpu_id: GPU and revision identifier + * @thread_max_threads: Maximum number of threads per core + * @thread_max_workgroup_size: Maximum number of threads per workgroup + * @thread_max_barrier_size: Maximum number of threads per barrier + * @thread_features: Thread features + * @coherency_mode: Note: This is the _selected_ coherency mode rather than the + * available modes as exposed in the coherency_features register + * @thread_tls_alloc: Number of threads per core that TLS must be allocated for + * @gpu_features: GPU features * * The information is presented inefficiently for access. For frequent access, * the values should be better expressed in an unpacked form in the @@ -694,16 +679,19 @@ struct gpu_raw_gpu_props { /** * struct base_gpu_props - Return structure for base_get_gpu_props(). + * @core_props: Core props. + * @l2_props: L2 props. + * @unused_1: Keep for backwards compatibility. + * @tiler_props: Tiler props. + * @thread_props: Thread props. + * @raw_props: This member is large, likely to be 128 bytes. + * @coherency_info: This must be last member of the structure. * * 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 * members exist to allow for efficient access and/or shielding the details * of the layout of the registers. - * - * @unused_1: Keep for backwards compatibility. - * @raw_props: This member is large, likely to be 128 bytes. - * @coherency_info: This must be last member of the structure. - */ + * */ struct base_gpu_props { struct mali_base_gpu_core_props core_props; struct mali_base_gpu_l2_cache_props l2_props; diff --git a/mali_kbase/mali_base_mem_priv.h b/mali_kbase/mali_base_mem_priv.h index fe193c0..9f59a4f 100644 --- a/mali_kbase/mali_base_mem_priv.h +++ b/mali_kbase/mali_base_mem_priv.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2010-2015, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase.h b/mali_kbase/mali_kbase.h index dabd9b8..8f70b78 100644 --- a/mali_kbase/mali_kbase.h +++ b/mali_kbase/mali_kbase.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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 @@ -434,13 +414,15 @@ void kbasep_as_do_poke(struct work_struct *work); /** * Check whether a system suspend is in progress, or has already been suspended + * @kbdev: The kbase device structure for the device * * The caller should ensure that either kbdev->pm.active_count_lock is held, or * a dmb was executed recently (to ensure the value is most * up-to-date). However, without a lock the value could change afterwards. * - * @return false if a suspend is not in progress - * @return !=false otherwise + * Return: + * * false if a suspend is not in progress + * * !=false otherwise */ static inline bool kbase_pm_is_suspending(struct kbase_device *kbdev) { @@ -521,6 +503,8 @@ void kbase_pm_metrics_stop(struct kbase_device *kbdev); /** * Return the atom's ID, as was originally supplied by userspace in * base_jd_atom::atom_number + * @kctx: KBase context pointer + * @katom: Atome for which to return ID */ static inline int kbase_jd_atom_id(struct kbase_context *kctx, struct kbase_jd_atom *katom) { @@ -572,7 +556,7 @@ static inline struct kbase_jd_atom *kbase_jd_atom_from_id( * The disjoint event counter is also incremented immediately whenever a job is soft stopped * and during context creation. * - * @param kbdev The kbase device + * @kbdev: The kbase device * * Return: 0 on success and non-zero value on failure. */ @@ -582,7 +566,7 @@ void kbase_disjoint_init(struct kbase_device *kbdev); * Increase the count of disjoint events * called when a disjoint event has happened * - * @param kbdev The kbase device + * @kbdev: The kbase device */ void kbase_disjoint_event(struct kbase_device *kbdev); @@ -592,14 +576,14 @@ void kbase_disjoint_event(struct kbase_device *kbdev); * This should be called when something happens which could be disjoint if the GPU * is in a disjoint state. The state refcount keeps track of this. * - * @param kbdev The kbase device + * @kbdev: The kbase device */ void kbase_disjoint_event_potential(struct kbase_device *kbdev); /** * Returns the count of disjoint events * - * @param kbdev The kbase device + * @kbdev: The kbase device * @return the count of disjoint events */ u32 kbase_disjoint_event_get(struct kbase_device *kbdev); @@ -611,7 +595,7 @@ u32 kbase_disjoint_event_get(struct kbase_device *kbdev); * eventually after the disjoint state has completed @ref kbase_disjoint_state_down * should be called * - * @param kbdev The kbase device + * @kbdev: The kbase device */ void kbase_disjoint_state_up(struct kbase_device *kbdev); @@ -622,11 +606,35 @@ void kbase_disjoint_state_up(struct kbase_device *kbdev); * * Called after @ref kbase_disjoint_state_up once the disjoint state is over * - * @param kbdev The kbase device + * @kbdev: The kbase device */ void kbase_disjoint_state_down(struct kbase_device *kbdev); /** + * kbase_device_pcm_dev_init() - Initialize the priority control manager device + * + * @kbdev: Pointer to the structure for the kbase device + * + * Pointer to the priority control manager device is retrieved from the device + * tree and a reference is taken on the module implementing the callbacks for + * priority control manager operations. + * + * Return: 0 if successful, or an error code on failure + */ +int kbase_device_pcm_dev_init(struct kbase_device *const kbdev); + +/** + * kbase_device_pcm_dev_term() - Performs priority control manager device + * deinitialization. + * + * @kbdev: Pointer to the structure for the kbase device + * + * Reference is released on the module implementing the callbacks for priority + * control manager operations. + */ +void kbase_device_pcm_dev_term(struct kbase_device *const kbdev); + +/** * If a job is soft stopped and the number of contexts is >= this value * it is reported as a disjoint event */ diff --git a/mali_kbase/mali_kbase_as_fault_debugfs.c b/mali_kbase/mali_kbase_as_fault_debugfs.c index 7851b6d..e6aaaf1 100644 --- a/mali_kbase/mali_kbase_as_fault_debugfs.c +++ b/mali_kbase/mali_kbase_as_fault_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/debugfs.h> diff --git a/mali_kbase/mali_kbase_as_fault_debugfs.h b/mali_kbase/mali_kbase_as_fault_debugfs.h index 19a3e17..b03884b 100644 --- a/mali_kbase/mali_kbase_as_fault_debugfs.h +++ b/mali_kbase/mali_kbase_as_fault_debugfs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2016, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_bits.h b/mali_kbase/mali_kbase_bits.h index e1625c6..6f6dba1 100644 --- a/mali_kbase/mali_kbase_bits.h +++ b/mali_kbase/mali_kbase_bits.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_cache_policy.c b/mali_kbase/mali_kbase_cache_policy.c index 1cc8738..7f266aa 100644 --- a/mali_kbase/mali_kbase_cache_policy.c +++ b/mali_kbase/mali_kbase_cache_policy.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -57,10 +55,11 @@ void kbase_sync_single_for_device(struct kbase_device *kbdev, dma_addr_t handle, { dma_sync_single_for_device(kbdev->dev, handle, size, dir); } - +KBASE_EXPORT_TEST_API(kbase_sync_single_for_device); void kbase_sync_single_for_cpu(struct kbase_device *kbdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { dma_sync_single_for_cpu(kbdev->dev, handle, size, dir); } +KBASE_EXPORT_TEST_API(kbase_sync_single_for_cpu); diff --git a/mali_kbase/mali_kbase_cache_policy.h b/mali_kbase/mali_kbase_cache_policy.h index 85c328a..817710a 100644 --- a/mali_kbase/mali_kbase_cache_policy.h +++ b/mali_kbase/mali_kbase_cache_policy.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2012-2013, 2015, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_caps.h b/mali_kbase/mali_kbase_caps.h index 1901c89..478a317 100644 --- a/mali_kbase/mali_kbase_caps.h +++ b/mali_kbase/mali_kbase_caps.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 @@ -40,9 +20,7 @@ */ /** - * @file mali_kbase_caps.h - * - * Driver Capability Queries. + * DOC: Driver Capability Queries. */ #ifndef _KBASE_CAPS_H_ diff --git a/mali_kbase/mali_kbase_ccswe.c b/mali_kbase/mali_kbase_ccswe.c index c48c4aa..624482a 100644 --- a/mali_kbase/mali_kbase_ccswe.c +++ b/mali_kbase/mali_kbase_ccswe.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_ccswe.h" diff --git a/mali_kbase/mali_kbase_ccswe.h b/mali_kbase/mali_kbase_ccswe.h index 77769f8..5c440b8 100644 --- a/mali_kbase/mali_kbase_ccswe.h +++ b/mali_kbase/mali_kbase_ccswe.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_config.c b/mali_kbase/mali_kbase_config.c index 5a1b8b1..98b6c35 100644 --- a/mali_kbase/mali_kbase_config.c +++ b/mali_kbase/mali_kbase_config.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/mali_kbase_config.h b/mali_kbase/mali_kbase_config.h index 804f0ed..549df78 100644 --- a/mali_kbase/mali_kbase_config.h +++ b/mali_kbase/mali_kbase_config.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010-2017, 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2017, 2019-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_config.h - * Configuration API and Attributes for KBase + * DOC: Configuration API and Attributes for KBase */ #ifndef _KBASE_CONFIG_H_ @@ -52,21 +31,6 @@ #include <mali_kbase_backend_config.h> #include <linux/rbtree.h> -/** - * @addtogroup base_api - * @{ - */ - -/** - * @addtogroup base_kbase_api - * @{ - */ - -/** - * @addtogroup kbase_config Configuration API and Attributes - * @{ - */ - /* Forward declaration of struct kbase_device */ struct kbase_device; @@ -77,8 +41,7 @@ struct kbase_context; struct kbase_jd_atom; /** - * kbase_platform_funcs_conf - Specifies platform integration function pointers - * for init/term and other events. + * struct kbase_platform_funcs_conf - Specifies platform init/term function pointers * * Specifies the functions pointers for platform specific initialization and * termination as well as other events. By default no functions are required. @@ -86,7 +49,7 @@ struct kbase_jd_atom; */ struct kbase_platform_funcs_conf { /** - * platform_init_func - platform specific init function pointer + * @platform_init_func: platform specific init function pointer * @kbdev - kbase_device pointer * * Returns 0 on success, negative error code otherwise. @@ -101,7 +64,7 @@ struct kbase_platform_funcs_conf { */ int (*platform_init_func)(struct kbase_device *kbdev); /** - * platform_term_func - platform specific termination function pointer + * @platform_term_func: platform specific termination function pointer * @kbdev - kbase_device pointer * * Function pointer for platform specific termination or NULL if no @@ -313,14 +276,15 @@ struct kbase_gpu_clk_notifier_data { }; /** - * kbase_clk_rate_trace_op_conf - Specifies GPU clock rate trace operations. + * struct kbase_clk_rate_trace_op_conf - Specifies GPU clock rate trace + * operations. * * Specifies the functions pointers for platform specific GPU clock rate trace * operations. By default no functions are required. */ struct kbase_clk_rate_trace_op_conf { /** - * enumerate_gpu_clk - Enumerate a GPU clock on the given index + * @enumerate_gpu_clk: Enumerate a GPU clock on the given index * @kbdev - kbase_device pointer * @index - GPU clock index * @@ -334,7 +298,7 @@ struct kbase_clk_rate_trace_op_conf { unsigned int index); /** - * get_gpu_clk_rate - Get the current rate for an enumerated clock. + * @get_gpu_clk_rate: Get the current rate for an enumerated clock. * @kbdev - kbase_device pointer * @gpu_clk_handle - Handle unique to the enumerated GPU clock * @@ -344,7 +308,7 @@ struct kbase_clk_rate_trace_op_conf { void *gpu_clk_handle); /** - * gpu_clk_notifier_register - Register a clock rate change notifier. + * @gpu_clk_notifier_register: Register a clock rate change notifier. * @kbdev - kbase_device pointer * @gpu_clk_handle - Handle unique to the enumerated GPU clock * @nb - notifier block containing the callback function @@ -363,7 +327,7 @@ struct kbase_clk_rate_trace_op_conf { void *gpu_clk_handle, struct notifier_block *nb); /** - * gpu_clk_notifier_unregister - Unregister clock rate change notifier + * @gpu_clk_notifier_unregister: Unregister clock rate change notifier * @kbdev - kbase_device pointer * @gpu_clk_handle - Handle unique to the enumerated GPU clock * @nb - notifier block containing the callback function @@ -407,7 +371,7 @@ struct kbase_platform_config { #endif /* CONFIG_OF */ /** - * @brief Gets the pointer to platform config. + * kbase_get_platform_config - Gets the pointer to platform config. * * @return Pointer to the platform config */ @@ -505,8 +469,4 @@ int kbase_platform_register(void); void kbase_platform_unregister(void); #endif - /** @} *//* end group kbase_config */ - /** @} *//* end group base_kbase_api */ - /** @} *//* end group base_api */ - #endif /* _KBASE_CONFIG_H_ */ diff --git a/mali_kbase/mali_kbase_config_defaults.h b/mali_kbase/mali_kbase_config_defaults.h index c903f76..4b46979 100644 --- a/mali_kbase/mali_kbase_config_defaults.h +++ b/mali_kbase/mali_kbase_config_defaults.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2013-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2013-2021 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 @@ -51,9 +31,7 @@ #define TICK_MULTIPLIER (1) /** - * @file mali_kbase_config_defaults.h - * - * Default values for configuration settings + * DOC: Default values for configuration settings * */ diff --git a/mali_kbase/mali_kbase_core_linux.c b/mali_kbase/mali_kbase_core_linux.c index a863bea..f78a11f 100644 --- a/mali_kbase/mali_kbase_core_linux.c +++ b/mali_kbase/mali_kbase_core_linux.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> @@ -131,7 +129,9 @@ #define KERNEL_SIDE_DDK_VERSION_STRING "K:" MALI_RELEASE_NAME "(GPL)" /** - * Kernel min/maj <=> API Version + * KBASE_API_VERSION - KBase API Version + * @major: Kernel major version + * @minor: Kernel minor version */ #define KBASE_API_VERSION(major, minor) ((((major) & 0xFFF) << 20) | \ (((minor) & 0xFFF) << 8) | \ @@ -141,14 +141,14 @@ #define KBASE_API_MAJ(api_version) ((api_version >> 20) & 0xFFF) /** - * kbase capabilities table + * typedef mali_kbase_capability_def - kbase capabilities table */ typedef struct mali_kbase_capability_def { u16 required_major; u16 required_minor; } mali_kbase_capability_def; -/** +/* * This must be kept in-sync with mali_kbase_cap * * TODO: The alternative approach would be to embed the cap enum values @@ -3139,16 +3139,8 @@ static ssize_t kbase_show_gpuinfo(struct device *dev, .name = "Mali-G57" }, { .id = GPU_ID2_PRODUCT_TODX >> GPU_ID_VERSION_PRODUCT_ID_SHIFT, .name = "Mali-TODX" }, - { .id = GPU_ID2_PRODUCT_TGRX >> GPU_ID_VERSION_PRODUCT_ID_SHIFT, - .name = "Mali-TGRX" }, - { .id = GPU_ID2_PRODUCT_TVAX >> GPU_ID_VERSION_PRODUCT_ID_SHIFT, - .name = "Mali-TVAX" }, { .id = GPU_ID2_PRODUCT_LODX >> GPU_ID_VERSION_PRODUCT_ID_SHIFT, .name = "Mali-LODX" }, - { .id = GPU_ID2_PRODUCT_TTUX >> GPU_ID_VERSION_PRODUCT_ID_SHIFT, - .name = "Mali-TTUX" }, - { .id = GPU_ID2_PRODUCT_LTUX >> GPU_ID_VERSION_PRODUCT_ID_SHIFT, - .name = "Mali-LTUX" }, }; const char *product_name = "(Unknown Mali GPU)"; struct kbase_device *kbdev; @@ -4899,6 +4891,17 @@ int kbase_device_coherency_init(struct kbase_device *kbdev) override_coherency = be32_to_cpup(coherency_override_dts); +#if MALI_USE_CSF && !defined(CONFIG_MALI_NO_MALI) + /* ACE coherency mode is not supported by Driver on CSF GPUs. + * Return an error to signal the invalid device tree configuration. + */ + if (override_coherency == COHERENCY_ACE) { + dev_err(kbdev->dev, + "ACE coherency not supported, wrong DT configuration"); + return -EINVAL; + } +#endif + if ((override_coherency <= COHERENCY_NONE) && (supported_coherency_bitmap & COHERENCY_FEATURE_BIT(override_coherency))) { diff --git a/mali_kbase/mali_kbase_cs_experimental.h b/mali_kbase/mali_kbase_cs_experimental.h index 8a3daa0..67cd5ee 100644 --- a/mali_kbase/mali_kbase_cs_experimental.h +++ b/mali_kbase/mali_kbase_cs_experimental.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_ctx_sched.c b/mali_kbase/mali_kbase_ctx_sched.c index 953db9e..f59a2d7 100644 --- a/mali_kbase/mali_kbase_ctx_sched.c +++ b/mali_kbase/mali_kbase_ctx_sched.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/mali_kbase_ctx_sched.h b/mali_kbase/mali_kbase_ctx_sched.h index 5e5e242..1aa3762 100644 --- a/mali_kbase/mali_kbase_ctx_sched.h +++ b/mali_kbase/mali_kbase_ctx_sched.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2017-2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2017-2018, 2020-2021 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 @@ -45,7 +25,7 @@ #include <mali_kbase.h> /** - * The Context Scheduler manages address space assignment and reference + * DOC: The Context Scheduler manages address space assignment and reference * counting to kbase_context. The interface has been designed to minimise * interactions between the Job Scheduler and Power Management/MMU to support * the existing Job Scheduler interface. @@ -60,7 +40,7 @@ */ /** - * kbase_ctx_sched_init - Initialise the context scheduler + * kbase_ctx_sched_init() - Initialise the context scheduler * @kbdev: The device for which the context scheduler needs to be initialised * * This must be called during device initialisation. The number of hardware diff --git a/mali_kbase/mali_kbase_debug.c b/mali_kbase/mali_kbase_debug.c index 82d709d..6caf56c 100644 --- a/mali_kbase/mali_kbase_debug.c +++ b/mali_kbase/mali_kbase_debug.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/mali_kbase_debug.h b/mali_kbase/mali_kbase_debug.h index 75e4ed1..9e1f73b 100644 --- a/mali_kbase/mali_kbase_debug.h +++ b/mali_kbase/mali_kbase_debug.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2012-2015, 2017, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2015, 2017, 2020-2021 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 @@ -68,9 +48,9 @@ struct kbasep_debug_assert_cb { }; /** - * @def KBASEP_DEBUG_PRINT_TRACE - * @brief Private macro containing the format of the trace to display before every message - * @sa KBASE_DEBUG_SKIP_TRACE, KBASE_DEBUG_SKIP_FUNCTION_NAME + * KBASEP_DEBUG_PRINT_TRACE - Private macro containing the format of the trace + * to display before every message @sa KBASE_DEBUG_SKIP_TRACE, + * KBASE_DEBUG_SKIP_FUNCTION_NAME */ #if !KBASE_DEBUG_SKIP_TRACE #define KBASEP_DEBUG_PRINT_TRACE \ @@ -85,21 +65,22 @@ struct kbasep_debug_assert_cb { #endif /** - * @def KBASEP_DEBUG_ASSERT_OUT(trace, function, ...) - * @brief (Private) system printing function associated to the @ref KBASE_DEBUG_ASSERT_MSG event. - * @param trace location in the code from where the message is printed - * @param function function from where the message is printed - * @param ... Format string followed by format arguments. + * KBASEP_DEBUG_ASSERT_OUT(trace, function, ...) - (Private) system printing + * function associated to the @ref KBASE_DEBUG_ASSERT_MSG event. + * @trace: location in the code from where the message is printed + * @function: function from where the message is printed + * @...: Format string followed by format arguments. + * * @note function parameter cannot be concatenated with other strings */ /* Select the correct system output function*/ #ifdef CONFIG_MALI_DEBUG -#define KBASEP_DEBUG_ASSERT_OUT(trace, function, ...)\ - do { \ - pr_err("Mali<ASSERT>: %s function:%s ", trace, function);\ - pr_err(__VA_ARGS__);\ - pr_err("\n");\ - } while (false) +#define KBASEP_DEBUG_ASSERT_OUT(trace, function, ...) \ + do { \ + pr_err("Mali<ASSERT>: %s function:%s ", trace, function); \ + pr_err(__VA_ARGS__); \ + pr_err("\n"); \ + } while (false) #else #define KBASEP_DEBUG_ASSERT_OUT(trace, function, ...) CSTD_NOP() #endif @@ -111,12 +92,12 @@ struct kbasep_debug_assert_cb { #endif /** - * @def KBASE_DEBUG_ASSERT(expr) - * @brief Calls @ref KBASE_PRINT_ASSERT and prints the expression @a expr if @a expr is false + * KBASE_DEBUG_ASSERT(expr) - Calls @ref KBASE_PRINT_ASSERT and prints the + * expression @a expr if @a expr is false + * @expr: Boolean expression * * @note This macro does nothing if the flag @ref KBASE_DEBUG_DISABLE_ASSERTS is set to 1 * - * @param expr Boolean expression */ #define KBASE_DEBUG_ASSERT(expr) \ KBASE_DEBUG_ASSERT_MSG(expr, #expr) @@ -124,15 +105,15 @@ struct kbasep_debug_assert_cb { #if KBASE_DEBUG_DISABLE_ASSERTS #define KBASE_DEBUG_ASSERT_MSG(expr, ...) CSTD_NOP() #else - /** - * @def KBASE_DEBUG_ASSERT_MSG(expr, ...) - * @brief Calls @ref KBASEP_DEBUG_ASSERT_OUT and prints the given message if @a expr is false - * - * @note This macro does nothing if the flag @ref KBASE_DEBUG_DISABLE_ASSERTS is set to 1 - * - * @param expr Boolean expression - * @param ... Message to display when @a expr is false, as a format string followed by format arguments. - */ +/** + * KBASE_DEBUG_ASSERT_MSG() - Calls @ref KBASEP_DEBUG_ASSERT_OUT and prints the + * given message if @a expr is false + * @expr: Boolean expression + * @...: Message to display when @a expr is false, as a format string followed + * by format arguments. + * + * This macro does nothing if the flag KBASE_DEBUG_DISABLE_ASSERTS is set to 1 + */ #define KBASE_DEBUG_ASSERT_MSG(expr, ...) \ do { \ if (!(expr)) { \ @@ -144,10 +125,8 @@ struct kbasep_debug_assert_cb { #endif /* KBASE_DEBUG_DISABLE_ASSERTS */ /** - * @def KBASE_DEBUG_CODE( X ) - * @brief Executes the code inside the macro only in debug mode - * - * @param X Code to compile only in debug mode. + * KBASE_DEBUG_CODE( X ) - Executes the code inside the macro only in debug mode + * @X: Code to compile only in debug mode. */ #ifdef CONFIG_MALI_DEBUG #define KBASE_DEBUG_CODE(X) X @@ -158,7 +137,9 @@ struct kbasep_debug_assert_cb { /** @} */ /** - * @brief Register a function to call on ASSERT + * kbase_debug_assert_register_hook - Register a function to call on ASSERT + * @func: the function to call when an assert is triggered. + * @param: the parameter to pass to \a func when calling it * * Such functions will \b only be called during Debug mode, and for debugging * features \b only. Do not rely on them to be called in general use. @@ -168,13 +149,12 @@ struct kbasep_debug_assert_cb { * @note This function is not thread-safe, and should only be used to * register/deregister once in the module's lifetime. * - * @param[in] func the function to call when an assert is triggered. - * @param[in] param the parameter to pass to \a func when calling it */ void kbase_debug_assert_register_hook(kbase_debug_assert_hook *func, void *param); /** - * @brief Call a debug assert hook previously registered with kbase_debug_assert_register_hook() + * kbasep_debug_assert_call_hook - Call a debug assert hook previously + * registered with kbase_debug_assert_register_hook() * * @note This function is not thread-safe with respect to multiple threads * registering functions and parameters with diff --git a/mali_kbase/mali_kbase_debug_job_fault.c b/mali_kbase/mali_kbase_debug_job_fault.c index 5a1bc2d..6902ded 100644 --- a/mali_kbase/mali_kbase_debug_job_fault.c +++ b/mali_kbase/mali_kbase_debug_job_fault.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/mali_kbase_debug_job_fault.h b/mali_kbase/mali_kbase_debug_job_fault.h index c147153..63ccb3d 100644 --- a/mali_kbase/mali_kbase_debug_job_fault.h +++ b/mali_kbase/mali_kbase_debug_job_fault.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2012-2016, 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_debug_mem_view.c b/mali_kbase/mali_kbase_debug_mem_view.c index 305007c..9bdb765 100644 --- a/mali_kbase/mali_kbase_debug_mem_view.c +++ b/mali_kbase/mali_kbase_debug_mem_view.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_debug_mem_view.h b/mali_kbase/mali_kbase_debug_mem_view.h index bee7a53..c913d5c 100644 --- a/mali_kbase/mali_kbase_debug_mem_view.h +++ b/mali_kbase/mali_kbase_debug_mem_view.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2013-2015, 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_debugfs_helper.c b/mali_kbase/mali_kbase_debugfs_helper.c index c48af37..28df887 100644 --- a/mali_kbase/mali_kbase_debugfs_helper.c +++ b/mali_kbase/mali_kbase_debugfs_helper.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/debugfs.h> diff --git a/mali_kbase/mali_kbase_debugfs_helper.h b/mali_kbase/mali_kbase_debugfs_helper.h index c1e1689..5fcbb15 100644 --- a/mali_kbase/mali_kbase_debugfs_helper.h +++ b/mali_kbase/mali_kbase_debugfs_helper.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_defs.h b/mali_kbase/mali_kbase_defs.h index f5330b7..3f0a953 100644 --- a/mali_kbase/mali_kbase_defs.h +++ b/mali_kbase/mali_kbase_defs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2011-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2021 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 @@ -40,10 +20,8 @@ */ /** - * @file mali_kbase_defs.h - * - * Defintions (types, defines, etcs) common to Kbase. They are placed here to - * allow the hierarchy of header files to work. + * DOC: Defintions (types, defines, etcs) common to Kbase. They are placed here + * to allow the hierarchy of header files to work. */ #ifndef _KBASE_DEFS_H_ @@ -144,6 +122,11 @@ #define KBASE_LOCK_REGION_MIN_SIZE_LOG2 (15) /** + * Maximum number of GPU memory region zones + */ +#define KBASE_REG_ZONE_MAX 4ul + +/** * Priority level for realtime worker threads */ #define KBASE_RT_THREAD_PRIO (60) @@ -346,7 +329,7 @@ struct kbasep_mem_device { struct kbase_clk_rate_listener; /** - * kbase_clk_rate_listener_on_change_t() - Frequency change callback + * typedef kbase_clk_rate_listener_on_change_t() - Frequency change callback * * @listener: Clock frequency change listener. * @clk_index: Index of the clock for which the change has occurred. @@ -396,92 +379,62 @@ struct kbase_clk_rate_trace_manager { }; /** - * Data stored per device for power management. - * - * This structure contains data for the power management framework. There is one - * instance of this structure per device in the system. + * struct kbase_pm_device_data - Data stored per device for power management. + * @lock: The lock protecting Power Management structures accessed outside of + * IRQ. + * This lock must also be held whenever the GPU is being powered on or + * off. + * @active_count: The reference count of active contexts on this device. Note + * that some code paths keep shaders/the tiler powered whilst this is 0. + * Use kbase_pm_is_active() instead to check for such cases. + * @suspending: Flag indicating suspending/suspended + * @gpu_lost: Flag indicating gpu lost + * This structure contains data for the power management framework. There + * is one instance of this structure per device in the system. + * @zero_active_count_wait: Wait queue set when active_count == 0 + * @resume_wait: system resume of GPU device. + * @debug_core_mask: Bit masks identifying the available shader cores that are + * specified via sysfs. One mask per job slot. + * @debug_core_mask_all: Bit masks identifying the available shader cores that + * are specified via sysfs. + * @callback_power_runtime_init: Callback for initializing the runtime power + * management. Return 0 on success, else error code + * @callback_power_runtime_term: Callback for terminating the runtime power + * management. + * @dvfs_period: Time in milliseconds between each dvfs sample + * @backend: KBase PM backend data + * @arb_vm_state: The state of the arbiter VM machine + * @gpu_users_waiting: Used by virtualization to notify the arbiter that there + * are users waiting for the GPU so that it can request and resume the + * driver. + * @clk_rtm: The state of the GPU clock rate trace manager */ struct kbase_pm_device_data { - /** - * The lock protecting Power Management structures accessed outside of - * IRQ. - * - * This lock must also be held whenever the GPU is being powered on or - * off. - */ struct mutex lock; - - /** - * The reference count of active contexts on this device. Note that - * some code paths keep shaders/the tiler powered whilst this is 0. Use - * kbase_pm_is_active() instead to check for such cases. - */ int active_count; - /** Flag indicating suspending/suspended */ bool suspending; #ifdef CONFIG_MALI_ARBITER_SUPPORT - /* Flag indicating gpu lost */ atomic_t gpu_lost; #endif /* CONFIG_MALI_ARBITER_SUPPORT */ - /* Wait queue set when active_count == 0 */ wait_queue_head_t zero_active_count_wait; - /* Wait queue to block the termination of a Kbase context until the - * system resume of GPU device. - */ wait_queue_head_t resume_wait; #if MALI_USE_CSF - /** - * Bit masks identifying the available shader cores that are specified - * via sysfs. - */ u64 debug_core_mask; #else - /** - * Bit masks identifying the available shader cores that are specified - * via sysfs. One mask per job slot. - */ + /* One mask per job slot. */ u64 debug_core_mask[BASE_JM_MAX_NR_SLOTS]; u64 debug_core_mask_all; #endif /* MALI_USE_CSF */ - /** - * Callback for initializing the runtime power management. - * - * @param kbdev The kbase device - * - * @return 0 on success, else error code - */ - int (*callback_power_runtime_init)(struct kbase_device *kbdev); - - /** - * Callback for terminating the runtime power management. - * - * @param kbdev The kbase device - */ + int (*callback_power_runtime_init)(struct kbase_device *kbdev); void (*callback_power_runtime_term)(struct kbase_device *kbdev); - - /* Time in milliseconds between each dvfs sample */ u32 dvfs_period; - struct kbase_pm_backend_data backend; - #ifdef CONFIG_MALI_ARBITER_SUPPORT - /** - * The state of the arbiter VM machine - */ struct kbase_arbiter_vm_state *arb_vm_state; - - /** - * Used by virtualization to notify the arbiter that there are users - * waiting for the GPU so that it can request and resume the driver. - */ atomic_t gpu_users_waiting; #endif /* CONFIG_MALI_ARBITER_SUPPORT */ - - /** - * The state of the GPU clock rate trace manager - */ struct kbase_clk_rate_trace_manager clk_rtm; }; @@ -710,6 +663,8 @@ struct kbase_process { * @irqs: Array containing IRQ resource info for 3 types of * interrupts : Job scheduling, MMU & GPU events (like * power management, cache etc.) + * @irqs.irq: irq number + * @irqs.flags: irq flags * @clocks: Pointer to the input clock resources referenced by * the GPU device node. * @nr_clocks: Number of clocks set in the clocks array. @@ -743,6 +698,7 @@ struct kbase_process { * accesses made by the driver. * @pm: Per device object for storing data for power management * framework. + * @csf: CSF object for the GPU device. * @js_data: Per device object encapsulating the current context of * Job Scheduler, which is global to the device and is not * tied to any particular struct kbase_context running on @@ -770,11 +726,19 @@ struct kbase_process { * @disjoint_event: struct for keeping track of the disjoint information, * that whether the GPU is in a disjoint state and the * number of disjoint events that have occurred on GPU. + * @disjoint_event.count: disjoint event count + * @disjoint_event.state: disjoint event state * @nr_hw_address_spaces: Number of address spaces actually available in the * GPU, remains constant after driver initialisation. * @nr_user_address_spaces: Number of address spaces available to user contexts * @hwcnt: Structure used for instrumentation and HW counters * dumping + * @hwcnt.lock: The lock should be used when accessing any of the + * following members + * @hwcnt.kctx: kbase context + * @hwcnt.addr: HW counter address + * @hwcnt.addr_bytes: HW counter size in bytes + * @hwcnt.backend: Kbase instrumentation backend * @hwcnt_gpu_iface: Backend interface for GPU hardware counter access. * @hwcnt_gpu_ctx: Context for GPU hardware counter access. * @hwaccess_lock must be held when calling @@ -785,6 +749,7 @@ struct kbase_process { * are enabled. If zero, there is no timeline client and * therefore timeline is disabled. * @timeline: Timeline context created per device. + * @ktrace: kbase device's ktrace * @trace_lock: Lock to serialize the access to trace buffer. * @trace_first_out: Index/offset in the trace buffer at which the first * unread message is present. @@ -838,6 +803,7 @@ struct kbase_process { * table in devicetree. * @num_opps: Number of operating performance points available for the Mali * GPU device. + * @last_devfreq_metrics: last PM metrics * @devfreq_queue: Per device object for storing data that manages devfreq * suspend & resume request queue and the related items. * @devfreq_cooling: Pointer returned on registering devfreq cooling device @@ -848,6 +814,17 @@ struct kbase_process { * previously entered protected mode. * @ipa: Top level structure for IPA, containing pointers to both * configured & fallback models. + * @ipa.lock: Access to this struct must be with ipa.lock held + * @ipa.configured_model: ipa model to use + * @ipa.fallback_model: ipa fallback model + * @ipa.last_metrics: Values of the PM utilization metrics from last time + * the power model was invoked. The utilization is + * calculated as the difference between last_metrics + * and the current values. + * @ipa.force_fallback_model: true if use of fallback model has been forced by + * the User + * @ipa.last_sample_time: Records the time when counters, used for dynamic + * energy estimation, were last sampled. * @previous_frequency: Previous frequency of GPU clock used for * BASE_HW_ISSUE_GPU2017_1336 workaround, This clock is * restored when L2 is powered on. @@ -856,6 +833,7 @@ struct kbase_process { * @mali_debugfs_directory: Root directory for the debugfs files created by the driver * @debugfs_ctx_directory: Directory inside the @mali_debugfs_directory containing * a sub-directory for every context. + * @debugfs_instr_directory: Instrumentation debugfs directory * @debugfs_as_read_bitmap: bitmap of address spaces for which the bus or page fault * has occurred. * @job_fault_wq: Waitqueue to block the job fault dumping daemon till the @@ -872,6 +850,8 @@ struct kbase_process { * @job_fault_event_lock: Lock to protect concurrent accesses to @job_fault_event_list * @regs_dump_debugfs_data: Contains the offset of register to be read through debugfs * file "read_register". + * @regs_dump_debugfs_data.reg_offset: Contains the offset of register to be + * read through debugfs file "read_register". * @ctx_num: Total number of contexts created for the device. * @io_history: Pointer to an object keeping a track of all recent * register accesses. The history of register accesses @@ -958,6 +938,13 @@ struct kbase_process { * @apc.timer: A hrtimer for powering off based on wake duration. * @apc.pending: Whether apc is requested and not handled yet. * @apc.lock: Lock for @apc.end_ts, @apc.timer and @apc.pending. + * @dummy_job_wa: struct for dummy job execution workaround for the + * GPU hang issue + * @dummy_job_wa.ctx: dummy job workaround context + * @dummy_job_wa.jc: dummy job workaround job + * @dummy_job_wa.slot: dummy job workaround slot + * @dummy_job_wa.flags: dummy job workaround flags + * @arb: Pointer to the arbiter device * @pcm_dev: The priority control manager device. */ struct kbase_device { @@ -1031,7 +1018,6 @@ struct kbase_device { struct kbase_hwcnt_backend_csf_if hwcnt_backend_csf_if_fw; #else struct kbase_hwcnt { - /* The lock should be used when accessing any of the following members */ spinlock_t lock; struct kbase_context *kctx; @@ -1233,7 +1219,6 @@ struct kbase_device { } dummy_job_wa; #ifdef CONFIG_MALI_ARBITER_SUPPORT - /* Pointer to the arbiter device */ struct kbase_arbiter_device arb; #endif /* Priority Control Manager device */ @@ -1409,6 +1394,21 @@ struct kbase_sub_alloc { }; /** + * struct kbase_reg_zone - Information about GPU memory region zones + * @base_pfn: Page Frame Number in GPU virtual address space for the start of + * the Zone + * @va_size_pages: Size of the Zone in pages + * + * Track information about a zone KBASE_REG_ZONE() and related macros. + * In future, this could also store the &rb_root that are currently in + * &kbase_context + */ +struct kbase_reg_zone { + u64 base_pfn; + u64 va_size_pages; +}; + +/** * struct kbase_context - Kernel base context * * @filp: Pointer to the struct file corresponding to device file @@ -1456,6 +1456,7 @@ struct kbase_sub_alloc { * @reg_rbtree_exec: RB tree of the memory regions allocated from the EXEC_VA * zone of the GPU virtual address space. Used for GPU-executable * allocations which don't need the SAME_VA property. + * @reg_zone: Zone information for the reg_rbtree_<...> members. * @cookies: Bitmask containing of BITS_PER_LONG bits, used mainly for * SAME_VA allocations to defer the reservation of memory region * (from the GPU virtual address space) from base_mem_alloc @@ -1480,6 +1481,7 @@ struct kbase_sub_alloc { * which actually created the context. This is usually, * but not necessarily, the same as the thread which * opened the device file /dev/malixx instance. + * @csf: kbase csf context * @jctx: object encapsulating all the Job dispatcher related state, * including the array of atoms. * @used_pages: Keeps a track of the number of 4KB physical pages in use @@ -1506,6 +1508,8 @@ struct kbase_sub_alloc { * waiting atoms and the waitqueue to process the work item * queued for the atoms blocked on the signaling of dma-buf * fences. + * @dma_fence.waiting_resource: list head for the list of dma-buf fence + * @dma_fence.wq: waitqueue to process the work item queued * @as_nr: id of the address space being used for the scheduled in * context. This is effectively part of the Run Pool, because * it only has a valid setting (!=KBASEP_AS_NR_INVALID) whilst @@ -1531,9 +1535,6 @@ struct kbase_sub_alloc { * created the context. Used for accounting the physical * pages used for GPU allocations, done for the context, * to the memory consumed by the process. - * @same_va_end: End address of the SAME_VA zone (in 4KB page units) - * @exec_va_start: Start address of the EXEC_VA zone (in 4KB page units) - * or U64_MAX if the EXEC_VA zone is uninitialized. * @gpu_va_end: End address of the GPU va space (in 4KB page units) * @jit_va: Indicates if a JIT_VA zone has been created. * @mem_profile_data: Buffer containing the profiling information provided by @@ -1662,6 +1663,12 @@ struct kbase_sub_alloc { * @kinstr_jm: Kernel job manager instrumentation context handle * @tl_kctx_list_node: List item into the device timeline's list of * contexts, for timeline summarization. + * @mmu_flush_pend_state: Tracks if the MMU flush operations are pending for the + * context. The flush required due to unmap is also + * tracked. It is supposed to be in + * KCTX_MMU_FLUSH_NOT_PEND state whilst a context is + * active and shall be updated with mmu_hw_mutex lock + * held. * @platform_data: Pointer to platform specific per-context data. * * A kernel base context is an entity among which the GPU is scheduled. @@ -1700,6 +1707,7 @@ struct kbase_context { struct rb_root reg_rbtree_same; struct rb_root reg_rbtree_custom; struct rb_root reg_rbtree_exec; + struct kbase_reg_zone reg_zone[KBASE_REG_ZONE_MAX]; #if MALI_USE_CSF struct kbase_csf_context csf; @@ -1753,8 +1761,6 @@ struct kbase_context { spinlock_t mm_update_lock; struct mm_struct __rcu *process_mm; - u64 same_va_end; - u64 exec_va_start; u64 gpu_va_end; bool jit_va; @@ -1812,11 +1818,6 @@ struct kbase_context { struct list_head tl_kctx_list_node; #if MALI_USE_CSF - /* Tracks if the MMU flush operations are pending for the context. - * The flush required due to unmap is also tracked. - * It is supposed to be in KCTX_MMU_FLUSH_NOT_PEND state whilst a - * context is active and shall be updated with mmu_hw_mutex lock held. - */ enum kbase_ctx_mmu_flush_pending_state mmu_flush_pend_state; #endif diff --git a/mali_kbase/mali_kbase_disjoint_events.c b/mali_kbase/mali_kbase_disjoint_events.c index ea41565..0b73f55 100644 --- a/mali_kbase/mali_kbase_disjoint_events.c +++ b/mali_kbase/mali_kbase_disjoint_events.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_dma_fence.c b/mali_kbase/mali_kbase_dma_fence.c index 027e530..aa8a933 100644 --- a/mali_kbase/mali_kbase_dma_fence.c +++ b/mali_kbase/mali_kbase_dma_fence.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 diff --git a/mali_kbase/mali_kbase_dma_fence.h b/mali_kbase/mali_kbase_dma_fence.h index b53ead1..0dd3d92 100644 --- a/mali_kbase/mali_kbase_dma_fence.h +++ b/mali_kbase/mali_kbase_dma_fence.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2010-2016, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_dummy_job_wa.c b/mali_kbase/mali_kbase_dummy_job_wa.c index d3bb307..b37b60e 100644 --- a/mali_kbase/mali_kbase_dummy_job_wa.c +++ b/mali_kbase/mali_kbase_dummy_job_wa.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_dummy_job_wa.h b/mali_kbase/mali_kbase_dummy_job_wa.h index d480291..4f3c227 100644 --- a/mali_kbase/mali_kbase_dummy_job_wa.h +++ b/mali_kbase/mali_kbase_dummy_job_wa.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_dvfs_debugfs.c b/mali_kbase/mali_kbase_dvfs_debugfs.c index 3c7930b..ce23ede 100644 --- a/mali_kbase/mali_kbase_dvfs_debugfs.c +++ b/mali_kbase/mali_kbase_dvfs_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_dvfs_debugfs.h" diff --git a/mali_kbase/mali_kbase_dvfs_debugfs.h b/mali_kbase/mali_kbase_dvfs_debugfs.h index cd17ac2..080331f 100644 --- a/mali_kbase/mali_kbase_dvfs_debugfs.h +++ b/mali_kbase/mali_kbase_dvfs_debugfs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_event.c b/mali_kbase/mali_kbase_event.c index ab52468..bde72e8 100644 --- a/mali_kbase/mali_kbase_event.c +++ b/mali_kbase/mali_kbase_event.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/mali_kbase_fence.c b/mali_kbase/mali_kbase_fence.c index edf1d52..d65b4eb 100644 --- a/mali_kbase/mali_kbase_fence.c +++ b/mali_kbase/mali_kbase_fence.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/atomic.h> diff --git a/mali_kbase/mali_kbase_fence.h b/mali_kbase/mali_kbase_fence.h index 0705598..a28aacc 100644 --- a/mali_kbase/mali_kbase_fence.h +++ b/mali_kbase/mali_kbase_fence.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2010-2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_fence_defs.h b/mali_kbase/mali_kbase_fence_defs.h index d8f1193..006512d 100644 --- a/mali_kbase/mali_kbase_fence_defs.h +++ b/mali_kbase/mali_kbase_fence_defs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2010-2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_fence_ops.c b/mali_kbase/mali_kbase_fence_ops.c index d0d1672..4712ef4 100644 --- a/mali_kbase/mali_kbase_fence_ops.c +++ b/mali_kbase/mali_kbase_fence_ops.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/atomic.h> diff --git a/mali_kbase/mali_kbase_gator.h b/mali_kbase/mali_kbase_gator.h index f1ee3fc..9c722b6 100644 --- a/mali_kbase/mali_kbase_gator.h +++ b/mali_kbase/mali_kbase_gator.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2011-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_gpu_memory_debugfs.c b/mali_kbase/mali_kbase_gpu_memory_debugfs.c index 84837f4..45ce740 100644 --- a/mali_kbase/mali_kbase_gpu_memory_debugfs.c +++ b/mali_kbase/mali_kbase_gpu_memory_debugfs.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2012-2017, 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2017, 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,24 +17,23 @@ * 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 <device/mali_kbase_device.h> #ifdef CONFIG_DEBUG_FS -/** Show callback for the @c gpu_memory debugfs file. +/** + * kbasep_gpu_memory_seq_show - Show callback for the @c gpu_memory debugfs file + * @sfile: The debugfs entry + * @data: Data associated with the entry * * This function is called to get the contents of the @c gpu_memory debugfs * file. This is a report of current gpu memory usage. * - * @param sfile The debugfs entry - * @param data Data associated with the entry - * - * @return 0 if successfully prints data in debugfs entry file - * -1 if it encountered an error + * Return: + * * 0 if successfully prints data in debugfs entry file + * * -1 if it encountered an error */ static int kbasep_gpu_memory_seq_show(struct seq_file *sfile, void *data) diff --git a/mali_kbase/mali_kbase_gpu_memory_debugfs.h b/mali_kbase/mali_kbase_gpu_memory_debugfs.h index 9b1aaa0..023703b 100644 --- a/mali_kbase/mali_kbase_gpu_memory_debugfs.h +++ b/mali_kbase/mali_kbase_gpu_memory_debugfs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2012-2014, 2016, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2014, 2016, 2020-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_gpu_memory_debugfs.h - * Header file for gpu_memory entry in debugfs + * DOC: 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 5eae532..9da0b00 100644 --- a/mali_kbase/mali_kbase_gpuprops.c +++ b/mali_kbase/mali_kbase_gpuprops.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2011-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -474,6 +472,16 @@ int kbase_gpuprops_update_l2_features(struct kbase_device *kbdev) break; } + /* pm.active_count is expected to be 1 here, which is set in + * kbase_hwaccess_pm_powerup(). + */ + WARN_ON(kbdev->pm.active_count != 1); + /* The new settings for L2 cache can only be applied when it is + * off, so first do the power down. + */ + kbase_pm_context_idle(kbdev); + kbase_pm_wait_for_desired_state(kbdev); + /* Need L2 to get powered to reflect to L2_FEATURES */ kbase_pm_context_active(kbdev); @@ -483,7 +491,7 @@ int kbase_gpuprops_update_l2_features(struct kbase_device *kbdev) /* Dump L2_FEATURES register */ err = kbase_backend_gpuprops_get_l2_features(kbdev, ®dump); if (err) - goto idle_gpu; + goto exit; dev_info(kbdev->dev, "Reflected L2_FEATURES is 0x%x\n", regdump.l2_features); @@ -492,11 +500,7 @@ int kbase_gpuprops_update_l2_features(struct kbase_device *kbdev) gpu_props->raw_props.l2_features = regdump.l2_features; gpu_props->l2_props.log2_cache_size = KBASE_UBFX32(gpu_props->raw_props.l2_features, 16U, 8); - -idle_gpu: - /* Let GPU idle */ - kbase_pm_context_idle(kbdev); -} + } exit: return err; diff --git a/mali_kbase/mali_kbase_gpuprops.h b/mali_kbase/mali_kbase_gpuprops.h index e634922..7c7b123 100644 --- a/mali_kbase/mali_kbase_gpuprops.h +++ b/mali_kbase/mali_kbase_gpuprops.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2011-2015, 2017, 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2015, 2017, 2019-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_gpuprops.h - * Base kernel property query APIs + * DOC: Base kernel property query APIs */ #ifndef _KBASE_GPUPROPS_H_ @@ -67,11 +46,10 @@ struct kbase_device; (((u32)(value) >> (u32)(offset)) & (u32)((1ULL << (u32)(size)) - 1)) /** - * @brief Set up Kbase GPU properties. + * kbase_gpuprops_set - Set up Kbase GPU properties. + * @kbdev: The struct kbase_device structure for the device * * Set up Kbase GPU properties with information from the GPU registers - * - * @param kbdev The struct kbase_device structure for the device */ void kbase_gpuprops_set(struct kbase_device *kbdev); @@ -92,6 +70,8 @@ int kbase_gpuprops_set_features(struct kbase_device *kbdev); * @kbdev: Device pointer * * This function updates l2_features and the log2 cache size. + * The function expects GPU to be powered up and value of pm.active_count + * to be 1. * * Return: Zero on success, Linux error code for failure */ diff --git a/mali_kbase/mali_kbase_gpuprops_types.h b/mali_kbase/mali_kbase_gpuprops_types.h index d96243d..8ecb54f 100644 --- a/mali_kbase/mali_kbase_gpuprops_types.h +++ b/mali_kbase/mali_kbase_gpuprops_types.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2011-2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2018, 2020-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_gpuprops_types.h - * Base kernel property query APIs + * DOC: Base kernel property query APIs */ #ifndef _KBASE_GPUPROPS_TYPES_H_ diff --git a/mali_kbase/mali_kbase_gwt.c b/mali_kbase/mali_kbase_gwt.c index 42ddf9b..93acf8a 100644 --- a/mali_kbase/mali_kbase_gwt.c +++ b/mali_kbase/mali_kbase_gwt.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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" diff --git a/mali_kbase/mali_kbase_gwt.h b/mali_kbase/mali_kbase_gwt.h index 4510497..f349d8f 100644 --- a/mali_kbase/mali_kbase_gwt.h +++ b/mali_kbase/mali_kbase_gwt.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2010-2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_hw.c b/mali_kbase/mali_kbase_hw.c index 512213c..d2063bb 100644 --- a/mali_kbase/mali_kbase_hw.c +++ b/mali_kbase/mali_kbase_hw.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2012-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -77,17 +75,6 @@ void kbase_hw_set_features_mask(struct kbase_device *kbdev) case GPU_ID2_PRODUCT_LODX: features = base_hw_features_tODx; break; - case GPU_ID2_PRODUCT_TGRX: - features = base_hw_features_tGRx; - break; - case GPU_ID2_PRODUCT_TVAX: - features = base_hw_features_tVAx; - break; - case GPU_ID2_PRODUCT_TTUX: - /* Fallthrough */ - case GPU_ID2_PRODUCT_LTUX: - features = base_hw_features_tTUx; - break; default: features = base_hw_features_generic; break; @@ -217,28 +204,13 @@ static const enum base_hw_issue *kbase_hw_get_issues_for_new_id( {GPU_ID2_PRODUCT_TODX, {{GPU_ID2_VERSION_MAKE(0, 0, 0), base_hw_issues_tODx_r0p0}, + {GPU_ID2_VERSION_MAKE(0, 0, 4), base_hw_issues_tODx_r0p0}, + {GPU_ID2_VERSION_MAKE(0, 0, 5), base_hw_issues_tODx_r0p0}, {U32_MAX, NULL} } }, {GPU_ID2_PRODUCT_LODX, {{GPU_ID2_VERSION_MAKE(0, 0, 0), base_hw_issues_tODx_r0p0}, {U32_MAX, NULL} } }, - - {GPU_ID2_PRODUCT_TGRX, - {{GPU_ID2_VERSION_MAKE(0, 0, 0), base_hw_issues_tGRx_r0p0}, - {U32_MAX, NULL} } }, - - {GPU_ID2_PRODUCT_TVAX, - {{GPU_ID2_VERSION_MAKE(0, 0, 0), base_hw_issues_tVAx_r0p0}, - {U32_MAX, NULL} } }, - - {GPU_ID2_PRODUCT_TTUX, - {{GPU_ID2_VERSION_MAKE(0, 0, 0), base_hw_issues_tTUx_r0p0}, - {U32_MAX, NULL} } }, - - {GPU_ID2_PRODUCT_LTUX, - {{GPU_ID2_VERSION_MAKE(0, 0, 0), base_hw_issues_tTUx_r0p0}, - {U32_MAX, NULL} } }, - }; u32 gpu_id = kbdev->gpu_props.props.raw_props.gpu_id; @@ -388,16 +360,6 @@ int kbase_hw_set_issues_mask(struct kbase_device *kbdev) case GPU_ID2_PRODUCT_LODX: issues = base_hw_issues_model_tODx; break; - case GPU_ID2_PRODUCT_TGRX: - issues = base_hw_issues_model_tGRx; - break; - case GPU_ID2_PRODUCT_TVAX: - issues = base_hw_issues_model_tVAx; - break; - case GPU_ID2_PRODUCT_TTUX: - case GPU_ID2_PRODUCT_LTUX: - issues = base_hw_issues_model_tTUx; - break; default: dev_err(kbdev->dev, "Unknown GPU ID %x", gpu_id); diff --git a/mali_kbase/mali_kbase_hw.h b/mali_kbase/mali_kbase_hw.h index afc56a6..65b417c 100644 --- a/mali_kbase/mali_kbase_hw.h +++ b/mali_kbase/mali_kbase_hw.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2012-2017, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2017, 2020-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file - * Run-time work-arounds helpers + * DOC: Run-time work-arounds helpers */ #ifndef _KBASE_HW_H_ @@ -50,13 +29,17 @@ #include "mali_kbase_defs.h" /** - * @brief Tell whether a work-around should be enabled + * Tell whether a work-around should be enabled + * @kbdev: Device pointer + * @issue: issue to be checked */ #define kbase_hw_has_issue(kbdev, issue)\ test_bit(issue, &(kbdev)->hw_issues_mask[0]) /** - * @brief Tell whether a feature is supported + * Tell whether a feature is supported + * @kbdev: Device pointer + * @feature: feature to be checked */ #define kbase_hw_has_feature(kbdev, feature)\ test_bit(feature, &(kbdev)->hw_features_mask[0]) @@ -80,7 +63,8 @@ int kbase_hw_set_issues_mask(struct kbase_device *kbdev); /** - * @brief Set the features mask depending on the GPU ID + * Set the features mask depending on the GPU ID + * @kbdev: Device pointer */ void kbase_hw_set_features_mask(struct kbase_device *kbdev); diff --git a/mali_kbase/mali_kbase_hwaccess_backend.h b/mali_kbase/mali_kbase_hwaccess_backend.h index ce57991..90851e2 100644 --- a/mali_kbase/mali_kbase_hwaccess_backend.h +++ b/mali_kbase/mali_kbase_hwaccess_backend.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2015, 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_hwaccess_defs.h b/mali_kbase/mali_kbase_hwaccess_defs.h index e21f52d..97a593f 100644 --- a/mali_kbase/mali_kbase_hwaccess_defs.h +++ b/mali_kbase/mali_kbase_hwaccess_defs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014, 2016-2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014, 2016-2018, 2020-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_hwaccess_gpu_defs.h - * HW access common definitions + * DOC: HW access common definitions */ #ifndef _KBASE_HWACCESS_DEFS_H_ diff --git a/mali_kbase/mali_kbase_hwaccess_gpuprops.h b/mali_kbase/mali_kbase_hwaccess_gpuprops.h index edfa02e..5e5f9dc 100644 --- a/mali_kbase/mali_kbase_hwaccess_gpuprops.h +++ b/mali_kbase/mali_kbase_hwaccess_gpuprops.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2015, 2018, 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_hwaccess_instr.h b/mali_kbase/mali_kbase_hwaccess_instr.h index 25a4695..959bfeb 100644 --- a/mali_kbase/mali_kbase_hwaccess_instr.h +++ b/mali_kbase/mali_kbase_hwaccess_instr.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2015, 2017-2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_hwaccess_jm.h b/mali_kbase/mali_kbase_hwaccess_jm.h index 82236fe..0e513c7 100644 --- a/mali_kbase/mali_kbase_hwaccess_jm.h +++ b/mali_kbase/mali_kbase_hwaccess_jm.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2021 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 @@ -49,7 +29,7 @@ /** * kbase_backend_run_atom() - Run an atom on the GPU * @kbdev: Device pointer - * @atom: Atom to run + * @katom: Atom to run * * Caller must hold the HW access lock */ diff --git a/mali_kbase/mali_kbase_hwaccess_pm.h b/mali_kbase/mali_kbase_hwaccess_pm.h index eb6229e..4b2a53e 100644 --- a/mali_kbase/mali_kbase_hwaccess_pm.h +++ b/mali_kbase/mali_kbase_hwaccess_pm.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014-2015, 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2015, 2018-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_hwaccess_pm.h - * HW access power manager common APIs + * DOC: HW access power manager common APIs */ #ifndef _KBASE_HWACCESS_PM_H_ @@ -98,24 +77,21 @@ int kbase_hwaccess_pm_powerup(struct kbase_device *kbdev, * the time this function returns, regardless of whether or not the active power * policy asks for the GPU to be powered off. * - * @param kbdev The kbase device structure for the device (must be a valid - * pointer) + * @kbdev: The kbase device structure for the device (must be a valid pointer) */ void kbase_hwaccess_pm_halt(struct kbase_device *kbdev); /** * Perform any backend-specific actions to suspend the GPU * - * @param kbdev The kbase device structure for the device (must be a valid - * pointer) + * @kbdev: The kbase device structure for the device (must be a valid pointer) */ void kbase_hwaccess_pm_suspend(struct kbase_device *kbdev); /** * Perform any backend-specific actions to resume the GPU from a suspend * - * @param kbdev The kbase device structure for the device (must be a valid - * pointer) + * @kbdev: The kbase device structure for the device (must be a valid pointer) */ void kbase_hwaccess_pm_resume(struct kbase_device *kbdev); @@ -123,8 +99,7 @@ void kbase_hwaccess_pm_resume(struct kbase_device *kbdev); * Perform any required actions for activating the GPU. Called when the first * context goes active. * - * @param kbdev The kbase device structure for the device (must be a valid - * pointer) + * @kbdev: The kbase device structure for the device (must be a valid pointer) */ void kbase_hwaccess_pm_gpu_active(struct kbase_device *kbdev); @@ -132,8 +107,7 @@ void kbase_hwaccess_pm_gpu_active(struct kbase_device *kbdev); * Perform any required actions for idling the GPU. Called when the last * context goes idle. * - * @param kbdev The kbase device structure for the device (must be a valid - * pointer) + * @kbdev: The kbase device structure for the device (must be a valid pointer) */ void kbase_hwaccess_pm_gpu_idle(struct kbase_device *kbdev); @@ -143,9 +117,8 @@ void kbase_hwaccess_pm_gpu_idle(struct kbase_device *kbdev); * * This determines which cores the power manager is allowed to use. * - * @param kbdev The kbase device structure for the device (must be a - * valid pointer) - * @param new_core_mask The core mask to use + * @kbdev: The kbase device structure for the device (must be a valid pointer) + * @new_core_mask: The core mask to use */ void kbase_pm_set_debug_core_mask(struct kbase_device *kbdev, u64 new_core_mask); @@ -155,11 +128,10 @@ void kbase_pm_set_debug_core_mask(struct kbase_device *kbdev, * * This determines which cores the power manager is allowed to use. * - * @param kbdev The kbase device structure for the device (must be a - * valid pointer) - * @param new_core_mask_js0 The core mask to use for job slot 0 - * @param new_core_mask_js0 The core mask to use for job slot 1 - * @param new_core_mask_js0 The core mask to use for job slot 2 + * @kbdev: The kbase device structure for the device (must be a valid pointer) + * @new_core_mask_js0: The core mask to use for job slot 0 + * @new_core_mask_js1: The core mask to use for job slot 1 + * @new_core_mask_js2: The core mask to use for job slot 2 */ void kbase_pm_set_debug_core_mask(struct kbase_device *kbdev, u64 new_core_mask_js0, u64 new_core_mask_js1, @@ -171,8 +143,7 @@ void kbase_pm_set_debug_core_mask(struct kbase_device *kbdev, * * Returns the policy that is currently active. * - * @param kbdev The kbase device structure for the device (must be a valid - * pointer) + * @kbdev: The kbase device structure for the device (must be a valid pointer) * * @return The current policy */ @@ -182,10 +153,9 @@ const struct kbase_pm_ca_policy /** * Change the policy to the one specified. * - * @param kbdev The kbase device structure for the device (must be a valid - * pointer) - * @param policy The policy to change to (valid pointer returned from - * @ref kbase_pm_ca_list_policies) + * @kbdev: The kbase device structure for the device (must be a valid pointer) + * @policy: The policy to change to (valid pointer returned from + * @ref kbase_pm_ca_list_policies) */ void kbase_pm_ca_set_policy(struct kbase_device *kbdev, const struct kbase_pm_ca_policy *policy); @@ -193,23 +163,20 @@ void kbase_pm_ca_set_policy(struct kbase_device *kbdev, /** * Retrieve a static list of the available policies. * - * @param[out] policies An array pointer to take the list of policies. This may - * be NULL. The contents of this array must not be - * modified. + * @policies: An array pointer to take the list of policies. This may be NULL. + * The contents of this array must not be modified. * * @return The number of policies */ int kbase_pm_ca_list_policies(const struct kbase_pm_ca_policy * const **policies); - /** * Get the current policy. * * Returns the policy that is currently active. * - * @param kbdev The kbase device structure for the device (must be a valid - * pointer) + * @kbdev: The kbase device structure for the device (must be a valid pointer) * * @return The current policy */ @@ -218,9 +185,9 @@ const struct kbase_pm_policy *kbase_pm_get_policy(struct kbase_device *kbdev); /** * Change the policy to the one specified. * - * @param kbdev The kbase device structure for the device (must be a valid + * @kbdev: The kbase device structure for the device (must be a valid * pointer) - * @param policy The policy to change to (valid pointer returned from + * @policy: The policy to change to (valid pointer returned from * @ref kbase_pm_list_policies) */ void kbase_pm_set_policy(struct kbase_device *kbdev, diff --git a/mali_kbase/mali_kbase_hwaccess_time.h b/mali_kbase/mali_kbase_hwaccess_time.h index d982f2a..8488a32 100644 --- a/mali_kbase/mali_kbase_hwaccess_time.h +++ b/mali_kbase/mali_kbase_hwaccess_time.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014,2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014, 2018-2021 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 @@ -39,19 +19,15 @@ * */ -/** - * - */ - #ifndef _KBASE_BACKEND_TIME_H_ #define _KBASE_BACKEND_TIME_H_ /** * kbase_backend_get_gpu_time() - Get current GPU time - * @kbdev: Device pointer - * @cycle_counter: Pointer to u64 to store cycle counter in - * @system_time: Pointer to u64 to store system time in - * @ts: Pointer to struct timespec to store current monotonic + * @kbdev: Device pointer + * @cycle_counter: Pointer to u64 to store cycle counter in. + * @system_time: Pointer to u64 to store system time in + * @ts: Pointer to struct timespec to store current monotonic * time in */ void kbase_backend_get_gpu_time(struct kbase_device *kbdev, u64 *cycle_counter, diff --git a/mali_kbase/mali_kbase_hwcnt.c b/mali_kbase/mali_kbase_hwcnt.c index 59bbc9d..6bd7d5f 100644 --- a/mali_kbase/mali_kbase_hwcnt.c +++ b/mali_kbase/mali_kbase_hwcnt.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_accumulator.h b/mali_kbase/mali_kbase_hwcnt_accumulator.h index c3c06b3..fbd13a4 100644 --- a/mali_kbase/mali_kbase_hwcnt_accumulator.h +++ b/mali_kbase/mali_kbase_hwcnt_accumulator.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_hwcnt_backend.h b/mali_kbase/mali_kbase_hwcnt_backend.h index 5f3ab08..a3013a6 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend.h +++ b/mali_kbase/mali_kbase_hwcnt_backend.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018, 2020-2021 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 @@ -65,7 +45,7 @@ struct kbase_hwcnt_backend_info; */ struct kbase_hwcnt_backend; -/** +/* * typedef kbase_hwcnt_backend_metadata_fn - Get the immutable hardware counter * metadata that describes the layout * of the counter data structures. diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf.c b/mali_kbase/mali_kbase_hwcnt_backend_csf.c index 8560fd7..c1bc7fc 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_csf.c +++ b/mali_kbase/mali_kbase_hwcnt_backend_csf.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_hwcnt_backend_csf.h" diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf.h b/mali_kbase/mali_kbase_hwcnt_backend_csf.h index c2b3644..93938f0 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_csf.h +++ b/mali_kbase/mali_kbase_hwcnt_backend_csf.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h b/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h index bfc0e3c..e86d240 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h +++ b/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c b/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c index 21e9853..7a3b239 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c +++ b/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_backend_csf_if_fw.h b/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.h index b826a50..d72851e 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.h +++ b/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2021 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 diff --git a/mali_kbase/mali_kbase_hwcnt_backend_jm.c b/mali_kbase/mali_kbase_hwcnt_backend_jm.c index 3e60ecc..c6c672c 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_jm.c +++ b/mali_kbase/mali_kbase_hwcnt_backend_jm.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_hwcnt_backend_jm.h" @@ -158,7 +156,7 @@ static void kbasep_hwcnt_backend_jm_on_freq_change( /** * kbasep_hwcnt_backend_jm_cc_enable() - Enable cycle count tracking * - * @backend: Non-NULL pointer to backend. + * @backend_jm: Non-NULL pointer to backend. * @enable_map: Non-NULL pointer to enable map specifying enabled counters. * @timestamp_ns: Timestamp(ns) when HWCNT were enabled. */ @@ -218,7 +216,7 @@ static void kbasep_hwcnt_backend_jm_cc_enable( /** * kbasep_hwcnt_backend_jm_cc_disable() - Disable cycle count tracking * - * @backend: Non-NULL pointer to backend. + * @backend_jm: Non-NULL pointer to backend. */ static void kbasep_hwcnt_backend_jm_cc_disable( struct kbase_hwcnt_backend_jm *backend_jm) diff --git a/mali_kbase/mali_kbase_hwcnt_backend_jm.h b/mali_kbase/mali_kbase_hwcnt_backend_jm.h index b0b24e6..5d1947e 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_jm.h +++ b/mali_kbase/mali_kbase_hwcnt_backend_jm.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_hwcnt_context.h b/mali_kbase/mali_kbase_hwcnt_context.h index 99d9d1c..403b1c5 100644 --- a/mali_kbase/mali_kbase_hwcnt_context.h +++ b/mali_kbase/mali_kbase_hwcnt_context.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_hwcnt_gpu.c b/mali_kbase/mali_kbase_hwcnt_gpu.c index 9760643..91d1f8c 100644 --- a/mali_kbase/mali_kbase_hwcnt_gpu.c +++ b/mali_kbase/mali_kbase_hwcnt_gpu.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_hwcnt_gpu.h" @@ -218,7 +216,7 @@ static int kbasep_hwcnt_backend_gpu_metadata_create( /** * kbasep_hwcnt_backend_jm_dump_bytes() - Get the raw dump buffer size for the * GPU. - * @v5_info: Non-NULL pointer to hwcnt info for the GPU. + * @gpu_info: Non-NULL pointer to hwcnt info for the GPU. * * Return: Size of buffer the GPU needs to perform a counter dump. */ diff --git a/mali_kbase/mali_kbase_hwcnt_gpu.h b/mali_kbase/mali_kbase_hwcnt_gpu.h index 244577d..4ebff2d 100644 --- a/mali_kbase/mali_kbase_hwcnt_gpu.h +++ b/mali_kbase/mali_kbase_hwcnt_gpu.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018, 2020-2021 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 @@ -125,7 +105,7 @@ struct kbase_hwcnt_physical_enable_map { u32 mmu_l2_bm; }; -/** +/* * Values for Hardware Counter SET_SELECT value. * Directly passed to HW. */ diff --git a/mali_kbase/mali_kbase_hwcnt_legacy.c b/mali_kbase/mali_kbase_hwcnt_legacy.c index de9b669..bd523dd 100644 --- a/mali_kbase/mali_kbase_hwcnt_legacy.c +++ b/mali_kbase/mali_kbase_hwcnt_legacy.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_hwcnt_legacy.h" diff --git a/mali_kbase/mali_kbase_hwcnt_legacy.h b/mali_kbase/mali_kbase_hwcnt_legacy.h index fd0d01e..deaf7eb 100644 --- a/mali_kbase/mali_kbase_hwcnt_legacy.h +++ b/mali_kbase/mali_kbase_hwcnt_legacy.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_hwcnt_reader.h b/mali_kbase/mali_kbase_hwcnt_reader.h index 081244c..9f2172b 100644 --- a/mali_kbase/mali_kbase_hwcnt_reader.h +++ b/mali_kbase/mali_kbase_hwcnt_reader.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2015, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2015, 2020-2021 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 @@ -108,14 +88,14 @@ enum base_hwcnt_reader_event { BASE_HWCNT_READER_EVENT_COUNT }; +#define KBASE_HWCNT_READER_API_VERSION_NO_FEATURE (0) +#define KBASE_HWCNT_READER_API_VERSION_FEATURE_CYCLES_TOP (1 << 0) +#define KBASE_HWCNT_READER_API_VERSION_FEATURE_CYCLES_SHADER_CORES (1 << 1) /** * struct kbase_hwcnt_reader_api_version - hwcnt reader API version - * @versoin: API version + * @version: API version * @features: available features in this API version */ -#define KBASE_HWCNT_READER_API_VERSION_NO_FEATURE (0) -#define KBASE_HWCNT_READER_API_VERSION_FEATURE_CYCLES_TOP (1 << 0) -#define KBASE_HWCNT_READER_API_VERSION_FEATURE_CYCLES_SHADER_CORES (1 << 1) struct kbase_hwcnt_reader_api_version { u32 version; u32 features; diff --git a/mali_kbase/mali_kbase_hwcnt_types.c b/mali_kbase/mali_kbase_hwcnt_types.c index f4c0def..931fbf3 100644 --- a/mali_kbase/mali_kbase_hwcnt_types.c +++ b/mali_kbase/mali_kbase_hwcnt_types.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_hwcnt_types.h" diff --git a/mali_kbase/mali_kbase_hwcnt_types.h b/mali_kbase/mali_kbase_hwcnt_types.h index 47f3c0f..e775393 100644 --- a/mali_kbase/mali_kbase_hwcnt_types.h +++ b/mali_kbase/mali_kbase_hwcnt_types.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2018, 2020-2021 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 @@ -1133,10 +1113,10 @@ static inline void kbase_hwcnt_dump_buffer_block_accumulate_strict( } /** - * @brief Iterate over each clock domain in the metadata. + * Iterate over each clock domain in the metadata. * - * @param[in] md Non-NULL pointer to metadata. - * @param[in] clk size_t variable used as clock iterator. + * @md: Non-NULL pointer to metadata. + * @clk: size_t variable used as clock iterator. */ #define kbase_hwcnt_metadata_for_each_clock(md, clk) \ for ((clk) = 0; (clk) < (md)->clk_cnt; (clk)++) diff --git a/mali_kbase/mali_kbase_hwcnt_virtualizer.c b/mali_kbase/mali_kbase_hwcnt_virtualizer.c index 637ebf5..4bb8489 100644 --- a/mali_kbase/mali_kbase_hwcnt_virtualizer.c +++ b/mali_kbase/mali_kbase_hwcnt_virtualizer.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_hwcnt_virtualizer.h" diff --git a/mali_kbase/mali_kbase_hwcnt_virtualizer.h b/mali_kbase/mali_kbase_hwcnt_virtualizer.h index d143de2..1bce691 100644 --- a/mali_kbase/mali_kbase_hwcnt_virtualizer.h +++ b/mali_kbase/mali_kbase_hwcnt_virtualizer.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_ioctl.h b/mali_kbase/mali_kbase_ioctl.h index 9a9a93b..35e5cb0 100644 --- a/mali_kbase/mali_kbase_ioctl.h +++ b/mali_kbase/mali_kbase_ioctl.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2017-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2017-2021 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 @@ -106,16 +86,14 @@ struct kbase_ioctl_get_gpuprops { /** * union kbase_ioctl_mem_alloc - Allocate memory on the GPU - * - * @va_pages: The number of pages of virtual address space to reserve - * @commit_pages: The number of physical pages to allocate - * @extension: The number of extra pages to allocate on each GPU fault which grows - * the region - * @flags: Flags - * @gpu_va: The GPU virtual address which is allocated - * * @in: Input parameters + * @in.va_pages: The number of pages of virtual address space to reserve + * @in.commit_pages: The number of physical pages to allocate + * @in.extension: The number of extra pages to allocate on each GPU fault which grows the region + * @in.flags: Flags * @out: Output parameters + * @out.flags: Flags + * @out.gpu_va: The GPU virtual address which is allocated */ union kbase_ioctl_mem_alloc { struct { @@ -135,14 +113,13 @@ union kbase_ioctl_mem_alloc { /** * struct kbase_ioctl_mem_query - Query properties of a GPU memory region - * @gpu_addr: A GPU address contained within the region - * @query: The type of query - * @value: The result of the query - * - * Use a %KBASE_MEM_QUERY_xxx flag as input for @query. - * * @in: Input parameters + * @in.gpu_addr: A GPU address contained within the region + * @in.query: The type of query * @out: Output parameters + * @out.value: The result of the query + * + * Use a %KBASE_MEM_QUERY_xxx flag as input for @query. */ union kbase_ioctl_mem_query { struct { @@ -362,13 +339,12 @@ struct kbase_ioctl_mem_sync { /** * union kbase_ioctl_mem_find_cpu_offset - Find the offset of a CPU pointer * - * @gpu_addr: The GPU address of the memory region - * @cpu_addr: The CPU address to locate - * @size: A size in bytes to validate is contained within the region - * @offset: The offset from the start of the memory region to @cpu_addr - * * @in: Input parameters + * @in.gpu_addr: The GPU address of the memory region + * @in.cpu_addr: The CPU address to locate + * @in.size: A size in bytes to validate is contained within the region * @out: Output parameters + * @out.offset: The offset from the start of the memory region to @cpu_addr */ union kbase_ioctl_mem_find_cpu_offset { struct { @@ -433,15 +409,15 @@ struct kbase_ioctl_mem_commit { /** * union kbase_ioctl_mem_alias - Create an alias of memory regions - * @flags: Flags, see BASE_MEM_xxx - * @stride: Bytes between start of each memory region - * @nents: The number of regions to pack together into the alias - * @aliasing_info: Pointer to an array of struct base_mem_aliasing_info - * @gpu_va: Address of the new alias - * @va_pages: Size of the new alias - * * @in: Input parameters + * @in.flags: Flags, see BASE_MEM_xxx + * @in.stride: Bytes between start of each memory region + * @in.nents: The number of regions to pack together into the alias + * @in.aliasing_info: Pointer to an array of struct base_mem_aliasing_info * @out: Output parameters + * @out.flags: Flags, see BASE_MEM_xxx + * @out.gpu_va: Address of the new alias + * @out.va_pages: Size of the new alias */ union kbase_ioctl_mem_alias { struct { @@ -462,15 +438,15 @@ union kbase_ioctl_mem_alias { /** * union kbase_ioctl_mem_import - Import memory for use by the GPU - * @flags: Flags, see BASE_MEM_xxx - * @phandle: Handle to the external memory - * @type: Type of external memory, see base_mem_import_type - * @padding: Amount of extra VA pages to append to the imported buffer - * @gpu_va: Address of the new alias - * @va_pages: Size of the new alias - * * @in: Input parameters + * @in.flags: Flags, see BASE_MEM_xxx + * @in.phandle: Handle to the external memory + * @in.type: Type of external memory, see base_mem_import_type + * @in.padding: Amount of extra VA pages to append to the imported buffer * @out: Output parameters + * @out.flags: Flags, see BASE_MEM_xxx + * @out.gpu_va: Address of the new alias + * @out.va_pages: Size of the new alias */ union kbase_ioctl_mem_import { struct { @@ -583,15 +559,13 @@ struct kbase_ioctl_sticky_resource_unmap { * 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 + * @in.gpu_addr: GPU virtual address + * @in.size: Size in bytes within the region * @out: Output parameters + * @out.start: Address of the beginning of the memory region enclosing @gpu_addr + * for the length of @offset bytes + * @out.offset: The offset from the start of the memory region to @gpu_addr */ union kbase_ioctl_mem_find_gpu_start_and_offset { struct { @@ -616,14 +590,15 @@ union kbase_ioctl_mem_find_gpu_start_and_offset { /** * union kbase_ioctl_gwt_dump - Used to collect all GPU write fault addresses. - * @addr_buffer: Address of buffer to hold addresses of gpu modified areas. - * @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 + * @in.addr_buffer: Address of buffer to hold addresses of gpu modified areas. + * @in.size_buffer: Address of buffer to hold size of modified areas (in pages) + * @in.len: Number of addresses the buffers can hold. + * @in.padding: padding * @out: Output parameters + * @out.no_of_addr_collected: Number of addresses collected into addr_buffer. + * @out.more_data_available: Status indicating if more addresses are available. + * @out.padding: padding * * This structure is used when performing a call to dump GPU write fault * addresses. @@ -661,18 +636,15 @@ struct kbase_ioctl_mem_exec_init { /** * union kbase_ioctl_get_cpu_gpu_timeinfo - Request zero or more types of * cpu/gpu time (counter values) - * - * @request_flags: Bit-flags indicating the requested types. - * @paddings: Unused, size alignment matching the out. - * @sec: Integer field of the monotonic time, unit in seconds. - * @nsec: Fractional sec of the monotonic time, in nano-seconds. - * @padding: Unused, for u64 alignment - * @timestamp: System wide timestamp (counter) value. - * @cycle_counter: GPU cycle counter value. - * * @in: Input parameters + * @in.request_flags: Bit-flags indicating the requested types. + * @in.paddings: Unused, size alignment matching the out. * @out: Output parameters - * + * @out.sec: Integer field of the monotonic time, unit in seconds. + * @out.nsec: Fractional sec of the monotonic time, in nano-seconds. + * @out.padding: Unused, for u64 alignment + * @out.timestamp: System wide timestamp (counter) value. + * @out.cycle_counter: GPU cycle counter value. */ union kbase_ioctl_get_cpu_gpu_timeinfo { struct { diff --git a/mali_kbase/mali_kbase_jd.c b/mali_kbase/mali_kbase_jd.c index 4b9e228..f6fbc30 100644 --- a/mali_kbase/mali_kbase_jd.c +++ b/mali_kbase/mali_kbase_jd.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/dma-buf.h> @@ -461,9 +459,6 @@ static inline void jd_resolve_dep(struct list_head *out_list, #endif /* CONFIG_MALI_DMA_FENCE */ if (dep_satisfied) { - trace_sysgraph(SGR_DEP_RES, - dep_atom->kctx->id, - kbase_jd_atom_id(katom->kctx, dep_atom)); dep_atom->in_jd_list = true; list_add_tail(&dep_atom->jd_item, out_list); } @@ -552,10 +547,6 @@ static void jd_try_submitting_deps(struct list_head *out_list, #endif /* CONFIG_MALI_DMA_FENCE */ if (dep0_valid && dep1_valid && dep_satisfied) { - trace_sysgraph(SGR_DEP_RES, - dep_atom->kctx->id, - kbase_jd_atom_id(dep_atom->kctx, - dep_atom)); dep_atom->in_jd_list = true; list_add(&dep_atom->jd_item, out_list); } diff --git a/mali_kbase/mali_kbase_jd_debugfs.c b/mali_kbase/mali_kbase_jd_debugfs.c index 7b2dade..940b920 100644 --- a/mali_kbase/mali_kbase_jd_debugfs.c +++ b/mali_kbase/mali_kbase_jd_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 diff --git a/mali_kbase/mali_kbase_jd_debugfs.h b/mali_kbase/mali_kbase_jd_debugfs.h index c3cee2e..f183a9f 100644 --- a/mali_kbase/mali_kbase_jd_debugfs.h +++ b/mali_kbase/mali_kbase_jd_debugfs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014-2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2018, 2020-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_jd_debugfs.h - * Header file for job dispatcher-related entries in debugfs + * DOC: Header file for job dispatcher-related entries in debugfs */ #ifndef _KBASE_JD_DEBUGFS_H @@ -57,7 +36,7 @@ struct kbase_context; /** * kbasep_jd_debugfs_ctx_init() - Add debugfs entries for JD system * - * @kctx Pointer to kbase_context + * @kctx: Pointer to kbase_context */ void kbasep_jd_debugfs_ctx_init(struct kbase_context *kctx); diff --git a/mali_kbase/mali_kbase_jm.c b/mali_kbase/mali_kbase_jm.c index d5e64a1..be14b45 100644 --- a/mali_kbase/mali_kbase_jm.c +++ b/mali_kbase/mali_kbase_jm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_jm.h b/mali_kbase/mali_kbase_jm.h index 697a3ff..47202b9 100644 --- a/mali_kbase/mali_kbase_jm.h +++ b/mali_kbase/mali_kbase_jm.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2013-2014, 2016, 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_js.c b/mali_kbase/mali_kbase_js.c index 83e4351..f8524ed 100644 --- a/mali_kbase/mali_kbase_js.c +++ b/mali_kbase/mali_kbase_js.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -2450,8 +2448,6 @@ static void kbase_js_evict_deps(struct kbase_context *kctx, KBASE_KATOM_FLAG_JSCTX_IN_X_DEP_LIST))) { /* Remove dependency.*/ x_dep->atom_flags &= ~KBASE_KATOM_FLAG_X_DEP_BLOCKED; - trace_sysgraph(SGR_DEP_RES, kctx->id, - kbase_jd_atom_id(kctx, x_dep)); dev_dbg(kctx->kbdev->dev, "Cleared X_DEP flag on atom %p\n", (void *)x_dep); @@ -3312,8 +3308,6 @@ struct kbase_jd_atom *kbase_js_complete_atom(struct kbase_jd_atom *katom, bool was_pullable = kbase_js_ctx_pullable(kctx, x_dep->slot_nr, false); x_dep->atom_flags &= ~KBASE_KATOM_FLAG_X_DEP_BLOCKED; - trace_sysgraph(SGR_DEP_RES, kctx->id, - kbase_jd_atom_id(katom->kctx, x_dep)); dev_dbg(kbdev->dev, "Cleared X_DEP flag on atom %p\n", (void *)x_dep); diff --git a/mali_kbase/mali_kbase_js.h b/mali_kbase/mali_kbase_js.h index 3e9719a..a4dc207 100644 --- a/mali_kbase/mali_kbase_js.h +++ b/mali_kbase/mali_kbase_js.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2011-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_js.h - * Job Scheduler APIs. + * DOC: Job Scheduler APIs. */ #ifndef _KBASE_JS_H_ diff --git a/mali_kbase/mali_kbase_js_ctx_attr.c b/mali_kbase/mali_kbase_js_ctx_attr.c index 67c4952..40967cb 100644 --- a/mali_kbase/mali_kbase_js_ctx_attr.c +++ b/mali_kbase/mali_kbase_js_ctx_attr.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2012-2016, 2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2016, 2018, 2020-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> @@ -29,8 +27,11 @@ */ /** - * @brief Check whether a ctx has a certain attribute, and if so, retain that + * Check whether a ctx has a certain attribute, and if so, retain that * attribute on the runpool. + * @kbdev: Device pointer + * @kctx: KBase context + * @attribute: Atribute to check/retain * * Requires: * - jsctx mutex @@ -75,8 +76,11 @@ static bool kbasep_js_ctx_attr_runpool_retain_attr(struct kbase_device *kbdev, s } /** - * @brief Check whether a ctx has a certain attribute, and if so, release that + * Check whether a ctx has a certain attribute, and if so, release that * attribute on the runpool. + * @kbdev: Device pointer + * @kctx: KBase context + * @attribute: Atribute to release * * Requires: * - jsctx mutex @@ -120,8 +124,11 @@ static bool kbasep_js_ctx_attr_runpool_release_attr(struct kbase_device *kbdev, } /** - * @brief Retain a certain attribute on a ctx, also retaining it on the runpool + * Retain a certain attribute on a ctx, also retaining it on the runpool * if the context is scheduled. + * @kbdev: Device pointer + * @kctx: KBase context + * @attribute: Atribute to retain * * Requires: * - jsctx mutex @@ -156,9 +163,12 @@ static bool kbasep_js_ctx_attr_ctx_retain_attr(struct kbase_device *kbdev, struc return runpool_state_changed; } -/* - * @brief Release a certain attribute on a ctx, also releasing it from the runpool +/** + * Release a certain attribute on a ctx, also releasing it from the runpool * if the context is scheduled. + * @kbdev: Device pointer + * @kctx: KBase context + * @attribute: Atribute to release * * Requires: * - jsctx mutex diff --git a/mali_kbase/mali_kbase_js_ctx_attr.h b/mali_kbase/mali_kbase_js_ctx_attr.h index fa8731a..1477b1d 100644 --- a/mali_kbase/mali_kbase_js_ctx_attr.h +++ b/mali_kbase/mali_kbase_js_ctx_attr.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2012-2015, 2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2015, 2018, 2020-2021 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 @@ -40,30 +20,16 @@ */ /** - * @file mali_kbase_js_ctx_attr.h - * Job Scheduler Context Attribute APIs + * DOC: Job Scheduler Context Attribute APIs */ #ifndef _KBASE_JS_CTX_ATTR_H_ #define _KBASE_JS_CTX_ATTR_H_ /** - * @addtogroup base_api - * @{ - */ - -/** - * @addtogroup base_kbase_api - * @{ - */ - -/** - * @addtogroup kbase_js - * @{ - */ - -/** * Retain all attributes of a context + * @kbdev: KBase device + * @kctx: KBase context * * This occurs on scheduling in the context on the runpool (but after * is_scheduled is set) @@ -77,6 +43,8 @@ void kbasep_js_ctx_attr_runpool_retain_ctx(struct kbase_device *kbdev, struct kb /** * Release all attributes of a context + * @kbdev: KBase device + * @kctx: KBase context * * This occurs on scheduling out the context from the runpool (but before * is_scheduled is cleared) @@ -96,6 +64,9 @@ bool kbasep_js_ctx_attr_runpool_release_ctx(struct kbase_device *kbdev, struct k /** * Retain all attributes of an atom + * @kbdev: KBase device + * @kctx: KBase context + * @katom: Atom * * This occurs on adding an atom to a context * @@ -107,6 +78,9 @@ void kbasep_js_ctx_attr_ctx_retain_atom(struct kbase_device *kbdev, struct kbase /** * Release all attributes of an atom, given its retained state. + * @kbdev: KBase device + * @kctx: KBase context + * @katom_retained_state: Retained state * * This occurs after (permanently) removing an atom from a context * @@ -124,7 +98,7 @@ void kbasep_js_ctx_attr_ctx_retain_atom(struct kbase_device *kbdev, struct kbase */ bool kbasep_js_ctx_attr_ctx_release_atom(struct kbase_device *kbdev, struct kbase_context *kctx, struct kbasep_js_atom_retained_state *katom_retained_state); -/** +/* * Requires: * - runpool_irq spinlock */ @@ -139,7 +113,7 @@ static inline s8 kbasep_js_ctx_attr_count_on_runpool(struct kbase_device *kbdev, return js_devdata->runpool_irq.ctx_attr_ref_count[attribute]; } -/** +/* * Requires: * - runpool_irq spinlock */ @@ -149,7 +123,7 @@ static inline bool kbasep_js_ctx_attr_is_attr_on_runpool(struct kbase_device *kb return (bool) kbasep_js_ctx_attr_count_on_runpool(kbdev, attribute); } -/** +/* * Requires: * - jsctx mutex */ @@ -165,8 +139,4 @@ static inline bool kbasep_js_ctx_attr_is_attr_on_ctx(struct kbase_context *kctx, return (bool) (js_kctx_info->ctx.ctx_attr_ref_count[attribute]); } - /** @} *//* end group kbase_js */ - /** @} *//* end group base_kbase_api */ - /** @} *//* end group base_api */ - #endif /* _KBASE_JS_DEFS_H_ */ diff --git a/mali_kbase/mali_kbase_kinstr_jm.c b/mali_kbase/mali_kbase_kinstr_jm.c index fbd0de5..76cff41 100644 --- a/mali_kbase/mali_kbase_kinstr_jm.c +++ b/mali_kbase/mali_kbase_kinstr_jm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* @@ -101,6 +99,11 @@ struct kbase_kinstr_jm { * KBASE_KINSTR_JM_ATOM_STATE_FLAG_* defines. * @reserved: Reserved for future use. * @data: Extra data for the state change. Active member depends on state. + * @data.start: Extra data for the state change. Active member depends on + * state. + * @data.start.slot: Extra data for the state change. Active member depends on + * state. + * @data.padding: Padding * * We can add new fields to the structure and old user code will gracefully * ignore the new fields. diff --git a/mali_kbase/mali_kbase_kinstr_jm.h b/mali_kbase/mali_kbase_kinstr_jm.h index a276361..74fe5cf 100644 --- a/mali_kbase/mali_kbase_kinstr_jm.h +++ b/mali_kbase/mali_kbase_kinstr_jm.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_kinstr_jm_reader.h b/mali_kbase/mali_kbase_kinstr_jm_reader.h index 1d2c141..cbd495f 100644 --- a/mali_kbase/mali_kbase_kinstr_jm_reader.h +++ b/mali_kbase/mali_kbase_kinstr_jm_reader.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_linux.h b/mali_kbase/mali_kbase_linux.h index eb4ce77..ff29337 100644 --- a/mali_kbase/mali_kbase_linux.h +++ b/mali_kbase/mali_kbase_linux.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010-2014, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2014, 2020-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_linux.h - * Base kernel APIs, Linux implementation. + * DOC: Base kernel APIs, Linux implementation. */ #ifndef _KBASE_LINUX_H_ diff --git a/mali_kbase/mali_kbase_mem.c b/mali_kbase/mali_kbase_mem.c index 5944da0..862bb2c 100644 --- a/mali_kbase/mali_kbase_mem.c +++ b/mali_kbase/mali_kbase_mem.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /** @@ -106,22 +104,28 @@ static struct rb_root *kbase_gpu_va_to_rbtree(struct kbase_context *kctx, u64 gpu_pfn) { struct rb_root *rbtree = NULL; + struct kbase_reg_zone *exec_va_zone = + kbase_ctx_reg_zone_get(kctx, KBASE_REG_ZONE_EXEC_VA); /* The gpu_pfn can only be greater than the starting pfn of the EXEC_VA * zone if this has been initialized. */ - if (gpu_pfn >= kctx->exec_va_start) + if (gpu_pfn >= exec_va_zone->base_pfn) rbtree = &kctx->reg_rbtree_exec; else { u64 same_va_end; #ifdef CONFIG_64BIT - if (kbase_ctx_flag(kctx, KCTX_COMPAT)) + if (kbase_ctx_flag(kctx, KCTX_COMPAT)) { #endif /* CONFIG_64BIT */ same_va_end = KBASE_REG_ZONE_CUSTOM_VA_BASE; #ifdef CONFIG_64BIT - else - same_va_end = kctx->same_va_end; + } else { + struct kbase_reg_zone *same_va_zone = + kbase_ctx_reg_zone_get(kctx, + KBASE_REG_ZONE_SAME_VA); + same_va_end = kbase_reg_zone_end_pfn(same_va_zone); + } #endif /* CONFIG_64BIT */ if (gpu_pfn >= same_va_end) @@ -346,7 +350,8 @@ static struct kbase_va_region *kbase_region_tracker_find_region_meeting_reqs( } /** - * @brief Remove a region object from the global list. + * Remove a region object from the global list. + * @reg: Region object to remove * * The region reg is removed, possibly by merging with other free and * compatible adjacent regions. It must be called with the context @@ -651,7 +656,7 @@ exit: return err; } -/** +/* * @brief Initialize the internal region tracker data structure. */ static void kbase_region_tracker_ds_init(struct kbase_context *kctx, @@ -731,21 +736,24 @@ int kbase_region_tracker_init(struct kbase_context *kctx) u64 custom_va_size = KBASE_REG_ZONE_CUSTOM_VA_SIZE; u64 gpu_va_limit = (1ULL << kctx->kbdev->gpu_props.mmu.va_bits) >> PAGE_SHIFT; u64 same_va_pages; + u64 same_va_base = 1u; int err; /* Take the lock as kbase_free_alloced_region requires it */ kbase_gpu_vm_lock(kctx); - same_va_pages = (1ULL << (same_va_bits - PAGE_SHIFT)) - 1; + same_va_pages = (1ULL << (same_va_bits - PAGE_SHIFT)) - same_va_base; /* all have SAME_VA */ - same_va_reg = kbase_alloc_free_region(&kctx->reg_rbtree_same, 1, - same_va_pages, - KBASE_REG_ZONE_SAME_VA); + same_va_reg = + kbase_alloc_free_region(&kctx->reg_rbtree_same, same_va_base, + same_va_pages, KBASE_REG_ZONE_SAME_VA); if (!same_va_reg) { err = -ENOMEM; goto fail_unlock; } + kbase_ctx_reg_zone_init(kctx, KBASE_REG_ZONE_SAME_VA, same_va_base, + same_va_pages); #ifdef CONFIG_64BIT /* 32-bit clients have custom VA zones */ @@ -771,17 +779,23 @@ int kbase_region_tracker_init(struct kbase_context *kctx) err = -ENOMEM; goto fail_free_same_va; } + kbase_ctx_reg_zone_init(kctx, KBASE_REG_ZONE_CUSTOM_VA, + KBASE_REG_ZONE_CUSTOM_VA_BASE, + custom_va_size); #ifdef CONFIG_64BIT } else { custom_va_size = 0; } #endif + /* EXEC_VA zone's codepaths are slightly easier when its base_pfn is + * initially U64_MAX + */ + kbase_ctx_reg_zone_init(kctx, KBASE_REG_ZONE_EXEC_VA, U64_MAX, 0u); + /* Other zones are 0: kbase_create_context() uses vzalloc */ kbase_region_tracker_ds_init(kctx, same_va_reg, custom_va_reg); - kctx->same_va_end = same_va_pages + 1; - kctx->gpu_va_end = kctx->same_va_end + custom_va_size; - kctx->exec_va_start = U64_MAX; + kctx->gpu_va_end = same_va_base + same_va_pages + custom_va_size; kctx->jit_va = false; #if MALI_USE_CSF @@ -798,44 +812,147 @@ fail_unlock: return err; } +static bool kbase_has_exec_va_zone_locked(struct kbase_context *kctx) +{ + struct kbase_reg_zone *exec_va_zone; + + lockdep_assert_held(&kctx->reg_lock); + exec_va_zone = kbase_ctx_reg_zone_get(kctx, KBASE_REG_ZONE_EXEC_VA); + + return (exec_va_zone->base_pfn != U64_MAX); +} + +bool kbase_has_exec_va_zone(struct kbase_context *kctx) +{ + bool has_exec_va_zone; + + kbase_gpu_vm_lock(kctx); + has_exec_va_zone = kbase_has_exec_va_zone_locked(kctx); + kbase_gpu_vm_unlock(kctx); + + return has_exec_va_zone; +} + +/** + * Determine if any allocations have been made on a context's region tracker + * @kctx: KBase context + * + * Check the context to determine if any allocations have been made yet from + * any of its zones. This check should be done before resizing a zone, e.g. to + * make space to add a second zone. + * + * Whilst a zone without allocations can be resized whilst other zones have + * allocations, we still check all of @kctx 's zones anyway: this is a stronger + * guarantee and should be adhered to when creating new zones anyway. + * + * Allocations from kbdev zones are not counted. + * + * Return: true if any allocs exist on any zone, false otherwise + */ +bool kbase_region_tracker_has_allocs(struct kbase_context *kctx) +{ + unsigned int zone_idx; + + lockdep_assert_held(&kctx->reg_lock); + + for (zone_idx = 0; zone_idx < KBASE_REG_ZONE_MAX; ++zone_idx) { + struct kbase_reg_zone *zone; + struct kbase_va_region *reg; + u64 zone_base_addr; + unsigned long zone_bits = KBASE_REG_ZONE(zone_idx); + unsigned long reg_zone; + + zone = kbase_ctx_reg_zone_get(kctx, zone_bits); + zone_base_addr = zone->base_pfn << PAGE_SHIFT; + + reg = kbase_region_tracker_find_region_base_address( + kctx, zone_base_addr); + + if (!zone->va_size_pages) { + WARN(reg, + "Should not have found a region that starts at 0x%.16llx for zone 0x%lx", + (unsigned long long)zone_base_addr, zone_bits); + continue; + } + + if (WARN(!reg, + "There should always be a region that starts at 0x%.16llx for zone 0x%lx, couldn't find it", + (unsigned long long)zone_base_addr, zone_bits)) + return true; /* Safest return value */ + + reg_zone = reg->flags & KBASE_REG_ZONE_MASK; + if (WARN(reg_zone != zone_bits, + "The region that starts at 0x%.16llx should be in zone 0x%lx but was found in the wrong zone 0x%lx", + (unsigned long long)zone_base_addr, zone_bits, + reg_zone)) + return true; /* Safest return value */ + + /* Unless the region is completely free, of the same size as + * the original zone, then it has allocs + */ + if ((!(reg->flags & KBASE_REG_FREE)) || + (reg->nr_pages != zone->va_size_pages)) + return true; + } + + /* All zones are the same size as originally made, so there are no + * allocs + */ + return false; +} + #ifdef CONFIG_64BIT static int kbase_region_tracker_init_jit_64(struct kbase_context *kctx, u64 jit_va_pages) { - struct kbase_va_region *same_va; + struct kbase_va_region *same_va_reg; + struct kbase_reg_zone *same_va_zone; + u64 same_va_zone_base_addr; + const unsigned long same_va_zone_bits = KBASE_REG_ZONE_SAME_VA; struct kbase_va_region *custom_va_reg; + u64 jit_va_start; lockdep_assert_held(&kctx->reg_lock); - /* First verify that a JIT_VA zone has not been created already. */ - if (kctx->jit_va) - return -EINVAL; - /* - * Modify the same VA free region after creation. Be careful to ensure - * that allocations haven't been made as they could cause an overlap - * to happen with existing same VA allocations and the custom VA zone. + * Modify the same VA free region after creation. The caller has + * ensured that allocations haven't been made, as any allocations could + * cause an overlap to happen with existing same VA allocations and the + * custom VA zone. */ - same_va = kbase_region_tracker_find_region_base_address(kctx, - PAGE_SIZE); - if (!same_va) + same_va_zone = kbase_ctx_reg_zone_get(kctx, same_va_zone_bits); + same_va_zone_base_addr = same_va_zone->base_pfn << PAGE_SHIFT; + + same_va_reg = kbase_region_tracker_find_region_base_address( + kctx, same_va_zone_base_addr); + if (WARN(!same_va_reg, + "Already found a free region at the start of every zone, but now cannot find any region for zone base 0x%.16llx zone 0x%lx", + (unsigned long long)same_va_zone_base_addr, same_va_zone_bits)) return -ENOMEM; - if (same_va->nr_pages < jit_va_pages || kctx->same_va_end < jit_va_pages) + /* kbase_region_tracker_has_allocs() in the caller has already ensured + * that all of the zones have no allocs, so no need to check that again + * on same_va_reg + */ + WARN_ON((!(same_va_reg->flags & KBASE_REG_FREE)) || + same_va_reg->nr_pages != same_va_zone->va_size_pages); + + if (same_va_reg->nr_pages < jit_va_pages || + same_va_zone->va_size_pages < jit_va_pages) return -ENOMEM; /* It's safe to adjust the same VA zone now */ - same_va->nr_pages -= jit_va_pages; - kctx->same_va_end -= jit_va_pages; + same_va_reg->nr_pages -= jit_va_pages; + same_va_zone->va_size_pages -= jit_va_pages; + jit_va_start = kbase_reg_zone_end_pfn(same_va_zone); /* * Create a custom VA zone at the end of the VA for allocations which * JIT can use so it doesn't have to allocate VA from the kernel. */ - custom_va_reg = kbase_alloc_free_region(&kctx->reg_rbtree_custom, - kctx->same_va_end, - jit_va_pages, - KBASE_REG_ZONE_CUSTOM_VA); + custom_va_reg = + kbase_alloc_free_region(&kctx->reg_rbtree_custom, jit_va_start, + jit_va_pages, KBASE_REG_ZONE_CUSTOM_VA); /* * The context will be destroyed if we fail here so no point @@ -843,6 +960,11 @@ static int kbase_region_tracker_init_jit_64(struct kbase_context *kctx, */ if (!custom_va_reg) return -ENOMEM; + /* Since this is 64-bit, the custom zone will not have been + * initialized, so initialize it now + */ + kbase_ctx_reg_zone_init(kctx, KBASE_REG_ZONE_CUSTOM_VA, jit_va_start, + jit_va_pages); kbase_region_tracker_insert(custom_va_reg); return 0; @@ -871,6 +993,23 @@ int kbase_region_tracker_init_jit(struct kbase_context *kctx, u64 jit_va_pages, kbase_gpu_vm_lock(kctx); + /* Verify that a JIT_VA zone has not been created already. */ + if (kctx->jit_va) { + err = -EINVAL; + goto exit_unlock; + } + + /* If in 64-bit, we always lookup the SAME_VA zone. To ensure it has no + * allocs, we can ensure there are no allocs anywhere. + * + * This check is also useful in 32-bit, just to make sure init of the + * zone is always done before any allocs. + */ + if (kbase_region_tracker_has_allocs(kctx)) { + err = -ENOMEM; + goto exit_unlock; + } + #ifdef CONFIG_64BIT if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) err = kbase_region_tracker_init_jit_64(kctx, jit_va_pages); @@ -892,6 +1031,7 @@ int kbase_region_tracker_init_jit(struct kbase_context *kctx, u64 jit_va_pages, #endif /* MALI_JIT_PRESSURE_LIMIT_BASE */ } +exit_unlock: kbase_gpu_vm_unlock(kctx); return err; @@ -899,24 +1039,33 @@ int kbase_region_tracker_init_jit(struct kbase_context *kctx, u64 jit_va_pages, int kbase_region_tracker_init_exec(struct kbase_context *kctx, u64 exec_va_pages) { - struct kbase_va_region *shrinking_va_reg; struct kbase_va_region *exec_va_reg; - u64 exec_va_start, exec_va_base_addr; + struct kbase_reg_zone *exec_va_zone; + struct kbase_reg_zone *target_zone; + struct kbase_va_region *target_reg; + u64 target_zone_base_addr; + unsigned long target_zone_bits; + u64 exec_va_start; int err; - /* The EXEC_VA zone shall be created by making space at the end of the - * address space. Firstly, verify that the number of EXEC_VA pages - * requested by the client is reasonable and then make sure that it is - * not greater than the address space itself before calculating the base - * address of the new zone. + /* The EXEC_VA zone shall be created by making space either: + * - for 64-bit clients, at the end of the process's address space + * - for 32-bit clients, in the CUSTOM zone + * + * Firstly, verify that the number of EXEC_VA pages requested by the + * client is reasonable and then make sure that it is not greater than + * the address space itself before calculating the base address of the + * new zone. */ if (exec_va_pages == 0 || exec_va_pages > KBASE_REG_ZONE_EXEC_VA_MAX_PAGES) return -EINVAL; kbase_gpu_vm_lock(kctx); - /* First verify that a JIT_VA zone has not been created already. */ - if (kctx->jit_va) { + /* Verify that we've not already created a EXEC_VA zone, and that the + * EXEC_VA zone must come before JIT's CUSTOM_VA. + */ + if (kbase_has_exec_va_zone_locked(kctx) || kctx->jit_va) { err = -EPERM; goto exit_unlock; } @@ -926,28 +1075,50 @@ int kbase_region_tracker_init_exec(struct kbase_context *kctx, u64 exec_va_pages goto exit_unlock; } - exec_va_start = kctx->gpu_va_end - exec_va_pages; - exec_va_base_addr = exec_va_start << PAGE_SHIFT; - - shrinking_va_reg = kbase_region_tracker_find_region_enclosing_address(kctx, - exec_va_base_addr); - if (!shrinking_va_reg) { + /* Verify no allocations have already been made */ + if (kbase_region_tracker_has_allocs(kctx)) { err = -ENOMEM; goto exit_unlock; } - /* Make sure that the EXEC_VA region is still uninitialized */ - if ((shrinking_va_reg->flags & KBASE_REG_ZONE_MASK) == - KBASE_REG_ZONE_EXEC_VA) { - err = -EPERM; +#ifdef CONFIG_64BIT + if (kbase_ctx_flag(kctx, KCTX_COMPAT)) { +#endif + /* 32-bit client: take from CUSTOM_VA zone */ + target_zone_bits = KBASE_REG_ZONE_CUSTOM_VA; +#ifdef CONFIG_64BIT + } else { + /* 64-bit client: take from SAME_VA zone */ + target_zone_bits = KBASE_REG_ZONE_SAME_VA; + } +#endif + target_zone = kbase_ctx_reg_zone_get(kctx, target_zone_bits); + target_zone_base_addr = target_zone->base_pfn << PAGE_SHIFT; + + target_reg = kbase_region_tracker_find_region_base_address( + kctx, target_zone_base_addr); + if (WARN(!target_reg, + "Already found a free region at the start of every zone, but now cannot find any region for zone base 0x%.16llx zone 0x%lx", + (unsigned long long)target_zone_base_addr, target_zone_bits)) { + err = -ENOMEM; goto exit_unlock; } + /* kbase_region_tracker_has_allocs() above has already ensured that all + * of the zones have no allocs, so no need to check that again on + * target_reg + */ + WARN_ON((!(target_reg->flags & KBASE_REG_FREE)) || + target_reg->nr_pages != target_zone->va_size_pages); - if (shrinking_va_reg->nr_pages <= exec_va_pages) { + if (target_reg->nr_pages <= exec_va_pages || + target_zone->va_size_pages <= exec_va_pages) { err = -ENOMEM; goto exit_unlock; } + /* Taken from the end of the target zone */ + exec_va_start = kbase_reg_zone_end_pfn(target_zone) - exec_va_pages; + exec_va_reg = kbase_alloc_free_region(&kctx->reg_rbtree_exec, exec_va_start, exec_va_pages, @@ -956,13 +1127,17 @@ int kbase_region_tracker_init_exec(struct kbase_context *kctx, u64 exec_va_pages err = -ENOMEM; goto exit_unlock; } + /* Update EXEC_VA zone + * + * not using kbase_ctx_reg_zone_init() - it was already initialized + */ + exec_va_zone = kbase_ctx_reg_zone_get(kctx, KBASE_REG_ZONE_EXEC_VA); + exec_va_zone->base_pfn = exec_va_start; + exec_va_zone->va_size_pages = exec_va_pages; - shrinking_va_reg->nr_pages -= exec_va_pages; -#ifdef CONFIG_64BIT - if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) - kctx->same_va_end -= exec_va_pages; -#endif - kctx->exec_va_start = exec_va_start; + /* Update target zone and corresponding region */ + target_reg->nr_pages -= exec_va_pages; + target_zone->va_size_pages -= exec_va_pages; kbase_region_tracker_insert(exec_va_reg); err = 0; @@ -1113,7 +1288,11 @@ void kbase_mem_term(struct kbase_device *kbdev) KBASE_EXPORT_TEST_API(kbase_mem_term); /** - * @brief Allocate a free region object. + * Allocate a free region object. + * @rbtree: Backlink to the red-black tree of memory regions. + * @start_pfn: The Page Frame Number in GPU virtual address space. + * @nr_pages: The size of the region in pages. + * @zone: KBASE_REG_ZONE_CUSTOM_VA or KBASE_REG_ZONE_SAME_VA * * The allocated object is not part of any list yet, and is flagged as * KBASE_REG_FREE. No mapping is allocated yet. @@ -1186,7 +1365,8 @@ static struct kbase_context *kbase_reg_flags_to_kctx( } /** - * @brief Free a region object. + * Free a region object. + * @reg: Region * * The described region must be freed of any mapping. * @@ -1782,7 +1962,9 @@ int kbase_mem_free_region(struct kbase_context *kctx, struct kbase_va_region *re KBASE_EXPORT_TEST_API(kbase_mem_free_region); /** - * @brief Free the region from the GPU and unregister it. + * Free the region from the GPU and unregister it. + * @kctx: KBase context + * @gpu_addr: GPU address to free * * This function implements the free operation on a memory segment. * It will loudly fail if called with outstanding mappings. @@ -2957,7 +3139,8 @@ int kbase_check_alloc_sizes(struct kbase_context *kctx, unsigned long flags, } /** - * @brief Acquire the per-context region list lock + * Acquire the per-context region list lock + * @kctx: KBase context */ void kbase_gpu_vm_lock(struct kbase_context *kctx) { @@ -2968,7 +3151,8 @@ void kbase_gpu_vm_lock(struct kbase_context *kctx) KBASE_EXPORT_TEST_API(kbase_gpu_vm_lock); /** - * @brief Release the per-context region list lock + * Release the per-context region list lock + * @kctx: KBase context */ void kbase_gpu_vm_unlock(struct kbase_context *kctx) { @@ -4266,17 +4450,6 @@ void kbase_jit_report_update_pressure(struct kbase_context *kctx, } #endif /* MALI_JIT_PRESSURE_LIMIT_BASE */ -bool kbase_has_exec_va_zone(struct kbase_context *kctx) -{ - bool has_exec_va_zone; - - kbase_gpu_vm_lock(kctx); - has_exec_va_zone = (kctx->exec_va_start != U64_MAX); - kbase_gpu_vm_unlock(kctx); - - return has_exec_va_zone; -} - static inline void unpin_user_buf_page(struct page *page) { #if KERNEL_VERSION(5, 9, 0) > LINUX_VERSION_CODE diff --git a/mali_kbase/mali_kbase_mem.h b/mali_kbase/mali_kbase_mem.h index 973fb7a..cda6b57 100644 --- a/mali_kbase/mali_kbase_mem.h +++ b/mali_kbase/mali_kbase_mem.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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 @@ -40,8 +20,7 @@ */ /** - * @file mali_kbase_mem.h - * Base kernel memory APIs + * DOC: Base kernel memory APIs */ #ifndef _KBASE_MEM_H_ @@ -80,7 +59,8 @@ static inline void kbase_process_page_usage_inc(struct kbase_context *kctx, #define KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES (1u << KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_LOG2) #define KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_HW_ISSUE_8316 (1u << KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_LOG2_HW_ISSUE_8316) #define KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_HW_ISSUE_9630 (1u << KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_LOG2_HW_ISSUE_9630) -/** + +/* * A CPU mapping */ struct kbase_cpu_mapping { @@ -109,9 +89,7 @@ struct kbase_aliased { u64 length; /* in pages */ }; -/** - * @brief Physical pages tracking object properties - */ +/* Physical pages tracking object properties */ #define KBASE_MEM_PHY_ALLOC_ACCESSED_CACHED (1u << 0) #define KBASE_MEM_PHY_ALLOC_LARGE (1u << 1) @@ -129,6 +107,10 @@ struct kbase_aliased { * @gpu_mappings: count number of times mapped on the GPU. Indicates the number * of references there are to the physical pages from different * GPU VA regions. + * @kernel_mappings: count number of times mapped on the CPU, specifically in + * the kernel. Indicates the number of references there are + * to the physical pages to prevent flag changes or shrink + * while maps are still held. * @nents: 0..N * @pages: N elements, only 0..nents are valid * @mappings: List of CPU mappings of this physical memory allocation. @@ -151,6 +133,7 @@ struct kbase_aliased { struct kbase_mem_phy_alloc { struct kref kref; atomic_t gpu_mappings; + atomic_t kernel_mappings; size_t nents; struct tagged_addr *pages; struct list_head mappings; @@ -241,6 +224,30 @@ static inline void kbase_mem_phy_alloc_gpu_unmapped(struct kbase_mem_phy_alloc * } /** + * kbase_mem_phy_alloc_kernel_mapped - Increment kernel_mappings + * counter for a memory region to prevent commit and flag changes + * + * @alloc: Pointer to physical pages tracking object + */ +static inline void +kbase_mem_phy_alloc_kernel_mapped(struct kbase_mem_phy_alloc *alloc) +{ + atomic_inc(&alloc->kernel_mappings); +} + +/** + * kbase_mem_phy_alloc_kernel_unmapped - Decrement kernel_mappings + * counter for a memory region to allow commit and flag changes + * + * @alloc: Pointer to physical pages tracking object + */ +static inline void +kbase_mem_phy_alloc_kernel_unmapped(struct kbase_mem_phy_alloc *alloc) +{ + WARN_ON(atomic_dec_return(&alloc->kernel_mappings) < 0); +} + +/** * kbase_mem_is_imported - Indicate whether a memory type is imported * * @type: the memory type @@ -272,7 +279,7 @@ static inline struct kbase_mem_phy_alloc *kbase_mem_phy_alloc_put(struct kbase_m } /** - * A GPU memory region, and attributes for CPU mappings. + * struct kbase_va_region - A GPU memory region, and attributes for CPU mappings * * @rblink: Node in a red-black tree of memory regions within the same zone of * the GPU's virtual address space. @@ -286,6 +293,7 @@ static inline struct kbase_mem_phy_alloc *kbase_mem_phy_alloc_put(struct kbase_m * @threshold_pages: If non-zero and the amount of memory committed to a region * that can grow on page fault exceeds this number of pages * then the driver switches to incremental rendering. + * @flags: Flags * @extension: Number of pages allocated on page fault. * @cpu_alloc: The physical memory we mmap to the CPU when mapping this region. * @gpu_alloc: The physical memory we mmap to the GPU when mapping this region. @@ -293,6 +301,23 @@ static inline struct kbase_mem_phy_alloc *kbase_mem_phy_alloc_put(struct kbase_m * @jit_usage_id: The last just-in-time memory usage ID for this region. * @jit_bin_id: The just-in-time memory bin this region came from. * @va_refcnt: Number of users of this region. Protected by reg_lock. + * @heap_info_gpu_addr: Pointer to an object in GPU memory defining an end of + * an allocated region + * The object can be one of: + * - u32 value defining the size of the region + * - u64 pointer first unused byte in the region + * The interpretation of the object depends on + * BASE_JIT_ALLOC_HEAP_INFO_IS_SIZE flag in + * jit_info_flags - if it is set, the heap info object + * should be interpreted as size. + * @used_pages: The current estimate of the number of pages used, which in + * normal use is either: + * - the initial estimate == va_pages + * - the actual pages used, as found by a JIT usage report + * Note that since the value is calculated from GPU memory after a + * JIT usage report, at any point in time it is allowed to take a + * random value that is no greater than va_pages (e.g. it may be + * greater than gpu_alloc->nents) */ struct kbase_va_region { struct rb_node rblink; @@ -332,8 +357,13 @@ struct kbase_va_region { #define KBASE_REG_SHARE_BOTH (1ul << 10) /* Space for 4 different zones */ -#define KBASE_REG_ZONE_MASK (3ul << 11) -#define KBASE_REG_ZONE(x) (((x) & 3) << 11) +#define KBASE_REG_ZONE_MASK ((KBASE_REG_ZONE_MAX - 1ul) << 11) +#define KBASE_REG_ZONE(x) (((x) & (KBASE_REG_ZONE_MAX - 1ul)) << 11) +#define KBASE_REG_ZONE_IDX(x) (((x) & KBASE_REG_ZONE_MASK) >> 11) + +#if ((KBASE_REG_ZONE_MAX - 1) & 0x3) != (KBASE_REG_ZONE_MAX - 1) +#error KBASE_REG_ZONE_MAX too large for allocation of KBASE_REG_<...> bits +#endif /* GPU read access */ #define KBASE_REG_GPU_RD (1ul<<13) @@ -628,6 +658,7 @@ static inline struct kbase_mem_phy_alloc *kbase_alloc_create( kref_init(&alloc->kref); atomic_set(&alloc->gpu_mappings, 0); + atomic_set(&alloc->kernel_mappings, 0); alloc->nents = 0; alloc->pages = (void *)(alloc + 1); INIT_LIST_HEAD(&alloc->mappings); @@ -1067,7 +1098,9 @@ struct kbase_va_region *kbase_find_region_enclosing_address( struct rb_root *rbtree, u64 gpu_addr); /** - * @brief Check that a pointer is actually a valid region. + * Check that a pointer is actually a valid region. + * @kctx: kbase context containing the region + * @gpu_addr: pointer to check * * Must be called with context lock held. */ @@ -1128,14 +1161,21 @@ void kbase_gpu_vm_unlock(struct kbase_context *kctx); int kbase_alloc_phy_pages(struct kbase_va_region *reg, size_t vsize, size_t size); /** - * @brief Register region and map it on the GPU. + * Register region and map it on the GPU. + * @kctx: kbase context containing the region + * @reg: the region to add + * @addr: the address to insert the region at + * @nr_pages: the number of pages in the region + * @align: the minimum alignment in pages * * Call kbase_add_va_region() and map the region on the GPU. */ int kbase_gpu_mmap(struct kbase_context *kctx, struct kbase_va_region *reg, u64 addr, size_t nr_pages, size_t align); /** - * @brief Remove the region from the GPU and unregister it. + * Remove the region from the GPU and unregister it. + * @kctx: KBase context + * @reg: The region to remove * * Must be called with context lock held. */ @@ -1984,4 +2024,76 @@ int kbase_mem_copy_to_pinned_user_pages(struct page **dest_pages, void *src_page, size_t *to_copy, unsigned int nr_pages, unsigned int *target_page_nr, size_t offset); +/** + * kbase_ctx_reg_zone_end_pfn - return the end Page Frame Number of @zone + * @zone: zone to query + * + * Return: The end of the zone corresponding to @zone + */ +static inline u64 kbase_reg_zone_end_pfn(struct kbase_reg_zone *zone) +{ + return zone->base_pfn + zone->va_size_pages; +} + +/** + * kbase_ctx_reg_zone_init - initialize a zone in @kctx + * @kctx: Pointer to kbase context + * @zone_bits: A KBASE_REG_ZONE_<...> to initialize + * @base_pfn: Page Frame Number in GPU virtual address space for the start of + * the Zone + * @va_size_pages: Size of the Zone in pages + */ +static inline void kbase_ctx_reg_zone_init(struct kbase_context *kctx, + unsigned long zone_bits, + u64 base_pfn, u64 va_size_pages) +{ + struct kbase_reg_zone *zone; + + lockdep_assert_held(&kctx->reg_lock); + WARN_ON((zone_bits & KBASE_REG_ZONE_MASK) != zone_bits); + + zone = &kctx->reg_zone[KBASE_REG_ZONE_IDX(zone_bits)]; + *zone = (struct kbase_reg_zone){ + .base_pfn = base_pfn, .va_size_pages = va_size_pages, + }; +} + +/** + * kbase_ctx_reg_zone_get_nolock - get a zone from @kctx where the caller does + * not have @kctx 's region lock + * @kctx: Pointer to kbase context + * @zone_bits: A KBASE_REG_ZONE_<...> to retrieve + * + * This should only be used in performance-critical paths where the code is + * resilient to a race with the zone changing. + * + * Return: The zone corresponding to @zone_bits + */ +static inline struct kbase_reg_zone * +kbase_ctx_reg_zone_get_nolock(struct kbase_context *kctx, + unsigned long zone_bits) +{ + WARN_ON((zone_bits & KBASE_REG_ZONE_MASK) != zone_bits); + + return &kctx->reg_zone[KBASE_REG_ZONE_IDX(zone_bits)]; +} + +/** + * kbase_ctx_reg_zone_get - get a zone from @kctx + * @kctx: Pointer to kbase context + * @zone_bits: A KBASE_REG_ZONE_<...> to retrieve + * + * The get is not refcounted - there is no corresponding 'put' operation + * + * Return: The zone corresponding to @zone_bits + */ +static inline struct kbase_reg_zone * +kbase_ctx_reg_zone_get(struct kbase_context *kctx, unsigned long zone_bits) +{ + lockdep_assert_held(&kctx->reg_lock); + WARN_ON((zone_bits & KBASE_REG_ZONE_MASK) != zone_bits); + + return &kctx->reg_zone[KBASE_REG_ZONE_IDX(zone_bits)]; +} + #endif /* _KBASE_MEM_H_ */ diff --git a/mali_kbase/mali_kbase_mem_linux.c b/mali_kbase/mali_kbase_mem_linux.c index 2c65e70..d7edf31 100644 --- a/mali_kbase/mali_kbase_mem_linux.c +++ b/mali_kbase/mali_kbase_mem_linux.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,13 +17,10 @@ * 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. + * DOC: Base kernel memory APIs, Linux implementation. */ #include <linux/compat.h> @@ -642,6 +639,13 @@ unsigned long kbase_mem_evictable_reclaim_count_objects(struct shrinker *s, kctx = container_of(s, struct kbase_context, reclaim); + WARN((sc->gfp_mask & __GFP_ATOMIC), + "Shrinkers cannot be called for GFP_ATOMIC allocations. Check kernel mm for problems. gfp_mask==%x\n", + sc->gfp_mask); + WARN(in_atomic(), + "Shrinker called whilst in atomic context. The caller must switch to using GFP_ATOMIC or similar. gfp_mask==%x\n", + sc->gfp_mask); + mutex_lock(&kctx->jit_evict_lock); list_for_each_entry(alloc, &kctx->evict_list, evict_node) @@ -922,6 +926,9 @@ int kbase_mem_flags_change(struct kbase_context *kctx, u64 gpu_addr, unsigned in if (atomic_read(®->cpu_alloc->gpu_mappings) > 1) goto out_unlock; + if (atomic_read(®->cpu_alloc->kernel_mappings) > 0) + goto out_unlock; + if (new_needed) { /* Only native allocations can be marked not needed */ if (reg->cpu_alloc->type != KBASE_MEM_TYPE_NATIVE) { @@ -1506,6 +1513,7 @@ static struct kbase_va_region *kbase_mem_from_user_buffer( u32 cache_line_alignment = kbase_get_cache_line_alignment(kctx->kbdev); struct kbase_alloc_import_user_buf *user_buf; struct page **pages = NULL; + int write; /* Flag supported only for dma-buf imported memory */ if (*flags & BASE_MEM_IMPORT_SYNC_ON_MAP_UNMAP) @@ -1619,22 +1627,22 @@ static struct kbase_va_region *kbase_mem_from_user_buffer( down_read(kbase_mem_get_process_mmap_lock()); + write = reg->flags & (KBASE_REG_CPU_WR | KBASE_REG_GPU_WR); + #if KERNEL_VERSION(4, 6, 0) > LINUX_VERSION_CODE faulted_pages = get_user_pages(current, current->mm, address, *va_pages, #if KERNEL_VERSION(4, 4, 168) <= LINUX_VERSION_CODE && \ KERNEL_VERSION(4, 5, 0) > LINUX_VERSION_CODE - reg->flags & KBASE_REG_CPU_WR ? FOLL_WRITE : 0, - pages, NULL); + write ? FOLL_WRITE : 0, pages, NULL); #else - reg->flags & KBASE_REG_CPU_WR, 0, pages, NULL); + write, 0, pages, NULL); #endif #elif KERNEL_VERSION(4, 9, 0) > LINUX_VERSION_CODE faulted_pages = get_user_pages(address, *va_pages, - reg->flags & KBASE_REG_CPU_WR, 0, pages, NULL); + write, 0, pages, NULL); #else faulted_pages = get_user_pages(address, *va_pages, - reg->flags & KBASE_REG_CPU_WR ? FOLL_WRITE : 0, - pages, NULL); + write ? FOLL_WRITE : 0, pages, NULL); #endif up_read(kbase_mem_get_process_mmap_lock()); @@ -2171,6 +2179,9 @@ int kbase_mem_commit(struct kbase_context *kctx, u64 gpu_addr, u64 new_pages) */ if (atomic_read(®->gpu_alloc->gpu_mappings) > 1) goto out_unlock; + + if (atomic_read(®->cpu_alloc->kernel_mappings) > 0) + goto out_unlock; /* can't grow regions which are ephemeral */ if (reg->flags & KBASE_REG_DONT_NEED) goto out_unlock; @@ -2964,7 +2975,6 @@ static int kbase_vmap_phy_pages(struct kbase_context *kctx, * - CPU-arch-specific integration required * - kbase_vmap() requires no access checks to be made/enforced */ - cpu_addr = vmap(pages, page_count, VM_MAP, prot); kfree(pages); @@ -2985,6 +2995,7 @@ static int kbase_vmap_phy_pages(struct kbase_context *kctx, if (map->sync_needed) kbase_sync_mem_regions(kctx, map, KBASE_SYNC_TO_CPU); + kbase_mem_phy_alloc_kernel_mapped(reg->cpu_alloc); return 0; } @@ -3055,6 +3066,7 @@ static void kbase_vunmap_phy_pages(struct kbase_context *kctx, if (map->sync_needed) kbase_sync_mem_regions(kctx, map, KBASE_SYNC_TO_DEVICE); + kbase_mem_phy_alloc_kernel_unmapped(map->cpu_alloc); map->offset_in_page = 0; map->cpu_pages = NULL; map->gpu_pages = NULL; diff --git a/mali_kbase/mali_kbase_mem_linux.h b/mali_kbase/mali_kbase_mem_linux.h index c96498f..c04b7fe 100644 --- a/mali_kbase/mali_kbase_mem_linux.h +++ b/mali_kbase/mali_kbase_mem_linux.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010, 2012-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010, 2012-2021 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 @@ -40,14 +20,13 @@ */ /** - * @file mali_kbase_mem_linux.h * Base kernel memory APIs, Linux implementation. */ #ifndef _KBASE_MEM_LINUX_H_ #define _KBASE_MEM_LINUX_H_ -/** A HWC dump mapping */ +/* A HWC dump mapping */ struct kbase_hwc_dma_mapping { void *cpu_va; dma_addr_t dma_pa; diff --git a/mali_kbase/mali_kbase_mem_lowlevel.h b/mali_kbase/mali_kbase_mem_lowlevel.h index 96a0b66..ab09ec9 100644 --- a/mali_kbase/mali_kbase_mem_lowlevel.h +++ b/mali_kbase/mali_kbase_mem_lowlevel.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2012-2014, 2016-2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2014, 2016-2018, 2020-2021 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 @@ -48,9 +28,7 @@ #include <linux/dma-mapping.h> -/** - * @brief Flags for kbase_phy_allocator_pages_alloc - */ +/* Flags for kbase_phy_allocator_pages_alloc */ #define KBASE_PHY_PAGES_FLAG_DEFAULT (0) /** Default allocation flag */ #define KBASE_PHY_PAGES_FLAG_CLEAR (1 << 0) /** Clear the pages after allocation */ #define KBASE_PHY_PAGES_FLAG_POISON (1 << 1) /** Fill the memory with a poison value */ diff --git a/mali_kbase/mali_kbase_mem_pool.c b/mali_kbase/mali_kbase_mem_pool.c index c075727..9b5854a 100644 --- a/mali_kbase/mali_kbase_mem_pool.c +++ b/mali_kbase/mali_kbase_mem_pool.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/mali_kbase_mem_pool_debugfs.c b/mali_kbase/mali_kbase_mem_pool_debugfs.c index 3ed0d1a..e7d8fdc 100644 --- a/mali_kbase/mali_kbase_mem_pool_debugfs.c +++ b/mali_kbase/mali_kbase_mem_pool_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/debugfs.h> diff --git a/mali_kbase/mali_kbase_mem_pool_debugfs.h b/mali_kbase/mali_kbase_mem_pool_debugfs.h index 32dd843..b2a94d7 100644 --- a/mali_kbase/mali_kbase_mem_pool_debugfs.h +++ b/mali_kbase/mali_kbase_mem_pool_debugfs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_mem_pool_group.c b/mali_kbase/mali_kbase_mem_pool_group.c index 5d6269e..72a17b2 100644 --- a/mali_kbase/mali_kbase_mem_pool_group.c +++ b/mali_kbase/mali_kbase_mem_pool_group.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/mali_kbase_mem_pool_group.h b/mali_kbase/mali_kbase_mem_pool_group.h index 4b50155..35333e9 100644 --- a/mali_kbase/mali_kbase_mem_pool_group.h +++ b/mali_kbase/mali_kbase_mem_pool_group.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_mem_profile_debugfs.c b/mali_kbase/mali_kbase_mem_profile_debugfs.c index 72b4633..113b69e 100644 --- a/mali_kbase/mali_kbase_mem_profile_debugfs.c +++ b/mali_kbase/mali_kbase_mem_profile_debugfs.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2012-2017, 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2017, 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,23 +17,23 @@ * 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> #ifdef CONFIG_DEBUG_FS -/** Show callback for the @c mem_profile debugfs file. +/** + * Show callback for the @c mem_profile debugfs file. * * This function is called to get the contents of the @c mem_profile debugfs * file. This is a report of current memory usage and distribution in userspace. * - * @param sfile The debugfs entry - * @param data Data associated with the entry + * @sfile: The debugfs entry + * @data: Data associated with the entry * - * @return 0 if it successfully prints data in debugfs entry file, non-zero otherwise + * Return: 0 if it successfully prints data in debugfs entry file, non-zero + * otherwise */ static int kbasep_mem_profile_seq_show(struct seq_file *sfile, void *data) { diff --git a/mali_kbase/mali_kbase_mem_profile_debugfs.h b/mali_kbase/mali_kbase_mem_profile_debugfs.h index 04e593f..7b5695d 100644 --- a/mali_kbase/mali_kbase_mem_profile_debugfs.h +++ b/mali_kbase/mali_kbase_mem_profile_debugfs.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2012-2016, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2016, 2020-2021 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 @@ -40,7 +20,6 @@ */ /** - * @file mali_kbase_mem_profile_debugfs.h * Header file for mem profiles entries in debugfs * */ @@ -52,12 +31,17 @@ #include <linux/seq_file.h> /** - * @brief Remove entry from Mali memory profile debugfs + * Remove entry from Mali memory profile debugfs + * @kctx: The context whose debugfs file @p data should be removed from */ void kbasep_mem_profile_debugfs_remove(struct kbase_context *kctx); /** - * @brief Insert @p data to the debugfs file so it can be read by userspace + * Insert @p data to the debugfs file so it can be read by userspace + * @kctx: The context whose debugfs file @p data should be inserted to + * @data: A NULL-terminated string to be inserted to the debugfs file, + * without the trailing new line character + * @size: The length of the @p data string * * The function takes ownership of @p data and frees it later when new data * is inserted. @@ -65,10 +49,6 @@ void kbasep_mem_profile_debugfs_remove(struct kbase_context *kctx); * If the debugfs entry corresponding to the @p kctx doesn't exist, * an attempt will be made to create it. * - * @param kctx The context whose debugfs file @p data should be inserted to - * @param data A NULL-terminated string to be inserted to the debugfs file, - * without the trailing new line character - * @param size The length of the @p data string * @return 0 if @p data inserted correctly * -EAGAIN in case of error * @post @ref mem_profile_initialized will be set to @c true 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 9f530ca..8489c55 100644 --- a/mali_kbase/mali_kbase_mem_profile_debugfs_buf_size.h +++ b/mali_kbase/mali_kbase_mem_profile_debugfs_buf_size.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014, 2017-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014, 2017-2021 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 @@ -40,7 +20,6 @@ */ /** - * @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_mipe_gen_header.h b/mali_kbase/mali_kbase_mipe_gen_header.h index 669f843..87eb65b 100644 --- a/mali_kbase/mali_kbase_mipe_gen_header.h +++ b/mali_kbase/mali_kbase_mipe_gen_header.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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 diff --git a/mali_kbase/mali_kbase_mipe_proto.h b/mali_kbase/mali_kbase_mipe_proto.h index 5202bf6..ee88ee6 100644 --- a/mali_kbase/mali_kbase_mipe_proto.h +++ b/mali_kbase/mali_kbase_mipe_proto.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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 diff --git a/mali_kbase/mali_kbase_native_mgm.c b/mali_kbase/mali_kbase_native_mgm.c index a3417a1..957d884 100644 --- a/mali_kbase/mali_kbase_native_mgm.c +++ b/mali_kbase/mali_kbase_native_mgm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/gfp.h> diff --git a/mali_kbase/mali_kbase_native_mgm.h b/mali_kbase/mali_kbase_native_mgm.h index 4d43ea4..f14fee4 100644 --- a/mali_kbase/mali_kbase_native_mgm.h +++ b/mali_kbase/mali_kbase_native_mgm.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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 @@ -44,7 +24,7 @@ #include <linux/memory_group_manager.h> -/** +/* * kbase_native_mgm_dev - Native memory group manager device * * An implementation of the memory group manager interface that is intended for diff --git a/mali_kbase/mali_kbase_platform_fake.c b/mali_kbase/mali_kbase_platform_fake.c index c3f85b5..02bfb25 100644 --- a/mali_kbase/mali_kbase_platform_fake.c +++ b/mali_kbase/mali_kbase_platform_fake.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2011-2014, 2016-2017, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2014, 2016-2017, 2020-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/errno.h> @@ -42,14 +40,13 @@ static struct platform_device *mali_device; #ifndef CONFIG_OF /** - * @brief Convert data in struct kbase_io_resources struct to Linux-specific resources + * Convert data in struct kbase_io_resources struct to Linux-specific resources + * @io_resources: Input IO resource data + * @linux_resources: Pointer to output array of Linux resource structures * * Function converts data in struct kbase_io_resources struct to an array of Linux resource structures. Note that function * assumes that size of linux_resource array is at least PLATFORM_CONFIG_RESOURCE_COUNT. * Resources are put in fixed order: I/O memory region, job IRQ, MMU IRQ, GPU IRQ. - * - * @param[in] io_resource Input IO resource data - * @param[out] linux_resources Pointer to output array of Linux resource structures */ static void kbasep_config_parse_io_resources(const struct kbase_io_resources *io_resources, struct resource *const linux_resources) { diff --git a/mali_kbase/mali_kbase_pm.c b/mali_kbase/mali_kbase_pm.c index 0c30167..7d0b672 100644 --- a/mali_kbase/mali_kbase_pm.c +++ b/mali_kbase/mali_kbase_pm.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,13 +17,10 @@ * 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 + * DOC: Base kernel power management APIs */ #include <mali_kbase.h> diff --git a/mali_kbase/mali_kbase_pm.h b/mali_kbase/mali_kbase_pm.h index 4960825..c880684 100644 --- a/mali_kbase/mali_kbase_pm.h +++ b/mali_kbase/mali_kbase_pm.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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 @@ -40,7 +20,6 @@ */ /** - * @file mali_kbase_pm.h * Power management API definitions */ @@ -83,12 +62,12 @@ int kbase_pm_powerup(struct kbase_device *kbdev, unsigned int flags); /** * Halt the power management framework. + * @kbdev: The kbase device structure for the device (must be a valid pointer) + * * Should ensure that no new interrupts are generated, * but allow any currently running interrupt handlers to complete successfully. * The GPU is forced off by the time this function returns, regardless of * whether or not the active power policy asks for the GPU to be powered off. - * - * @param kbdev The kbase device structure for the device (must be a valid pointer) */ void kbase_pm_halt(struct kbase_device *kbdev); @@ -178,6 +157,7 @@ void kbase_pm_context_idle(struct kbase_device *kbdev); /** * Suspend the GPU and prevent any further register accesses to it from Kernel * threads. + * @kbdev: The kbase device structure for the device (must be a valid pointer) * * This is called in response to an OS suspend event, and calls into the various * kbase components to complete the suspend. @@ -185,21 +165,18 @@ void kbase_pm_context_idle(struct kbase_device *kbdev); * @note the mechanisms used here rely on all user-space threads being frozen * by the OS before we suspend. Otherwise, an IOCTL could occur that powers up * the GPU e.g. via atom submission. - * - * @param kbdev The kbase device structure for the device (must be a valid pointer) */ void kbase_pm_suspend(struct kbase_device *kbdev); /** * Resume the GPU, allow register accesses to it, and resume running atoms on * the GPU. + * @kbdev: The kbase device structure for the device (must be a valid pointer) * * This is called in response to an OS resume event, and calls into the various * kbase components to complete the resume. * * Also called when using VM arbiter, when GPU access has been granted. - * - * @param kbdev The kbase device structure for the device (must be a valid pointer) */ void kbase_pm_resume(struct kbase_device *kbdev); @@ -216,8 +193,7 @@ void kbase_pm_vsync_callback(int buffer_updated, void *data); /** * kbase_pm_driver_suspend() - Put GPU and driver in suspend state - * @param kbdev The kbase device structure for the device - * (must be a valid pointer) + * @kbdev: The kbase device structure for the device (must be a valid pointer) * * Suspend the GPU and prevent any further register accesses to it from Kernel * threads. @@ -236,8 +212,8 @@ void kbase_pm_driver_suspend(struct kbase_device *kbdev); /** * kbase_pm_driver_resume() - Put GPU and driver in resume - * @param kbdev The kbase device structure for the device - * (must be a valid pointer) + * @kbdev: The kbase device structure for the device (must be a valid pointer) + * @arb_gpu_start: Arbiter has notified we can use GPU * * Resume the GPU, allow register accesses to it, and resume running atoms on * the GPU. diff --git a/mali_kbase/mali_kbase_regs_history_debugfs.c b/mali_kbase/mali_kbase_regs_history_debugfs.c index 1cc7b29..ede4996 100644 --- a/mali_kbase/mali_kbase_regs_history_debugfs.c +++ b/mali_kbase/mali_kbase_regs_history_debugfs.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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" diff --git a/mali_kbase/mali_kbase_regs_history_debugfs.h b/mali_kbase/mali_kbase_regs_history_debugfs.h index 0d5ce9b..9af8d05 100644 --- a/mali_kbase/mali_kbase_regs_history_debugfs.h +++ b/mali_kbase/mali_kbase_regs_history_debugfs.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014, 2016, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_reset_gpu.h b/mali_kbase/mali_kbase_reset_gpu.h index a1b75bf..4f66972 100644 --- a/mali_kbase/mali_kbase_reset_gpu.h +++ b/mali_kbase/mali_kbase_reset_gpu.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_smc.c b/mali_kbase/mali_kbase_smc.c index e1b884d..82c5a10 100644 --- a/mali_kbase/mali_kbase_smc.c +++ b/mali_kbase/mali_kbase_smc.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 diff --git a/mali_kbase/mali_kbase_smc.h b/mali_kbase/mali_kbase_smc.h index 5c384e4..9b89c32 100644 --- a/mali_kbase/mali_kbase_smc.h +++ b/mali_kbase/mali_kbase_smc.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2015, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_softjobs.c b/mali_kbase/mali_kbase_softjobs.c index daa9b90..18736d8 100644 --- a/mali_kbase/mali_kbase_softjobs.c +++ b/mali_kbase/mali_kbase_softjobs.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2011-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> @@ -44,9 +42,7 @@ #if !MALI_USE_CSF /** - * @file mali_kbase_softjobs.c - * - * This file implements the logic behind software only jobs that are + * DOC: This file implements the logic behind software only jobs that are * executed within the driver rather than being handed over to the GPU. */ @@ -137,7 +133,7 @@ static int kbase_dump_cpu_gpu_time(struct kbase_jd_atom *katom) void *user_result; struct timespec64 ts; struct base_dump_cpu_gpu_counters data; - u64 system_time; + u64 system_time = 0ULL; u64 cycle_counter; u64 jc = katom->jc; struct kbase_context *kctx = katom->kctx; @@ -833,7 +829,7 @@ int kbase_mem_copy_from_extres(struct kbase_context *kctx, dma_buf_kunmap(dma_buf, i, extres_page); #endif if (ret) - goto out_unlock; + break; } } dma_buf_end_cpu_access(dma_buf, @@ -1097,7 +1093,7 @@ static int kbase_jit_allocate_process(struct kbase_jd_atom *katom) } #if MALI_JIT_PRESSURE_LIMIT_BASE - /** + /* * If this is the only JIT_ALLOC atom in-flight or if JIT pressure limit * is disabled at the context scope, then bypass JIT pressure limit * logic in kbase_jit_allocate(). diff --git a/mali_kbase/mali_kbase_strings.c b/mali_kbase/mali_kbase_strings.c index 5413dae..f380930 100644 --- a/mali_kbase/mali_kbase_strings.c +++ b/mali_kbase/mali_kbase_strings.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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" diff --git a/mali_kbase/mali_kbase_strings.h b/mali_kbase/mali_kbase_strings.h index 56974a2..e6ec7f3 100644 --- a/mali_kbase/mali_kbase_strings.h +++ b/mali_kbase/mali_kbase_strings.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2010-2016, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_sync.h b/mali_kbase/mali_kbase_sync.h index 78211f4..bad8b54 100644 --- a/mali_kbase/mali_kbase_sync.h +++ b/mali_kbase/mali_kbase_sync.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2012-2016, 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2016, 2018-2021 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 @@ -40,9 +20,7 @@ */ /** - * @file mali_kbase_sync.h - * - * This file contains our internal "API" for explicit fences. + * DOC: This file contains our internal "API" for explicit fences. * It hides the implementation details of the actual explicit fence mechanism * used (Android fences or sync file with DMA fences). */ @@ -50,6 +28,7 @@ #ifndef MALI_KBASE_SYNC_H #define MALI_KBASE_SYNC_H +#include <linux/fdtable.h> #include <linux/syscalls.h> #ifdef CONFIG_SYNC #include <sync.h> @@ -184,7 +163,9 @@ void kbase_sync_fence_out_remove(struct kbase_jd_atom *katom); */ static inline void kbase_sync_fence_close_fd(int fd) { -#if KERNEL_VERSION(4, 17, 0) <= LINUX_VERSION_CODE +#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE + close_fd(fd); +#elif KERNEL_VERSION(4, 17, 0) <= LINUX_VERSION_CODE ksys_close(fd); #else sys_close(fd); diff --git a/mali_kbase/mali_kbase_sync_android.c b/mali_kbase/mali_kbase_sync_android.c index 2705fa2..2bd1f5d 100644 --- a/mali_kbase/mali_kbase_sync_android.c +++ b/mali_kbase/mali_kbase_sync_android.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_sync_common.c b/mali_kbase/mali_kbase_sync_common.c index 13eee59..8f0c074 100644 --- a/mali_kbase/mali_kbase_sync_common.c +++ b/mali_kbase/mali_kbase_sync_common.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_sync_file.c b/mali_kbase/mali_kbase_sync_file.c index f52ad43..d426640 100644 --- a/mali_kbase/mali_kbase_sync_file.c +++ b/mali_kbase/mali_kbase_sync_file.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_trace_gpu_mem.c b/mali_kbase/mali_kbase_trace_gpu_mem.c index 5cbe432..0458e17 100644 --- a/mali_kbase/mali_kbase_trace_gpu_mem.c +++ b/mali_kbase/mali_kbase_trace_gpu_mem.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/mali_kbase_trace_gpu_mem.h b/mali_kbase/mali_kbase_trace_gpu_mem.h index 5b25139..b78b553 100644 --- a/mali_kbase/mali_kbase_trace_gpu_mem.h +++ b/mali_kbase/mali_kbase_trace_gpu_mem.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_utility.h b/mali_kbase/mali_kbase_utility.h index e8e928f..5911969 100644 --- a/mali_kbase/mali_kbase_utility.h +++ b/mali_kbase/mali_kbase_utility.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2012-2013, 2015, 2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_kbase_vinstr.c b/mali_kbase/mali_kbase_vinstr.c index 9b2ec6f..bc985cb 100644 --- a/mali_kbase/mali_kbase_vinstr.c +++ b/mali_kbase/mali_kbase_vinstr.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_vinstr.h" diff --git a/mali_kbase/mali_kbase_vinstr.h b/mali_kbase/mali_kbase_vinstr.h index fafcd5a..a20f31a 100644 --- a/mali_kbase/mali_kbase_vinstr.h +++ b/mali_kbase/mali_kbase_vinstr.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2015-2018, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_linux_trace.h b/mali_kbase/mali_linux_trace.h index bbe9287..dacda97 100644 --- a/mali_kbase/mali_linux_trace.h +++ b/mali_kbase/mali_linux_trace.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2011-2016, 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2016, 2018-2021 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 @@ -50,7 +30,7 @@ #if defined(CONFIG_MALI_GATOR_SUPPORT) #define MALI_JOB_SLOTS_EVENT_CHANGED -/** +/* * mali_job_slots_event - Reports change of job slot status. * @gpu_id: Kbase device id * @event_id: ORed together bitfields representing a type of event, @@ -409,7 +389,6 @@ TRACE_EVENT(mali_jit_report_pressure, /* Enum of sysgraph message IDs */ enum sysgraph_msg { SGR_ARRIVE, - SGR_DEP_RES, SGR_SUBMIT, SGR_COMPLETE, SGR_POST, @@ -552,7 +531,7 @@ TRACE_EVENT(mali_jit_trim, TP_printk("freed_pages=%zu", __entry->freed_pages) ); -#include "mali_kbase_debug_linux_ktrace.h" +#include "debug/mali_kbase_debug_linux_ktrace.h" #endif /* _TRACE_MALI_H */ diff --git a/mali_kbase/mali_malisw.h b/mali_kbase/mali_malisw.h index 61ff7ae..c064044 100644 --- a/mali_kbase/mali_malisw.h +++ b/mali_kbase/mali_malisw.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014-2015, 2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2015, 2018, 2020-2021 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 @@ -50,6 +30,8 @@ /** * MIN - Return the lesser of two values. + * @x: value1 + * @y: value2 * * As a macro it may evaluate its arguments more than once. * Refer to MAX macro for more details @@ -57,7 +39,9 @@ #define MIN(x, y) ((x) < (y) ? (x) : (y)) /** - * MAX - Return the greater of two values. + * MAX - Return the greater of two values. + * @x: value1 + * @y: value2 * * As a macro it may evaluate its arguments more than once. * If called on the same two arguments as MIN it is guaranteed to return @@ -69,24 +53,27 @@ #define MAX(x, y) ((x) < (y) ? (y) : (x)) /** - * @hideinitializer - * Function-like macro for suppressing unused variable warnings. Where possible - * such variables should be removed; this macro is present for cases where we - * much support API backwards compatibility. + * Function-like macro for suppressing unused variable warnings. + * @x: unused variable + * + * Where possible such variables should be removed; this macro is present for + * cases where we much support API backwards compatibility. */ #define CSTD_UNUSED(x) ((void)(x)) /** - * @hideinitializer - * Function-like macro for use where "no behavior" is desired. This is useful - * when compile time macros turn a function-like macro in to a no-op, but - * where having no statement is otherwise invalid. + * Function-like macro for use where "no behavior" is desired. + * @...: no-op + * + * This is useful when compile time macros turn a function-like macro in to a + * no-op, but where having no statement is otherwise invalid. */ #define CSTD_NOP(...) ((void)#__VA_ARGS__) /** - * @hideinitializer * Function-like macro for stringizing a single level macro. + * @x: macro's value + * * @code * #define MY_MACRO 32 * CSTD_STR1( MY_MACRO ) @@ -96,10 +83,11 @@ #define CSTD_STR1(x) #x /** - * @hideinitializer - * Function-like macro for stringizing a macro's value. This should not be used - * if the macro is defined in a way which may have no value; use the - * alternative @c CSTD_STR2N macro should be used instead. + * Function-like macro for stringizing a macro's value. + * @x: macro's value + * + * This should not be used if the macro is defined in a way which may have no + * value; use the alternative @c CSTD_STR2N macro should be used instead. * @code * #define MY_MACRO 32 * CSTD_STR2( MY_MACRO ) diff --git a/mali_kbase/mali_power_gpu_frequency_trace.c b/mali_kbase/mali_power_gpu_frequency_trace.c index 36fb9cf..f548b04 100644 --- a/mali_kbase/mali_power_gpu_frequency_trace.c +++ b/mali_kbase/mali_power_gpu_frequency_trace.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 - * */ /* Create the trace point if not configured in kernel */ diff --git a/mali_kbase/mali_power_gpu_frequency_trace.h b/mali_kbase/mali_power_gpu_frequency_trace.h index b131d62..d6909a4 100644 --- a/mali_kbase/mali_power_gpu_frequency_trace.h +++ b/mali_kbase/mali_power_gpu_frequency_trace.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mali_uk.h b/mali_kbase/mali_uk.h index 9c3e89b..a499e02 100644 --- a/mali_kbase/mali_uk.h +++ b/mali_kbase/mali_uk.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010, 2012-2015, 2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010, 2012-2015, 2018, 2020-2021 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 @@ -40,7 +20,6 @@ */ /** - * @file mali_uk.h * Types and definitions that are common across OSs for both the user * and kernel side of the User-Kernel interface. */ @@ -53,12 +32,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @addtogroup base_api - * @{ - */ - -/** - * @defgroup uk_api User-Kernel Interface API + * DOC: uk_api User-Kernel Interface API * * The User-Kernel Interface abstracts the communication mechanism between the user and kernel-side code of device * drivers developed as part of the Midgard DDK. Currently that includes the Base driver. @@ -68,12 +42,16 @@ extern "C" { * * This API is internal to the Midgard DDK and is not exposed to any applications. * - * @{ */ /** - * These are identifiers for kernel-side drivers implementing a UK interface, aka UKK clients. The - * UK module maps this to an OS specific device name, e.g. "gpu_base" -> "GPU0:". Specify this + * enum uk_client_id - These are identifiers for kernel-side drivers + * implementing a UK interface, aka UKK clients. + * @UK_CLIENT_MALI_T600_BASE: Value used to identify the Base driver UK client. + * @UK_CLIENT_COUNT: The number of uk clients supported. This must be + * the last member of the enum + * + * The UK module maps this to an OS specific device name, e.g. "gpu_base" -> "GPU0:". Specify this * identifier to select a UKK client to the uku_open() function. * * When a new UKK client driver is created a new identifier needs to be added to the uk_client_id @@ -82,19 +60,10 @@ extern "C" { * */ enum uk_client_id { - /** - * Value used to identify the Base driver UK client. - */ UK_CLIENT_MALI_T600_BASE, - - /** The number of uk clients supported. This must be the last member of the enum */ UK_CLIENT_COUNT }; -/** @} end group uk_api */ - -/** @} *//* end group base_api */ - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/mali_kbase/mmu/backend/mali_kbase_mmu_csf.c b/mali_kbase/mmu/backend/mali_kbase_mmu_csf.c index 265e19a..6b7cb42 100644 --- a/mali_kbase/mmu/backend/mali_kbase_mmu_csf.c +++ b/mali_kbase/mmu/backend/mali_kbase_mmu_csf.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,12 +17,10 @@ * 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 MMU management specific for CSF GPU. + * DOC: Base kernel MMU management specific for CSF GPU. */ #include <mali_kbase.h> @@ -188,7 +186,7 @@ void kbase_gpu_report_bus_fault_and_kill(struct kbase_context *kctx, spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags); } -/** +/* * The caller must ensure it's retained the ctx to prevent it from being * scheduled out whilst it's being worked on. */ diff --git a/mali_kbase/mmu/backend/mali_kbase_mmu_jm.c b/mali_kbase/mmu/backend/mali_kbase_mmu_jm.c index ddb3fd2..18a74ab 100644 --- a/mali_kbase/mmu/backend/mali_kbase_mmu_jm.c +++ b/mali_kbase/mmu/backend/mali_kbase_mmu_jm.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,12 +17,10 @@ * 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 MMU management specific for Job Manager GPU. + * DOC: Base kernel MMU management specific for Job Manager GPU. */ #include <mali_kbase.h> @@ -98,7 +96,7 @@ void kbase_gpu_report_bus_fault_and_kill(struct kbase_context *kctx, KBASE_MMU_FAULT_TYPE_BUS_UNEXPECTED); } -/** +/* * The caller must ensure it's retained the ctx to prevent it from being * scheduled out whilst it's being worked on. */ @@ -145,6 +143,7 @@ void kbase_mmu_report_fault_and_kill(struct kbase_context *kctx, kctx->pid); /* hardware counters dump fault handling */ + spin_lock_irqsave(&kbdev->hwcnt.lock, flags); if ((kbdev->hwcnt.kctx) && (kbdev->hwcnt.kctx->as_nr == as_no) && (kbdev->hwcnt.backend.state == KBASE_INSTR_STATE_DUMPING)) { @@ -153,6 +152,7 @@ void kbase_mmu_report_fault_and_kill(struct kbase_context *kctx, kbdev->hwcnt.addr_bytes))) kbdev->hwcnt.backend.state = KBASE_INSTR_STATE_FAULT; } + spin_unlock_irqrestore(&kbdev->hwcnt.lock, flags); /* Stop the kctx from submitting more jobs and cause it to be scheduled * out/rescheduled - this will occur on releasing the context's refcount @@ -201,6 +201,8 @@ static void kbase_mmu_interrupt_process(struct kbase_device *kbdev, struct kbase_context *kctx, struct kbase_as *as, struct kbase_fault *fault) { + unsigned long flags; + lockdep_assert_held(&kbdev->hwaccess_lock); dev_dbg(kbdev->dev, @@ -238,11 +240,13 @@ static void kbase_mmu_interrupt_process(struct kbase_device *kbdev, * hw counters dumping in progress, signal the * other thread that it failed */ + spin_lock_irqsave(&kbdev->hwcnt.lock, flags); if ((kbdev->hwcnt.kctx == kctx) && (kbdev->hwcnt.backend.state == KBASE_INSTR_STATE_DUMPING)) kbdev->hwcnt.backend.state = KBASE_INSTR_STATE_FAULT; + spin_unlock_irqrestore(&kbdev->hwcnt.lock, flags); /* * Stop the kctx from submitting more jobs and cause it diff --git a/mali_kbase/mmu/mali_kbase_mmu.c b/mali_kbase/mmu/mali_kbase_mmu.c index 402f024..51bee43 100644 --- a/mali_kbase/mmu/mali_kbase_mmu.c +++ b/mali_kbase/mmu/mali_kbase_mmu.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,13 +17,10 @@ * 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. + * DOC: Base kernel MMU management. */ #include <linux/kernel.h> @@ -83,21 +80,20 @@ static void kbase_mmu_flush_invalidate_no_ctx(struct kbase_device *kbdev, u64 vpfn, size_t nr, bool sync, int as_nr); /** - * kbase_mmu_sync_pgd - sync page directory to memory + * kbase_mmu_sync_pgd() - sync page directory to memory when needed. * @kbdev: Device pointer. * @handle: Address of DMA region. * @size: Size of the region to sync. * * This should be called after each page directory update. */ - static void kbase_mmu_sync_pgd(struct kbase_device *kbdev, dma_addr_t handle, size_t size) { - /* If page table is not coherent then ensure the gpu can read + /* In non-coherent system, ensure the GPU can read * the pages from memory */ - if (kbdev->system_coherency != COHERENCY_ACE) + if (kbdev->system_coherency == COHERENCY_NONE) dma_sync_single_for_device(kbdev->dev, handle, size, DMA_TO_DEVICE); } @@ -118,7 +114,7 @@ static int kbase_mmu_update_pages_no_flush(struct kbase_context *kctx, u64 vpfn, /** * reg_grow_calc_extra_pages() - Calculate the number of backed pages to add to * a region on a GPU page fault - * + * @kbdev: KBase device * @reg: The region that will be backed with more pages * @fault_rel_pfn: PFN of the fault relative to the start of the region * @@ -1615,7 +1611,7 @@ static void kbase_mmu_flush_invalidate_as(struct kbase_device *kbdev, /* Flush failed to complete, assume the GPU has hung and * perform a reset to recover */ - dev_err(kbdev->dev, "Flush for GPU page table update did not complete. Issueing GPU soft-reset to recover\n"); + dev_err(kbdev->dev, "Flush for GPU page table update did not complete. Issuing GPU soft-reset to recover\n"); #if MALI_USE_CSF /* A GPU hang could mean hardware counters will stop working. diff --git a/mali_kbase/mmu/mali_kbase_mmu.h b/mali_kbase/mmu/mali_kbase_mmu.h index ba525e7..1d877ac 100644 --- a/mali_kbase/mmu/mali_kbase_mmu.h +++ b/mali_kbase/mmu/mali_kbase_mmu.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mmu/mali_kbase_mmu_hw.h b/mali_kbase/mmu/mali_kbase_mmu_hw.h index bc7561d..ea088e9 100644 --- a/mali_kbase/mmu/mali_kbase_mmu_hw.h +++ b/mali_kbase/mmu/mali_kbase_mmu_hw.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2014-2015, 2018-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2015, 2018-2021 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 @@ -58,6 +38,11 @@ struct kbase_context; /** * enum kbase_mmu_fault_type - MMU fault type descriptor. + * @KBASE_MMU_FAULT_TYPE_UNKNOWN: unknown fault + * @KBASE_MMU_FAULT_TYPE_PAGE: page fault + * @KBASE_MMU_FAULT_TYPE_BUS: nus fault + * @KBASE_MMU_FAULT_TYPE_PAGE_UNEXPECTED: page_unexpected fault + * @KBASE_MMU_FAULT_TYPE_BUS_UNEXPECTED: bus_unexpected fault */ enum kbase_mmu_fault_type { KBASE_MMU_FAULT_TYPE_UNKNOWN = 0, diff --git a/mali_kbase/mmu/mali_kbase_mmu_hw_direct.c b/mali_kbase/mmu/mali_kbase_mmu_hw_direct.c index 78d84ad..b0596af 100644 --- a/mali_kbase/mmu/mali_kbase_mmu_hw_direct.c +++ b/mali_kbase/mmu/mali_kbase_mmu_hw_direct.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/bitops.h> @@ -140,7 +138,7 @@ void kbase_mmu_hw_configure(struct kbase_device *kbdev, struct kbase_as *as) */ transcfg |= AS_TRANSCFG_R_ALLOCATE; - if (kbdev->system_coherency == COHERENCY_ACE) { + if (kbdev->system_coherency != COHERENCY_NONE) { /* Set flag AS_TRANSCFG_PTW_SH_OS (outer shareable) * Clear PTW_SH bits */ @@ -154,7 +152,7 @@ void kbase_mmu_hw_configure(struct kbase_device *kbdev, struct kbase_as *as) kbase_reg_write(kbdev, MMU_AS_REG(as->number, AS_TRANSCFG_HI), (transcfg >> 32) & 0xFFFFFFFFUL); } else { - if (kbdev->system_coherency == COHERENCY_ACE) + if (kbdev->system_coherency != COHERENCY_NONE) current_setup->transtab |= AS_TRANSTAB_LPAE_SHARE_OUTER; } diff --git a/mali_kbase/mmu/mali_kbase_mmu_internal.h b/mali_kbase/mmu/mali_kbase_mmu_internal.h index cc47c91..d3fcd39 100644 --- a/mali_kbase/mmu/mali_kbase_mmu_internal.h +++ b/mali_kbase/mmu/mali_kbase_mmu_internal.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/mmu/mali_kbase_mmu_mode_aarch64.c b/mali_kbase/mmu/mali_kbase_mmu_mode_aarch64.c index f705663..fac515c 100644 --- a/mali_kbase/mmu/mali_kbase_mmu_mode_aarch64.c +++ b/mali_kbase/mmu/mali_kbase_mmu_mode_aarch64.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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" diff --git a/mali_kbase/mmu/mali_kbase_mmu_mode_lpae.c b/mali_kbase/mmu/mali_kbase_mmu_mode_lpae.c index b98d64e..09793e1 100644 --- a/mali_kbase/mmu/mali_kbase_mmu_mode_lpae.c +++ b/mali_kbase/mmu/mali_kbase_mmu_mode_lpae.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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" @@ -72,7 +70,7 @@ static void mmu_get_as_setup(struct kbase_mmu_table *mmut, AS_TRANSTAB_LPAE_ADRMODE_TABLE | AS_TRANSTAB_LPAE_READ_INNER; - setup->transcfg = 0; + setup->transcfg = AS_TRANSCFG_ADRMODE_LEGACY; } static void mmu_update(struct kbase_device *kbdev, diff --git a/mali_kbase/platform/Kconfig b/mali_kbase/platform/Kconfig index f1e2537..ffb9aa7 100644 --- a/mali_kbase/platform/Kconfig +++ b/mali_kbase/platform/Kconfig @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2012-2013, 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 -# # # Add your platform specific Kconfig file here diff --git a/mali_kbase/platform/devicetree/Kbuild b/mali_kbase/platform/devicetree/Kbuild index 78343c0..4068e28 100644 --- a/mali_kbase/platform/devicetree/Kbuild +++ b/mali_kbase/platform/devicetree/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2012-2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 += \ diff --git a/mali_kbase/platform/devicetree/mali_kbase_clk_rate_trace.c b/mali_kbase/platform/devicetree/mali_kbase_clk_rate_trace.c index 080514c..f149554 100644 --- a/mali_kbase/platform/devicetree/mali_kbase_clk_rate_trace.c +++ b/mali_kbase/platform/devicetree/mali_kbase_clk_rate_trace.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c b/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c index df82806..5f300b1 100644 --- a/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c +++ b/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_config.h> diff --git a/mali_kbase/platform/devicetree/mali_kbase_config_platform.h b/mali_kbase/platform/devicetree/mali_kbase_config_platform.h index f16c9bc..ee9ae52 100644 --- a/mali_kbase/platform/devicetree/mali_kbase_config_platform.h +++ b/mali_kbase/platform/devicetree/mali_kbase_config_platform.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c b/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c index 72639b5..008f8a4 100644 --- a/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c +++ b/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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> diff --git a/mali_kbase/platform/vexpress/Kbuild b/mali_kbase/platform/vexpress/Kbuild index bcd3167..c184180 100644 --- a/mali_kbase/platform/vexpress/Kbuild +++ b/mali_kbase/platform/vexpress/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2012-2013, 2016-2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 += \ diff --git a/mali_kbase/platform/vexpress/mali_kbase_config_platform.h b/mali_kbase/platform/vexpress/mali_kbase_config_platform.h index a9988ae..97fdd13 100644 --- a/mali_kbase/platform/vexpress/mali_kbase_config_platform.h +++ b/mali_kbase/platform/vexpress/mali_kbase_config_platform.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c b/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c index d02ca3f..1816817 100644 --- a/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c +++ b/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/ioport.h> diff --git a/mali_kbase/platform/vexpress_1xv7_a57/Kbuild b/mali_kbase/platform/vexpress_1xv7_a57/Kbuild index ae03670..777a4ce 100644 --- a/mali_kbase/platform/vexpress_1xv7_a57/Kbuild +++ b/mali_kbase/platform/vexpress_1xv7_a57/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2013-2014, 2016-2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 += \ 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 a9988ae..97fdd13 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 @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2017, 2020 ARM Limited. All rights reserved. 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 6d6aaf6..3bb5caf 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 @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/ioport.h> diff --git a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild index e07709c..edda36c 100644 --- a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild +++ b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2012-2013, 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 += \ 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 a9988ae..97fdd13 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 @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014-2017, 2020 ARM Limited. All rights reserved. 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 c3fbf21..a7a842a 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 @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/ioport.h> diff --git a/mali_kbase/protected_mode_switcher.h b/mali_kbase/protected_mode_switcher.h index bde31ec..d9bab56 100644 --- a/mali_kbase/protected_mode_switcher.h +++ b/mali_kbase/protected_mode_switcher.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2017, 2020-2021 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 @@ -47,35 +27,23 @@ struct protected_mode_device; /** * struct protected_mode_ops - Callbacks for protected mode switch operations * - * @protected_mode_enable: Callback to enable protected mode for device + * @protected_mode_enable: Callback to enable protected mode for device, and + * reset device + * Returns 0 on success, non-zero on error * @protected_mode_disable: Callback to disable protected mode for device + * Returns 0 on success, non-zero on error */ struct protected_mode_ops { - /** - * protected_mode_enable() - Enable protected mode on device - * @dev: The struct device - * - * Return: 0 on success, non-zero on error - */ int (*protected_mode_enable)( struct protected_mode_device *protected_dev); - - /** - * protected_mode_disable() - Disable protected mode on device, and - * reset device - * @dev: The struct device - * - * Return: 0 on success, non-zero on error - */ int (*protected_mode_disable)( struct protected_mode_device *protected_dev); }; /** * struct protected_mode_device - Device structure for protected mode devices - * - * @ops - Callbacks associated with this device - * @data - Pointer to device private data + * @ops: Callbacks associated with this device + * @data: Pointer to device private data * * This structure should be registered with the platform device using * platform_set_drvdata(). diff --git a/mali_kbase/tests/Kbuild b/mali_kbase/tests/Kbuild index c26bef7..cf9d7fd 100644 --- a/mali_kbase/tests/Kbuild +++ b/mali_kbase/tests/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 -# # obj-$(CONFIG_MALI_KUTF) += kutf/ diff --git a/mali_kbase/tests/Kconfig b/mali_kbase/tests/Kconfig index 83a4d77..cf2a23a 100644 --- a/mali_kbase/tests/Kconfig +++ b/mali_kbase/tests/Kconfig @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 -# # source "drivers/gpu/arm/midgard/tests/kutf/Kconfig" diff --git a/mali_kbase/tests/Mconfig b/mali_kbase/tests/Mconfig index cdbbaac..2630736 100644 --- a/mali_kbase/tests/Mconfig +++ b/mali_kbase/tests/Mconfig @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 # -# (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved. +# (C) COPYRIGHT 2018, 2020-2021 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 @@ -20,7 +20,7 @@ config UNIT_TEST_KERNEL_MODULES bool - default y if UNIT_TEST_CODE && BUILD_KERNEL_MODULES + default y if UNIT_TEST_CODE && BACKEND_KERNEL default n config BUILD_IPA_TESTS diff --git a/mali_kbase/tests/include/kutf/kutf_helpers.h b/mali_kbase/tests/include/kutf/kutf_helpers.h index ea87f9c..3b8613a 100644 --- a/mali_kbase/tests/include/kutf/kutf_helpers.h +++ b/mali_kbase/tests/include/kutf/kutf_helpers.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/tests/include/kutf/kutf_helpers_user.h b/mali_kbase/tests/include/kutf/kutf_helpers_user.h index 38f36fc..49aad29 100644 --- a/mali_kbase/tests/include/kutf/kutf_helpers_user.h +++ b/mali_kbase/tests/include/kutf/kutf_helpers_user.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/tests/include/kutf/kutf_mem.h b/mali_kbase/tests/include/kutf/kutf_mem.h index 8a0e855..47c4bea 100644 --- a/mali_kbase/tests/include/kutf/kutf_mem.h +++ b/mali_kbase/tests/include/kutf/kutf_mem.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/tests/include/kutf/kutf_resultset.h b/mali_kbase/tests/include/kutf/kutf_resultset.h index f21de19..1f2dcfa 100644 --- a/mali_kbase/tests/include/kutf/kutf_resultset.h +++ b/mali_kbase/tests/include/kutf/kutf_resultset.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/tests/include/kutf/kutf_suite.h b/mali_kbase/tests/include/kutf/kutf_suite.h index f4af4fa..426e435 100644 --- a/mali_kbase/tests/include/kutf/kutf_suite.h +++ b/mali_kbase/tests/include/kutf/kutf_suite.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/tests/include/kutf/kutf_utils.h b/mali_kbase/tests/include/kutf/kutf_utils.h index a60e569..e5e2f02 100644 --- a/mali_kbase/tests/include/kutf/kutf_utils.h +++ b/mali_kbase/tests/include/kutf/kutf_utils.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/tests/kutf/Kbuild b/mali_kbase/tests/kutf/Kbuild index de68729..bd6540c 100644 --- a/mali_kbase/tests/kutf/Kbuild +++ b/mali_kbase/tests/kutf/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 diff --git a/mali_kbase/tests/kutf/Kconfig b/mali_kbase/tests/kutf/Kconfig index 3d1f92d..7ea95b6 100644 --- a/mali_kbase/tests/kutf/Kconfig +++ b/mali_kbase/tests/kutf/Kconfig @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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_KUTF diff --git a/mali_kbase/tests/kutf/Makefile b/mali_kbase/tests/kutf/Makefile index b9e070b..041f539 100644 --- a/mali_kbase/tests/kutf/Makefile +++ b/mali_kbase/tests/kutf/Makefile @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2014-2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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/kutf/kutf_helpers.c b/mali_kbase/tests/kutf/kutf_helpers.c index 13b6353..13923fa 100644 --- a/mali_kbase/tests/kutf/kutf_helpers.c +++ b/mali_kbase/tests/kutf/kutf_helpers.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 */ diff --git a/mali_kbase/tests/kutf/kutf_helpers_user.c b/mali_kbase/tests/kutf/kutf_helpers_user.c index 00bc9c0..84c63be 100644 --- a/mali_kbase/tests/kutf/kutf_helpers_user.c +++ b/mali_kbase/tests/kutf/kutf_helpers_user.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 */ diff --git a/mali_kbase/tests/kutf/kutf_mem.c b/mali_kbase/tests/kutf/kutf_mem.c index 88c2de8..b005b68 100644 --- a/mali_kbase/tests/kutf/kutf_mem.c +++ b/mali_kbase/tests/kutf/kutf_mem.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 */ diff --git a/mali_kbase/tests/kutf/kutf_resultset.c b/mali_kbase/tests/kutf/kutf_resultset.c index ed6f02a..1eea08c 100644 --- a/mali_kbase/tests/kutf/kutf_resultset.c +++ b/mali_kbase/tests/kutf/kutf_resultset.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 */ diff --git a/mali_kbase/tests/kutf/kutf_suite.c b/mali_kbase/tests/kutf/kutf_suite.c index 382557b..4b1dde4 100644 --- a/mali_kbase/tests/kutf/kutf_suite.c +++ b/mali_kbase/tests/kutf/kutf_suite.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 diff --git a/mali_kbase/tests/kutf/kutf_utils.c b/mali_kbase/tests/kutf/kutf_utils.c index 7d1de25..f0dad1f 100644 --- a/mali_kbase/tests/kutf/kutf_utils.c +++ b/mali_kbase/tests/kutf/kutf_utils.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 */ diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kbuild b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kbuild index f5565d3..00b2a41 100644 --- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kbuild +++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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_clk_rate_trace/kernel/Kconfig b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kconfig index 04b44cf..51c2d27 100644 --- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kconfig +++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kconfig @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 CONFIG_MALI_CLK_RATE_TRACE_PORTAL diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Makefile b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Makefile index 71c78b8..950acd8 100644 --- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Makefile +++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Makefile @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 -# # ifneq ($(KERNELRELEASE),) diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c index 88dfef4..bd091fa 100644 --- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c +++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/fdtable.h> diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/mali_kutf_clk_rate_trace_test.h b/mali_kbase/tests/mali_kutf_clk_rate_trace/mali_kutf_clk_rate_trace_test.h index 0b7b84d..600b025 100644 --- a/mali_kbase/tests/mali_kutf_clk_rate_trace/mali_kutf_clk_rate_trace_test.h +++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/mali_kutf_clk_rate_trace_test.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/tests/mali_kutf_irq_test/Kbuild b/mali_kbase/tests/mali_kutf_irq_test/Kbuild index a1a4828..cc38cb8 100644 --- a/mali_kbase/tests/mali_kutf_irq_test/Kbuild +++ b/mali_kbase/tests/mali_kutf_irq_test/Kbuild @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 c49ec11..e28106b 100644 --- a/mali_kbase/tests/mali_kutf_irq_test/Kconfig +++ b/mali_kbase/tests/mali_kutf_irq_test/Kconfig @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2017, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 diff --git a/mali_kbase/tests/mali_kutf_irq_test/Makefile b/mali_kbase/tests/mali_kutf_irq_test/Makefile index bc4d654..cbec0d3 100644 --- a/mali_kbase/tests/mali_kutf_irq_test/Makefile +++ b/mali_kbase/tests/mali_kutf_irq_test/Makefile @@ -1,10 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 # # (C) COPYRIGHT 2015, 2017-2018, 2020 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. +# of such GNU license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,8 +16,6 @@ # 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 3c22004..e9f276e 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 @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2016-2018, 2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2016-2018, 2020-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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 <linux/module.h> @@ -26,8 +24,8 @@ #include <linux/interrupt.h> #include "mali_kbase.h" -#include <midgard/device/mali_kbase_device.h> -#include <midgard/backend/gpu/mali_kbase_pm_internal.h> +#include <device/mali_kbase_device.h> +#include <backend/gpu/mali_kbase_pm_internal.h> #include <kutf/kutf_suite.h> #include <kutf/kutf_utils.h> diff --git a/mali_kbase/thirdparty/mali_kbase_mmap.c b/mali_kbase/thirdparty/mali_kbase_mmap.c index 6201cfc..a3b4a74 100644 --- a/mali_kbase/thirdparty/mali_kbase_mmap.c +++ b/mali_kbase/thirdparty/mali_kbase_mmap.c @@ -1,24 +1,4 @@ /* - * - * (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 @@ -271,6 +251,26 @@ unsigned long kbase_context_get_unmapped_area(struct kbase_context *const kctx, bool is_same_4gb_page = false; unsigned long ret; + /* the 'nolock' form is used here: + * - the base_pfn of the SAME_VA zone does not change + * - in normal use, va_size_pages is constant once the first allocation + * begins + * + * However, in abnormal use this function could be processing whilst + * another new zone is being setup in a different thread (e.g. to + * borrow part of the SAME_VA zone). In the worst case, this path may + * witness a higher SAME_VA end_pfn than the code setting up the new + * zone. + * + * This is safe because once we reach the main allocation functions, + * we'll see the updated SAME_VA end_pfn and will determine that there + * is no free region at the address found originally by too large a + * same_va_end_addr here, and will fail the allocation gracefully. + */ + struct kbase_reg_zone *zone = + kbase_ctx_reg_zone_get_nolock(kctx, KBASE_REG_ZONE_SAME_VA); + u64 same_va_end_addr = kbase_reg_zone_end_pfn(zone) << PAGE_SHIFT; + /* err on fixed address */ if ((flags & MAP_FIXED) || addr) return -EINVAL; @@ -281,9 +281,8 @@ unsigned long kbase_context_get_unmapped_area(struct kbase_context *const kctx, return -ENOMEM; if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) { - - high_limit = min_t(unsigned long, mm->mmap_base, - (kctx->same_va_end << PAGE_SHIFT)); + high_limit = + min_t(unsigned long, mm->mmap_base, same_va_end_addr); /* If there's enough (> 33 bits) of GPU VA space, align * to 2MB boundaries. @@ -359,11 +358,10 @@ unsigned long kbase_context_get_unmapped_area(struct kbase_context *const kctx, is_same_4gb_page); if (IS_ERR_VALUE(ret) && high_limit == mm->mmap_base && - high_limit < (kctx->same_va_end << PAGE_SHIFT)) { + high_limit < same_va_end_addr) { /* Retry above mmap_base */ info.low_limit = mm->mmap_base; - info.high_limit = min_t(u64, TASK_SIZE, - (kctx->same_va_end << PAGE_SHIFT)); + info.high_limit = min_t(u64, TASK_SIZE, same_va_end_addr); ret = kbase_unmapped_area_topdown(&info, is_shader_code, is_same_4gb_page); diff --git a/mali_kbase/tl/backend/mali_kbase_timeline_csf.c b/mali_kbase/tl/backend/mali_kbase_timeline_csf.c index 476214d..42f1e2d 100644 --- a/mali_kbase/tl/backend/mali_kbase_timeline_csf.c +++ b/mali_kbase/tl/backend/mali_kbase_timeline_csf.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_tracepoints.h" diff --git a/mali_kbase/tl/backend/mali_kbase_timeline_jm.c b/mali_kbase/tl/backend/mali_kbase_timeline_jm.c index 4babd1e..f016e8b 100644 --- a/mali_kbase/tl/backend/mali_kbase_timeline_jm.c +++ b/mali_kbase/tl/backend/mali_kbase_timeline_jm.c @@ -6,7 +6,7 @@ * 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_tracepoints.h" diff --git a/mali_kbase/tl/mali_kbase_timeline.c b/mali_kbase/tl/mali_kbase_timeline.c index 98185e9..4f955a1 100644 --- a/mali_kbase/tl/mali_kbase_timeline.c +++ b/mali_kbase/tl/mali_kbase_timeline.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2015-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2015-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_timeline.h" @@ -267,16 +265,24 @@ int kbase_timeline_io_acquire(struct kbase_device *kbdev, u32 flags) return ret; } -void kbase_timeline_streams_flush(struct kbase_timeline *timeline) +int kbase_timeline_streams_flush(struct kbase_timeline *timeline) { enum tl_stream_type stype; - + bool has_bytes = false; + size_t nbytes = 0; #if MALI_USE_CSF - kbase_csf_tl_reader_flush_buffer(&timeline->csf_tl_reader); + int ret = kbase_csf_tl_reader_flush_buffer(&timeline->csf_tl_reader); + + if (ret > 0) + has_bytes = true; #endif - for (stype = 0; stype < TL_STREAM_TYPE_COUNT; stype++) - kbase_tlstream_flush_stream(&timeline->streams[stype]); + for (stype = 0; stype < TL_STREAM_TYPE_COUNT; stype++) { + nbytes = kbase_tlstream_flush_stream(&timeline->streams[stype]); + if (nbytes > 0) + has_bytes = true; + } + return has_bytes ? 0 : -EIO; } void kbase_timeline_streams_body_reset(struct kbase_timeline *timeline) diff --git a/mali_kbase/tl/mali_kbase_timeline.h b/mali_kbase/tl/mali_kbase_timeline.h index ea75a69..9315fcc 100644 --- a/mali_kbase/tl/mali_kbase_timeline.h +++ b/mali_kbase/tl/mali_kbase_timeline.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2015-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2015-2021 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 @@ -89,8 +69,10 @@ int kbase_timeline_io_acquire(struct kbase_device *kbdev, u32 flags); * @timeline: Timeline instance * * Function will flush pending data in all timeline streams. + * + * Return: Zero on success, errno on failure. */ -void kbase_timeline_streams_flush(struct kbase_timeline *timeline); +int kbase_timeline_streams_flush(struct kbase_timeline *timeline); /** * kbase_timeline_streams_body_reset - reset timeline body streams. diff --git a/mali_kbase/tl/mali_kbase_timeline_io.c b/mali_kbase/tl/mali_kbase_timeline_io.c index a6d02b9..8587ba0 100644 --- a/mali_kbase/tl/mali_kbase_timeline_io.c +++ b/mali_kbase/tl/mali_kbase_timeline_io.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,35 +17,36 @@ * 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_timeline_priv.h" #include "mali_kbase_tlstream.h" #include "mali_kbase_tracepoints.h" +#include "mali_kbase_timeline.h" #include <linux/poll.h> /* The timeline stream file operations functions. */ -static ssize_t kbasep_timeline_io_read( - struct file *filp, - char __user *buffer, - size_t size, - loff_t *f_pos); -static unsigned int kbasep_timeline_io_poll(struct file *filp, poll_table *wait); +static ssize_t kbasep_timeline_io_read(struct file *filp, char __user *buffer, + size_t size, loff_t *f_pos); +static unsigned int kbasep_timeline_io_poll(struct file *filp, + poll_table *wait); static int kbasep_timeline_io_release(struct inode *inode, struct file *filp); +static int kbasep_timeline_io_fsync(struct file *filp, loff_t start, loff_t end, + int datasync); /* The timeline stream file operations structure. */ const struct file_operations kbasep_tlstream_fops = { .owner = THIS_MODULE, .release = kbasep_timeline_io_release, - .read = kbasep_timeline_io_read, - .poll = kbasep_timeline_io_poll, + .read = kbasep_timeline_io_read, + .poll = kbasep_timeline_io_poll, + .fsync = kbasep_timeline_io_fsync, }; /** - * kbasep_timeline_io_packet_pending - check timeline streams for pending packets + * kbasep_timeline_io_packet_pending - check timeline streams for pending + *packets * @timeline: Timeline instance * @ready_stream: Pointer to variable where stream will be placed * @rb_idx_raw: Pointer to variable where read buffer index will be placed @@ -57,10 +58,10 @@ const struct file_operations kbasep_tlstream_fops = { * * Return: non-zero if any of timeline streams has at last one packet ready */ -static int kbasep_timeline_io_packet_pending( - struct kbase_timeline *timeline, - struct kbase_tlstream **ready_stream, - unsigned int *rb_idx_raw) +static int +kbasep_timeline_io_packet_pending(struct kbase_timeline *timeline, + struct kbase_tlstream **ready_stream, + unsigned int *rb_idx_raw) { enum tl_stream_type i; @@ -79,7 +80,6 @@ static int kbasep_timeline_io_packet_pending( *ready_stream = stream; return 1; } - } return 0; @@ -93,13 +93,11 @@ static int kbasep_timeline_io_packet_pending( * * Return: non-zero if any of timeline headers has at last one packet ready. */ -static int kbasep_timeline_has_header_data( - struct kbase_timeline *timeline) +static int kbasep_timeline_has_header_data(struct kbase_timeline *timeline) { - return timeline->obj_header_btc - || timeline->aux_header_btc + return timeline->obj_header_btc || timeline->aux_header_btc #if MALI_USE_CSF - || timeline->csf_tl_reader.tl_header.btc + || timeline->csf_tl_reader.tl_header.btc #endif ; } @@ -117,11 +115,9 @@ static int kbasep_timeline_has_header_data( * * Returns: 0 if success, -1 otherwise. */ -static inline int copy_stream_header( - char __user *buffer, size_t size, ssize_t *copy_len, - const char *hdr, - size_t hdr_size, - size_t *hdr_btc) +static inline int copy_stream_header(char __user *buffer, size_t size, + ssize_t *copy_len, const char *hdr, + size_t hdr_size, size_t *hdr_btc) { const size_t offset = hdr_size - *hdr_btc; const size_t copy_size = MIN(size - *copy_len, *hdr_btc); @@ -155,34 +151,27 @@ static inline int copy_stream_header( * * Returns: 0 if success, -1 if copy_to_user has failed. */ -static inline int kbasep_timeline_copy_headers( - struct kbase_timeline *timeline, - char __user *buffer, - size_t size, - ssize_t *copy_len) +static inline int kbasep_timeline_copy_headers(struct kbase_timeline *timeline, + char __user *buffer, size_t size, + ssize_t *copy_len) { - if (copy_stream_header(buffer, size, copy_len, - obj_desc_header, - obj_desc_header_size, - &timeline->obj_header_btc)) + if (copy_stream_header(buffer, size, copy_len, obj_desc_header, + obj_desc_header_size, &timeline->obj_header_btc)) return -1; - if (copy_stream_header(buffer, size, copy_len, - aux_desc_header, - aux_desc_header_size, - &timeline->aux_header_btc)) + if (copy_stream_header(buffer, size, copy_len, aux_desc_header, + aux_desc_header_size, &timeline->aux_header_btc)) return -1; #if MALI_USE_CSF if (copy_stream_header(buffer, size, copy_len, - timeline->csf_tl_reader.tl_header.data, - timeline->csf_tl_reader.tl_header.size, - &timeline->csf_tl_reader.tl_header.btc)) + timeline->csf_tl_reader.tl_header.data, + timeline->csf_tl_reader.tl_header.size, + &timeline->csf_tl_reader.tl_header.btc)) return -1; #endif return 0; } - /** * kbasep_timeline_io_read - copy data from streams to buffer provided by user * @filp: Pointer to file structure @@ -192,11 +181,8 @@ static inline int kbasep_timeline_copy_headers( * * Return: number of bytes stored in the buffer */ -static ssize_t kbasep_timeline_io_read( - struct file *filp, - char __user *buffer, - size_t size, - loff_t *f_pos) +static ssize_t kbasep_timeline_io_read(struct file *filp, char __user *buffer, + size_t size, loff_t *f_pos) { ssize_t copy_len = 0; struct kbase_timeline *timeline; @@ -207,7 +193,7 @@ static ssize_t kbasep_timeline_io_read( if (WARN_ON(!filp->private_data)) return -EFAULT; - timeline = (struct kbase_timeline *) filp->private_data; + timeline = (struct kbase_timeline *)filp->private_data; if (!buffer) return -EINVAL; @@ -219,35 +205,31 @@ static ssize_t kbasep_timeline_io_read( while (copy_len < size) { struct kbase_tlstream *stream = NULL; - unsigned int rb_idx_raw = 0; - unsigned int wb_idx_raw; - unsigned int rb_idx; - size_t rb_size; + unsigned int rb_idx_raw = 0; + unsigned int wb_idx_raw; + unsigned int rb_idx; + size_t rb_size; - if (kbasep_timeline_copy_headers( - timeline, buffer, size, ©_len)) { + if (kbasep_timeline_copy_headers(timeline, buffer, size, + ©_len)) { copy_len = -EFAULT; break; } /* If we already read some packets and there is no - * packet pending then return back to user. - * If we don't have any data yet, wait for packet to be - * submitted. - */ + * packet pending then return back to user. + * If we don't have any data yet, wait for packet to be + * submitted. + */ if (copy_len > 0) { if (!kbasep_timeline_io_packet_pending( - timeline, - &stream, - &rb_idx_raw)) + timeline, &stream, &rb_idx_raw)) break; } else { if (wait_event_interruptible( - timeline->event_queue, - kbasep_timeline_io_packet_pending( - timeline, - &stream, - &rb_idx_raw))) { + timeline->event_queue, + kbasep_timeline_io_packet_pending( + timeline, &stream, &rb_idx_raw))) { copy_len = -ERESTARTSYS; break; } @@ -259,25 +241,23 @@ static ssize_t kbasep_timeline_io_read( } /* Check if this packet fits into the user buffer. - * If so copy its content. - */ + * If so copy its content. + */ rb_idx = rb_idx_raw % PACKET_COUNT; rb_size = atomic_read(&stream->buffer[rb_idx].size); if (rb_size > size - copy_len) break; - if (copy_to_user( - &buffer[copy_len], - stream->buffer[rb_idx].data, - rb_size)) { + if (copy_to_user(&buffer[copy_len], stream->buffer[rb_idx].data, + rb_size)) { copy_len = -EFAULT; break; } /* If the distance between read buffer index and write - * buffer index became more than PACKET_COUNT, then overflow - * happened and we need to ignore the last portion of bytes - * that we have just sent to user. - */ + * buffer index became more than PACKET_COUNT, then overflow + * happened and we need to ignore the last portion of bytes + * that we have just sent to user. + */ smp_rmb(); wb_idx_raw = atomic_read(&stream->wbi); @@ -310,7 +290,7 @@ static ssize_t kbasep_timeline_io_read( static unsigned int kbasep_timeline_io_poll(struct file *filp, poll_table *wait) { struct kbase_tlstream *stream; - unsigned int rb_idx; + unsigned int rb_idx; struct kbase_timeline *timeline; KBASE_DEBUG_ASSERT(filp); @@ -319,7 +299,7 @@ static unsigned int kbasep_timeline_io_poll(struct file *filp, poll_table *wait) if (WARN_ON(!filp->private_data)) return -EFAULT; - timeline = (struct kbase_timeline *) filp->private_data; + timeline = (struct kbase_timeline *)filp->private_data; /* If there are header bytes to copy, read will not block */ if (kbasep_timeline_has_header_data(timeline)) @@ -348,7 +328,7 @@ static int kbasep_timeline_io_release(struct inode *inode, struct file *filp) CSTD_UNUSED(inode); - timeline = (struct kbase_timeline *) filp->private_data; + timeline = (struct kbase_timeline *)filp->private_data; #if MALI_USE_CSF kbase_csf_tl_reader_stop(&timeline->csf_tl_reader); @@ -361,3 +341,20 @@ static int kbasep_timeline_io_release(struct inode *inode, struct file *filp) atomic_set(timeline->timeline_flags, 0); return 0; } + +static int kbasep_timeline_io_fsync(struct file *filp, loff_t start, loff_t end, + int datasync) +{ + struct kbase_timeline *timeline; + + CSTD_UNUSED(start); + CSTD_UNUSED(end); + CSTD_UNUSED(datasync); + + if (WARN_ON(!filp->private_data)) + return -EFAULT; + + timeline = (struct kbase_timeline *)filp->private_data; + + return kbase_timeline_streams_flush(timeline); +} diff --git a/mali_kbase/tl/mali_kbase_timeline_priv.h b/mali_kbase/tl/mali_kbase_timeline_priv.h index d305bb3..2825f77 100644 --- a/mali_kbase/tl/mali_kbase_timeline_priv.h +++ b/mali_kbase/tl/mali_kbase_timeline_priv.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-2021 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 @@ -69,6 +49,7 @@ * otherwise. See kbase_timeline_io_acquire(). * @obj_header_btc: Remaining bytes to copy for the object stream header * @aux_header_btc: Remaining bytes to copy for the aux stream header + * @csf_tl_reader: CSFFW timeline reader */ struct kbase_timeline { struct kbase_tlstream streams[TL_STREAM_TYPE_COUNT]; diff --git a/mali_kbase/tl/mali_kbase_tl_serialize.h b/mali_kbase/tl/mali_kbase_tl_serialize.h index 78aee83..f8cad4a 100644 --- a/mali_kbase/tl/mali_kbase_tl_serialize.h +++ b/mali_kbase/tl/mali_kbase_tl_serialize.h @@ -1,24 +1,4 @@ -/* - * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0 */ /* * * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved. diff --git a/mali_kbase/tl/mali_kbase_tlstream.c b/mali_kbase/tl/mali_kbase_tlstream.c index b682ecd..c6eb3c8 100644 --- a/mali_kbase/tl/mali_kbase_tlstream.c +++ b/mali_kbase/tl/mali_kbase_tlstream.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2015-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2015-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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_tlstream.h" @@ -279,7 +277,7 @@ void kbase_tlstream_msgbuf_release( spin_unlock_irqrestore(&stream->lock, flags); } -void kbase_tlstream_flush_stream( +size_t kbase_tlstream_flush_stream( struct kbase_tlstream *stream) { unsigned long flags; @@ -288,6 +286,7 @@ void kbase_tlstream_flush_stream( size_t wb_size; size_t min_size = PACKET_HEADER_SIZE; + if (stream->numbered) min_size += PACKET_NUMBER_SIZE; @@ -302,7 +301,14 @@ void kbase_tlstream_flush_stream( stream, wb_idx_raw, wb_size); wb_idx = (wb_idx_raw + 1) % PACKET_COUNT; atomic_set(&stream->buffer[wb_idx].size, wb_size); + } else { + /* we return that there is no bytes to be read.*/ + /* Timeline io fsync will use this info the decide whether + * fsync should return an error + */ + wb_size = 0; } + spin_unlock_irqrestore(&stream->lock, flags); + return wb_size; } - diff --git a/mali_kbase/tl/mali_kbase_tlstream.h b/mali_kbase/tl/mali_kbase_tlstream.h index 4ad4ad1..2d3bbc8 100644 --- a/mali_kbase/tl/mali_kbase_tlstream.h +++ b/mali_kbase/tl/mali_kbase_tlstream.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2015-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2015-2021 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 @@ -63,6 +43,8 @@ * struct kbase_tlstream - timeline stream structure * @lock: Message order lock * @buffer: Array of buffers + * @buffer.size: Number of bytes in buffer + * @buffer.data: Buffer's data * @wbi: Write buffer index * @rbi: Read buffer index * @numbered: If non-zero stream's packets are sequentially numbered @@ -95,8 +77,8 @@ struct kbase_tlstream { spinlock_t lock; struct { - atomic_t size; /* number of bytes in buffer */ - char data[PACKET_SIZE]; /* buffer's data */ + atomic_t size; + char data[PACKET_SIZE]; } buffer[PACKET_COUNT]; atomic_t wbi; @@ -181,8 +163,10 @@ void kbase_tlstream_msgbuf_release(struct kbase_tlstream *stream, * @stream: Pointer to the stream structure * * Flush pending data in the timeline stream. + * + * Return: Number of bytes available flushed and available to be read + * */ -void kbase_tlstream_flush_stream(struct kbase_tlstream *stream); +size_t kbase_tlstream_flush_stream(struct kbase_tlstream *stream); #endif /* _KBASE_TLSTREAM_H */ - diff --git a/mali_kbase/tl/mali_kbase_tracepoints.c b/mali_kbase/tl/mali_kbase_tracepoints.c index 9a2d7db..479f0f4 100644 --- a/mali_kbase/tl/mali_kbase_tracepoints.c +++ b/mali_kbase/tl/mali_kbase_tracepoints.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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. + * of such GNU license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ * 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/tl/mali_kbase_tracepoints.h b/mali_kbase/tl/mali_kbase_tracepoints.h index 844bdf4..a3fd7c1 100644 --- a/mali_kbase/tl/mali_kbase_tracepoints.h +++ b/mali_kbase/tl/mali_kbase_tracepoints.h @@ -1,27 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * - * (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 - * - *//* SPDX-License-Identifier: GPL-2.0 */ -/* - * - * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2021 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 |