Re: [PATCH i-g-t] tests/gem_guc_loading: Adding simple GuC loading test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This has been reviewed internally. LGTM.

Reviewed-by: Alex Dai <yu.dai@xxxxxxxxx>

On 01/05/2016 08:17 AM, Lukasz Fiedorowicz wrote:
Test check GuC debugfs file for successful loading confirmation

Signed-off-by: Lukasz Fiedorowicz <lukasz.fiedorowicz@xxxxxxxxx>
---
  tests/Makefile.sources  |  1 +
  tests/gem_guc_loading.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 90 insertions(+)
  create mode 100644 tests/gem_guc_loading.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index d594038..331234f 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -36,6 +36,7 @@ TESTS_progs_M = \
  	gem_flink_basic \
  	gem_flink_race \
  	gem_linear_blits \
+	gem_guc_loading \
  	gem_madvise \
  	gem_mmap \
  	gem_mmap_gtt \
diff --git a/tests/gem_guc_loading.c b/tests/gem_guc_loading.c
new file mode 100644
index 0000000..fd53a46
--- /dev/null
+++ b/tests/gem_guc_loading.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Lukasz Fiedorowicz <lukasz.fiedorowicz@xxxxxxxxx>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "igt.h"
+
+IGT_TEST_DESCRIPTION("GuC firmware loading test.");
+
+#define LOAD_STATUS_BUF_SIZE 96
+
+enum guc_status { GUC_ENABLED, GUC_DISABLED };
+
+int guc_status_fd;
+
+static void open_guc_status(void)
+{
+	guc_status_fd = igt_debugfs_open("i915_guc_load_status", O_RDONLY);
+	igt_assert_f(guc_status_fd >= 0, "Can't open i915_guc_load_status\n");
+}
+
+static enum guc_status get_guc_status(void)
+{
+	char buf[LOAD_STATUS_BUF_SIZE];
+
+	FILE *fp = fdopen(guc_status_fd, "r");
+	igt_assert_f(fp != NULL, "Can't open i915_guc_load_status file\n");
+
+	while (fgets(buf, LOAD_STATUS_BUF_SIZE, fp))
+		if ((strstr(buf, "\tload: SUCCESS\n")))
+			return GUC_ENABLED;
+
+	return GUC_DISABLED;
+}
+
+static void close_guc_status(void)
+{
+	close(guc_status_fd);
+}
+
+static void test_guc_loaded()
+{
+	igt_assert_f(get_guc_status() == GUC_ENABLED, "GuC is disabled\n");
+}
+
+igt_main
+{
+	int gfx_fd = 0;
+	int gen = 0;
+
+	igt_fixture
+	{
+		gfx_fd = drm_open_driver(DRIVER_INTEL);
+		gen = intel_gen(intel_get_drm_devid(gfx_fd));
+		igt_require(gen >= 9);
+		open_guc_status();
+	}
+
+	igt_subtest("guc_loaded") test_guc_loaded();
+
+	igt_fixture close_guc_status();
+}

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux