All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [RFCv2 15/19] drm/i915: Test all fw tables during mock selftests
Date: Tue, 20 Dec 2016 13:08:10 +0000	[thread overview]
Message-ID: <20161220130814.10213-15-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20161220130814.10213-1-chris@chris-wilson.co.uk>

In addition to just testing the fw table we load, during the initial
mock testing we can test that all tables are valid (so the testing is
not limited to just the platforms that load that particular table).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 .../gpu/drm/i915/selftests/i915_mock_selftests.h   |  1 +
 drivers/gpu/drm/i915/selftests/intel_uncore.c      | 49 ++++++++++++++++------
 2 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h b/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h
index 33390b2530a7..390af5cd895e 100644
--- a/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h
+++ b/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h
@@ -10,6 +10,7 @@
  */
 selftest(sanitycheck, i915_mock_sanitycheck) /* keep first (igt selfcheck) */
 selftest(scatterlist, mock_scatterlist_selftests)
+selftest(uncore, intel_uncore_mock_selftests)
 selftest(breadcrumbs, intel_breadcrumbs_selftest)
 selftest(requests, i915_gem_request_selftest)
 selftest(objects, i915_gem_object_selftests)
diff --git a/drivers/gpu/drm/i915/selftests/intel_uncore.c b/drivers/gpu/drm/i915/selftests/intel_uncore.c
index 0ac467940a4f..c18fddb12d00 100644
--- a/drivers/gpu/drm/i915/selftests/intel_uncore.c
+++ b/drivers/gpu/drm/i915/selftests/intel_uncore.c
@@ -24,20 +24,16 @@
 
 #include "i915_selftest.h"
 
-static int intel_fw_table_check(struct drm_i915_private *i915)
+static int intel_fw_table_check(const struct intel_forcewake_range *ranges,
+				unsigned int num_ranges,
+				bool is_watertight)
 {
-	const struct intel_forcewake_range *ranges;
-	unsigned int num_ranges, i;
+	unsigned int i;
 	s32 prev;
 
-	ranges = i915->uncore.fw_domains_table;
-	if (!ranges)
-		return 0;
-
-	num_ranges = i915->uncore.fw_domains_table_entries;
 	for (i = 0, prev = -1; i < num_ranges; i++, ranges++) {
 		/* Check that the table is watertight */
-		if (IS_GEN9(i915) && (prev + 1) != (s32)ranges->start) {
+		if (is_watertight && (prev + 1) != (s32)ranges->start) {
 			pr_err("%s: entry[%d]:(%x, %x) is not watertight to previous (%x)\n",
 			       __func__, i, ranges->start, ranges->end, prev);
 			return -EINVAL;
@@ -83,15 +79,42 @@ static int intel_shadow_table_check(void)
 	return 0;
 }
 
-int intel_uncore_live_selftests(struct drm_i915_private *i915)
+int intel_uncore_mock_selftests(void)
 {
-	int err;
+	struct {
+		const struct intel_forcewake_range *ranges;
+		unsigned int num_ranges;
+		bool is_watertight;
+	} fw[] = {
+		{ __vlv_fw_ranges, ARRAY_SIZE(__vlv_fw_ranges), false },
+		{ __chv_fw_ranges, ARRAY_SIZE(__chv_fw_ranges), false },
+		{ __gen9_fw_ranges, ARRAY_SIZE(__gen9_fw_ranges), true },
+	};
+	int err, i;
+
+	for (i = 0; i < ARRAY_SIZE(fw); i++) {
+		err = intel_fw_table_check(fw[i].ranges,
+					   fw[i].num_ranges,
+					   fw[i].is_watertight);
+		if (err)
+			return err;
+	}
 
-	err = intel_fw_table_check(i915);
+	err = intel_shadow_table_check();
 	if (err)
 		return err;
 
-	err = intel_shadow_table_check();
+	return 0;
+}
+
+int intel_uncore_live_selftests(struct drm_i915_private *i915)
+{
+	int err;
+
+	/* Confirm the table we load is still valid */
+	err = intel_fw_table_check(i915->uncore.fw_domains_table,
+				   i915->uncore.fw_domains_table_entries,
+				   INTEL_GEN(i915) >= 9);
 	if (err)
 		return err;
 
-- 
2.11.0

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

  parent reply	other threads:[~2016-12-20 13:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 13:07 [RFCv2 01/19] drm/i915: Provide a hook for selftests Chris Wilson
2016-12-20 13:07 ` [RFCv2 02/19] kselftests: Exercise hw-independent mock tests for i915.ko Chris Wilson
2016-12-20 13:07 ` [RFCv2 03/19] drm/i915: Add some selftests for sg_table manipulation Chris Wilson
2016-12-20 13:07 ` [RFCv2 04/19] drm/i915: Add unit tests for the breadcrumb rbtree, insert/remove Chris Wilson
2016-12-20 13:08 ` [RFCv2 05/19] drm/i915: Add unit tests for the breadcrumb rbtree, completion Chris Wilson
2016-12-20 13:08 ` [RFCv2 06/19] drm/i915: Add unit tests for the breadcrumb rbtree, wakeups Chris Wilson
2016-12-20 13:08 ` [RFCv2 07/19] drm/i915: Mock the GEM device for self-testing Chris Wilson
2017-01-09 15:10   ` Matthew Auld
2016-12-20 13:08 ` [RFCv2 08/19] drm/i915: Mock a GGTT " Chris Wilson
2017-01-09 15:16   ` Matthew Auld
2017-01-10 12:33     ` Chris Wilson
2016-12-20 13:08 ` [RFCv2 09/19] drm/i915: Mock infrastructure for request emission Chris Wilson
2016-12-20 13:08 ` [RFCv2 10/19] drm/i915: Add selftests for i915_gem_request Chris Wilson
2016-12-20 13:08 ` [RFCv2 11/19] drm/i915: Add a simple request selftest for waiting Chris Wilson
2016-12-20 13:08 ` [RFCv2 12/19] drm/i915: Add a simple fence selftest to i915_gem_request Chris Wilson
2016-12-20 13:08 ` [RFCv2 13/19] drm/i915: Add selftests for object allocation, phys Chris Wilson
2016-12-20 13:08 ` [RFCv2 14/19] drm/i915: Move uncore selfchecks to live selftest infrastructure Chris Wilson
2017-01-11 18:21   ` Matthew Auld
2016-12-20 13:08 ` Chris Wilson [this message]
2017-01-11 18:22   ` [RFCv2 15/19] drm/i915: Test all fw tables during mock selftests Matthew Auld
2016-12-20 13:08 ` [RFCv2 16/19] drm/i915: Sanity check all registers for matching fw domains Chris Wilson
2017-01-11 18:25   ` Matthew Auld
2017-01-11 18:39     ` Chris Wilson
2017-01-11 19:08   ` Matthew Auld
2016-12-20 13:08 ` [RFCv2 17/19] drm/i915: Add some mock tests for dmabuf interop Chris Wilson
2017-01-10 19:12   ` Matthew Auld
2016-12-20 13:08 ` [RFCv2 18/19] drm/i915: Add initial selftests for i915_gem_gtt Chris Wilson
2017-01-10 19:32   ` Matthew Auld
2016-12-20 13:08 ` [RFCv2 19/19] drm/i915: Initial selftests for exercising eviction Chris Wilson
2017-01-10 19:49   ` Matthew Auld
2016-12-20 14:16 ` ✓ Fi.CI.BAT: success for series starting with [RFCv2,01/19] drm/i915: Provide a hook for selftests Patchwork
2017-01-11 18:17 ` [RFCv2 01/19] " Tvrtko Ursulin
2017-01-11 18:34   ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161220130814.10213-15-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.