All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: shobhit.kumar@intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 7/8] drm/i915: Add support to parse DMI table and get platform memory info (v3)
Date: Tue, 8 Mar 2016 10:55:22 -0800	[thread overview]
Message-ID: <20160308185522.GI8165@intel.com> (raw)
In-Reply-To: <20160308184923.GR10446@intel.com>

On Tue, Mar 08, 2016 at 08:49:23PM +0200, Ville Syrjälä wrote:
> On Mon, Mar 07, 2016 at 05:05:45PM -0800, Matt Roper wrote:
> > From: Shobhit Kumar <shobhit.kumar@intel.com>
> > 
> > This is needed for WM computation workaround for arbitrated display
> > bandwidth.
> > 
> > v2: Address Matt's review comments
> >     - Be more paranoid while dmi decoding
> >     - Also add support for decoding speed from configured memory speed
> >       if availble in DMI memory entry
> > 
> > v3 (by Matt):
> >  - Use memdev_dmi_entry from dmi.h
> >  - Don't try to use/compare negative numbers in unsigned types
> > 
> > Cc: matthew.d.roper@intel.com
> > Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
> > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_dma.c | 34 ++++++++++++++++++++++++++++++++++
> >  drivers/gpu/drm/i915/i915_drv.h |  7 +++++++
> >  2 files changed, 41 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> > index 4aa3db6..4259afe 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -49,6 +49,7 @@
> >  #include <linux/pm.h>
> >  #include <linux/pm_runtime.h>
> >  #include <linux/oom.h>
> > +#include <linux/dmi.h>
> >  
> >  
> >  static int i915_getparam(struct drm_device *dev, void *data,
> > @@ -973,6 +974,33 @@ static void i915_mmio_cleanup(struct drm_device *dev)
> >  	pci_iounmap(dev->pdev, dev_priv->regs);
> >  }
> >  
> > +static void dmi_decode_memory_info(const struct dmi_header *hdr, void *priv)
> > +{
> > +	struct drm_i915_private *dev_priv = (struct drm_i915_private *) priv;
> > +	const struct memdev_dmi_entry *memdev =
> > +		(const struct memdev_dmi_entry *)hdr;
> > +	uint16_t mem_speed = 0;
> > +
> > +	if (hdr->type != DMI_ENTRY_MEM_DEVICE)
> > +		return;
> > +
> > +	/* Get the speed */
> > +	if (hdr->length > offsetof(struct memdev_dmi_entry, conf_mem_clk_speed))
> > +		mem_speed = memdev->conf_mem_clk_speed;
> > +	else if (hdr->length > offsetof(struct memdev_dmi_entry, speed))
> > +		mem_speed = memdev->speed;
> > +	else
> > +		return;
> > +
> > +	dev_priv->dmi.mem_channel++;
> > +
> > +	/* All channels are expected to have same the speed */
> > +	if (dev_priv->dmi.mem_speed == 0)
> > +		dev_priv->dmi.mem_speed = mem_speed;
> > +	else if (mem_speed != dev_priv->dmi.mem_speed)
> > +		dev_priv->dmi.valid = false;
> > +}
> 
> Dunno if this was covered already, but trusting DMI for this feels
> rather fragile to me. Isn't there some way to get the relevant
> information from the hardware itself?

Not sure.  You're right that it's fragile though; I find that the DMI
never provides valid memdev information on the BXT board I'm working
with, so the workaround always winds up disabled for me.  Not sure if
Shobhit has any other ideas for how we could get valid memory
information.


Matt

> 
> > +
> >  /**
> >   * i915_driver_load - setup chip and create an initial config
> >   * @dev: DRM device
> > @@ -1000,6 +1028,12 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
> >  	dev->dev_private = dev_priv;
> >  	dev_priv->dev = dev;
> >  
> > +	/* walk the dmi device table for getting platform memory information */
> > +	dev_priv->dmi.valid = true;
> > +	dmi_walk(dmi_decode_memory_info, dev_priv);
> > +	if (!dev_priv->dmi.mem_speed)
> > +		dev_priv->dmi.valid = false;
> > +
> >  	/* Setup the write-once "constant" device info */
> >  	device_info = (struct intel_device_info *)&dev_priv->info;
> >  	memcpy(device_info, info, sizeof(dev_priv->info));
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index f37ac12..a2a7d8d 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -2022,6 +2022,13 @@ struct drm_i915_private {
> >  	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
> >  	 * will be rejected. Instead look for a better place.
> >  	 */
> > +
> > +	/* DMI data for memory bandwidth calculation */
> > +	struct {
> > +		bool valid;
> > +		uint16_t mem_channel;
> > +		int16_t mem_speed;
> > +	} dmi;
> >  };
> >  
> >  static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
> > -- 
> > 2.1.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel OTC

-- 
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-03-08 18:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08  1:05 [PATCH 0/8] SKL WM fixes and Arbitrated Display Bandwidth WA Matt Roper
2016-03-08  1:05 ` [PATCH 1/8] drm/i915/skl+: Use plane size for relative data rate calculation Matt Roper
2016-03-08  1:05 ` [PATCH 2/8] drm/i915/skl+: calculate ddb minimum allocation (v3) Matt Roper
2016-03-08  1:05 ` [PATCH 3/8] drm/i915/skl+: calculate plane pixel rate (v3) Matt Roper
2016-03-08  1:05 ` [PATCH 4/8] drm/i915/skl+: Use scaling amount for plane data rate calculation (v3) Matt Roper
2016-04-13 20:58   ` Sripada, Radhakrishna
2016-03-08  1:05 ` [PATCH 5/8] drm/i915/gen9: Hold wm_mutex around SKL watermark updates Matt Roper
2016-03-08  1:05 ` [PATCH 6/8] dmi: Move memdev_dmi_entry definition to dmi.h Matt Roper
2016-03-08 12:37   ` Jean Delvare
2016-03-08 12:37     ` Jean Delvare
2016-03-08 18:32     ` [PATCH 6/8] dmi: Move memdev_dmi_entry definition to dmi.h (v2) Matt Roper
2016-03-08 18:32       ` Matt Roper
2016-03-17 14:18       ` Jean Delvare
2017-07-31  8:36         ` Jean Delvare
2017-07-31  8:36           ` Jean Delvare
2017-08-09 16:18           ` Matt Roper
2017-08-09 16:18             ` Matt Roper
2017-08-10  9:39             ` Jean Delvare
2017-08-10  9:39               ` Jean Delvare
2016-03-08  1:05 ` [PATCH 7/8] drm/i915: Add support to parse DMI table and get platform memory info (v3) Matt Roper
2016-03-08 18:49   ` Ville Syrjälä
2016-03-08 18:55     ` Matt Roper [this message]
2016-03-08 19:00   ` [PATCH 7/8] drm/i915: Add support to parse DMI table and get platform memory info (v4) Matt Roper
2016-03-08  1:05 ` [PATCH 8/8] drm/i915/skl: WA for watermark calculation based on Arbitrated Display BW (v4) Matt Roper
2016-03-08  5:07 ` [PATCH 0/8] SKL WM fixes and Arbitrated Display Bandwidth WA Kumar, Shobhit
2016-03-08  7:57 ` ✗ Fi.CI.BAT: failure for " Patchwork
2016-03-08 18:51   ` Matt Roper
2016-03-09  7:01 ` ✗ Fi.CI.BAT: failure for SKL WM fixes and Arbitrated Display Bandwidth WA (rev3) 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=20160308185522.GI8165@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=shobhit.kumar@intel.com \
    --cc=ville.syrjala@linux.intel.com \
    /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.