All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: linux-kernel@lists.codethink.co.uk, Andrew Lunn <andrew@lunn.ch>,
	Jason Cooper <jason@lakedaemon.net>,
	Gregory Clement <gregory.clement@bootlin.com>,
	linux-arm-kernel@lists.infradead.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH] mvebu: fix __iomem on mvebu_pm_store_armadaxp_bootinfo()
Date: Wed, 9 Oct 2019 17:00:19 +0100	[thread overview]
Message-ID: <20191009160019.GF25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <20191009153342.23789-1-ben.dooks@codethink.co.uk>

On Wed, Oct 09, 2019 at 04:33:42PM +0100, Ben Dooks wrote:
> The mvebu_pm_store_armadaxp_bootinfo() uses writel to
> store data, so the pointer into it should be __iomem
> annotated. Fixes the following sparse warnings:
> 
> arch/arm/mach-mvebu/pm.c:124:9: warning: incorrect type in argument 2 (different address spaces)
> arch/arm/mach-mvebu/pm.c:124:9:    expected void volatile [noderef] <asn:2> *addr
> arch/arm/mach-mvebu/pm.c:124:9:    got unsigned int [usertype] *
> arch/arm/mach-mvebu/pm.c:125:9: warning: incorrect type in argument 2 (different address spaces)
> arch/arm/mach-mvebu/pm.c:125:9:    expected void volatile [noderef] <asn:2> *addr
> arch/arm/mach-mvebu/pm.c:125:9:    got unsigned int [usertype] *
> arch/arm/mach-mvebu/pm.c:133:9: warning: incorrect type in argument 2 (different address spaces)
> arch/arm/mach-mvebu/pm.c:133:9:    expected void volatile [noderef] <asn:2> *addr
> arch/arm/mach-mvebu/pm.c:133:9:    got unsigned int [usertype] *
> arch/arm/mach-mvebu/pm.c:134:9: warning: incorrect type in argument 2 (different address spaces)
> arch/arm/mach-mvebu/pm.c:134:9:    expected void volatile [noderef] <asn:2> *addr
> arch/arm/mach-mvebu/pm.c:134:9:    got unsigned int [usertype] *
> arch/arm/mach-mvebu/pm.c:140:9: warning: incorrect type in argument 2 (different address spaces)
> arch/arm/mach-mvebu/pm.c:140:9:    expected void volatile [noderef] <asn:2> *addr
> arch/arm/mach-mvebu/pm.c:140:9:    got unsigned int [usertype] *
> arch/arm/mach-mvebu/pm.c:141:9: warning: incorrect type in argument 2 (different address spaces)
> arch/arm/mach-mvebu/pm.c:141:9:    expected void volatile [noderef] <asn:2> *addr
> arch/arm/mach-mvebu/pm.c:141:9:    got unsigned int [usertype] *
> arch/arm/mach-mvebu/pm.c:148:50: warning: incorrect type in argument 1 (different address spaces)
> arch/arm/mach-mvebu/pm.c:148:50:    expected unsigned int [noderef] [usertype] <asn:2> *store_addr
> arch/arm/mach-mvebu/pm.c:148:50:    got unsigned int [usertype] *[assigned] store_addr
> arch/arm/mach-mvebu/pm.c:150:9: warning: incorrect type in argument 2 (different address spaces)
> arch/arm/mach-mvebu/pm.c:150:9:    expected void volatile [noderef] <asn:2> *addr
> arch/arm/mach-mvebu/pm.c:150:9:    got unsigned int [usertype] *[assigned] store_addr
> 
> Note, this doesn't take into account writel() is probably heavy
> handed here and just writing the data and then flushing all the
> caches etc would be good enough.

This is definitely wrong.

> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Gregory Clement <gregory.clement@bootlin.com>
> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  arch/arm/mach-mvebu/pm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/pm.c b/arch/arm/mach-mvebu/pm.c
> index c487be61d6d8..c223f87ed338 100644
> --- a/arch/arm/mach-mvebu/pm.c
> +++ b/arch/arm/mach-mvebu/pm.c
> @@ -106,7 +106,7 @@ static phys_addr_t mvebu_internal_reg_base(void)
>  	return of_translate_address(np, in_addr);
>  }
>  
> -static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr)
> +static void mvebu_pm_store_armadaxp_bootinfo(u32 __iomem *store_addr)
>  {
>  	phys_addr_t resume_pc;
>  
> @@ -152,9 +152,9 @@ static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr)
>  
>  static int mvebu_pm_store_bootinfo(void)
>  {
> -	u32 *store_addr;
> +	u32 __iomem *store_addr;
>  
> -	store_addr = phys_to_virt(BOOT_INFO_ADDR);
> +	store_addr = (__force __iomem u32*)phys_to_virt(BOOT_INFO_ADDR);

phys_to_virt() does not return an iomem pointer, so the memory pointed
to here is _not_ iomem.  Thus, iomem accessors should not be used - and
that's where the problem actually lies.

>  
>  	if (of_machine_is_compatible("marvell,armadaxp"))
>  		mvebu_pm_store_armadaxp_bootinfo(store_addr);
> -- 
> 2.23.0
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      parent reply	other threads:[~2019-10-09 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 15:33 [PATCH] mvebu: fix __iomem on mvebu_pm_store_armadaxp_bootinfo() Ben Dooks
2019-10-09 15:35 ` Christoph Hellwig
2019-10-09 16:00 ` Russell King - ARM Linux admin [this message]

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=20191009160019.GF25745@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=ben.dooks@codethink.co.uk \
    --cc=gregory.clement@bootlin.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=sebastian.hesselbarth@gmail.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.