All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [RFC 3/4] drm/i915: introduce display_uncore
Date: Thu, 27 Jun 2019 15:41:11 +0300	[thread overview]
Message-ID: <20190627124111.GX5942@intel.com> (raw)
In-Reply-To: <a9e9a66c-80ac-a68f-b07b-e033d85e5747@intel.com>

On Wed, Jun 26, 2019 at 01:27:57PM -0700, Daniele Ceraolo Spurio wrote:
> 
> 
> On 6/26/19 11:42 AM, Ville Syrjälä wrote:
> > On Mon, Jun 24, 2019 at 01:31:51PM -0700, Daniele Ceraolo Spurio wrote:
> >> A forcewake-less uncore to be used to decouple GT accesses from display
> >> ones to avoid serializing them when there is no need.
> >>
> >> New accessors that implicitly use the new uncore have also been added.
> >>
> >> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> ---
> >>   drivers/gpu/drm/i915/i915_drv.c     | 17 ++++++++-
> >>   drivers/gpu/drm/i915/i915_drv.h     | 58 +++++++++++++++++++++++++++++
> >>   drivers/gpu/drm/i915/intel_uncore.c |  9 ++++-
> >>   3 files changed, 81 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> >> index 2d6c643dde51..e22c0a6b3992 100644
> >> --- a/drivers/gpu/drm/i915/i915_drv.c
> >> +++ b/drivers/gpu/drm/i915/i915_drv.c
> >> @@ -903,6 +903,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv)
> >>   
> >>   	intel_uncore_mmio_debug_init_early(&dev_priv->mmio_debug);
> >>   	intel_uncore_init_early(&dev_priv->uncore, dev_priv);
> >> +	intel_uncore_init_early(&dev_priv->de_uncore, dev_priv);
> >>   
> >>   	spin_lock_init(&dev_priv->irq_lock);
> >>   	spin_lock_init(&dev_priv->gpu_error.lock);
> >> @@ -1001,6 +1002,10 @@ static int i915_driver_init_mmio(struct drm_i915_private *dev_priv)
> >>   	if (ret < 0)
> >>   		goto err_bridge;
> >>   
> >> +	ret = intel_uncore_init_mmio(&dev_priv->de_uncore);
> >> +	if (ret < 0)
> >> +		goto err_uncore;
> >> +
> >>   	/* Try to make sure MCHBAR is enabled before poking at it */
> >>   	intel_setup_mchbar(dev_priv);
> >>   
> >> @@ -1012,14 +1017,16 @@ static int i915_driver_init_mmio(struct drm_i915_private *dev_priv)
> >>   
> >>   	ret = intel_engines_init_mmio(dev_priv);
> >>   	if (ret)
> >> -		goto err_uncore;
> >> +		goto err_mchbar;
> >>   
> >>   	i915_gem_init_mmio(dev_priv);
> >>   
> >>   	return 0;
> >>   
> >> -err_uncore:
> >> +err_mchbar:
> >>   	intel_teardown_mchbar(dev_priv);
> >> +	intel_uncore_fini_mmio(&dev_priv->de_uncore);
> >> +err_uncore:
> >>   	intel_uncore_fini_mmio(&dev_priv->uncore);
> >>   err_bridge:
> >>   	pci_dev_put(dev_priv->bridge_dev);
> >> @@ -1034,6 +1041,7 @@ static int i915_driver_init_mmio(struct drm_i915_private *dev_priv)
> >>   static void i915_driver_cleanup_mmio(struct drm_i915_private *dev_priv)
> >>   {
> >>   	intel_teardown_mchbar(dev_priv);
> >> +	intel_uncore_fini_mmio(&dev_priv->de_uncore);
> >>   	intel_uncore_fini_mmio(&dev_priv->uncore);
> >>   	pci_dev_put(dev_priv->bridge_dev);
> >>   }
> >> @@ -2166,6 +2174,7 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
> >>   
> >>   	i915_gem_suspend_late(dev_priv);
> >>   
> >> +	intel_uncore_suspend(&dev_priv->de_uncore);
> >>   	intel_uncore_suspend(&dev_priv->uncore);
> >>   
> >>   	intel_power_domains_suspend(dev_priv,
> >> @@ -2363,6 +2372,7 @@ static int i915_drm_resume_early(struct drm_device *dev)
> >>   			  ret);
> >>   
> >>   	intel_uncore_resume_early(&dev_priv->uncore);
> >> +	intel_uncore_resume_early(&dev_priv->de_uncore);
> >>   
> >>   	intel_gt_check_and_clear_faults(&dev_priv->gt);
> >>   
> >> @@ -2937,6 +2947,7 @@ static int intel_runtime_suspend(struct device *kdev)
> >>   
> >>   	intel_runtime_pm_disable_interrupts(dev_priv);
> >>   
> >> +	intel_uncore_suspend(&dev_priv->de_uncore);
> >>   	intel_uncore_suspend(&dev_priv->uncore);
> >>   
> >>   	ret = 0;
> >> @@ -2955,6 +2966,7 @@ static int intel_runtime_suspend(struct device *kdev)
> >>   	if (ret) {
> >>   		DRM_ERROR("Runtime suspend failed, disabling it (%d)\n", ret);
> >>   		intel_uncore_runtime_resume(&dev_priv->uncore);
> >> +		intel_uncore_runtime_resume(&dev_priv->de_uncore);
> >>   
> >>   		intel_runtime_pm_enable_interrupts(dev_priv);
> >>   
> >> @@ -3053,6 +3065,7 @@ static int intel_runtime_resume(struct device *kdev)
> >>   	}
> >>   
> >>   	intel_uncore_runtime_resume(&dev_priv->uncore);
> >> +	intel_uncore_runtime_resume(&dev_priv->de_uncore);
> >>   
> >>   	intel_runtime_pm_enable_interrupts(dev_priv);
> >>   
> >> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> >> index a53b65d78159..c554b7697bdc 100644
> >> --- a/drivers/gpu/drm/i915/i915_drv.h
> >> +++ b/drivers/gpu/drm/i915/i915_drv.h
> >> @@ -1341,6 +1341,7 @@ struct drm_i915_private {
> >>   	resource_size_t stolen_usable_size;	/* Total size minus reserved ranges */
> >>   
> >>   	struct intel_uncore uncore;
> >> +	struct intel_uncore de_uncore;
> >>   	struct intel_uncore_mmio_debug mmio_debug;
> >>   
> >>   	struct i915_virtual_gpu vgpu;
> >> @@ -2746,6 +2747,63 @@ extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
> >>   #define I915_READ_FW(reg__) __I915_REG_OP(read_fw, dev_priv, (reg__))
> >>   #define I915_WRITE_FW(reg__, val__) __I915_REG_OP(write_fw, dev_priv, (reg__), (val__))
> >>   
> >> +/*
> >> + * The following are mmio-accessors that use an independent lock and skip all
> >> + * the forcewake logic, to be used to access display registers, which are
> >> + * outside the GT forcewake wells.
> >> + */
> >> +static inline void
> >> +intel_assert_register_is_display(struct drm_i915_private *i915, i915_reg_t reg)
> >> +{
> >> +#ifdef CONFIG_DRM_I915_DEBUG_MMIO
> >> +	u32 offset = i915_mmio_reg_offset(reg);
> >> +	bool is_de_register;
> >> +
> >> +	if (INTEL_GEN(i915) >= 5) {
> >> +		is_de_register = offset >= 0x40000 &&
> >> +			(INTEL_GEN(i915) < 11 || offset < 0x1c0000);
> > 
> > I think the gen11+ thing is wrong. There are eg. PHY registers
> > above 0x162000.
> 
> But that's still below 0x1c0000. Media engines start at 0x1c0000, so 
> we're back in GT-land at least until 0x1dffff.

Doh. Misread the offset.

> 
> > 
> >> +	} else {
> >> +		is_de_register =
> >> +			(offset >= 0x5000 && offset <= 0x5fff) ||
> >> +			(offset >= 0x6000 && offset <= 0x6fff) ||
> >> +			(offset >= 0xa000 && offset <= 0xafff) ||
> >> +			offset >= 0x30000;
> > 
> > I think the WARNs are coming from the mchbar range (0x10000+ on
> > these platforms). Not really sure if we should designate that
> > gt or de.
> > 
> > Unfortunately the register ranges don't seem to follow much
> > of a sensible pattern. Eg. we seem to have both gt and de
> > related stuff around the 0x130000 mark :(
> > 
> 
> Should I just drop the check for now then? Alternatively, I could change 
> to WARN if we try to access a register that is inside one of the 
> forcewake ranges if CONFIG_DRM_I915_DEBUG_MMIO is set.

Would be nice to have a warning like this so we don't accidentally end
up touching the same register (or cacheline) under two different locks
because that could trigger a system hang.

I guess from correcness POV it doesn't really matter which ranges are
under which lock. So we could try to include the mchbar range under
the de lock on old platforms as well. Maybe just s/0x30000/0x10000/ on
old platforms? I don't immediately see anything gt related above
0x10000. Hmm. But that still leaves out ilk which still has mchbar
at 0x10000. So we'd need to account for that as well.

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

  reply	other threads:[~2019-06-27 12:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 20:31 [RFC 0/4] Display uncore Daniele Ceraolo Spurio
2019-06-24 20:31 ` [RFC 1/4] drm/i915: split out uncore_mmio_debug Daniele Ceraolo Spurio
2019-06-26 10:02   ` Chris Wilson
2019-06-26 17:38     ` Daniele Ceraolo Spurio
2019-06-26 17:58       ` Chris Wilson
2019-06-26 18:20         ` Daniele Ceraolo Spurio
2019-06-24 20:31 ` [RFC 2/4] drm/i915: rework mmio debug stop/start Daniele Ceraolo Spurio
2019-06-24 20:31 ` [RFC 3/4] drm/i915: introduce display_uncore Daniele Ceraolo Spurio
2019-06-26 18:42   ` Ville Syrjälä
2019-06-26 20:27     ` Daniele Ceraolo Spurio
2019-06-27 12:41       ` Ville Syrjälä [this message]
2019-06-24 20:31 ` [RFC 4/4] drm/i915: convert intel_hdmi to display reg accessors Daniele Ceraolo Spurio
2019-06-24 20:43 ` ✗ Fi.CI.SPARSE: warning for Display uncore (rev2) Patchwork
2019-06-24 21:37 ` ✓ Fi.CI.BAT: success " Patchwork
2019-06-25  1:04 ` ✓ Fi.CI.IGT: " 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=20190627124111.GX5942@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --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.