[Cbe-oss-dev] [PATCH] block: Fix ps3vram sparse warnings

Jim Paris jim at jtan.com
Fri Mar 22 08:19:55 EST 2013


Geoff Levand wrote:
> Fix sparse warnings like these:
> 
>  drivers/block/ps3vram.c: warning: incorrect type in assignment (different address spaces)
>  drivers/block/ps3vram.c:    expected unsigned int [usertype] *ctrl
>  drivers/block/ps3vram.c:    got void [noderef] <asn:2>*
> 
> Cc: Jim Paris <jim at jtan.com>
> Signed-off-by: Geoff Levand <geoff at infradead.org>
> ---
> 
> Hi Jim,
> 
> I'll send this to Jens for linux-3.10.  Please check.
> 
> -Geoff
> 
>  drivers/block/ps3vram.c |   32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
> index 75e112d..8941212 100644
> --- a/drivers/block/ps3vram.c
> +++ b/drivers/block/ps3vram.c
> @@ -73,8 +73,8 @@ struct ps3vram_priv {
>  
>  	u64 memory_handle;
>  	u64 context_handle;
> -	u32 *ctrl;
> -	void *reports;
> +	u32 __iomem *ctrl;
> +	void __iomem *reports;
>  	u8 *xdr_buf;
>  
>  	u32 *fifo_base;
> @@ -104,7 +104,7 @@ static char *size = "256M";
>  module_param(size, charp, 0);
>  MODULE_PARM_DESC(size, "memory size");
>  
> -static u32 *ps3vram_get_notifier(void *reports, int notifier)
> +static u32 __iomem *ps3vram_get_notifier(void __iomem *reports, int notifier)
>  {
>  	return reports + DMA_NOTIFIER_OFFSET_BASE +
>  	       DMA_NOTIFIER_SIZE * notifier;
> @@ -113,22 +113,22 @@ static u32 *ps3vram_get_notifier(void *reports, int notifier)
>  static void ps3vram_notifier_reset(struct ps3_system_bus_device *dev)
>  {
>  	struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev);
> -	u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
> +	u32 __iomem *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
>  	int i;
>  
>  	for (i = 0; i < 4; i++)
> -		notify[i] = 0xffffffff;
> +		writel(0xffffffff, notify + i);

Hi Geoff,

It's been a while since I've looked at any of this, and I'm unable to
test on the PS3 at the moment, but shouldn't this be ioread32be() and
iowrite32be() instead of readl() and writel() throughout here?

-jim

>  }
>  
>  static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev,
>  				 unsigned int timeout_ms)
>  {
>  	struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev);
> -	u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
> +	u32 __iomem *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
>  	unsigned long timeout;
>  
>  	for (timeout = 20; timeout; timeout--) {
> -		if (!notify[3])
> +		if (!readl(notify + 3))
>  			return 0;
>  		udelay(10);
>  	}
> @@ -136,7 +136,7 @@ static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev,
>  	timeout = jiffies + msecs_to_jiffies(timeout_ms);
>  
>  	do {
> -		if (!notify[3])
> +		if (!readl(notify + 3))
>  			return 0;
>  		msleep(1);
>  	} while (time_before(jiffies, timeout));
> @@ -148,8 +148,8 @@ static void ps3vram_init_ring(struct ps3_system_bus_device *dev)
>  {
>  	struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev);
>  
> -	priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET;
> -	priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET;
> +	writel(FIFO_BASE + FIFO_OFFSET, priv->ctrl + CTRL_PUT);
> +	writel(FIFO_BASE + FIFO_OFFSET, priv->ctrl + CTRL_GET);
>  }
>  
>  static int ps3vram_wait_ring(struct ps3_system_bus_device *dev,
> @@ -159,14 +159,14 @@ static int ps3vram_wait_ring(struct ps3_system_bus_device *dev,
>  	unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
>  
>  	do {
> -		if (priv->ctrl[CTRL_PUT] == priv->ctrl[CTRL_GET])
> +		if (readl(priv->ctrl + CTRL_PUT) == readl(priv->ctrl + CTRL_GET))
>  			return 0;
>  		msleep(1);
>  	} while (time_before(jiffies, timeout));
>  
>  	dev_warn(&dev->core, "FIFO timeout (%08x/%08x/%08x)\n",
> -		 priv->ctrl[CTRL_PUT], priv->ctrl[CTRL_GET],
> -		 priv->ctrl[CTRL_TOP]);
> +		 readl(priv->ctrl + CTRL_PUT), readl(priv->ctrl + CTRL_GET),
> +		 readl(priv->ctrl + CTRL_TOP));
>  
>  	return -ETIMEDOUT;
>  }
> @@ -189,7 +189,7 @@ static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev)
>  
>  	ps3vram_out_ring(priv, 0x20000000 | (FIFO_BASE + FIFO_OFFSET));
>  
> -	priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET;
> +	writel(FIFO_BASE + FIFO_OFFSET, priv->ctrl + CTRL_PUT);
>  
>  	/* asking the HV for a blit will kick the FIFO */
>  	status = lv1_gpu_fb_blit(priv->context_handle, 0, 0, 0, 0);
> @@ -207,8 +207,8 @@ static void ps3vram_fire_ring(struct ps3_system_bus_device *dev)
>  
>  	mutex_lock(&ps3_gpu_mutex);
>  
> -	priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET +
> -			       (priv->fifo_ptr - priv->fifo_base) * sizeof(u32);
> +	writel(FIFO_BASE + FIFO_OFFSET + (priv->fifo_ptr - priv->fifo_base)
> +		* sizeof(u32), priv->ctrl + CTRL_PUT);
>  
>  	/* asking the HV for a blit will kick the FIFO */
>  	status = lv1_gpu_fb_blit(priv->context_handle, 0, 0, 0, 0);
> -- 
> 1.7.9.5
> 
> 
> 
> _______________________________________________
> cbe-oss-dev mailing list
> cbe-oss-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/cbe-oss-dev


More information about the cbe-oss-dev mailing list