From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Move uncore selfchecks to late selftest infrastructure
Date: Thu, 8 Dec 2016 11:58:41 +0000 [thread overview]
Message-ID: <67301ccb-6b15-1bd6-900b-fa3dd131f96b@linux.intel.com> (raw)
In-Reply-To: <20161207185201.10386-1-chris@chris-wilson.co.uk>
On 07/12/2016 18:52, Chris Wilson wrote:
> Now that the kselftest infrastructure exists, put it to use and add to
> it the existing consistency checks on the fw register lookup tables.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> drivers/gpu/drm/i915/i915_late_selftests.h | 1 +
> drivers/gpu/drm/i915/intel_uncore.c | 116 +++++++++++++++++------------
> 2 files changed, 69 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_late_selftests.h b/drivers/gpu/drm/i915/i915_late_selftests.h
> index e6645d08d964..289a651db2fd 100644
> --- a/drivers/gpu/drm/i915/i915_late_selftests.h
> +++ b/drivers/gpu/drm/i915/i915_late_selftests.h
> @@ -8,4 +8,5 @@
> *
> * Tests are executed in reverse order by igt/drv_selftest
> */
> +selftest(uncore, intel_uncore_late_selftests)
> selftest(sanitycheck, i915_late_sanitycheck) /* keep last */
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index c1ca4df38dea..bd8436b8f3a4 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -628,33 +628,6 @@ find_fw_domain(struct drm_i915_private *dev_priv, u32 offset)
> return entry ? entry->domains : 0;
> }
>
> -static void
> -intel_fw_table_check(struct drm_i915_private *dev_priv)
> -{
> - const struct intel_forcewake_range *ranges;
> - unsigned int num_ranges;
> - s32 prev;
> - unsigned int i;
> -
> - if (!IS_ENABLED(CONFIG_DRM_I915_DEBUG))
> - return;
> -
> - ranges = dev_priv->uncore.fw_domains_table;
> - if (!ranges)
> - return;
> -
> - num_ranges = dev_priv->uncore.fw_domains_table_entries;
> -
> - for (i = 0, prev = -1; i < num_ranges; i++, ranges++) {
> - WARN_ON_ONCE(IS_GEN9(dev_priv) &&
> - (prev + 1) != (s32)ranges->start);
> - WARN_ON_ONCE(prev >= (s32)ranges->start);
> - prev = ranges->start;
> - WARN_ON_ONCE(prev >= (s32)ranges->end);
> - prev = ranges->end;
> - }
> -}
> -
> #define GEN_FW_RANGE(s, e, d) \
> { .start = (s), .end = (e), .domains = (d) }
>
> @@ -693,23 +666,6 @@ static const i915_reg_t gen8_shadowed_regs[] = {
> /* TODO: Other registers are not yet used */
> };
>
> -static void intel_shadow_table_check(void)
> -{
> - const i915_reg_t *reg = gen8_shadowed_regs;
> - s32 prev;
> - u32 offset;
> - unsigned int i;
> -
> - if (!IS_ENABLED(CONFIG_DRM_I915_DEBUG))
> - return;
> -
> - for (i = 0, prev = -1; i < ARRAY_SIZE(gen8_shadowed_regs); i++, reg++) {
> - offset = i915_mmio_reg_offset(*reg);
> - WARN_ON_ONCE(prev >= (s32)offset);
> - prev = offset;
> - }
> -}
> -
> static int mmio_reg_cmp(u32 key, const i915_reg_t *reg)
> {
> u32 offset = i915_mmio_reg_offset(*reg);
> @@ -1436,10 +1392,6 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
> break;
> }
>
> - intel_fw_table_check(dev_priv);
> - if (INTEL_GEN(dev_priv) >= 8)
> - intel_shadow_table_check();
> -
> if (intel_vgpu_active(dev_priv)) {
> ASSIGN_WRITE_MMIO_VFUNCS(vgpu);
> ASSIGN_READ_MMIO_VFUNCS(vgpu);
> @@ -1962,3 +1914,71 @@ intel_uncore_forcewake_for_reg(struct drm_i915_private *dev_priv,
>
> return fw_domains;
> }
> +
> +#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
> +#include "i915_selftest.h"
> +
> +static int intel_fw_table_check(struct drm_i915_private *i915)
> +{
> + const struct intel_forcewake_range *ranges;
> + unsigned int num_ranges, 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 */
table
> + if (WARN_ON(IS_GEN9(i915) && (prev + 1) != (s32)ranges->start))
> + return -EINVAL;
> +
> + /* Check that the table never goes backwards */
> + if (WARN_ON(prev >= (s32)ranges->start))
> + return -EINVAL;
> +
> + /* Check that the entry is valid */
> + if (WARN_ON(ranges->start >= (s32)ranges->end))
Comparison between signed and unsigned?
> + return -EINVAL;
> +
> + prev = ranges->end;
> + }
> +
> + return 0;
> +}
> +
> +static int intel_shadow_table_check(void)
> +{
> + const i915_reg_t *reg = gen8_shadowed_regs;
> + unsigned int i;
> + s32 prev;
> +
> + for (i = 0, prev = -1; i < ARRAY_SIZE(gen8_shadowed_regs); i++, reg++) {
> + u32 offset = i915_mmio_reg_offset(*reg);
> + if (WARN_ON(prev >= (s32)offset))
> + return -EINVAL;
> +
> + prev = offset;
> + }
> +
> + return 0;
> +}
> +
> +int intel_uncore_late_selftests(struct drm_i915_private *i915)
> +{
> + int err;
> +
> + err = intel_fw_table_check(i915);
> + if (err)
> + return err;
> +
> + if (INTEL_GEN(i915) >= 8) {
Could just always check it, the fw table is identically unused on some
platforms.
> + err = intel_shadow_table_check();
> + if (err)
> + return err;
> + }
> +
> + return 0;
> +}
> +#endif
>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-12-08 11:58 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 13:58 [RFC] Smattering of selftests Chris Wilson
2016-12-07 13:58 ` [PATCH 01/16] drm/i915: Provide a hook for selftests Chris Wilson
2016-12-08 10:47 ` Tvrtko Ursulin
2016-12-08 11:15 ` Chris Wilson
2016-12-08 12:30 ` Tvrtko Ursulin
2016-12-08 12:40 ` Chris Wilson
2016-12-07 13:58 ` [PATCH 02/16] kselftests: Exercise hw-independent mock tests for i915.ko Chris Wilson
2016-12-07 14:09 ` Chris Wilson
2016-12-08 15:50 ` Shuah Khan
2016-12-08 16:01 ` Chris Wilson
2016-12-08 16:44 ` Shuah Khan
2016-12-07 13:58 ` [PATCH 03/16] drm/i915: Add unit tests for the breadcrumb rbtree, insert/remove Chris Wilson
2016-12-08 11:00 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 04/16] drm/i915: Add unit tests for the breadcrumb rbtree, completion Chris Wilson
2016-12-08 11:47 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 05/16] drm/i915: Add unit tests for the breadcrumb rbtree, wakeups Chris Wilson
2016-12-08 17:38 ` Tvrtko Ursulin
2016-12-08 21:04 ` Chris Wilson
2016-12-09 9:33 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 06/16] drm/i915: Add a reminder that i915_vma_move_to_active() requires struct_mutex Chris Wilson
2016-12-08 17:40 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 07/16] drm/i915: Move intel_lrc_context_pin() to avoid the forward declaration Chris Wilson
2016-12-08 17:45 ` Tvrtko Ursulin
2016-12-08 20:55 ` Chris Wilson
2016-12-07 13:58 ` [PATCH 08/16] drm/i915: Unify active context tracking between legacy/execlists/guc Chris Wilson
2016-12-09 11:48 ` Tvrtko Ursulin
2016-12-09 12:17 ` Chris Wilson
2016-12-07 13:58 ` [PATCH 09/16] drm/i915: Simplify releasing context reference Chris Wilson
2016-12-09 15:03 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 10/16] drm/i915: Mark the shadow gvt context as closed Chris Wilson
2016-12-09 15:07 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 11/16] drm/i915/execlists: Request the kernel context be pinned high Chris Wilson
2016-12-09 15:08 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 12/16] drm/i915: Swap if(enable_execlists) in i915_gem_request_alloc for a vfunc Chris Wilson
2016-12-09 15:16 ` Tvrtko Ursulin
2016-12-09 15:25 ` Chris Wilson
2016-12-09 15:53 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 13/16] drm/i915: Add selftests for i915_gem_request Chris Wilson
2016-12-09 15:51 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 14/16] drm/i915: Add a simple request selftest for waiting Chris Wilson
2016-12-09 15:59 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 15/16] drm/i915: Add a simple fence selftest to i915_gem_request Chris Wilson
2016-12-09 16:02 ` Tvrtko Ursulin
2016-12-07 13:58 ` [PATCH 16/16] drm/i915: Add selftests for object allocation, phys Chris Wilson
2016-12-13 17:10 ` Tvrtko Ursulin
2016-12-17 13:55 ` Chris Wilson
2016-12-07 14:04 ` [RFC] Smattering of selftests Chris Wilson
2016-12-07 15:45 ` ✓ Fi.CI.BAT: success for series starting with [01/16] drm/i915: Provide a hook for selftests Patchwork
2016-12-07 18:52 ` [PATCH 1/2] drm/i915: Move uncore selfchecks to late selftest infrastructure Chris Wilson
2016-12-07 18:52 ` [PATCH 2/2] drm/i915: Test all fw tables during mock selftests Chris Wilson
2016-12-08 12:14 ` Tvrtko Ursulin
2016-12-08 12:28 ` Chris Wilson
2016-12-08 13:11 ` Joonas Lahtinen
2016-12-08 16:52 ` Tvrtko Ursulin
2016-12-08 22:29 ` Chris Wilson
2016-12-09 9:41 ` Tvrtko Ursulin
2016-12-09 10:18 ` Chris Wilson
2016-12-09 10:35 ` Tvrtko Ursulin
2016-12-09 10:51 ` Chris Wilson
2016-12-08 11:58 ` Tvrtko Ursulin [this message]
2016-12-07 19:56 ` [RFC] Smattering of selftests Paulo Zanoni
2016-12-07 20:52 ` ✓ Fi.CI.BAT: success for series starting with [01/16] drm/i915: Provide a hook for selftests (rev2) Patchwork
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=67301ccb-6b15-1bd6-900b-fa3dd131f96b@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox