Skip to contentSkip to conversation

IGT/tests/firmware: Test firmware loading by reading debugfs

IGT Anusha Srivatsa 3 participants 5 messages Dec 1, 2017 – Dec 5, 2017

lore
Share & tools
lore
#0 lore raw

Read debugfs and sysfs entries to check for GuC loading conditions.

The patch is still WIP. Once all check conditions are covered, it can be extended to huc debugfs file too.

---
 tests/Makefile.sources |  1 +
 tests/test_firmware.c  | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 tests/test_firmware.c
tests/Makefile.sources +1 -0
index 0f4e39a..841fc54 100644
@@ -234,6 +234,7 @@ TESTS_progs = \
 	template \
 	tools_test \
 	vgem_basic \
+	test_firmware \
 	vgem_slow \
 	$(NULL)
 
tests/test_firmware.c new file +96 -0

96 lines not on this page · raw message

Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for IGT/tests/firmware: Test firmware loading by reading debugfs

== Series Details ==

== Series Details ==

Series: IGT/tests/firmware: Test firmware loading by reading debugfs
URL : https://patchwork.freedesktop.org/series/34778/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 476c4b462e0453c70ee81664c0227fdddc26cbd0 igt/gem_eio: Increase wakeup delay for in-flight-suspend

with latest DRM-Tip kernel build CI_DRM_3434
d872b1714457 drm-tip: 2017y-12m-01d-21h-08m-31s UTC integration manifest

Testlist changes:
+igt@test_firmware@guc-load-test

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-fail -> DMESG-WARN (fi-elk-e7500) fdo#103989

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:441s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:440s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:389s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:532s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:283s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:512s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:507s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:491s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:478s
fi-elk-e7500     total:224  pass:163  dwarn:15  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:178  dwarn:1   dfail:0   fail:1   skip:108 time:270s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:546s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:357s
fi-hsw-4770r     total:288  pass:224  dwarn:0   dfail:0   fail:0   skip:64  time:261s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:397s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:485s
fi-ivb-3770      total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:449s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:489s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:531s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:469s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:532s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:585s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:461s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:544s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:565s
fi-skl-6700k     total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:519s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:502s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:450s
fi-snb-2520m     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:549s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:417s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:606s
fi-cnl-y         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:559s
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:490s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_580/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Anusha Srivatsa
Quoted 19 lines · Anusha Srivatsa

Read debugfs and sysfs entries to check for GuC loading conditions.

The patch is still WIP. Once all check conditions are covered, it can be extended to huc debugfs file too.

---
 tests/Makefile.sources |  1 +
 tests/test_firmware.c  | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 tests/test_firmware.c
tests/Makefile.sources +0 -0
index 0f4e39a..841fc54 100644

tests/Makefile.sources TESTS_progs = \ · line 237

Quoted 4 lines
tests/Makefile.sources +1 -0
@@ -234,6 +234,7 @@ TESTS_progs = \
 	template \
 	tools_test \
 	vgem_basic \
+	test_firmware \

note that igt tests names are meaningful... <area>_<testname>

so probably better to use fw_basic

tests/Makefile.sources TESTS_progs = \ · line 238

Quoted 1 line
tests/Makefile.sources +0 -0
 	vgem_slow \

and also they are more or less sorted out here...
but you added on the middle of a vgem group...

Quoted 56 lines
tests/Makefile.sources +0 -0
 	$(NULL)
 
tests/test_firmware.c new file +48 -0
new file mode 100644
index 0000000..a5d621a
@@ -0,0 +1,96 @@
+/*
+ * Copyright © 2013 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: Anusha Srivatsa
+ *
+ */
+
+#include "igt.h"
+#include "stdio.h"
+#include "stdlib.h"
+#include "igt_sysfs.h"
+#include "igt_debugfs.h"
+#include "i915_drm.h"
+#include "fcntl.h"
+
+IGT_TEST_DESCRIPTION("Read contents of debugfs to check for firmware status.");
+
+static void guc_load(int drm_fd, int debugfs, int gen)
+{
+	char firmware_buf[250];
+	float fw_version_wanted;
+	float fw_version_found;
+	int ret;
+	int enable_guc_loading;
+	FILE *fp;
+
+	igt_skip_on_f(gen < 6,
+		      "GuC not available on platforms prior to Skylake\n");
+

tests/test_firmware.c line 58

Quoted 10 lines
tests/test_firmware.c new file +10 -0
+	igt_sysfs_scanf(debugfs, "i915_enable_guc_loading", "%d", &enable_guc_loading);
+	igt_skip_on_f(!(enable_guc_loading < 1), "GuC loading not enabled\n");
+
+	ret = igt_debugfs_open(drm_fd, "i915_guc_load_status", O_RDONLY);
+	fp = fdopen(ret, "r");
+	igt_fail_on_f(ret < 0, "Not able to open the debugfs file\n");
+
+	igt_debugfs_read(drm_fd, "i915_guc_load_status", firmware_buf);
+
+	fseek(fp, 99, SEEK_CUR);

This is risky/fragile imo... any small change on debugfs this will break...

Have you consider the new kernel seftest thing to make the tests inside kernel itself without need for parse this debugfs interface?

Quoted 41 lines
tests/test_firmware.c new file +38 -0
+	fscanf(fp, "%f", &fw_version_wanted);
+	fseek(fp, 119, SEEK_SET);
+	fscanf(fp, "%f", &fw_version_found);
+
+	igt_fail_on_f((fw_version_wanted != fw_version_found),
+		      "Firmware version found not the version wanted\n");
+	igt_fail_on_f(strstr(firmware_buf, "fetch: NONE"),
+		      "Firmware not fetched\n");
+	igt_fail_on_f(strstr(firmware_buf, "fetch: SUCCESS") &&
+		      strstr(firmware_buf, "load: NONE "),
+		      "Firmware not loaded\n");
+}
+
+int drm_fd;
+int debugfs;
+int gen;
+
+igt_main
+{
+	igt_skip_on_simulation();
+	igt_fixture {
+		drm_fd = drm_open_driver(DRIVER_INTEL);
+		igt_require(drm_fd >= 0);
+
+		debugfs = igt_debugfs_dir(drm_fd);
+		gen = intel_gen(intel_get_drm_devid(drm_fd));
+	}
+
+	igt_subtest("guc-load-test")
+		guc_load(drm_fd, debugfs, gen);
+
+	igt_success();
+
+	igt_fixture {
+		close(debugfs);
+		close(drm_fd);
+	}
+}
Signature · 1 line
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 36 lines

-----Original Message-----
From: Vivi, Rodrigo
Sent: Friday, December 1, 2017 2:33 PM
To: Srivatsa, Anusha <[email protected]>
Cc: [email protected]
Subject: Re: [IGT] IGT/tests/firmware: Test firmware loading by reading debugfs

Quoted 19 lines · Anusha Srivatsa

Read debugfs and sysfs entries to check for GuC loading conditions.

The patch is still WIP. Once all check conditions are covered, it can be extended to huc debugfs file too.

---
 tests/Makefile.sources |  1 +
 tests/test_firmware.c  | 96
++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 tests/test_firmware.c
tests/Makefile.sources index renamed from tests/Makefile.sources +0 -0

0f4e39a..841fc54 100644

tests/Makefile.sources TESTS_progs = \ · line 237

Quoted 4 lines
tests/Makefile.sources +1 -0
@@ -234,6 +234,7 @@ TESTS_progs = \
 	template \
 	tools_test \
 	vgem_basic \
+	test_firmware \

note that igt tests names are meaningful... <area>_<testname>

Quoted 1 line

so probably better to use fw_basic

OK... fw_basic or fw_debugfs?

Quoted 4 lines

tests/Makefile.sources TESTS_progs = \ · line 238

Quoted 1 line
tests/Makefile.sources +0 -0
 	vgem_slow \

and also they are more or less sorted out here...
but you added on the middle of a vgem group...

Oops .... will change the order.

Quoted 72 lines
Quoted 23 lines
tests/Makefile.sources +0 -0
 	$(NULL)
 
tests/test_firmware.c new file renamed from tests/test_firmware.c +0 -0

mode 100644 index 0000000..a5d621a

tests/test_firmware.c new file +16 -0
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2013 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

tests/test_firmware.c line 26

Quoted 10 lines
tests/test_firmware.c new file +10 -0
+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

tests/test_firmware.c line 28

Quoted 2 lines
tests/test_firmware.c new file +2 -0
+SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,

DAMAGES

Quoted 24 lines
tests/test_firmware.c new file +24 -0
+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: Anusha Srivatsa
+ *
+ */
+
+#include "igt.h"
+#include "stdio.h"
+#include "stdlib.h"
+#include "igt_sysfs.h"
+#include "igt_debugfs.h"
+#include "i915_drm.h"
+#include "fcntl.h"
+
+IGT_TEST_DESCRIPTION("Read contents of debugfs to check for firmware
+status.");
+
+static void guc_load(int drm_fd, int debugfs, int gen) {
+	char firmware_buf[250];

tests/test_firmware.c

Quoted 10 lines
tests/test_firmware.c new file +10 -0
+	float fw_version_wanted;
+	float fw_version_found;
+	int ret;
+	int enable_guc_loading;
+	FILE *fp;
+
+	igt_skip_on_f(gen < 6,
+		      "GuC not available on platforms prior to Skylake\n");
+
+	igt_sysfs_scanf(debugfs, "i915_enable_guc_loading", "%d",

&enable_guc_loading);

Quoted 12 lines

tests/test_firmware.c line 58

Quoted 10 lines
tests/test_firmware.c new file +10 -0
+	igt_skip_on_f(!(enable_guc_loading < 1), "GuC loading not
+enabled\n");
+
+	ret = igt_debugfs_open(drm_fd, "i915_guc_load_status", O_RDONLY);
+	fp = fdopen(ret, "r");
+	igt_fail_on_f(ret < 0, "Not able to open the debugfs file\n");
+
+	igt_debugfs_read(drm_fd, "i915_guc_load_status", firmware_buf);
+
+	fseek(fp, 99, SEEK_CUR);

This is risky/fragile imo... any small change on debugfs this will break...

I agree totally..... I am not very happy about it either. Any suggestions on how else I can scan it?

Quoted 2 lines

Have you consider the new kernel seftest thing to make the tests inside kernel itself without need for parse this debugfs interface?

Good point. Let me have a look at it.
Thanks a lot Rodrigo.

Anusha

Quoted 33 lines
Quoted 33 lines
tests/test_firmware.c new file +33 -0
+	fscanf(fp, "%f", &fw_version_wanted);
+	fseek(fp, 119, SEEK_SET);
+	fscanf(fp, "%f", &fw_version_found);
+
+	igt_fail_on_f((fw_version_wanted != fw_version_found),
+		      "Firmware version found not the version wanted\n");
+	igt_fail_on_f(strstr(firmware_buf, "fetch: NONE"),
+		      "Firmware not fetched\n");
+	igt_fail_on_f(strstr(firmware_buf, "fetch: SUCCESS") &&
+		      strstr(firmware_buf, "load: NONE "),
+		      "Firmware not loaded\n");
+}
+
+int drm_fd;
+int debugfs;
+int gen;
+
+igt_main
+{
+	igt_skip_on_simulation();
+	igt_fixture {
+		drm_fd = drm_open_driver(DRIVER_INTEL);
+		igt_require(drm_fd >= 0);
+
+		debugfs = igt_debugfs_dir(drm_fd);
+		gen = intel_gen(intel_get_drm_devid(drm_fd));
+	}
+
+	igt_subtest("guc-load-test")
+		guc_load(drm_fd, debugfs, gen);
+
+	igt_success();
+
Quoted 8 lines
Quoted 8 lines
tests/test_firmware.c new file +5 -1
+	igt_fixture {
+		close(debugfs);
+		close(drm_fd);
+	}
+}
--

2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✗ Fi.CI.IGT: warning for IGT/tests/firmware: Test firmware loading by reading debugfs

In reply to Anusha Srivatsa
== Series Details ==

== Series Details ==

Series: IGT/tests/firmware: Test firmware loading by reading debugfs
URL : https://patchwork.freedesktop.org/series/34778/
State : warning

== Summary ==

Test gem_busy:

        Subgroup close-race:
                fail       -> PASS       (shard-snb) fdo#103829
Test kms_cursor_crc:
        Subgroup cursor-256x256-onscreen:
                pass       -> SKIP       (shard-snb)
Test kms_vblank:
        Subgroup wait-idle:
                pass       -> SKIP       (shard-snb)
Test gem_tiled_swapping:
        Subgroup non-threaded:
                pass       -> INCOMPLETE (shard-snb) fdo#104009 +1
Test kms_flip:
        Subgroup flip-vs-expired-vblank-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#102887
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                fail       -> PASS       (shard-snb) fdo#101623 +1
Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912

fdo#103829 https://bugs.freedesktop.org/show_bug.cgi?id=103829
fdo#104009 https://bugs.freedesktop.org/show_bug.cgi?id=104009
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-hsw        total:2664 pass:1536 dwarn:1   dfail:0   fail:11  skip:1116 time:9527s
shard-snb        total:2621 pass:1280 dwarn:1   dfail:0   fail:13  skip:1326 time:7763s
Blacklisted hosts:
shard-apl        total:2664 pass:1686 dwarn:2   dfail:0   fail:26  skip:949 time:13724s
shard-kbl        total:2664 pass:1790 dwarn:14  dfail:1   fail:25  skip:834 time:10889s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_580/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx