Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Deepak S <deepak.s@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: Extend BIOS stolen mem handling to all platform
Date: Fri, 12 Sep 2014 12:23:14 +0300	[thread overview]
Message-ID: <20140912092314.GL4193@intel.com> (raw)
In-Reply-To: <1410434909-24902-1-git-send-email-daniel.vetter@ffwll.ch>

On Thu, Sep 11, 2014 at 01:28:29PM +0200, Daniel Vetter wrote:
> Based upon a patch from Deepak, but reworked to only apply on gen7+
> and with the logic a bit clarified.
> 
> Cc: Deepak S <deepak.s@intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 13 +++++++++++--
>  drivers/gpu/drm/i915/i915_reg.h        |  8 ++++++++
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 21c025a209c0..15d42b3e2029 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -289,6 +289,7 @@ void i915_gem_cleanup_stolen(struct drm_device *dev)
>  int i915_gem_init_stolen(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	u32 tmp;
>  	int bios_reserved = 0;
>  
>  #ifdef CONFIG_INTEL_IOMMU
> @@ -308,8 +309,16 @@ int i915_gem_init_stolen(struct drm_device *dev)
>  	DRM_DEBUG_KMS("found %zd bytes of stolen memory at %08lx\n",
>  		      dev_priv->gtt.stolen_size, dev_priv->mm.stolen_base);
>  
> -	if (IS_VALLEYVIEW(dev))
> -		bios_reserved = 1024*1024; /* top 1M on VLV/BYT */
> +	if (INTEL_INFO(dev)->gen >= 8) {
> +		tmp = I915_READ(GEN7_BIOS_RESERVED);
> +		tmp >>= GEN8_BIOS_RESERVED_SHIFT;
> +		tmp &= GEN8_BIOS_RESERVED_SHIFT;
                                          ^^^^^
MASK

The docs are a bit confusing on this topic, but othwewise this seems
to be OK wrt. most of the docs.

So with that one thing fixed:
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>


> +		bios_reserved = (1024*1024) << tmp;
> +	} else if (IS_GEN7(dev)) {
> +		tmp = I915_READ(GEN7_BIOS_RESERVED);
> +		bios_reserved = tmp & GEN7_BIOS_RESERVED_256K ?
> +			256*1024 : 1024*1024;
> +	}
>  
>  	if (WARN_ON(bios_reserved > dev_priv->gtt.stolen_size))
>  		return 0;
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 15c0eaa9f97f..eb1430974a9a 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -143,6 +143,14 @@
>  #define GAB_CTL				0x24000
>  #define   GAB_CTL_CONT_AFTER_PAGEFAULT	(1<<8)
>  
> +#define GEN7_BIOS_RESERVED		0x1082C0
> +#define GEN7_BIOS_RESERVED_1M		(0 << 5)
> +#define GEN7_BIOS_RESERVED_256K		(1 << 5)
> +#define GEN8_BIOS_RESERVED_SHIFT       7
> +#define GEN7_BIOS_RESERVED_MASK        0x1
> +#define GEN8_BIOS_RESERVED_MASK        0x3
> +
> +
>  /* VGA stuff */
>  
>  #define VGA_ST01_MDA 0x3ba
> -- 
> 2.0.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-09-12  9:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 11:28 [PATCH] drm/i915: Extend BIOS stolen mem handling to all platform Daniel Vetter
2014-09-12  9:23 ` Ville Syrjälä [this message]
2014-09-12  9:39   ` Daniel Vetter

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=20140912092314.GL4193@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=deepak.s@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox