linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	"open list:TEGRA ARCHITECTURE SUPPORT"
	<linux-tegra@vger.kernel.org>,
	linux-omap <linux-omap@vger.kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"moderated list:ARM/Mediatek SoC..."
	<linux-mediatek@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Vladimir Zapolskiy <vz@mleia.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	SoC Team <soc@kernel.org>, arm-soc <arm@kernel.org>,
	bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>,
	Markus Mayer <mmayer@broadcom.com>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Olof Johansson <olof@lixom.net>,
	Thierry Reding <thierry.reding@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Roger Quadros <rogerq@ti.com>
Subject: Re: [PATCH 14/23] memory: ti-emif-pm: Fix cast to iomem pointer
Date: Thu, 23 Jul 2020 11:14:02 +0200	[thread overview]
Message-ID: <CAK8P3a2O4bCb_Bcpc+Y4BuXmrO6mbVwgo67aGF5E=uxHQpeTnw@mail.gmail.com> (raw)
In-Reply-To: <20200723090230.GB25935@kozik-lap>

On Thu, Jul 23, 2020 at 11:02 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On Thu, Jul 23, 2020 at 10:48:19AM +0200, Arnd Bergmann wrote:
> > On Thu, Jul 23, 2020 at 9:39 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > >
> > > Cast pointer to iomem memory properly to fix sparse warning:
> > >
> > >     drivers/memory/ti-emif-pm.c:251:38: warning: incorrect type in argument 1 (different address spaces)
> > >     drivers/memory/ti-emif-pm.c:251:38:    expected void const volatile [noderef] __iomem *addr
> > >     drivers/memory/ti-emif-pm.c:251:38:    got void *
> > >
> > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> > > ---
> > >  drivers/memory/ti-emif-pm.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c
> > > index 9c90f815ad3a..6c747c1e98cb 100644
> > > --- a/drivers/memory/ti-emif-pm.c
> > > +++ b/drivers/memory/ti-emif-pm.c
> > > @@ -248,7 +248,7 @@ MODULE_DEVICE_TABLE(of, ti_emif_of_match);
> > >  static int ti_emif_resume(struct device *dev)
> > >  {
> > >         unsigned long tmp =
> > > -                       __raw_readl((void *)emif_instance->ti_emif_sram_virt);
> > > +                       __raw_readl((void __iomem *)emif_instance->ti_emif_sram_virt);
> > >
> >
> > Maybe this shouldn't even be __raw_readl(), but instead READ_ONCE()?
>
> Won't readl() be enough? Indeed it looks problematic.

readl() won't work on big-endian kernels, since this is a byte comparison.

> > The other accesses in this file don't use MMIO wrappers either but just treat
> > it as a pointer. The effect would be the same though.
>
> I think all the reads and writes are with readl() and writel().

I actually see only one other access:

        copy_addr = sram_exec_copy(emif_data->sram_pool_code,
                                   (void *)emif_data->ti_emif_sram_virt,
                                   &ti_emif_sram, ti_emif_sram_sz);

and this one ends up in a memcpy() that does not perform any byte
swapping or barriers.

     Arnd

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

  reply	other threads:[~2020-07-23  9:15 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23  7:37 [RFC PATCH 00/23] memory: Cleanup, improve and compile test memory drivers Krzysztof Kozlowski
2020-07-23  7:37 ` [RFT 01/23] memory: omap-gpmc: Remove unneeded asm/mach-types.h inclusion Krzysztof Kozlowski
2020-07-23  7:37 ` [RFT 02/23] memory: omap-gpmc: Remove unused file-scope phys_base and mem_size Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 03/23] memory: omap-gpmc: Include <linux/sizes.h> for SZ_16M Krzysztof Kozlowski
2020-07-23  7:37 ` [RFT 04/23] memory: ti-aemif: Rename SS to SSTROBE to avoid name conflicts Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 05/23] memory: Enable compile testing for most of the drivers Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 06/23] memory: of: Remove unused headers Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 07/23] memory: of: Remove __func__ in device related messages Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 08/23] memory: of: Correct indentation Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 09/23] memory: of: Remove unneeded extern from function declarations Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 10/23] memory: emif-asm-offsets: Add GPLv2 SPDX license header Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 11/23] memory: emif: Put constant in comparison on the right side Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 12/23] memory: emif: Fix whitespace coding style violations Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 13/23] memory: emif: Silence platform_get_irq() error in driver Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 14/23] memory: ti-emif-pm: Fix cast to iomem pointer Krzysztof Kozlowski
2020-07-23  8:48   ` Arnd Bergmann
2020-07-23  9:02     ` Krzysztof Kozlowski
2020-07-23  9:14       ` Arnd Bergmann [this message]
2020-07-23 10:01         ` Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 15/23] memory: renesas-rpc-if: Simplify with PTR_ERR_OR_ZERO Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 16/23] memory: brcmstb_dpfe: Constify the contents of string Krzysztof Kozlowski
2020-07-23 17:11   ` Florian Fainelli
2020-07-23 17:15     ` Markus Mayer
2020-07-23  7:37 ` [PATCH 17/23] memory: brcmstb_dpfe: Remove unneeded braces Krzysztof Kozlowski
2020-07-23 17:11   ` Florian Fainelli
2020-07-23 17:15     ` Markus Mayer
2020-07-23  7:37 ` [PATCH 18/23] memory: mtk-smi: Add argument to function definition Krzysztof Kozlowski
2020-07-23  8:50   ` Arnd Bergmann
2020-07-23  8:55     ` Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 19/23] memory: omap-gpmc: Enclose macro statements in do-while Krzysztof Kozlowski
2020-07-23  9:09   ` Arnd Bergmann
2020-07-23 10:16     ` Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 20/23] memory: omap-gpmc: Fix whitespace issue Krzysztof Kozlowski
2020-07-23  9:11   ` Arnd Bergmann
2020-07-23 10:08     ` Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 21/23] memory: pl172: Add GPLv2 SPDX license header Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 22/23] memory: tegra: tegra210-emc: Fix indentation Krzysztof Kozlowski
2020-07-23  7:37 ` [PATCH 23/23] MAINTAINERS: Add Krzysztof Kozlowski as maintainer of memory controllers Krzysztof Kozlowski
2020-07-23 17:12   ` Florian Fainelli
2020-07-24  7:15     ` Krzysztof Kozlowski
2020-07-23  7:46 ` [RFC PATCH 00/23] memory: Cleanup, improve and compile test memory drivers Greg Kroah-Hartman
2020-07-23  9:31 ` Arnd Bergmann
2020-07-23  9:52   ` Krzysztof Kozlowski
2020-07-23 10:14     ` Arnd Bergmann

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='CAK8P3a2O4bCb_Bcpc+Y4BuXmrO6mbVwgo67aGF5E=uxHQpeTnw@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=arm@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mmayer@broadcom.com \
    --cc=olof@lixom.net \
    --cc=rogerq@ti.com \
    --cc=soc@kernel.org \
    --cc=ssantosh@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=tony@atomide.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vz@mleia.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;
as well as URLs for NNTP newsgroup(s).