summaryrefslogtreecommitdiff
path: root/mali_kbase/tests
diff options
context:
space:
mode:
authorJack Diver <diverj@google.com>2022-09-02 11:38:04 +0000
committerJack Diver <diverj@google.com>2022-09-02 14:33:02 +0000
commitc30533582604fe0365bc3ce4e9e8e19dec3109da (patch)
tree2dc4d074c820b535e9f18b8cd81d7e91bff042e5 /mali_kbase/tests
parent88d7d984fed1c2a4358ce2bbc334e82d71e3a391 (diff)
downloadgpu-c30533582604fe0365bc3ce4e9e8e19dec3109da.tar.gz
Mali Valhall Android DDK r38p1-01eac0
VX504X08X-BU-00000-r38p1-01eac0 - Valhall Android DDK VX504X08X-BU-60000-r38p1-01eac0 - Valhall Android Document Bundle VX504X08X-DC-11001-r38p1-01eac0 - Valhall Android DDK Software Errata VX504X08X-SW-99006-r38p1-01eac0 - Valhall Android Renderscript AOSP parts Signed-off-by: Jack Diver <diverj@google.com> Change-Id: I242060ad8ddc14475bda657cbbbe6b6c26ecfd57
Diffstat (limited to 'mali_kbase/tests')
-rw-r--r--mali_kbase/tests/Kbuild3
-rw-r--r--mali_kbase/tests/Kconfig14
-rw-r--r--mali_kbase/tests/Mconfig14
-rw-r--r--mali_kbase/tests/kutf/kutf_helpers_user.c4
-rw-r--r--mali_kbase/tests/kutf/kutf_suite.c35
-rw-r--r--mali_kbase/tests/kutf/kutf_utils.c4
-rw-r--r--mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c12
-rw-r--r--mali_kbase/tests/mali_kutf_irq_test/mali_kutf_irq_test_main.c2
-rw-r--r--mali_kbase/tests/mali_kutf_mgm_integration_test/Kbuild25
-rw-r--r--mali_kbase/tests/mali_kutf_mgm_integration_test/build.bp41
-rw-r--r--mali_kbase/tests/mali_kutf_mgm_integration_test/mali_kutf_mgm_integration_test_main.c210
11 files changed, 327 insertions, 37 deletions
diff --git a/mali_kbase/tests/Kbuild b/mali_kbase/tests/Kbuild
index ee3de7b..38e4dd4 100644
--- a/mali_kbase/tests/Kbuild
+++ b/mali_kbase/tests/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
#
-# (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2017, 2020-2022 ARM Limited. All rights reserved.
#
# This program is 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,4 +27,5 @@ subdir-ccflags-y += -I$(src)/include \
obj-$(CONFIG_MALI_KUTF) += kutf/
obj-$(CONFIG_MALI_KUTF_IRQ_TEST) += mali_kutf_irq_test/
obj-$(CONFIG_MALI_KUTF_CLK_RATE_TRACE) += mali_kutf_clk_rate_trace/kernel/
+obj-$(CONFIG_MALI_KUTF_MGM_INTEGRATION) += mali_kutf_mgm_integration_test/
diff --git a/mali_kbase/tests/Kconfig b/mali_kbase/tests/Kconfig
index a86e1ce..e6f0376 100644
--- a/mali_kbase/tests/Kconfig
+++ b/mali_kbase/tests/Kconfig
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
#
-# (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2017, 2020-2022 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -52,6 +52,18 @@ config MALI_KUTF_CLK_RATE_TRACE
Modules:
- mali_kutf_clk_rate_trace_test_portal.ko
+config MALI_KUTF_MGM_INTEGRATION_TEST
+ bool "Build Mali KUTF MGM integration test module"
+ depends on MALI_KUTF
+ default y
+ help
+ This option will build the MGM integration test module.
+ It can test the implementation of PTE translation for specific
+ group ids.
+
+ Modules:
+ - mali_kutf_mgm_integration_test.ko
+
comment "Enable MALI_DEBUG for KUTF modules support"
depends on MALI_MIDGARD && !MALI_DEBUG && MALI_KUTF
diff --git a/mali_kbase/tests/Mconfig b/mali_kbase/tests/Mconfig
index 167facd..4203971 100644
--- a/mali_kbase/tests/Mconfig
+++ b/mali_kbase/tests/Mconfig
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
#
-# (C) COPYRIGHT 2018-2021 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2018-2022 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -52,6 +52,18 @@ config MALI_KUTF_CLK_RATE_TRACE
Modules:
- mali_kutf_clk_rate_trace_test_portal.ko
+config MALI_KUTF_MGM_INTEGRATION_TEST
+ bool "Build Mali KUTF MGM integration test module"
+ depends on MALI_KUTF
+ default y
+ help
+ This option will build the MGM integration test module.
+ It can test the implementation of PTE translation for specific
+ group ids.
+
+ Modules:
+ - mali_kutf_mgm_integration_test.ko
+
# Enable MALI_DEBUG for KUTF modules support
diff --git a/mali_kbase/tests/kutf/kutf_helpers_user.c b/mali_kbase/tests/kutf/kutf_helpers_user.c
index f88e138..c4e2943 100644
--- a/mali_kbase/tests/kutf/kutf_helpers_user.c
+++ b/mali_kbase/tests/kutf/kutf_helpers_user.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
/*
*
- * (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017, 2020-2022 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -28,7 +28,7 @@
#include <linux/slab.h>
#include <linux/export.h>
-const char *valtype_names[] = {
+static const char *const valtype_names[] = {
"INVALID",
"U64",
"STR",
diff --git a/mali_kbase/tests/kutf/kutf_suite.c b/mali_kbase/tests/kutf/kutf_suite.c
index 91065b5..4468066 100644
--- a/mali_kbase/tests/kutf/kutf_suite.c
+++ b/mali_kbase/tests/kutf/kutf_suite.c
@@ -106,22 +106,16 @@ struct kutf_convert_table {
enum kutf_result_status result;
};
-struct kutf_convert_table kutf_convert[] = {
-#define ADD_UTF_RESULT(_name) \
-{ \
- #_name, \
- _name, \
-},
-ADD_UTF_RESULT(KUTF_RESULT_BENCHMARK)
-ADD_UTF_RESULT(KUTF_RESULT_SKIP)
-ADD_UTF_RESULT(KUTF_RESULT_UNKNOWN)
-ADD_UTF_RESULT(KUTF_RESULT_PASS)
-ADD_UTF_RESULT(KUTF_RESULT_DEBUG)
-ADD_UTF_RESULT(KUTF_RESULT_INFO)
-ADD_UTF_RESULT(KUTF_RESULT_WARN)
-ADD_UTF_RESULT(KUTF_RESULT_FAIL)
-ADD_UTF_RESULT(KUTF_RESULT_FATAL)
-ADD_UTF_RESULT(KUTF_RESULT_ABORT)
+static const struct kutf_convert_table kutf_convert[] = {
+#define ADD_UTF_RESULT(_name) \
+ { \
+#_name, _name, \
+ }
+ ADD_UTF_RESULT(KUTF_RESULT_BENCHMARK), ADD_UTF_RESULT(KUTF_RESULT_SKIP),
+ ADD_UTF_RESULT(KUTF_RESULT_UNKNOWN), ADD_UTF_RESULT(KUTF_RESULT_PASS),
+ ADD_UTF_RESULT(KUTF_RESULT_DEBUG), ADD_UTF_RESULT(KUTF_RESULT_INFO),
+ ADD_UTF_RESULT(KUTF_RESULT_WARN), ADD_UTF_RESULT(KUTF_RESULT_FAIL),
+ ADD_UTF_RESULT(KUTF_RESULT_FATAL), ADD_UTF_RESULT(KUTF_RESULT_ABORT),
};
#define UTF_CONVERT_SIZE (ARRAY_SIZE(kutf_convert))
@@ -191,8 +185,7 @@ static void kutf_set_expected_result(struct kutf_context *context,
*
* Return: 1 if test result was successfully converted to string, 0 otherwise
*/
-static int kutf_result_to_string(char **result_str,
- enum kutf_result_status result)
+static int kutf_result_to_string(const char **result_str, enum kutf_result_status result)
{
int i;
int ret = 0;
@@ -382,7 +375,7 @@ static ssize_t kutf_debugfs_run_read(struct file *file, char __user *buf,
struct kutf_result *res;
unsigned long bytes_not_copied;
ssize_t bytes_copied = 0;
- char *kutf_str_ptr = NULL;
+ const char *kutf_str_ptr = NULL;
size_t kutf_str_len = 0;
size_t message_len = 0;
char separator = ':';
@@ -599,11 +592,7 @@ static int create_fixture_variant(struct kutf_test_function *test_func,
goto fail_file;
}
-#if KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE
tmp = debugfs_create_file_unsafe(
-#else
- tmp = debugfs_create_file(
-#endif
"run", 0600, test_fix->dir,
test_fix,
&kutf_debugfs_run_ops);
diff --git a/mali_kbase/tests/kutf/kutf_utils.c b/mali_kbase/tests/kutf/kutf_utils.c
index 2ae1510..21f5fad 100644
--- a/mali_kbase/tests/kutf/kutf_utils.c
+++ b/mali_kbase/tests/kutf/kutf_utils.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
/*
*
- * (C) COPYRIGHT 2014, 2017, 2020-2021 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017, 2020-2022 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -31,7 +31,7 @@
static char tmp_buffer[KUTF_MAX_DSPRINTF_LEN];
-DEFINE_MUTEX(buffer_lock);
+static DEFINE_MUTEX(buffer_lock);
const char *kutf_dsprintf(struct kutf_mempool *pool,
const char *fmt, ...)
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 935f8ca..2d7289d 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
@@ -46,7 +46,7 @@
#define MINOR_FOR_FIRST_KBASE_DEV (-1)
/* KUTF test application pointer for this test */
-struct kutf_application *kutf_app;
+static struct kutf_application *kutf_app;
enum portal_server_state {
PORTAL_STATE_NO_CLK,
@@ -113,7 +113,7 @@ struct kbasep_cmd_name_pair {
const char *name;
};
-struct kbasep_cmd_name_pair kbasep_portal_cmd_name_map[] = {
+static const struct kbasep_cmd_name_pair kbasep_portal_cmd_name_map[] = {
{ PORTAL_CMD_GET_PLATFORM, GET_PLATFORM },
{ PORTAL_CMD_GET_CLK_RATE_MGR, GET_CLK_RATE_MGR },
{ PORTAL_CMD_GET_CLK_RATE_TRACE, GET_CLK_RATE_TRACE },
@@ -128,7 +128,7 @@ struct kbasep_cmd_name_pair kbasep_portal_cmd_name_map[] = {
* this pointer is engaged, new requests for create fixture will fail
* hence limiting the use of the portal at any time to a singleton.
*/
-struct kutf_clk_rate_trace_fixture_data *g_ptr_portal_data;
+static struct kutf_clk_rate_trace_fixture_data *g_ptr_portal_data;
#define PORTAL_MSG_LEN (KUTF_MAX_LINE_LENGTH - MAX_REPLY_NAME_LEN)
static char portal_msg_buf[PORTAL_MSG_LEN];
@@ -825,14 +825,14 @@ static void *mali_kutf_clk_rate_trace_create_fixture(
if (!data)
return NULL;
- *data = (const struct kutf_clk_rate_trace_fixture_data) { 0 };
+ *data = (const struct kutf_clk_rate_trace_fixture_data){ NULL };
pr_debug("Hooking up the test portal to kbdev clk rate trace\n");
spin_lock(&kbdev->pm.clk_rtm.lock);
if (g_ptr_portal_data != NULL) {
pr_warn("Test portal is already in use, run aborted\n");
- kutf_test_fail(context, "Portal allows single session only");
spin_unlock(&kbdev->pm.clk_rtm.lock);
+ kutf_test_fail(context, "Portal allows single session only");
return NULL;
}
@@ -909,7 +909,7 @@ static int __init mali_kutf_clk_rate_trace_test_module_init(void)
{
struct kutf_suite *suite;
unsigned int filters;
- union kutf_callback_data suite_data = { 0 };
+ union kutf_callback_data suite_data = { NULL };
pr_debug("Creating app\n");
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 5824a4c..2d6e689 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
@@ -40,7 +40,7 @@
*/
/* KUTF test application pointer for this test */
-struct kutf_application *irq_app;
+static struct kutf_application *irq_app;
/**
* struct kutf_irq_fixture_data - test fixture used by the test functions.
diff --git a/mali_kbase/tests/mali_kutf_mgm_integration_test/Kbuild b/mali_kbase/tests/mali_kutf_mgm_integration_test/Kbuild
new file mode 100644
index 0000000..e9bff98
--- /dev/null
+++ b/mali_kbase/tests/mali_kutf_mgm_integration_test/Kbuild
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
+#
+# (C) COPYRIGHT 2022 ARM Limited. All rights reserved.
+#
+# This program is free software and is provided to you under the terms of the
+# GNU General Public License version 2 as published by the Free Software
+# Foundation, and any use by you of this program is subject to the terms
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+#
+
+ifeq ($(CONFIG_MALI_KUTF_MGM_INTEGRATION_TEST),y)
+obj-m += mali_kutf_mgm_integration_test.o
+
+mali_kutf_mgm_integration_test-y := mali_kutf_mgm_integration_test_main.o
+endif
diff --git a/mali_kbase/tests/mali_kutf_mgm_integration_test/build.bp b/mali_kbase/tests/mali_kutf_mgm_integration_test/build.bp
new file mode 100644
index 0000000..2e4a083
--- /dev/null
+++ b/mali_kbase/tests/mali_kutf_mgm_integration_test/build.bp
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ *
+ * (C) COPYRIGHT 2022 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
+ */
+bob_kernel_module {
+ name: "mali_kutf_mgm_integration_test",
+ defaults: [
+ "mali_kbase_shared_config_defaults",
+ "kernel_test_configs",
+ "kernel_test_includes",
+ ],
+ srcs: [
+ "Kbuild",
+ "mali_kutf_mgm_integration_test_main.c",
+ ],
+ extra_symbols: [
+ "mali_kbase",
+ "kutf",
+ ],
+ enabled: false,
+ mali_kutf_mgm_integration_test: {
+ kbuild_options: ["CONFIG_MALI_KUTF_MGM_INTEGRATION_TEST=y"],
+ enabled: true,
+ },
+} \ No newline at end of file
diff --git a/mali_kbase/tests/mali_kutf_mgm_integration_test/mali_kutf_mgm_integration_test_main.c b/mali_kbase/tests/mali_kutf_mgm_integration_test/mali_kutf_mgm_integration_test_main.c
new file mode 100644
index 0000000..5a42bd6
--- /dev/null
+++ b/mali_kbase/tests/mali_kutf_mgm_integration_test/mali_kutf_mgm_integration_test_main.c
@@ -0,0 +1,210 @@
+// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
+/*
+ *
+ * (C) COPYRIGHT 2022 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
+ */
+#include <linux/module.h>
+#include "mali_kbase.h"
+#include <kutf/kutf_suite.h>
+#include <kutf/kutf_utils.h>
+#include <kutf/kutf_helpers.h>
+#include <kutf/kutf_helpers_user.h>
+
+#define MINOR_FOR_FIRST_KBASE_DEV (-1)
+
+#define BASE_MEM_GROUP_COUNT (16)
+#define PA_MAX ((1ULL << 48) - 1)
+#define PA_START_BIT 12
+#define ENTRY_ACCESS_BIT (1ULL << 10)
+
+#define ENTRY_IS_ATE_L3 3ULL
+#define ENTRY_IS_ATE_L02 1ULL
+
+#define MGM_INTEGRATION_SUITE_NAME "mgm_integration"
+#define MGM_INTEGRATION_PTE_TRANSLATION "pte_translation"
+
+static char msg_buf[KUTF_MAX_LINE_LENGTH];
+
+/* KUTF test application pointer for this test */
+struct kutf_application *mgm_app;
+
+/**
+ * struct kutf_mgm_fixture_data - test fixture used by test functions
+ * @kbdev: kbase device for the GPU.
+ * @group_id: Memory group ID to test based on fixture index.
+ */
+struct kutf_mgm_fixture_data {
+ struct kbase_device *kbdev;
+ int group_id;
+};
+
+/**
+ * mali_kutf_mgm_pte_translation_test() - Tests forward and reverse translation
+ * of PTE by the MGM module
+ * @context: KUTF context within which to perform the test.
+ *
+ * This test creates PTEs with physical addresses in the range
+ * 0x0000-0xFFFFFFFFF000 and tests that mgm_update_gpu_pte() returns a different
+ * PTE and mgm_pte_to_original_pte() returns the original PTE. This is tested
+ * at MMU level 2 and 3 as mgm_update_gpu_pte() is called for ATEs only.
+ *
+ * This test is run for a specific group_id depending on the fixture_id.
+ */
+static void mali_kutf_mgm_pte_translation_test(struct kutf_context *context)
+{
+ struct kutf_mgm_fixture_data *data = context->fixture;
+ struct kbase_device *kbdev = data->kbdev;
+ struct memory_group_manager_device *mgm_dev = kbdev->mgm_dev;
+ u64 addr;
+
+ for (addr = 1 << (PA_START_BIT - 1); addr <= PA_MAX; addr <<= 1) {
+ /* Mask 1 << 11 by ~0xFFF to get 0x0000 at first iteration */
+ phys_addr_t pa = addr;
+ u8 mmu_level;
+
+ /* Test MMU level 3 and 2 (2MB pages) only */
+ for (mmu_level = MIDGARD_MMU_LEVEL(2); mmu_level <= MIDGARD_MMU_LEVEL(3);
+ mmu_level++) {
+ u64 translated_pte;
+ u64 returned_pte;
+ u64 original_pte;
+
+ if (mmu_level == MIDGARD_MMU_LEVEL(3))
+ original_pte =
+ (pa & PAGE_MASK) | ENTRY_ACCESS_BIT | ENTRY_IS_ATE_L3;
+ else
+ original_pte =
+ (pa & PAGE_MASK) | ENTRY_ACCESS_BIT | ENTRY_IS_ATE_L02;
+
+ dev_dbg(kbdev->dev, "Testing group_id=%u, mmu_level=%u, pte=0x%llx\n",
+ data->group_id, mmu_level, original_pte);
+
+ translated_pte = mgm_dev->ops.mgm_update_gpu_pte(mgm_dev, data->group_id,
+ mmu_level, original_pte);
+ if (translated_pte == original_pte) {
+ snprintf(
+ msg_buf, sizeof(msg_buf),
+ "PTE unchanged. translated_pte (0x%llx) == original_pte (0x%llx) for mmu_level=%u, group_id=%d",
+ translated_pte, original_pte, mmu_level, data->group_id);
+ kutf_test_fail(context, msg_buf);
+ return;
+ }
+
+ returned_pte = mgm_dev->ops.mgm_pte_to_original_pte(
+ mgm_dev, data->group_id, mmu_level, translated_pte);
+ dev_dbg(kbdev->dev, "\treturned_pte=%llx\n", returned_pte);
+
+ if (returned_pte != original_pte) {
+ snprintf(
+ msg_buf, sizeof(msg_buf),
+ "Original PTE not returned. returned_pte (0x%llx) != origin al_pte (0x%llx) for mmu_level=%u, group_id=%d",
+ returned_pte, original_pte, mmu_level, data->group_id);
+ kutf_test_fail(context, msg_buf);
+ return;
+ }
+ }
+ }
+ snprintf(msg_buf, sizeof(msg_buf), "Translation passed for group_id=%d", data->group_id);
+ kutf_test_pass(context, msg_buf);
+}
+
+/**
+ * mali_kutf_mgm_integration_create_fixture() - Creates the fixture data
+ * required for all tests in the mgm integration suite.
+ * @context: KUTF context.
+ *
+ * Return: Fixture data created on success or NULL on failure
+ */
+static void *mali_kutf_mgm_integration_create_fixture(struct kutf_context *context)
+{
+ struct kutf_mgm_fixture_data *data;
+ struct kbase_device *kbdev;
+
+ pr_debug("Finding kbase device\n");
+ kbdev = kbase_find_device(MINOR_FOR_FIRST_KBASE_DEV);
+ if (kbdev == NULL) {
+ kutf_test_fail(context, "Failed to find kbase device");
+ return NULL;
+ }
+ pr_debug("Creating fixture\n");
+
+ data = kutf_mempool_alloc(&context->fixture_pool, sizeof(struct kutf_mgm_fixture_data));
+ if (!data)
+ return NULL;
+ data->kbdev = kbdev;
+ data->group_id = context->fixture_index;
+
+ pr_debug("Fixture created\n");
+ return data;
+}
+
+/**
+ * mali_kutf_mgm_integration_remove_fixture() - Destroy fixture data previously
+ * created by mali_kutf_mgm_integration_create_fixture.
+ * @context: KUTF context.
+ */
+static void mali_kutf_mgm_integration_remove_fixture(struct kutf_context *context)
+{
+ struct kutf_mgm_fixture_data *data = context->fixture;
+ struct kbase_device *kbdev = data->kbdev;
+
+ kbase_release_device(kbdev);
+}
+
+/**
+ * mali_kutf_mgm_integration_test_main_init() - Module entry point for this test.
+ *
+ * Return: 0 on success, error code on failure.
+ */
+static int __init mali_kutf_mgm_integration_test_main_init(void)
+{
+ struct kutf_suite *suite;
+
+ mgm_app = kutf_create_application("mgm");
+
+ if (mgm_app == NULL) {
+ pr_warn("Creation of mgm KUTF app failed!\n");
+ return -ENOMEM;
+ }
+ suite = kutf_create_suite(mgm_app, MGM_INTEGRATION_SUITE_NAME, BASE_MEM_GROUP_COUNT,
+ mali_kutf_mgm_integration_create_fixture,
+ mali_kutf_mgm_integration_remove_fixture);
+ if (suite == NULL) {
+ pr_warn("Creation of %s suite failed!\n", MGM_INTEGRATION_SUITE_NAME);
+ kutf_destroy_application(mgm_app);
+ return -ENOMEM;
+ }
+ kutf_add_test(suite, 0x0, MGM_INTEGRATION_PTE_TRANSLATION,
+ mali_kutf_mgm_pte_translation_test);
+ return 0;
+}
+
+/**
+ * mali_kutf_mgm_integration_test_main_exit() - Module exit point for this test.
+ */
+static void __exit mali_kutf_mgm_integration_test_main_exit(void)
+{
+ kutf_destroy_application(mgm_app);
+}
+
+module_init(mali_kutf_mgm_integration_test_main_init);
+module_exit(mali_kutf_mgm_integration_test_main_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("ARM Ltd.");
+MODULE_VERSION("1.0");