linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Dąbroś" <jsd@semihalf.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: kernel test robot <lkp@intel.com>,
	kbuild-all@lists.01.org,
	 Linux Memory Management List <linux-mm@kvack.org>,
	Wolfram Sang <wsa-dev@sang-engineering.com>
Subject: Re: [linux-next:master 4897/5417] drivers/i2c/busses/i2c-designware-amdpsp.c:165:25: sparse: sparse: incorrect type in argument 1 (different address spaces)
Date: Wed, 16 Feb 2022 15:06:19 +0100	[thread overview]
Message-ID: <CAOtMz3OraM9uyRPNW7++r25LrD5-pV6-mJFg3Ct7NagdTOscwg@mail.gmail.com> (raw)
In-Reply-To: <YgpqrB2mX8gND9SP@smile.fi.intel.com>

pon., 14 lut 2022 o 15:44 Andy Shevchenko
<andriy.shevchenko@linux.intel.com> napisał(a):
>
> On Mon, Feb 14, 2022 at 02:59:34PM +0100, Jan Dąbroś wrote:
> > pon., 14 lut 2022 o 14:28 Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> napisał(a):
> > >
> > > On Mon, Feb 14, 2022 at 01:27:35PM +0100, Jan Dąbroś wrote:
> > > > pt., 11 lut 2022 o 22:24 kernel test robot <lkp@intel.com> napisał(a):
> > >
> > > > >    159
> > > > >    160  /* Helper to verify status returned by PSP */
> > > > >    161  static int check_i2c_req_sts(struct psp_i2c_req *req)
> > > > >    162  {
> > > > >    163          int status;
> > > > >    164
> > > > >  > 165          status = readl(&req->hdr.status);
> > > >
> > > > Actually the above error points to something hidden but important -
> > > > for reading from command-response buffer, we shouldn't use __iomem
> > > > specifier (nor readl() family of functions) since this is normal
> > > > memory - however updated by PSP. Thus I will refactor this to use
> > > > 'volatile u32 *' and reading status by de-referencing pointer.
> > >
> > > Not sure volatile is a good idea. Perhaps READ_ONCE() is what you need.
> > > Is this a system memory?
> >
> > Yes, this is system memory.
> >
> > Actually looking at asm-generic/rwonce.h:
> > #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
> > it is more-less based on volatile, so that compiler will not be able
> > to (among others) optimize out such reads of memory which may be
> > changed outside of the scope of "program".
> >
> > I believe that I will get the same outcome from using READ_ONCE and
> > explicit volatile, is the first way preferred in the kernel?
>
> READ_ONCE() may be different on different arches. I believe that's why
> it's preferred.

OK, I see. Let me send a commit with this change this week.

Best Regards,
Jan

>
> --
> With Best Regards,
> Andy Shevchenko
>
>


      reply	other threads:[~2022-02-16 14:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 21:24 [linux-next:master 4897/5417] drivers/i2c/busses/i2c-designware-amdpsp.c:165:25: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
2022-02-14 12:27 ` Jan Dąbroś
2022-02-14 13:27   ` Andy Shevchenko
2022-02-14 13:59     ` Jan Dąbroś
2022-02-14 14:43       ` Andy Shevchenko
2022-02-16 14:06         ` Jan Dąbroś [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=CAOtMz3OraM9uyRPNW7++r25LrD5-pV6-mJFg3Ct7NagdTOscwg@mail.gmail.com \
    --to=jsd@semihalf.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=wsa-dev@sang-engineering.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).