* [PATCH] mvebu: fix __iomem on mvebu_pm_store_armadaxp_bootinfo()
@ 2019-10-09 15:33 Ben Dooks
2019-10-09 15:35 ` Christoph Hellwig
2019-10-09 16:00 ` Russell King - ARM Linux admin
0 siblings, 2 replies; 3+ messages in thread
From: Ben Dooks @ 2019-10-09 15:33 UTC (permalink / raw)
To: linux-kernel
Cc: Andrew Lunn, Jason Cooper, Gregory Clement, Russell King,
Ben Dooks, linux-arm-kernel, Sebastian Hesselbarth
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.
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);
if (of_machine_is_compatible("marvell,armadaxp"))
mvebu_pm_store_armadaxp_bootinfo(store_addr);
--
2.23.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mvebu: fix __iomem on mvebu_pm_store_armadaxp_bootinfo()
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
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-10-09 15:35 UTC (permalink / raw)
To: Ben Dooks
Cc: linux-kernel, Andrew Lunn, Jason Cooper, Gregory Clement,
Russell King, linux-arm-kernel, Sebastian Hesselbarth
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:
Shouldn't this use something like early_ioremap instead of blind casts?
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mvebu: fix __iomem on mvebu_pm_store_armadaxp_bootinfo()
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
1 sibling, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux admin @ 2019-10-09 16:00 UTC (permalink / raw)
To: Ben Dooks
Cc: linux-kernel, Andrew Lunn, Jason Cooper, Gregory Clement,
linux-arm-kernel, Sebastian Hesselbarth
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-09 16:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).