linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	arm-soc <arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	SoC Team <soc-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Markus Mayer <mmayer-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	bcm-kernel-feedback-list
	<bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Florian Fainelli
	<f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Santosh Shilimkar
	<ssantosh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Matthias Brugger
	<matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>,
	Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	Vladimir Zapolskiy <vz-ChpfBGZJDbMAvxtiuMwx3w@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jonathan Hunter
	<jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux ARM
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"moderated list:ARM/Mediatek SoC..."
	<linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	linux-omap
	<linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>"open
	list:TEGRA ARCHITECTURE SUPPORT" <li>
Subject: Re: [PATCH 14/23] memory: ti-emif-pm: Fix cast to iomem pointer
Date: Thu, 23 Jul 2020 12:01:36 +0200	[thread overview]
Message-ID: <20200723100136.GB30472@kozik-lap> (raw)
In-Reply-To: <CAK8P3a2O4bCb_Bcpc+Y4BuXmrO6mbVwgo67aGF5E=uxHQpeTnw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, Jul 23, 2020 at 11:14:02AM +0200, Arnd Bergmann wrote:
> On Thu, Jul 23, 2020 at 11:02 AM Krzysztof Kozlowski <krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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.

Ah, right.

> 
> > > 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.

At least the barrier would come through mutex in sram_exec_copy() and
later spin locks for page table manipulation.

Anyway, I do not have the HW to test the changes or to confirm whether
this is real issue.  I guess the driver author/owner should follow up on
this report.

Best regards,
Krzysztof

  parent reply	other threads:[~2020-07-23 10:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200723073744.13400-1-krzk@kernel.org>
     [not found] ` <20200723073744.13400-15-krzk@kernel.org>
     [not found]   ` <20200723073744.13400-15-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-07-23  8:48     ` [PATCH 14/23] memory: ti-emif-pm: Fix cast to iomem pointer Arnd Bergmann
     [not found]       ` <CAK8P3a3btGD5oqmPXJk=UOmA=wuUxn-vOOO982uAjuRcE3crVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-23  9:02         ` Krzysztof Kozlowski
2020-07-23  9:14           ` Arnd Bergmann
     [not found]             ` <CAK8P3a2O4bCb_Bcpc+Y4BuXmrO6mbVwgo67aGF5E=uxHQpeTnw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-23 10:01               ` Krzysztof Kozlowski [this message]
     [not found] ` <20200723073744.13400-19-krzk@kernel.org>
     [not found]   ` <20200723073744.13400-19-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-07-23  8:50     ` [PATCH 18/23] memory: mtk-smi: Add argument to function definition Arnd Bergmann
2020-07-23  8:55       ` Krzysztof Kozlowski
     [not found] ` <20200723073744.13400-20-krzk@kernel.org>
     [not found]   ` <20200723073744.13400-20-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-07-23  9:09     ` [PATCH 19/23] memory: omap-gpmc: Enclose macro statements in do-while Arnd Bergmann
2020-07-23 10:16       ` Krzysztof Kozlowski
     [not found] ` <20200723073744.13400-21-krzk@kernel.org>
     [not found]   ` <20200723073744.13400-21-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-07-23  9:11     ` [PATCH 20/23] memory: omap-gpmc: Fix whitespace issue Arnd Bergmann
     [not found]       ` <CAK8P3a1=WCQ5326Et5RRK7yiOYeHH7uUkQ+T3YPtj2XRh+gkgA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-23 10:08         ` Krzysztof Kozlowski
     [not found] ` <20200723073744.13400-1-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-07-23  9:31   ` [RFC PATCH 00/23] memory: Cleanup, improve and compile test memory drivers Arnd Bergmann
     [not found]     ` <CAK8P3a0hcVhBbKCBDSZYXChmPpRVsEi_G6+oj5quC6uUiPeeiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-23  9:52       ` Krzysztof Kozlowski
2020-07-23 10:14         ` Arnd Bergmann
     [not found] ` <20200723073744.13400-17-krzk@kernel.org>
     [not found]   ` <20200723073744.13400-17-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-07-23 17:11     ` [PATCH 16/23] memory: brcmstb_dpfe: Constify the contents of string Florian Fainelli
2020-07-23 17:15       ` Markus Mayer
     [not found] ` <20200723073744.13400-18-krzk@kernel.org>
2020-07-23 17:11   ` [PATCH 17/23] memory: brcmstb_dpfe: Remove unneeded braces Florian Fainelli
     [not found]     ` <e65d4ed3-3c01-acb7-f324-be99201815df-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-07-23 17:15       ` Markus Mayer
     [not found] ` <20200723073744.13400-24-krzk@kernel.org>
2020-07-23 17:12   ` [PATCH 23/23] MAINTAINERS: Add Krzysztof Kozlowski as maintainer of memory controllers Florian Fainelli
2020-07-24  7:15     ` Krzysztof Kozlowski

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=20200723100136.GB30472@kozik-lap \
    --to=krzk-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=mmayer-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=rogerq-l0cyMroinI0@public.gmane.org \
    --cc=soc-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=ssantosh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    --cc=vz-ChpfBGZJDbMAvxtiuMwx3w@public.gmane.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).