[Intel-gfx] [PATCH 2/2] drm/i915: Test all fw tables during mock selftests

Chris Wilson chris at chris-wilson.co.uk
Thu Dec 8 12:28:52 UTC 2016


On Thu, Dec 08, 2016 at 12:14:10PM +0000, Tvrtko Ursulin wrote:
> >-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,
> >+				int gen)
> > {
> >-	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 tabke is watertight */
> >-		if (WARN_ON(IS_GEN9(i915) && (prev + 1) != (s32)ranges->start))
> >+		if (WARN_ON(gen >= 9 && (prev + 1) != (s32)ranges->start))
> > 			return -EINVAL;
> >
> > 		/* Check that the table never goes backwards */
> >@@ -1965,11 +1961,38 @@ static int intel_shadow_table_check(void)
> > 	return 0;
> > }
> >
> >+int intel_uncore_mock_selftests(void)
> >+{
> >+	struct {
> >+		const struct intel_forcewake_range *ranges;
> >+		unsigned int num_ranges;
> >+		int gen;
> >+	} fw[] = {
> >+		{ __vlv_fw_ranges, ARRAY_SIZE(__vlv_fw_ranges), 7 },
> >+		{ __chv_fw_ranges, ARRAY_SIZE(__chv_fw_ranges), 8 },
> >+		{ __gen9_fw_ranges, ARRAY_SIZE(__gen9_fw_ranges), 9 },
> 
> Tables are not per gen so this is a bit confusing. I don't have a
> much better idea though. Apart from replacing "int gen" with "bool
> test_watertight"?

bool is_watertight is a good suggestion.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list