[Intel-gfx] [PATCH 4/5] lib: Only warn about suspicious CRCs

Daniel Vetter daniel.vetter at ffwll.ch
Fri Mar 13 10:43:07 PDT 2015


It is theoretically possible to hit these in the wild, so only warn
about them. Dropping the test is probably too much since these caught
some real bugs in the past.

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 lib/igt_debugfs.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 61313aad6ef5..85c3f22293cc 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -188,22 +188,6 @@ FILE *igt_debugfs_fopen(const char *filename,
  * Pipe CRC
  */
 
-static bool igt_crc_is_null(igt_crc_t *crc)
-{
-	int i;
-
-	for (i = 0; i < crc->n_words; i++) {
-		igt_warn_on_f(crc->crc[i] == 0xffffffff,
-			      "Suspicious CRC: it looks like the CRC "
-			      "read back was from a register in a powered "
-			      "down well\n");
-		if (crc->crc[i])
-			return false;
-	}
-
-	return true;
-}
-
 /**
  * igt_assert_crc_equal:
  * @a: first pipe CRC value
@@ -498,6 +482,23 @@ igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
 	*out_crcs = crcs;
 }
 
+static void crc_sanity_checks(igt_crc_t *crc)
+{
+	int i;
+	bool all_zero = true;
+
+	for (i = 0; i < crc->n_words; i++) {
+		igt_warn_on_f(crc->crc[i] == 0xffffffff,
+			      "Suspicious CRC: it looks like the CRC "
+			      "read back was from a register in a powered "
+			      "down well\n");
+		if (crc->crc[i])
+			all_zero = false;
+	}
+
+	igt_warn_on_f(all_zero, "Suspicious CRC: All values are 0.\n");
+}
+
 /**
  * igt_pipe_crc_collect_crc:
  * @pipe_crc: pipe CRC object
@@ -515,7 +516,7 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
 	read_one_crc(pipe_crc, out_crc);
 	igt_pipe_crc_stop(pipe_crc);
 
-	igt_assert(!igt_crc_is_null(out_crc));
+	crc_sanity_checks(out_crc);
 }
 
 /*
-- 
1.9.3



More information about the Intel-gfx mailing list