diff options
author | Jesse Hall <jessehall@google.com> | 2021-03-22 22:13:08 -0700 |
---|---|---|
committer | Jesse Hall <jessehall@google.com> | 2021-03-23 08:20:33 -0700 |
commit | e0072f7ba56eac21aeb7cdbb7b809e57be3b9e02 (patch) | |
tree | d718c89ae3aa8ebca9c6c031d7d171dec842aead | |
parent | 93bc11f6bce0fd9852b58bd0fea7ac008f2da7e5 (diff) | |
download | gpu-e0072f7ba56eac21aeb7cdbb7b809e57be3b9e02.tar.gz |
mali_pixel: consolidate mali_mgm and mali_pcm
Test: boot to Android home, check dmesg for mali-mcm and mali-pcm probe
Signed-off-by: Jesse Hall <jessehall@google.com>
Change-Id: I47a7da5fd3b4a24832e2978dcce0b99fe7b54c7c
-rw-r--r-- | mali_mgm/Makefile | 38 | ||||
-rw-r--r-- | mali_mgm/build.bp | 22 | ||||
-rw-r--r-- | mali_pcm/Kbuild | 13 | ||||
-rw-r--r-- | mali_pcm/Kconfig | 10 | ||||
-rw-r--r-- | mali_pcm/build.bp | 11 | ||||
-rw-r--r-- | mali_pixel/Kbuild (renamed from mali_mgm/Kbuild) | 26 | ||||
-rw-r--r-- | mali_pixel/Kconfig (renamed from mali_mgm/Kconfig) | 7 | ||||
-rw-r--r-- | mali_pixel/Makefile (renamed from mali_pcm/Makefile) | 3 | ||||
-rw-r--r-- | mali_pixel/mali_pixel_mod.c | 52 | ||||
-rw-r--r-- | mali_pixel/mali_pixel_mod.h | 11 | ||||
-rw-r--r-- | mali_pixel/memory_group_manager.c (renamed from mali_mgm/memory_group_manager.c) | 9 | ||||
-rw-r--r-- | mali_pixel/priority_control_manager.c (renamed from mali_pcm/priority_control_manager.c) | 9 |
12 files changed, 94 insertions, 117 deletions
diff --git a/mali_mgm/Makefile b/mali_mgm/Makefile deleted file mode 100644 index 33a5f9b..0000000 --- a/mali_mgm/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# (C) COPYRIGHT 2019 ARM Limited. All rights reserved. -# -# This program is free software and is provided to you under the terms of the -# GNU General Public License version 2 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 -# -# - -# linux build system bootstrap for out-of-tree module - -KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build -M ?= $(shell pwd) - -KBUILD_OPTIONS += CONFIG_MALI_MEMORY_GROUP_MANAGER=m - -KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any - -modules: - $(MAKE) -C $(KERNEL_SRC) M=$(M) W=1 EXTRA_CFLAGS="-I$(M) -I$(M)/../common/include" modules $(KBUILD_OPTIONS) $(@) - -modules_install: - $(MAKE) -C $(KERNEL_SRC) M=$(M) modules_install - -clean: - $(MAKE) -C $(KDIR) M=$(CURDIR) clean diff --git a/mali_mgm/build.bp b/mali_mgm/build.bp deleted file mode 100644 index 04dbfd3..0000000 --- a/mali_mgm/build.bp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * (C) COPYRIGHT 2019 ARM Limited. All rights reserved. - * - * This program is free software and is provided to you under the terms of the - * GNU General Public License version 2 as published by the Free Software - * Foundation, and any use by you of this program is subject to the terms - * of such GNU licence. - * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -bob_kernel_module { - name: "memory_group_manager", - srcs: [ - "Kbuild", - "memory_group_manager.c", - ], - kbuild_options: ["CONFIG_MALI_MEMORY_GROUP_MANAGER=m"], - defaults: ["kernel_defaults"], -} diff --git a/mali_pcm/Kbuild b/mali_pcm/Kbuild deleted file mode 100644 index 0b9ce3d..0000000 --- a/mali_pcm/Kbuild +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright 2021 Google LLC -# - -# make $(src) as absolute path if it isn't already, by prefixing $(srctree) -src:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src)) - -# Add include path for related GPU modules -ccflags-y += -I$(src)/../common/include - -obj-$(CONFIG_MALI_PRIORITY_CONTROL_MANAGER) := mali_pcm.o -mali_pcm-objs := priority_control_manager.o diff --git a/mali_pcm/Kconfig b/mali_pcm/Kconfig deleted file mode 100644 index 94a4431..0000000 --- a/mali_pcm/Kconfig +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright 2021 Google LLC -# - -config MALI_PRIORITY_CONTROL_MANAGER - tristate "MALI_PRIORITY_CONTROL_MANAGER" - help - This option enables an implementation of a priority control manager - for determining the target GPU scheduling priority of a process. diff --git a/mali_pcm/build.bp b/mali_pcm/build.bp deleted file mode 100644 index 14cc6c9..0000000 --- a/mali_pcm/build.bp +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -bob_kernel_module { - name: "priority_control_manager", - srcs: [ - "Kbuild", - "priority_control_manager.c", - ], - kbuild_options: ["CONFIG_MALI_PRIORITY_CONTROL_MANAGER=m"], - defaults: ["kernel_defaults"], -} diff --git a/mali_mgm/Kbuild b/mali_pixel/Kbuild index f3179f3..2fd00e6 100644 --- a/mali_mgm/Kbuild +++ b/mali_pixel/Kbuild @@ -22,8 +22,26 @@ # make $(src) as absolute path if it isn't already, by prefixing $(srctree) src:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src)) -# Add include path for related GPU modules -ccflags-y += -I$(src)/../common/include +CONFIG_MALI_MEMORY_GROUP_MANAGER ?= m +CONFIG_MALI_PRIORITY_CONTROL_MANAGER ?= m -obj-$(CONFIG_MALI_MEMORY_GROUP_MANAGER) := mali_mgm.o -mali_mgm-objs := memory_group_manager.o +DEFINES += \ + -DCONFIG_MALI_MEMORY_GROUP_MANAGER=$(CONFIG_MALI_MEMORY_GROUP_MANAGER) \ + -DCONFIG_MALI_PRIORITY_CONTROL_MANAGER=$(CONFIG_MALI_PRIORITY_CONTROL_MANAGER) + +# Use our defines when compiling, and include mali platform module headers +ccflags-y += $(DEFINES) -I$(src)/../common/include + +mali_pixel-objs := +ifeq ($(CONFIG_MALI_MEMORY_GROUP_MANAGER),m) + mali_pixel-objs += memory_group_manager.o +endif +ifeq ($(CONFIG_MALI_PRIORITY_CONTROL_MANAGER),m) + mali_pixel-objs += priority_control_manager.o +endif + +# Add kernel module target if any of our config options is enabled +ifneq ($(mali_pixel-objs),) + obj-m += mali_pixel.o + mali_pixel-objs += mali_pixel_mod.o +endif diff --git a/mali_mgm/Kconfig b/mali_pixel/Kconfig index da464ec..bec8add 100644 --- a/mali_mgm/Kconfig +++ b/mali_pixel/Kconfig @@ -19,10 +19,15 @@ # # - config MALI_MEMORY_GROUP_MANAGER tristate "MALI_MEMORY_GROUP_MANAGER" help This option enables an example implementation of a memory group manager for allocation and release of pages for memory pools managed by Mali GPU device drivers. + +config MALI_PRIORITY_CONTROL_MANAGER + tristate "MALI_PRIORITY_CONTROL_MANAGER" + help + This option enables an implementation of a priority control manager + for determining the target GPU scheduling priority of a process. diff --git a/mali_pcm/Makefile b/mali_pixel/Makefile index d932910..517167e 100644 --- a/mali_pcm/Makefile +++ b/mali_pixel/Makefile @@ -3,11 +3,10 @@ # Copyright 2021 Google LLC # -# linux build system bootstrap for out-of-tree module - KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build M ?= $(shell pwd) +KBUILD_OPTIONS += CONFIG_MALI_MEMORY_GROUP_MANAGER=m KBUILD_OPTIONS += CONFIG_MALI_PRIORITY_CONTROL_MANAGER=m KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any diff --git a/mali_pixel/mali_pixel_mod.c b/mali_pixel/mali_pixel_mod.c new file mode 100644 index 0000000..47b5090 --- /dev/null +++ b/mali_pixel/mali_pixel_mod.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include "mali_pixel_mod.h" +#include <linux/module.h> + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Pixel platform integration for GPU"); +MODULE_AUTHOR("<sidaths@google.com>"); +MODULE_VERSION("1.0"); + +static int __init mali_pixel_init(void) +{ + int ret = 0; + +#ifdef CONFIG_MALI_MEMORY_GROUP_MANAGER + ret = platform_driver_register(&memory_group_manager_driver); +#endif + if (ret) + goto fail_mgm; + +#ifdef CONFIG_MALI_PRIORITY_CONTROL_MANAGER + ret = platform_driver_register(&priority_control_manager_driver); +#else +#endif + if (ret) + goto fail_pcm; + + goto exit; + +fail_pcm: +#ifdef CONFIG_MALI_MEMORY_GROUP_MANAGER + platform_driver_unregister(&memory_group_manager_driver); +#endif + +fail_mgm: + /* nothing to clean up here */ + +exit: + return ret; +} +module_init(mali_pixel_init); + +static void __exit mali_pixel_exit(void) +{ +#ifdef CONFIG_MALI_PRIORITY_CONTROL_MANAGER + platform_driver_unregister(&priority_control_manager_driver); +#endif +#ifdef CONFIG_MALI_MEMORY_GROUP_MANAGER + platform_driver_unregister(&memory_group_manager_driver); +#endif +} +module_exit(mali_pixel_exit); diff --git a/mali_pixel/mali_pixel_mod.h b/mali_pixel/mali_pixel_mod.h new file mode 100644 index 0000000..0f5f0d3 --- /dev/null +++ b/mali_pixel/mali_pixel_mod.h @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <linux/platform_device.h> + +#ifdef CONFIG_MALI_MEMORY_GROUP_MANAGER +extern struct platform_driver memory_group_manager_driver; +#endif + +#ifdef CONFIG_MALI_PRIORITY_CONTROL_MANAGER +extern struct platform_driver priority_control_manager_driver; +#endif
\ No newline at end of file diff --git a/mali_mgm/memory_group_manager.c b/mali_pixel/memory_group_manager.c index be0d382..7d6422e 100644 --- a/mali_mgm/memory_group_manager.c +++ b/mali_pixel/memory_group_manager.c @@ -643,7 +643,7 @@ static const struct of_device_id memory_group_manager_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, memory_group_manager_dt_ids); -static struct platform_driver memory_group_manager_driver = { +struct platform_driver memory_group_manager_driver = { .probe = memory_group_manager_probe, .remove = memory_group_manager_remove, .driver = { @@ -658,10 +658,3 @@ static struct platform_driver memory_group_manager_driver = { .suppress_bind_attrs = true, } }; - -module_platform_driver(memory_group_manager_driver); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("SLC Memory Manager for GPU"); -MODULE_AUTHOR("<sidaths@google.com>"); -MODULE_VERSION("1.0"); diff --git a/mali_pcm/priority_control_manager.c b/mali_pixel/priority_control_manager.c index 73e72e8..90ac59d 100644 --- a/mali_pcm/priority_control_manager.c +++ b/mali_pixel/priority_control_manager.c @@ -145,7 +145,7 @@ static const struct of_device_id priority_control_manager_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, priority_control_manager_dt_ids); -static struct platform_driver priority_control_manager_driver = { +struct platform_driver priority_control_manager_driver = { .probe = priority_control_manager_probe, .remove = priority_control_manager_remove, .driver = { @@ -155,10 +155,3 @@ static struct platform_driver priority_control_manager_driver = { .suppress_bind_attrs = true, } }; - -module_platform_driver(priority_control_manager_driver); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Priority Control Manager for GPU"); -MODULE_AUTHOR("<sidaths@google.com>"); -MODULE_VERSION("1.0"); |