summaryrefslogtreecommitdiff
path: root/mali_kbase/tests/kutf
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2021-11-23 14:38:46 -0800
committerJesse Hall <jessehall@google.com>2021-11-23 14:38:46 -0800
commit0c596dc70431fa2c70021fa1685e3efc969a852d (patch)
tree8c6cfe8da5d3bea214e991cc4438988f65d9081e /mali_kbase/tests/kutf
parentbbbb1cf6bb211bb2094dd66656966277c326867f (diff)
downloadgpu-0c596dc70431fa2c70021fa1685e3efc969a852d.tar.gz
Mali Valhall Android DDK r34p0-00dev1
Provenance: 046d23c969 (collaborate/google/android/v_r34p0-00dev1) VX504X08X-BU-00000-r34p0-00dev1 - Valhall Android DDK VX504X08X-SW-99006-r34p0-00dev1 - Valhall Android Renderscript AOSP parts Documentation from VX504X08X-BU-00000 omitted. Signed-off-by: Jesse Hall <jessehall@google.com> Change-Id: I4ebbb3a3af709bd39f883eed3b35bf4657a95797
Diffstat (limited to 'mali_kbase/tests/kutf')
-rw-r--r--mali_kbase/tests/kutf/kutf_helpers.c46
-rw-r--r--mali_kbase/tests/kutf/kutf_suite.c24
2 files changed, 57 insertions, 13 deletions
diff --git a/mali_kbase/tests/kutf/kutf_helpers.c b/mali_kbase/tests/kutf/kutf_helpers.c
index c075428..d76cebe 100644
--- a/mali_kbase/tests/kutf/kutf_helpers.c
+++ b/mali_kbase/tests/kutf/kutf_helpers.c
@@ -21,7 +21,6 @@
/* Kernel UTF test helpers */
#include <kutf/kutf_helpers.h>
-
#include <linux/err.h>
#include <linux/jiffies.h>
#include <linux/sched.h>
@@ -29,6 +28,10 @@
#include <linux/wait.h>
#include <linux/uaccess.h>
#include <linux/export.h>
+#include <linux/io.h>
+#include <linux/delay.h>
+#include "gpu/mali_kbase_gpu_regmap.h"
+#include <device/mali_kbase_device.h>
static DEFINE_SPINLOCK(kutf_input_lock);
@@ -128,3 +131,44 @@ void kutf_helper_input_enqueue_end_of_data(struct kutf_context *context)
{
kutf_helper_input_enqueue(context, NULL, 0);
}
+
+/* Values are taken from juno-fpga.dtsi */
+#define FPGA_SYSCTL_START_ADDR ((resource_size_t)0x6f020000)
+#define FPGA_SYSCTL_SIZE ((size_t)0xCC)
+
+/* Offset of FPGA_SYSCTL_GPU_RESET_REG register */
+#define FPGA_SYSCTL_GPU_RESET_REG 0x64
+#define GPU_RESET_HIGH 0x1
+#define GPU_RESET_LOW 0x0
+
+int kutf_helper_external_reset_gpu(void)
+{
+ void __iomem *regs = NULL;
+ void __iomem *gpu_reset_reg = NULL;
+ int error = -ENXIO;
+ int repeat = 100;
+
+ regs = ioremap(FPGA_SYSCTL_START_ADDR, FPGA_SYSCTL_SIZE);
+ if (!regs)
+ return -ENOMEM;
+
+ /* Reset GPU via SYSCTL_GPU_RESET by rising & falling the reset signal */
+ gpu_reset_reg = regs + FPGA_SYSCTL_GPU_RESET_REG;
+ while (error && repeat--) {
+ writel(GPU_RESET_HIGH, gpu_reset_reg);
+ if (readl(gpu_reset_reg) == GPU_RESET_HIGH) {
+ mdelay(100);
+ writel(GPU_RESET_LOW, gpu_reset_reg);
+ mdelay(100);
+
+ /* Succeed in resetting GPU */
+ if (readl(gpu_reset_reg) == GPU_RESET_LOW)
+ error = 0;
+ }
+ }
+
+ iounmap(regs);
+
+ return error;
+}
+EXPORT_SYMBOL(kutf_helper_external_reset_gpu);
diff --git a/mali_kbase/tests/kutf/kutf_suite.c b/mali_kbase/tests/kutf/kutf_suite.c
index 6745299..d45d9df 100644
--- a/mali_kbase/tests/kutf/kutf_suite.c
+++ b/mali_kbase/tests/kutf/kutf_suite.c
@@ -582,7 +582,7 @@ static int create_fixture_variant(struct kutf_test_function *test_func,
snprintf(name, sizeof(name), "%d", fixture_index);
test_fix->dir = debugfs_create_dir(name, test_func->dir);
- if (!test_func->dir) {
+ if (IS_ERR_OR_NULL(test_func->dir)) {
pr_err("Failed to create debugfs directory when adding fixture\n");
/* Might not be the right error, we don't get it passed back to us */
err = -EEXIST;
@@ -591,7 +591,7 @@ static int create_fixture_variant(struct kutf_test_function *test_func,
tmp = debugfs_create_file("type", S_IROTH, test_fix->dir, "fixture\n",
&kutf_debugfs_const_string_ops);
- if (!tmp) {
+ if (IS_ERR_OR_NULL(tmp)) {
pr_err("Failed to create debugfs file \"type\" when adding fixture\n");
/* Might not be the right error, we don't get it passed back to us */
err = -EEXIST;
@@ -606,7 +606,7 @@ static int create_fixture_variant(struct kutf_test_function *test_func,
"run", 0600, test_fix->dir,
test_fix,
&kutf_debugfs_run_ops);
- if (!tmp) {
+ if (IS_ERR_OR_NULL(tmp)) {
pr_err("Failed to create debugfs file \"run\" when adding fixture\n");
/* Might not be the right error, we don't get it passed back to us */
err = -EEXIST;
@@ -666,14 +666,14 @@ void kutf_add_test_with_filters_and_data(
INIT_LIST_HEAD(&test_func->variant_list);
test_func->dir = debugfs_create_dir(name, suite->dir);
- if (!test_func->dir) {
+ if (IS_ERR_OR_NULL(test_func->dir)) {
pr_err("Failed to create debugfs directory when adding test %s\n", name);
goto fail_dir;
}
tmp = debugfs_create_file("type", S_IROTH, test_func->dir, "test\n",
&kutf_debugfs_const_string_ops);
- if (!tmp) {
+ if (IS_ERR_OR_NULL(tmp)) {
pr_err("Failed to create debugfs file \"type\" when adding test %s\n", name);
goto fail_file;
}
@@ -686,7 +686,7 @@ void kutf_add_test_with_filters_and_data(
tmp = debugfs_create_x32("filters", S_IROTH, test_func->dir,
&test_func->filters);
#endif
- if (!tmp) {
+ if (IS_ERR_OR_NULL(tmp)) {
pr_err("Failed to create debugfs file \"filters\" when adding test %s\n", name);
goto fail_file;
}
@@ -698,7 +698,7 @@ void kutf_add_test_with_filters_and_data(
#else
tmp = debugfs_create_u32("test_id", S_IROTH, test_func->dir,
&test_func->test_id);
- if (!tmp) {
+ if (IS_ERR_OR_NULL(tmp)) {
pr_err("Failed to create debugfs file \"test_id\" when adding test %s\n", name);
goto fail_file;
}
@@ -805,14 +805,14 @@ struct kutf_suite *kutf_create_suite_with_filters_and_data(
}
suite->dir = debugfs_create_dir(name, app->dir);
- if (!suite->dir) {
+ if (IS_ERR_OR_NULL(suite->dir)) {
pr_err("Failed to create debugfs directory when adding test %s\n", name);
goto fail_debugfs;
}
tmp = debugfs_create_file("type", S_IROTH, suite->dir, "suite\n",
&kutf_debugfs_const_string_ops);
- if (!tmp) {
+ if (IS_ERR_OR_NULL(tmp)) {
pr_err("Failed to create debugfs file \"type\" when adding test %s\n", name);
goto fail_file;
}
@@ -913,14 +913,14 @@ struct kutf_application *kutf_create_application(const char *name)
}
app->dir = debugfs_create_dir(name, base_dir);
- if (!app->dir) {
+ if (IS_ERR_OR_NULL(app->dir)) {
pr_err("Failed to create debugfs direcotry when creating application %s\n", name);
goto fail_debugfs;
}
tmp = debugfs_create_file("type", S_IROTH, app->dir, "application\n",
&kutf_debugfs_const_string_ops);
- if (!tmp) {
+ if (IS_ERR_OR_NULL(tmp)) {
pr_err("Failed to create debugfs file \"type\" when creating application %s\n", name);
goto fail_file;
}
@@ -1172,7 +1172,7 @@ static int __init init_kutf_core(void)
return -ENOMEM;
base_dir = debugfs_create_dir("kutf_tests", NULL);
- if (!base_dir) {
+ if (IS_ERR_OR_NULL(base_dir)) {
destroy_workqueue(kutf_workq);
kutf_workq = NULL;
return -ENOMEM;