From: Daniel Vetter <daniel@ffwll.ch>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/i915/gtt: Allow >= 4GB sizes for vm.
Date: Tue, 12 May 2015 10:39:47 +0200 [thread overview]
Message-ID: <20150512083947.GC15256@phenom.ffwll.local> (raw)
In-Reply-To: <1431416110-11246-2-git-send-email-mika.kuoppala@intel.com>
On Tue, May 12, 2015 at 10:35:09AM +0300, Mika Kuoppala wrote:
> We can have exactly 4GB sized ppgtt with 32bit system.
> size_t is inadequate for this.
>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
A quick grep shows that there's still lots of size_t in gem code
(i915_gem.c, i915_gem_gtt.c and parts of i915_debugfs.c). I think we need
to convert them all to avoid overflow issues.
-Daniel
> ---
> drivers/char/agp/intel-gtt.c | 2 +-
> drivers/gpu/drm/i915/i915_debugfs.c | 4 ++--
> drivers/gpu/drm/i915/i915_gem_gtt.c | 8 ++++----
> drivers/gpu/drm/i915/i915_gem_gtt.h | 6 +++---
> include/drm/intel-gtt.h | 2 +-
> 5 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
> index 0b4188b..2f0396c 100644
> --- a/drivers/char/agp/intel-gtt.c
> +++ b/drivers/char/agp/intel-gtt.c
> @@ -1408,7 +1408,7 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
> }
> EXPORT_SYMBOL(intel_gmch_probe);
>
> -void intel_gtt_get(size_t *gtt_total, size_t *stolen_size,
> +void intel_gtt_get(u64 *gtt_total, size_t *stolen_size,
> phys_addr_t *mappable_base, unsigned long *mappable_end)
> {
> *gtt_total = intel_private.gtt_total_entries << PAGE_SHIFT;
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index adbbdda..44175f6 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -474,9 +474,9 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
> seq_printf(m, "%u fault mappable objects, %zu bytes\n",
> count, size);
>
> - seq_printf(m, "%zu [%lu] gtt total\n",
> + seq_printf(m, "%llu [%llu] gtt total\n",
> dev_priv->gtt.base.total,
> - dev_priv->gtt.mappable_end - dev_priv->gtt.base.start);
> + (u64)dev_priv->gtt.mappable_end - dev_priv->gtt.base.start);
>
> seq_putc(m, '\n');
> print_batch_pool_stats(m, dev_priv);
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 17b7df0..525d154 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2347,7 +2347,7 @@ static void chv_setup_private_ppat(struct drm_i915_private *dev_priv)
> }
>
> static int gen8_gmch_probe(struct drm_device *dev,
> - size_t *gtt_total,
> + u64 *gtt_total,
> size_t *stolen,
> phys_addr_t *mappable_base,
> unsigned long *mappable_end)
> @@ -2395,7 +2395,7 @@ static int gen8_gmch_probe(struct drm_device *dev,
> }
>
> static int gen6_gmch_probe(struct drm_device *dev,
> - size_t *gtt_total,
> + u64 *gtt_total,
> size_t *stolen,
> phys_addr_t *mappable_base,
> unsigned long *mappable_end)
> @@ -2446,7 +2446,7 @@ static void gen6_gmch_remove(struct i915_address_space *vm)
> }
>
> static int i915_gmch_probe(struct drm_device *dev,
> - size_t *gtt_total,
> + u64 *gtt_total,
> size_t *stolen,
> phys_addr_t *mappable_base,
> unsigned long *mappable_end)
> @@ -2514,7 +2514,7 @@ int i915_gem_gtt_init(struct drm_device *dev)
> gtt->base.dev = dev;
>
> /* GMADR is the PCI mmio aperture into the global GTT. */
> - DRM_INFO("Memory usable by graphics device = %zdM\n",
> + DRM_INFO("Memory usable by graphics device = %lluM\n",
> gtt->base.total >> 20);
> DRM_DEBUG_DRIVER("GMADR size = %ldM\n", gtt->mappable_end >> 20);
> DRM_DEBUG_DRIVER("GTT stolen size = %zdM\n", gtt->stolen_size >> 20);
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index 0d46dd2..5786c7d 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -233,8 +233,8 @@ struct i915_address_space {
> struct drm_mm mm;
> struct drm_device *dev;
> struct list_head global_link;
> - unsigned long start; /* Start offset always 0 for dri2 */
> - size_t total; /* size addr space maps (ex. 2GB for ggtt) */
> + u64 start; /* Start offset always 0 for dri2 */
> + u64 total; /* size addr space maps (ex. 2GB for ggtt) */
>
> struct {
> dma_addr_t addr;
> @@ -314,7 +314,7 @@ struct i915_gtt {
> int mtrr;
>
> /* global gtt ops */
> - int (*gtt_probe)(struct drm_device *dev, size_t *gtt_total,
> + int (*gtt_probe)(struct drm_device *dev, u64 *gtt_total,
> size_t *stolen, phys_addr_t *mappable_base,
> unsigned long *mappable_end);
> };
> diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
> index b08bdad..dbf4105 100644
> --- a/include/drm/intel-gtt.h
> +++ b/include/drm/intel-gtt.h
> @@ -3,7 +3,7 @@
> #ifndef _DRM_INTEL_GTT_H
> #define _DRM_INTEL_GTT_H
>
> -void intel_gtt_get(size_t *gtt_total, size_t *stolen_size,
> +void intel_gtt_get(u64 *gtt_total, size_t *stolen_size,
> phys_addr_t *mappable_base, unsigned long *mappable_end);
>
> int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
> --
> 1.9.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-05-12 8:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 7:35 [PATCH 1/3] drm/i915/gtt: Fix the boundary check for vm area Mika Kuoppala
2015-05-12 7:35 ` [PATCH 2/3] drm/i915/gtt: Allow >= 4GB sizes for vm Mika Kuoppala
2015-05-12 8:39 ` Daniel Vetter [this message]
2015-05-12 7:35 ` [PATCH 3/3] drm/i915/gtt: Check va range against vm size Mika Kuoppala
2015-05-15 9:22 ` shuang.he
2015-05-12 8:36 ` [PATCH 1/3] drm/i915/gtt: Fix the boundary check for vm area 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=20150512083947.GC15256@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox