linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Airlie <airlied@linux.ie>,
	linuxppc-dev@ozlabs.org, dri-devel@lists.sf.net
Subject: Re: [PATCH 1/3] drm: Use resource_size_t for drm_get_resource_{start, len}
Date: Mon, 02 Feb 2009 11:02:43 -0800	[thread overview]
Message-ID: <1233601363.4932.0.camel@gaiman> (raw)
In-Reply-To: <20090202055557.57CECDDF4A@ozlabs.org>

[-- Attachment #1: Type: text/plain, Size: 7019 bytes --]

On Mon, 2009-02-02 at 16:55 +1100, Benjamin Herrenschmidt wrote:
> The DRM uses its own wrappers to obtain resources from PCI devices,
> which currently convert the resource_size_t into an unsigned long.
> 
> This is broken on 32-bit platforms with >32-bit physical address
> space.
> 
> This fixes them, along with a few occurences of unsigned long used
> to store such a resource in drivers.

Do we just want to dump the wrappers, instead?

> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> 
>  drivers/gpu/drm/drm_bufs.c          |    4 ++--
>  drivers/gpu/drm/i915/i915_dma.c     |    2 +-
>  drivers/gpu/drm/mga/mga_drv.h       |    4 ++--
>  drivers/gpu/drm/radeon/radeon_drv.h |    2 +-
>  drivers/gpu/drm/savage/savage_bci.c |    8 ++++----
>  include/drm/drmP.h                  |    6 +++---
>  include/drm/drm_crtc.h              |    2 +-
>  7 files changed, 14 insertions(+), 14 deletions(-)
> 
> --- linux-work.orig/drivers/gpu/drm/drm_bufs.c	2009-02-02 14:11:26.000000000 +1100
> +++ linux-work/drivers/gpu/drm/drm_bufs.c	2009-02-02 14:11:35.000000000 +1100
> @@ -36,13 +36,13 @@
>  #include <linux/vmalloc.h>
>  #include "drmP.h"
>  
> -unsigned long drm_get_resource_start(struct drm_device *dev, unsigned int resource)
> +resource_size_t drm_get_resource_start(struct drm_device *dev, unsigned int resource)
>  {
>  	return pci_resource_start(dev->pdev, resource);
>  }
>  EXPORT_SYMBOL(drm_get_resource_start);
>  
> -unsigned long drm_get_resource_len(struct drm_device *dev, unsigned int resource)
> +resource_size_t drm_get_resource_len(struct drm_device *dev, unsigned int resource)
>  {
>  	return pci_resource_len(dev->pdev, resource);
>  }
> Index: linux-work/drivers/gpu/drm/i915/i915_dma.c
> ===================================================================
> --- linux-work.orig/drivers/gpu/drm/i915/i915_dma.c	2009-02-02 14:25:44.000000000 +1100
> +++ linux-work/drivers/gpu/drm/i915/i915_dma.c	2009-02-02 14:28:19.000000000 +1100
> @@ -1051,7 +1051,7 @@ void i915_master_destroy(struct drm_devi
>  int i915_driver_load(struct drm_device *dev, unsigned long flags)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	unsigned long base, size;
> +	resource_size_t base, size;
>  	int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1;
>  
>  	/* i915 has 4 more counters */
> Index: linux-work/drivers/gpu/drm/mga/mga_drv.h
> ===================================================================
> --- linux-work.orig/drivers/gpu/drm/mga/mga_drv.h	2009-02-02 14:18:10.000000000 +1100
> +++ linux-work/drivers/gpu/drm/mga/mga_drv.h	2009-02-02 14:18:37.000000000 +1100
> @@ -113,8 +113,8 @@ typedef struct drm_mga_private {
>  	 * \sa drm_mga_private_t::mmio
>  	 */
>  	/*@{ */
> -	u32 mmio_base;		   /**< Bus address of base of MMIO. */
> -	u32 mmio_size;		   /**< Size of the MMIO region. */
> +	resource_size_t mmio_base;	   /**< Bus address of base of MMIO. */
> +	resource_size_t mmio_size;	   /**< Size of the MMIO region. */
>  	/*@} */
>  
>  	u32 clear_cmd;
> Index: linux-work/drivers/gpu/drm/radeon/radeon_drv.h
> ===================================================================
> --- linux-work.orig/drivers/gpu/drm/radeon/radeon_drv.h	2009-02-02 14:13:35.000000000 +1100
> +++ linux-work/drivers/gpu/drm/radeon/radeon_drv.h	2009-02-02 14:13:44.000000000 +1100
> @@ -316,7 +316,7 @@ typedef struct drm_radeon_private {
>  
>  	/* starting from here on, data is preserved accross an open */
>  	uint32_t flags;		/* see radeon_chip_flags */
> -	unsigned long fb_aper_offset;
> +	resource_size_t fb_aper_offset;
>  
>  	int num_gb_pipes;
>  	int track_flush;
> Index: linux-work/drivers/gpu/drm/savage/savage_bci.c
> ===================================================================
> --- linux-work.orig/drivers/gpu/drm/savage/savage_bci.c	2009-02-02 14:15:43.000000000 +1100
> +++ linux-work/drivers/gpu/drm/savage/savage_bci.c	2009-02-02 14:16:04.000000000 +1100
> @@ -599,8 +599,8 @@ int savage_driver_firstopen(struct drm_d
>  			    drm_mtrr_add(dev_priv->mtrr[2].base,
>  					 dev_priv->mtrr[2].size, DRM_MTRR_WC);
>  		} else {
> -			DRM_ERROR("strange pci_resource_len %08lx\n",
> -				  drm_get_resource_len(dev, 0));
> +			DRM_ERROR("strange pci_resource_len %08llx\n",
> +				  (unsigned long long)drm_get_resource_len(dev, 0));
>  		}
>  	} else if (dev_priv->chipset != S3_SUPERSAVAGE &&
>  		   dev_priv->chipset != S3_SAVAGE2000) {
> @@ -620,8 +620,8 @@ int savage_driver_firstopen(struct drm_d
>  			    drm_mtrr_add(dev_priv->mtrr[0].base,
>  					 dev_priv->mtrr[0].size, DRM_MTRR_WC);
>  		} else {
> -			DRM_ERROR("strange pci_resource_len %08lx\n",
> -				  drm_get_resource_len(dev, 1));
> +			DRM_ERROR("strange pci_resource_len %08llx\n",
> +				  (unsigned long long)drm_get_resource_len(dev, 1));
>  		}
>  	} else {
>  		mmio_base = drm_get_resource_start(dev, 0);
> Index: linux-work/include/drm/drmP.h
> ===================================================================
> --- linux-work.orig/include/drm/drmP.h	2009-02-02 14:16:43.000000000 +1100
> +++ linux-work/include/drm/drmP.h	2009-02-02 14:16:57.000000000 +1100
> @@ -1173,10 +1173,10 @@ extern int drm_freebufs(struct drm_devic
>  extern int drm_mapbufs(struct drm_device *dev, void *data,
>  		       struct drm_file *file_priv);
>  extern int drm_order(unsigned long size);
> -extern unsigned long drm_get_resource_start(struct drm_device *dev,
> +extern resource_size_t drm_get_resource_start(struct drm_device *dev,
> +					      unsigned int resource);
> +extern resource_size_t drm_get_resource_len(struct drm_device *dev,
>  					    unsigned int resource);
> -extern unsigned long drm_get_resource_len(struct drm_device *dev,
> -					  unsigned int resource);
>  
>  				/* DMA support (drm_dma.h) */
>  extern int drm_dma_setup(struct drm_device *dev);
> Index: linux-work/include/drm/drm_crtc.h
> ===================================================================
> --- linux-work.orig/include/drm/drm_crtc.h	2009-02-02 14:24:56.000000000 +1100
> +++ linux-work/include/drm/drm_crtc.h	2009-02-02 14:25:03.000000000 +1100
> @@ -550,7 +550,7 @@ struct drm_mode_config {
>  	int min_width, min_height;
>  	int max_width, max_height;
>  	struct drm_mode_config_funcs *funcs;
> -	unsigned long fb_base;
> +	resource_size_t fb_base;
>  
>  	/* pointers to standard properties */
>  	struct list_head property_blob_list;
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> --
> _______________________________________________
> Dri-devel mailing list
> Dri-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dri-devel
-- 
Eric Anholt
eric@anholt.net                         eric.anholt@intel.com



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2009-02-02 19:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-02  5:55 [PATCH 1/3] drm: Use resource_size_t for drm_get_resource_{start, len} Benjamin Herrenschmidt
2009-02-02 13:08 ` Dave Airlie
2009-02-02 20:36   ` Benjamin Herrenschmidt
2009-02-02 19:02 ` Eric Anholt [this message]
2009-02-02 20:37   ` Benjamin Herrenschmidt

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=1233601363.4932.0.camel@gaiman \
    --to=eric@anholt.net \
    --cc=airlied@linux.ie \
    --cc=benh@kernel.crashing.org \
    --cc=dri-devel@lists.sf.net \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).