public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] i915: Add test to assert that the PCI-ID is known
@ 2020-05-19 14:12 Chris Wilson
  2020-05-19 14:12 ` [igt-dev] [PATCH i-g-t 2/2] lib: Remove early has_known_intel_chipset() check Chris Wilson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chris Wilson @ 2020-05-19 14:12 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

We do want to ensure that the igt identification table is kept up to
date, and so would like to be warned if being run on an unknown chipset.
Instead of refusing to run any test, have a specific test for the
unknown chipset.

Suggested-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 tests/Makefile.sources  |  3 ++
 tests/i915/i915_pciid.c | 62 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build       |  1 +
 3 files changed, 66 insertions(+)
 create mode 100644 tests/i915/i915_pciid.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index c450fa0ed..f1df13465 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -475,6 +475,9 @@ i915_hangman_SOURCES = i915/i915_hangman.c
 TESTS_progs += i915_module_load
 i915_module_load_SOURCES = i915/i915_module_load.c
 
+TESTS_progs += i915_pciid
+i915_pciid_SOURCES = i915/i915_pciid.c
+
 TESTS_progs += i915_pm_backlight
 i915_pm_backlight_SOURCES = i915/i915_pm_backlight.c
 
diff --git a/tests/i915/i915_pciid.c b/tests/i915/i915_pciid.c
new file mode 100644
index 000000000..03d0409c3
--- /dev/null
+++ b/tests/i915/i915_pciid.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2020 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 <sys/ioctl.h>
+
+#include "drm.h"
+#include "drmtest.h"
+#include "i915_drm.h"
+#include "intel_chipset.h"
+
+IGT_TEST_DESCRIPTION("Check that igt/i915 know about this PCI-ID");
+
+static bool has_known_intel_chipset(int fd)
+{
+	int devid = 0;
+	struct drm_i915_getparam gp = {
+		.param = I915_PARAM_CHIPSET_ID,
+		.value = &devid,
+	};
+	const struct intel_device_info *info;
+
+	if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)))
+		return false;
+
+	info = intel_get_device_info(devid);
+	if (!info) {
+		igt_warn("Unrecongised PCI-ID: %04x\n", devid);
+		return false;
+	}
+
+	igt_info("PCI-ID: %#04x, gen %d, %s\n",
+		 devid, ffs(info->gen), info->codename);
+	return true;
+}
+
+igt_simple_main
+{
+	int intel = drm_open_driver(DRIVER_INTEL);
+
+	igt_assert(has_known_intel_chipset(intel));
+}
diff --git a/tests/meson.build b/tests/meson.build
index 88e4875b6..d021af682 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -218,6 +218,7 @@ i915_progs = [
 	'i915_getparams_basic',
 	'i915_hangman',
 	'i915_module_load',
+	'i915_pciid',
 	'i915_pm_backlight',
 	'i915_pm_lpsp',
 	'i915_pm_rpm',
-- 
2.26.2

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-20  1:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-19 14:12 [igt-dev] [PATCH i-g-t 1/2] i915: Add test to assert that the PCI-ID is known Chris Wilson
2020-05-19 14:12 ` [igt-dev] [PATCH i-g-t 2/2] lib: Remove early has_known_intel_chipset() check Chris Wilson
2020-05-19 14:48 ` [igt-dev] [PATCH i-g-t 1/2] i915: Add test to assert that the PCI-ID is known Mika Kuoppala
2020-05-19 17:00 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2020-05-20  1:30 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox