intel-gpu-tools: Changes to 'debian-unstable'
MAINTAINERS | 2
NEWS | 54 +
assembler/brw_eu_emit.c | 4
assembler/gram.y | 4
benchmarks/.gitignore | 3
benchmarks/Android.mk | 2
benchmarks/Makefile.sources | 1
benchmarks/ezbench.d/gem_blt.test | 4
benchmarks/ezbench.d/gem_latency.test | 24
benchmarks/ezbench.d/prime_lookup.test | 19
benchmarks/gem_blt.c | 30
benchmarks/gem_busy.c | 39 -
benchmarks/gem_latency.c | 46 +
benchmarks/gem_syslatency.c | 4
benchmarks/prime_lookup.c | 204 +++++
configure.ac | 17
demos/Makefile.sources | 2
docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml | 2
lib/Makefile.am | 11
lib/Makefile.sources | 6
lib/drmtest.c | 25
lib/igt.h | 1
lib/igt_aux.c | 450 ++++++++++--
lib/igt_aux.h | 161 ++++
lib/igt_core.c | 22
lib/igt_core.h | 30
lib/igt_debugfs.c | 33
lib/igt_debugfs.h | 12
lib/igt_draw.c | 10
lib/igt_dummyload.c | 293 +++++++
lib/igt_dummyload.h | 48 +
lib/igt_fb.c | 48 -
lib/igt_fb.h | 2
lib/igt_gt.c | 150 ++--
lib/igt_gt.h | 21
lib/igt_gvt.c | 78 --
lib/igt_kmod.c | 419 +++++++++++
lib/igt_kmod.h | 40 +
lib/igt_kms.c | 20
lib/igt_primes.c | 178 ++++
lib/igt_primes.h | 33
lib/igt_sysfs.c | 123 +++
lib/igt_sysfs.h | 3
lib/intel_chipset.c | 3
lib/intel_os.c | 16
lib/ioctl_wrappers.c | 74 +
lib/ioctl_wrappers.h | 7
lib/stubs/drm/README | 6
lib/stubs/drm/intel_aub.h | 153 ++++
overlay/igfx.c | 4
tests/Makefile.am | 1
tests/Makefile.sources | 12
tests/debugfs_wedged | 2
tests/drm_lib.sh | 64 +
tests/drm_mm.c | 32
tests/drv_hangman.c | 22
tests/drv_missed_irq.c | 18
tests/drv_module_reload.c | 332 ++++++++
tests/drv_module_reload_basic | 85 --
tests/drv_selftest.c | 32
tests/drv_suspend.c | 24
tests/eviction_common.c | 2
tests/gem_alive.c | 35
tests/gem_busy.c | 306 ++++++--
tests/gem_close_race.c | 2
tests/gem_concurrent_all.c | 79 --
tests/gem_ctx_create.c | 162 ++++
tests/gem_ctx_exec.c | 2
tests/gem_ctx_param.c | 128 +--
tests/gem_ctx_switch.c | 33
tests/gem_ctx_thrash.c | 38 -
tests/gem_eio.c | 68 +
tests/gem_evict_everything.c | 16
tests/gem_exec_async.c | 217 +++++
tests/gem_exec_big.c | 12
tests/gem_exec_create.c | 4
tests/gem_exec_fence.c | 377 ++++++++++
tests/gem_exec_flush.c | 15
tests/gem_exec_latency.c | 358 +++++++++
tests/gem_exec_nop.c | 124 ++-
tests/gem_exec_parse.c | 597 ++++++++--------
tests/gem_exec_reloc.c | 254 ++++++
tests/gem_exec_schedule.c | 501 +++++++++++++
tests/gem_exec_suspend.c | 26
tests/gem_exec_whisper.c | 536 ++++++++------
tests/gem_gtt_speed.c | 2
tests/gem_mmap_gtt.c | 271 +++++--
tests/gem_mocs_settings.c | 24
tests/gem_pread_after_blit.c | 10
tests/gem_reloc_vs_gpu.c | 10
tests/gem_reset_stats.c | 4
tests/gem_ringfill.c | 8
tests/gem_seqno_wrap.c | 60 -
tests/gem_softpin.c | 8
tests/gem_stolen.c | 2
tests/gem_storedw_loop.c | 6
tests/gem_sync.c | 52 -
tests/gem_tiled_pread_basic.c | 34
tests/gem_userptr_blits.c | 343 ++++-----
tests/gem_wait.c | 334 +++-----
tests/gem_workarounds.c | 2
tests/gvt_basic.c | 2
tests/intel-ci/README | 34
tests/intel-ci/fast-feedback.testlist | 247 ++++++
tests/kms_atomic.c | 25
tests/kms_atomic_transition.c | 225 ++++--
tests/kms_busy.c | 85 --
tests/kms_cursor_crc.c | 3
tests/kms_cursor_legacy.c | 475 ++++++++++++
tests/kms_fbcon_fbt.c | 6
tests/kms_flip.c | 364 +++------
tests/kms_frontbuffer_tracking.c | 28
tests/kms_panel_fitting.c | 23
tests/kms_pipe_color.c | 7
tests/kms_pipe_crc_basic.c | 5
tests/kms_plane.c | 3
tests/kms_plane_multiple.c | 494 +++++++++++++
tests/kms_properties.c | 102 ++
tests/kms_psr_sink_crc.c | 6
tests/kms_setmode.c | 129 ++-
tests/kms_sysfs_edid_timing | 25
tests/kms_sysfs_edid_timing.c | 97 ++
tests/pm_rpm.c | 6
tests/prime_vgem.c | 4
tests/sysfs_l3_parity | 7
tests/tools_test | 4
tests/vgem_basic.c | 78 ++
tests/vgem_reload_basic | 27
tools/.gitignore | 4
tools/Makefile.am | 2
tools/Makefile.sources | 2
tools/aubdump.c | 213 ++++-
tools/intel_aub.h | 153 ----
tools/intel_aubdump.in | 48 +
tools/intel_bios.h | 15
tools/intel_bios_reader.c | 76 +-
tools/intel_gem_info.c | 35
tools/intel_guc_logger.c | 438 +++++++++++
tools/intel_l3_parity.c | 30
tools/intel_reg.c | 2
tools/registers/kabylake | 2
141 files changed, 9699 insertions(+), 2459 deletions(-)
New commits:
commit e631bb54d263614d687645e6295739e06d4a2353
Author: Petri Latvala <petri.latvala@intel.com>
Date: Fri Dec 2 17:50:29 2016 +0200
Update NEWS, bump version to 1.17.
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
diff --git a/NEWS b/NEWS
index 6bb8056..1f824bd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,57 @@
+Release 1.17 (2016-12-02)
+-------------------------
+
+Library changes:
+
+- Added an iterator that generate primes for creating input data that
+ should not fall into any patterns that may be optimised by the
+ drivers. (Chris Wilson)
+
+- Crashes in fixture blocks now print a stacktrace. (Marius Vlad)
+
+- Added support for various system suspend/resume options. (Imre Deak)
+
+- Added linked list helpers from the Wayland project. (Lyude)
+
+- Added a generic dummy workload helper for submitting GPU workloads
+ that consume exactly a specified amount of time. (Abdiel Janulgue)
+
+- Added C functions for driver loading/unloading, pkill and lsof, for
+ converting shell script tests to C code. (Marius Vlad)
+
+Tools changes:
+
+- intel_reg: Add Kabylake support. (Jani Nikula)
+
+- intel_bios_reader: Also dump PSR info. (Ville Syrjälä)
+
+- intel_guc_logger: New tool for capturing logs from the GuC
+ firmware. (Akash Goel)
+
+- intel_aubdump: Added commandline option to stream the dump to
+ another process. (Lionel Landwerlin)
+
+- intel_aubdump: Annotate the dump with the application name and the
+ used PCI ID. (Jason Ekstrand)
+
+Benchmark changes:
+
+- gem_latency: Added support for measuring fence wakeup latencies. (Chris Wilson)
+
+- prime_lookup: New microbenchmark for stressing prime_fd_to_handle
+ and prime_handle_to_fd. (Chris Wilson)
+
+Test changes:
+
+- Multiple new tests.
+
+- Added an explicit list of tests used for Intel CI. (Petri Latvala)
+
+- Converted multiple shell script tests to C. (Marius Vlad)
+
+
+And many other bug fixes and improvements.
+
Release 1.16 (2016-09-02)
-------------------------
diff --git a/configure.ac b/configure.ac
index cba312f..0b48e6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
AC_PREREQ([2.60])
AC_INIT([intel-gpu-tools],
- [1.16],
+ [1.17],
[https://bugs.freedesktop.org/enter_bug.cgi?product=DRI&component=IGT],
[intel-gpu-tools])
commit f9e5fe7e1df20e7c398083a36a338c51507c8812
Author: Petri Latvala <petri.latvala@intel.com>
Date: Fri Dec 2 11:00:36 2016 +0200
tools: Add intel_gem_info to .gitignore
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
diff --git a/tools/.gitignore b/tools/.gitignore
index b19c908..13825a3 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -13,6 +13,7 @@ intel_error_decode
intel_firmware_decode
intel_forcewaked
intel_framebuffer_dump
+intel_gem_info
intel_gpu_frequency
intel_gpu_time
intel_gpu_top
commit 2e66e8db86d876b28d0f526682875084e9a935b6
Author: Marius Vlad <marius.c.vlad@intel.com>
Date: Thu Dec 1 14:23:58 2016 +0200
tests/kms_sysfs_edid_timing: Convert sh to C version.
The debug output for a HSW machine with two connectors (VGA and HDMI):
DEBUG: card0-VGA-1: mean.max 12896229,00ns, 12896,23us, 12,90ms, mean.avg 12785055,80ns, 12785,06us, 12,79ms
WARNING: card0-VGA-1: probe time exceed 10ms, max=12,90ms, avg=12,79ms
DEBUG: card0-HDMI-A-1: mean.max 781433,00ns, 781,43us, 0,78ms, mean.avg 706643,20ns, 706,64us, 0,71ms
v4:
- do not include the time opening the fd (Chris Wilson)
- include output from debug (Chris Wilson)
v3:
- use igt_mean for accounting (Chris Wilson)
- make it Intel-agnostic when searching for connectors (Chris Wilson)
v2:
- don't read cached values (Chris Wilson)
- warn on per connector, and fail per mean (Chris Wilson)
These are synthetic: 10ms per connector, and 50ms for all.
Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
Acked-by: Petri Latvala <petri.latvala@intel.com>
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index bfe1b8b..04dd2d5 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -218,6 +218,7 @@ TESTS_progs = \
kms_sink_crc_basic \
prime_udl \
drv_module_reload \
+ kms_sysfs_edid_timing \
$(NULL)
# IMPORTANT: The ZZ_ tests need to be run last!
@@ -228,7 +229,6 @@ TESTS_scripts_M = \
TESTS_scripts = \
debugfs_emon_crash \
drv_debugfs_reader \
- kms_sysfs_edid_timing \
sysfs_l3_parity \
test_rte_check \
tools_test \
diff --git a/tests/kms_sysfs_edid_timing b/tests/kms_sysfs_edid_timing
deleted file mode 100755
index 46ea540..0000000
--- a/tests/kms_sysfs_edid_timing
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-#
-# This check the time we take to read the content of all the possible connectors.
-# Without the edid -ENXIO patch (http://permalink.gmane.org/gmane.comp.video.dri.devel/62083),
-# we sometimes take a *really* long time. So let's just check for some reasonable timing here
-#
-
-DRM_LIB_ALLOW_NO_MASTER=1
-
-SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
-. $SOURCE_DIR/drm_lib.sh
-
-TIME1=$(date +%s%N)
-cat $(find /sys/devices/|grep drm | grep /status) > /dev/null
-TIME2=$(date +%s%N)
-
-# time in ms
-RES=$(((TIME2 - TIME1) / 1000000))
-
-if [ $RES -gt 600 ]; then
- echo "Talking to outputs took ${RES}ms, something is wrong"
- exit $IGT_EXIT_FAILURE
-fi
-
-exit $IGT_EXIT_SUCCESS
diff --git a/tests/kms_sysfs_edid_timing.c b/tests/kms_sysfs_edid_timing.c
new file mode 100644
index 0000000..1201388
--- /dev/null
+++ b/tests/kms_sysfs_edid_timing.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright © 2016 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.
+ */
+#include "igt.h"
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#define THRESHOLD_PER_CONNECTOR 10
+#define THRESHOLD_TOTAL 50
+#define CHECK_TIMES 15
+
+IGT_TEST_DESCRIPTION("This check the time we take to read the content of all "
+ "the possible connectors. Without the edid -ENXIO patch "
+ "(http://permalink.gmane.org/gmane.comp.video.dri.devel/62083), "
+ "we sometimes take a *really* long time. "
+ "So let's just check for some reasonable timing here");
+
+
+igt_simple_main
+{
+ DIR *dirp;
+ struct dirent *de;
+
+ dirp = opendir("/sys/class/drm");
+ igt_assert(dirp != NULL);
+
+ while ((de = readdir(dirp))) {
+ struct igt_mean mean = {};
+ struct stat st;
+ char path[PATH_MAX];
+ int i;
+
+ if (*de->d_name == '.')
+ continue;;
+
+ snprintf(path, sizeof(path), "/sys/class/drm/%s/status",
+ de->d_name);
+
+ if (stat(path, &st))
+ continue;
+
+ igt_mean_init(&mean);
+ for (i = 0; i < CHECK_TIMES; i++) {
+ struct timespec ts = {};
+ int fd;
+
+ if ((fd = open(path, O_WRONLY)) < 0)
+ continue;
+
+ igt_nsec_elapsed(&ts);
+ igt_ignore_warn(write(fd, "detect\n", 7));
+ igt_mean_add(&mean, igt_nsec_elapsed(&ts));
+
+ close(fd);
+ }
+
+ igt_debug("%s: mean.max %.2fns, %.2fus, %.2fms, "
+ "mean.avg %.2fns, %.2fus, %.2fms\n",
+ de->d_name,
+ mean.max, mean.max / 1e3, mean.max / 1e6,
+ mean.mean, mean.mean / 1e3, mean.mean / 1e6);
+
+ if (mean.max > (THRESHOLD_PER_CONNECTOR * 1e6)) {
+ igt_warn("%s: probe time exceed 10ms, "
+ "max=%.2fms, avg=%.2fms\n", de->d_name,
+ mean.max / 1e6, mean.mean / 1e6);
+ }
+ igt_assert_f(mean.mean < (THRESHOLD_TOTAL * 1e6),
+ "%s: average probe time exceeded 50ms, "
+ "max=%.2fms, avg=%.2fms\n", de->d_name,
+ mean.max / 1e6, mean.mean / 1e6);
+
+ }
+ closedir(dirp);
+
+}
commit 2fea8d26e589a9d256eca9f3d561750ecb3fb681
Author: Marius Vlad <marius.c.vlad@intel.com>
Date: Thu Dec 1 14:23:57 2016 +0200
tests/drv_module_reload: Convert sh script to C version.
v5:
- reword gem_info to gem_sanitychecks (Chris Wilson)
- remove subgroups/subtests for gem_exec_store and gem_sanitycheck
(Chris Wilson)
v4:
- adjust test to make use of lib/igt_kmod
- replaced SW_FINISH with SET_CACHEING (Chris Wilson)
v3:
- fix passing boolean value as flags to igt_kmod_unload().
v2:
- embedded gem_alive and gem_exec_store into test (Chris Wilson)
- int main() to igt_main (Chris Wilson)
- moved tests/gem_alive -> tools/gem_info (Chris Wilson)
- added to intel-ci/fast-feedback.testlist (Petri Latvala)
- added hda_dynamic_debug() (Petri Latvala)
- renamed from tests/drv_module_reload_basic to tests/drv_module_reload
(all subtests are basic and have been added to fast-feedback.testlist)
Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
Acked-by: Petri Latvala <petri.latvala@intel.com>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a408126..14a41ae 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,7 +26,6 @@ noinst_PROGRAMS = \
$(NULL)
pkglibexec_PROGRAMS = \
- gem_alive \
gem_stress \
$(TESTS_progs) \
$(TESTS_progs_M) \
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 9fcb93c..bfe1b8b 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -217,6 +217,7 @@ TESTS_progs = \
kms_pwrite_crc \
kms_sink_crc_basic \
prime_udl \
+ drv_module_reload \
$(NULL)
# IMPORTANT: The ZZ_ tests need to be run last!
@@ -227,7 +228,6 @@ TESTS_scripts_M = \
TESTS_scripts = \
debugfs_emon_crash \
drv_debugfs_reader \
- drv_module_reload_basic \
kms_sysfs_edid_timing \
sysfs_l3_parity \
test_rte_check \
diff --git a/tests/drv_module_reload.c b/tests/drv_module_reload.c
new file mode 100644
index 0000000..31ec2ec
--- /dev/null
+++ b/tests/drv_module_reload.c
@@ -0,0 +1,332 @@
+/*
+ * Copyright © 2016 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.
+ */
+#include "igt.h"
+#include "igt_debugfs.h"
+#include "igt_aux.h"
+#include "igt_kmod.h"
+#include "igt_sysfs.h"
+#include "igt_core.h"
+
+#include <dirent.h>
+#include <sys/utsname.h>
+#include <linux/limits.h>
+#include <signal.h>
+#include <libgen.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+
+
+#define LOCAL_I915_EXEC_BSD_SHIFT (13)
+#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT)
+
+#define ENGINE_MASK (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
+
+static void store_dword(int fd, unsigned ring)
+{
+ const int gen = intel_gen(intel_get_drm_devid(fd));
+ struct drm_i915_gem_exec_object2 obj[2];
+ struct drm_i915_gem_relocation_entry reloc;
+ struct drm_i915_gem_execbuffer2 execbuf;
+ uint32_t batch[16];
+ int i;
+
+ if (!gem_has_ring(fd, ring))
+ return;
+
+ if (gen == 6 && (ring & ~(3<<13)) == I915_EXEC_BSD)
+ return;
+
+ intel_detect_and_clear_missed_interrupts(fd);
+ memset(&execbuf, 0, sizeof(execbuf));
+ execbuf.buffers_ptr = (uintptr_t)obj;
+ execbuf.buffer_count = 2;
+ execbuf.flags = ring;
+ if (gen < 6)
+ execbuf.flags |= I915_EXEC_SECURE;
+
+ memset(obj, 0, sizeof(obj));
+ obj[0].handle = gem_create(fd, 4096);
+ obj[1].handle = gem_create(fd, 4096);
+
+ memset(&reloc, 0, sizeof(reloc));
+ reloc.target_handle = obj[0].handle;
+ reloc.presumed_offset = 0;
+ reloc.offset = sizeof(uint32_t);
+ reloc.delta = 0;
+ reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION;
+ reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION;
+ obj[1].relocs_ptr = (uintptr_t)&reloc;
+ obj[1].relocation_count = 1;
+
+ i = 0;
+ batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
+ if (gen >= 8) {
+ batch[++i] = 0;
+ batch[++i] = 0;
+ } else if (gen >= 4) {
+ batch[++i] = 0;
+ batch[++i] = 0;
+ reloc.offset += sizeof(uint32_t);
+ } else {
+ batch[i]--;
+ batch[++i] = 0;
+ }
+ batch[++i] = 0xc0ffee;
+ batch[++i] = MI_BATCH_BUFFER_END;
+ gem_write(fd, obj[1].handle, 0, batch, sizeof(batch));
+ gem_execbuf(fd, &execbuf);
+ gem_close(fd, obj[1].handle);
+
+ gem_read(fd, obj[0].handle, 0, batch, sizeof(batch));
+ gem_close(fd, obj[0].handle);
+ igt_assert_eq(*batch, 0xc0ffee);
+ igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
+}
+
+static void store_all(int fd)
+{
+ const int gen = intel_gen(intel_get_drm_devid(fd));
+ struct drm_i915_gem_exec_object2 obj[2];
+ struct drm_i915_gem_relocation_entry reloc[32];
+ struct drm_i915_gem_execbuffer2 execbuf;
+ unsigned engines[16], permuted[16];
+ uint32_t batch[16];
+ uint64_t offset;
+ unsigned engine, nengine;
+ int value;
+ int i, j;
+
+ memset(&execbuf, 0, sizeof(execbuf));
+ execbuf.buffers_ptr = (uintptr_t)obj;
+ execbuf.buffer_count = 2;
+ if (gen < 6)
+ execbuf.flags |= I915_EXEC_SECURE;
+
+ memset(reloc, 0, sizeof(reloc));
+ memset(obj, 0, sizeof(obj));
+ obj[0].handle = gem_create(fd, 4096);
+ obj[1].handle = gem_create(fd, 4096);
+ obj[1].relocation_count = 1;
+
+ offset = sizeof(uint32_t);
+ i = 0;
+ batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
+ if (gen >= 8) {
+ batch[++i] = 0;
+ batch[++i] = 0;
+ } else if (gen >= 4) {
+ batch[++i] = 0;
+ batch[++i] = 0;
+ offset += sizeof(uint32_t);
+ } else {
+ batch[i]--;
+ batch[++i] = 0;
+ }
+ batch[value = ++i] = 0xc0ffee;
+ batch[++i] = MI_BATCH_BUFFER_END;
+
+ nengine = 0;
+ intel_detect_and_clear_missed_interrupts(fd);
+ for_each_engine(fd, engine) {
+ if (gen == 6 && (engine & ~(3<<13)) == I915_EXEC_BSD)
+ continue;
+
+ igt_assert(2*(nengine+1)*sizeof(batch) <= 4096);
+
+ execbuf.flags &= ~ENGINE_MASK;
+ execbuf.flags |= engine;
+
+ j = 2*nengine;
+ reloc[j].target_handle = obj[0].handle;
+ reloc[j].presumed_offset = ~0;
+ reloc[j].offset = j*sizeof(batch) + offset;
+ reloc[j].delta = nengine*sizeof(uint32_t);
+ reloc[j].read_domains = I915_GEM_DOMAIN_INSTRUCTION;
+ reloc[j].write_domain = I915_GEM_DOMAIN_INSTRUCTION;
+ obj[1].relocs_ptr = (uintptr_t)&reloc[j];
+
+ batch[value] = 0xdeadbeef;
+ gem_write(fd, obj[1].handle, j*sizeof(batch),
+ batch, sizeof(batch));
+ execbuf.batch_start_offset = j*sizeof(batch);
+ gem_execbuf(fd, &execbuf);
+
+ j = 2*nengine + 1;
+ reloc[j].target_handle = obj[0].handle;
+ reloc[j].presumed_offset = ~0;
+ reloc[j].offset = j*sizeof(batch) + offset;
+ reloc[j].delta = nengine*sizeof(uint32_t);
+ reloc[j].read_domains = I915_GEM_DOMAIN_INSTRUCTION;
+ reloc[j].write_domain = I915_GEM_DOMAIN_INSTRUCTION;
+ obj[1].relocs_ptr = (uintptr_t)&reloc[j];
+
+ batch[value] = nengine;
+ gem_write(fd, obj[1].handle, j*sizeof(batch),
+ batch, sizeof(batch));
+ execbuf.batch_start_offset = j*sizeof(batch);
+ gem_execbuf(fd, &execbuf);
+
+ engines[nengine++] = engine;
+ }
+ gem_sync(fd, obj[1].handle);
+
+ for (i = 0; i < nengine; i++) {
+ obj[1].relocs_ptr = (uintptr_t)&reloc[2*i];
+ execbuf.batch_start_offset = 2*i*sizeof(batch);
+ memcpy(permuted, engines, nengine*sizeof(engines[0]));
+ igt_permute_array(permuted, nengine, igt_exchange_int);
+ for (j = 0; j < nengine; j++) {
+ execbuf.flags &= ~ENGINE_MASK;
+ execbuf.flags |= permuted[j];
+ gem_execbuf(fd, &execbuf);
+ }
+ obj[1].relocs_ptr = (uintptr_t)&reloc[2*i+1];
+ execbuf.batch_start_offset = (2*i+1)*sizeof(batch);
+ execbuf.flags &= ~ENGINE_MASK;
+ execbuf.flags |= engines[i];
+ gem_execbuf(fd, &execbuf);
+ }
+ gem_close(fd, obj[1].handle);
+
+ gem_read(fd, obj[0].handle, 0, engines, sizeof(engines));
+ gem_close(fd, obj[0].handle);
+
+ for (i = 0; i < nengine; i++)
+ igt_assert_eq_u32(engines[i], i);
+ igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
+}
+
+static int
+reload(const char *opts_i915)
+{
+ int err = IGT_EXIT_SUCCESS;
+
+ if ((err = igt_i915_driver_unload()))
+ return err;
+
+ if ((err = igt_i915_driver_load(opts_i915)))
+ return err;
+
+ return err;
+}
+
+static void
+gem_sanitycheck(void)
+{
+ int err = 0;
+ int fd;
+ struct drm_i915_gem_caching args = {};
+
+
+ fd = __drm_open_driver(DRIVER_INTEL);
+ igt_set_timeout(1, "Module reload timeout!");
+
+ if (ioctl(fd, DRM_IOCTL_I915_GEM_SET_CACHING, &args) < 0)
+ err = -errno;
+
+ igt_set_timeout(0, NULL);
+ close(fd);
+
+ igt_assert_eq(err, -ENOENT);
+}
+
+static void
+gem_exec_store(void)
+{
+ int fd;
+ const struct intel_execution_engine *e;
+
+ fd = __drm_open_driver(DRIVER_INTEL);
+ igt_fork_hang_detector(fd);
+
+ for (e = intel_execution_engines; e->name; e++) {
+ store_dword(fd, e->exec_id | e->flags);
+ }
+
+ store_all(fd);
+
+ igt_stop_hang_detector();
+ close(fd);
+}
+
+static void
+hda_dynamic_debug(bool enable)
+{
+ FILE *fp;
+ const char snd_hda_intel_on[] = "module snd_hda_intel +pf";
+ const char snd_hda_core_on[] = "module snd_hda_core +pf";
+
+ const char snd_hda_intel_off[] = "module snd_hda_core =_";
+ const char snd_hda_core_off[] = "module snd_hda_intel =_";
+
+ fp = fopen("/sys/kernel/debug/dynamic_debug/control", "w");
+ igt_assert(fp != NULL);
+
+ if (enable) {
+ fwrite(snd_hda_intel_on, 1, sizeof(snd_hda_intel_on), fp);
+ fwrite(snd_hda_core_on, 1, sizeof(snd_hda_core_on), fp);
+ } else {
+ fwrite(snd_hda_intel_off, 1, sizeof(snd_hda_intel_off), fp);
+ fwrite(snd_hda_core_off, 1, sizeof(snd_hda_core_off), fp);
+ }
+
+ fclose(fp);
+}
+
+igt_main
+{
+ int i, err;
+ char buf[64];
+
+ igt_fixture
+ hda_dynamic_debug(true);
+
+ igt_subtest("basic-reload") {
+
+ if ((err = reload(NULL)))
+ igt_fail(err);
+
+ gem_sanitycheck();
+ gem_exec_store();
+ }
+
+ igt_subtest("basic-reload-inject") {
+ for (i = 0; i < 4; i++) {
+ memset(buf, 0, sizeof(buf));
+ snprintf(buf, sizeof(buf), "inject_load_failure=%d", i);
+ reload(buf);
+ }
+ }
+
+ igt_subtest("basic-reload-final") {
+ if ((err = reload(NULL)))
+ igt_fail(err);
+
+ gem_sanitycheck();
+ gem_exec_store();
+ }
+
+ igt_fixture
+ hda_dynamic_debug(false);
+}
diff --git a/tests/drv_module_reload_basic b/tests/drv_module_reload_basic
deleted file mode 100755
index 98f3694..0000000
--- a/tests/drv_module_reload_basic
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/bash
-#
-# Testcase: Reload the drm module
-#
-# ... we've broken this way too often :(
-#
-
-SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
-. $SOURCE_DIR/drm_lib.sh
-
-# no other drm service should be running, so we can just unbind
-
-# return 0 if module by name $1 is loaded according to lsmod
-function mod_loaded()
-{
- lsmod | grep -w "^$1" &> /dev/null
-}
-
-function reload() {
- local snd_hda_intel_unloaded
-
- echo Reloading i915.ko with $*
-
- # we must kick away fbcon (but only fbcon)
- for vtcon in /sys/class/vtconsole/vtcon*/ ; do
- if grep "frame buffer device" $vtcon/name > /dev/null ; then
- echo unbinding $vtcon: `cat $vtcon/name`
- echo 0 > $vtcon/bind
- fi
- done
-
- # The sound driver uses our power well
- pkill alsactl
- snd_hda_intel_unloaded=0
- if mod_loaded snd_hda_intel; then
- # unbind sound cards
- for card in $(find /sys/bus/pci/drivers/snd_hda_intel -name "0000:*" -printf "%f\n"); do
- echo $card > /sys/bus/pci/drivers/snd_hda_intel/unbind
- done
-
- if rmmod snd_hda_intel; then
- snd_hda_intel_unloaded=1
- else
- lsmod >&2
- lsof /dev/snd/* >&2
- fi
- fi
-
- # gen5 only
- if mod_loaded intel_ips; then
- rmmod intel_ips
- fi
-
- if ! rmmod i915; then
- lsmod >&2
- return $IGT_EXIT_SKIP
- fi
- #ignore errors in intel-gtt, often built-in
- rmmod intel-gtt &> /dev/null
- # drm may be used by other devices (nouveau, radeon, udl, etc)
- rmmod drm_kms_helper &> /dev/null
- rmmod drm &> /dev/null
-
- if mod_loaded i915; then
- echo WARNING: i915.ko still loaded!
- return $IGT_EXIT_FAILURE
- else
- echo module successfully unloaded
- fi
-
- modprobe i915 $*
-
- if [ -f /sys/class/vtconsole/vtcon1/bind ]; then
- echo 1 > /sys/class/vtconsole/vtcon1/bind
- fi
-
- modprobe -q snd_hda_intel || return $snd_hda_intel_unloaded
-}
-
-function finish_load() {
- # does the device exist?
- if $SOURCE_DIR/gem_alive > /dev/null ; then
- echo "module successfully loaded again"
- else
- echo "failed to reload module successfully"
- return $IGT_EXIT_FAILURE
- fi
-
- # then try to run something
- if ! $SOURCE_DIR/gem_exec_store > /dev/null ; then
- echo "failed to execute a simple batch after reload"
- return $IGT_EXIT_FAILURE
- fi
-
- return $IGT_EXIT_SUCCESS
-}
-
-hda_dynamic_debug_enable
-
-reload || exit $?
-finish_load || exit $?
-
-# Repeat the module reload trying to to generate faults
-for i in $(seq 1 4); do
- reload inject_load_failure=$i
-done
-
-reload || exit $?
-finish_load
-
-exit $?
diff --git a/tests/gem_alive.c b/tests/gem_alive.c
deleted file mode 100644
index 7544443..0000000
--- a/tests/gem_alive.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "igt.h"
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <i915_drm.h>
-
-
-int main(void)
-{
- struct drm_i915_gem_sw_finish arg = { 0 };
- int fd;
-
- signal(SIGALRM, SIG_IGN);
-
- fd = __drm_open_driver(DRIVER_INTEL);
- if (fd < 0)
- return IGT_EXIT_SKIP;
-
- alarm(1);
- if (ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &arg) == 0)
- return IGT_EXIT_SKIP;
-
- switch (errno) {
- case ENOENT:
- return 0;
- case EIO:
- return 1;
- case EINTR:
- return 2;
- default:
- return 3;
- }
-}
diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index 2c305c0..e25facf 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -3,7 +3,9 @@ igt@core_prop_blob@basic
igt@drv_getparams_basic@basic-eu-total
igt@drv_getparams_basic@basic-subslice-total
igt@drv_hangman@error-state-basic
-igt@drv_module_reload_basic
Reply to: