Message ID | 20161220130814.10213-16-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 20 December 2016 at 13:08, Chris Wilson <chris@chris-wilson.co.uk> wrote: > Add a late selftest that walks over all forcewake registers (those below > 0x40000) and checks intel_uncore_forcewake_for_reg() that the look > exists and we having the matching powerwells. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > --- > drivers/gpu/drm/i915/selftests/intel_uncore.c | 47 +++++++++++++++++++++++++++ > 1 file changed, 47 insertions(+) > > diff --git a/drivers/gpu/drm/i915/selftests/intel_uncore.c b/drivers/gpu/drm/i915/selftests/intel_uncore.c > index c18fddb12d00..c9f90514500f 100644 > --- a/drivers/gpu/drm/i915/selftests/intel_uncore.c > +++ b/drivers/gpu/drm/i915/selftests/intel_uncore.c > @@ -107,6 +107,49 @@ int intel_uncore_mock_selftests(void) > return 0; > } > > +static int intel_uncore_check_forcewake_domains(struct drm_i915_private *dev_priv) > +{ > +#define FW_RANGE 0x40000 > + unsigned long *valid; > + u32 offset; > + int err; > + > + valid = kzalloc(BITS_TO_LONGS(FW_RANGE) * sizeof(*valid), > + GFP_TEMPORARY); > + if (!valid) > + return -ENOMEM; > + > + intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); > + > + check_for_unclaimed_mmio(dev_priv); > + for (offset = 0; offset < FW_RANGE; offset += 4) { > + i915_reg_t reg = { offset }; > + > + (void)I915_READ_FW(reg); > + if (!check_for_unclaimed_mmio(dev_priv)) > + set_bit(offset, valid); > + } > + > + intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); > + > + for_each_set_bit(offset, valid, FW_RANGE) { > + i915_reg_t reg = { offset }; > + > + intel_uncore_forcewake_reset(dev_priv, false); > + check_for_unclaimed_mmio(dev_priv); hmm, what do we need this for ? > + > + (void)I915_READ(reg); > + if (check_for_unclaimed_mmio(dev_priv)) { > + pr_err("Unclaimed mmio read to register 0x%04x\n", > + offset); > + err = -EINVAL; > + } > + } > + > + kfree(valid); > + return err; > +} > + > int intel_uncore_live_selftests(struct drm_i915_private *i915) > { > int err; > @@ -118,5 +161,9 @@ int intel_uncore_live_selftests(struct drm_i915_private *i915) > if (err) > return err; > > + err = intel_uncore_check_forcewake_domains(i915); > + if (err) > + return err; > + > return 0; > } > -- > 2.11.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Wed, Jan 11, 2017 at 06:25:59PM +0000, Matthew Auld wrote: > On 20 December 2016 at 13:08, Chris Wilson <chris@chris-wilson.co.uk> wrote: > > + for_each_set_bit(offset, valid, FW_RANGE) { > > + i915_reg_t reg = { offset }; > > + > > + intel_uncore_forcewake_reset(dev_priv, false); > > + check_for_unclaimed_mmio(dev_priv); > hmm, what do we need this for ? It clears the debug register before every test - so that we know the only thing the debug register is complaining about is the I915_READ() sandwiched in between. The reset is there to ensure that the fw is turned off and the timer disabled, so that we have a vanilla state every time with the powerwell off. Hopefully. > > + > > + (void)I915_READ(reg); > > + if (check_for_unclaimed_mmio(dev_priv)) {
On 20 December 2016 at 13:08, Chris Wilson <chris@chris-wilson.co.uk> wrote: > Add a late selftest that walks over all forcewake registers (those below > 0x40000) and checks intel_uncore_forcewake_for_reg() that the look I don't see where we use intel_uncore_forcewake_for_reg() ? look ? > exists and we having the matching powerwells. s/having/have/ > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > --- > drivers/gpu/drm/i915/selftests/intel_uncore.c | 47 +++++++++++++++++++++++++++ > 1 file changed, 47 insertions(+) > > diff --git a/drivers/gpu/drm/i915/selftests/intel_uncore.c b/drivers/gpu/drm/i915/selftests/intel_uncore.c > index c18fddb12d00..c9f90514500f 100644 > --- a/drivers/gpu/drm/i915/selftests/intel_uncore.c > +++ b/drivers/gpu/drm/i915/selftests/intel_uncore.c > @@ -107,6 +107,49 @@ int intel_uncore_mock_selftests(void) > return 0; > } > > +static int intel_uncore_check_forcewake_domains(struct drm_i915_private *dev_priv) > +{ > +#define FW_RANGE 0x40000 > + unsigned long *valid; > + u32 offset; > + int err; > + > + valid = kzalloc(BITS_TO_LONGS(FW_RANGE) * sizeof(*valid), > + GFP_TEMPORARY); > + if (!valid) > + return -ENOMEM; > + > + intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); > + > + check_for_unclaimed_mmio(dev_priv); > + for (offset = 0; offset < FW_RANGE; offset += 4) { > + i915_reg_t reg = { offset }; > + > + (void)I915_READ_FW(reg); > + if (!check_for_unclaimed_mmio(dev_priv)) > + set_bit(offset, valid); > + } > + > + intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); > + > + for_each_set_bit(offset, valid, FW_RANGE) { > + i915_reg_t reg = { offset }; > + > + intel_uncore_forcewake_reset(dev_priv, false); > + check_for_unclaimed_mmio(dev_priv); > + > + (void)I915_READ(reg); > + if (check_for_unclaimed_mmio(dev_priv)) { > + pr_err("Unclaimed mmio read to register 0x%04x\n", > + offset); > + err = -EINVAL; > + } > + } > + > + kfree(valid); > + return err; #undef FW_RANGE Reviewed-by: Matthew Auld <matthew.auld@intel.com>
diff --git a/drivers/gpu/drm/i915/selftests/intel_uncore.c b/drivers/gpu/drm/i915/selftests/intel_uncore.c index c18fddb12d00..c9f90514500f 100644 --- a/drivers/gpu/drm/i915/selftests/intel_uncore.c +++ b/drivers/gpu/drm/i915/selftests/intel_uncore.c @@ -107,6 +107,49 @@ int intel_uncore_mock_selftests(void) return 0; } +static int intel_uncore_check_forcewake_domains(struct drm_i915_private *dev_priv) +{ +#define FW_RANGE 0x40000 + unsigned long *valid; + u32 offset; + int err; + + valid = kzalloc(BITS_TO_LONGS(FW_RANGE) * sizeof(*valid), + GFP_TEMPORARY); + if (!valid) + return -ENOMEM; + + intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); + + check_for_unclaimed_mmio(dev_priv); + for (offset = 0; offset < FW_RANGE; offset += 4) { + i915_reg_t reg = { offset }; + + (void)I915_READ_FW(reg); + if (!check_for_unclaimed_mmio(dev_priv)) + set_bit(offset, valid); + } + + intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); + + for_each_set_bit(offset, valid, FW_RANGE) { + i915_reg_t reg = { offset }; + + intel_uncore_forcewake_reset(dev_priv, false); + check_for_unclaimed_mmio(dev_priv); + + (void)I915_READ(reg); + if (check_for_unclaimed_mmio(dev_priv)) { + pr_err("Unclaimed mmio read to register 0x%04x\n", + offset); + err = -EINVAL; + } + } + + kfree(valid); + return err; +} + int intel_uncore_live_selftests(struct drm_i915_private *i915) { int err; @@ -118,5 +161,9 @@ int intel_uncore_live_selftests(struct drm_i915_private *i915) if (err) return err; + err = intel_uncore_check_forcewake_domains(i915); + if (err) + return err; + return 0; }
Add a late selftest that walks over all forcewake registers (those below 0x40000) and checks intel_uncore_forcewake_for_reg() that the look exists and we having the matching powerwells. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/selftests/intel_uncore.c | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)