mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Andersson <andersson@kernel.org>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>,
	 Konrad Dybcio <konradybcio@kernel.org>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Chris Lew <christopher.lew@oss.qualcomm.com>
Subject: Re: [PATCH] soc: qcom: smp2p: fix __iomem annotation on entry->value pointer
Date: Mon, 6 Jul 2026 22:29:59 -0500	[thread overview]
Message-ID: <akxyWw03z9fGqO64@baldur> (raw)
In-Reply-To: <cc9cd039-83c1-479e-bb97-4c3b1345cf35@oss.qualcomm.com>

On Tue, Jun 23, 2026 at 11:30:47AM +0200, Konrad Dybcio wrote:
> On 6/23/26 10:59 AM, Ben Dooks wrote:
> > The entry->value is passed to readl() so should be marked __iomem
> > so remove these sparse warnings by marking it __iomem and do the
> > relevant casting to ensure no further warnings:
> > 
> > drivers/soc/qcom/smp2p.c:280:64: warning: incorrect type in argument 1 (different address spaces)
> > drivers/soc/qcom/smp2p.c:280:64:    expected void const volatile [noderef] __iomem *addr
> > drivers/soc/qcom/smp2p.c:280:64:    got unsigned int [usertype] *value
> > drivers/soc/qcom/smp2p.c:318:34: warning: incorrect type in argument 1 (different address spaces)
> > drivers/soc/qcom/smp2p.c:318:34:    expected void const volatile [noderef] __iomem *addr
> > drivers/soc/qcom/smp2p.c:318:34:    got unsigned int [usertype] *value
> > drivers/soc/qcom/smp2p.c:446:26: warning: incorrect type in argument 1 (different address spaces)
> > drivers/soc/qcom/smp2p.c:446:26:    expected void const volatile [noderef] __iomem *addr
> > drivers/soc/qcom/smp2p.c:446:26:    got unsigned int [usertype] *value
> > drivers/soc/qcom/smp2p.c:501:33: warning: incorrect type in argument 1 (different address spaces)
> > drivers/soc/qcom/smp2p.c:501:33:    expected void const volatile [noderef] __iomem *addr
> > drivers/soc/qcom/smp2p.c:501:33:    got unsigned int [usertype] *value
> > drivers/soc/qcom/smp2p.c:504:26: warning: incorrect type in argument 2 (different address spaces)
> > drivers/soc/qcom/smp2p.c:504:26:    expected void volatile [noderef] __iomem *addr
> > drivers/soc/qcom/smp2p.c:504:26:    got unsigned int [usertype] *value
> > 
> > Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> > ---
> 
> +Chris, is this actually iomem, or should this be treated as normal
> memory (since this is just coming from SMEM, perhaps just memmap()?)
> 

It's generally DDR, but in theory SMEM can dish out iomem, iff the item
we're looking for happens to reside in a RPM "aux" memory region.

It would have been nice if I figured out how to abstract this away when
I wrote that code...

Regards,
Bjorn

> Konrad
> 
> >  drivers/soc/qcom/smp2p.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
> > index af0ceeaf6e07..fef6f17c3257 100644
> > --- a/drivers/soc/qcom/smp2p.c
> > +++ b/drivers/soc/qcom/smp2p.c
> > @@ -102,7 +102,7 @@ struct smp2p_entry {
> >  	struct qcom_smp2p *smp2p;
> >  
> >  	const char *name;
> > -	u32 *value;
> > +	u32 __iomem *value;
> >  	u32 last_value;
> >  
> >  	struct irq_domain *domain;
> > @@ -276,7 +276,7 @@ static void qcom_smp2p_start_in(struct qcom_smp2p *smp2p)
> >  		list_for_each_entry(entry, &smp2p->inbound, node) {
> >  			memcpy(buf, in->entries[i].name, sizeof(buf));
> >  			if (!strcmp(buf, entry->name)) {
> > -				entry->value = &in->entries[i].value;
> > +				entry->value = (u32 __iomem *)&in->entries[i].value;
> >  				entry->last_value = readl(entry->value);
> >  				break;
> >  			}
> > @@ -302,7 +302,7 @@ static void qcom_smp2p_notify_in(struct qcom_smp2p *smp2p)
> >  		list_for_each_entry(entry, &smp2p->inbound, node) {
> >  			memcpy(buf, in->entries[i].name, sizeof(buf));
> >  			if (!strcmp(buf, entry->name)) {
> > -				entry->value = &in->entries[i].value;
> > +				entry->value = (u32 __iomem *)&in->entries[i].value;
> >  				break;
> >  			}
> >  		}
> > @@ -528,7 +528,7 @@ static int qcom_smp2p_outbound_entry(struct qcom_smp2p *smp2p,
> >  	memcpy(out->entries[out->valid_entries].name, buf, SMP2P_MAX_ENTRY_NAME);
> >  
> >  	/* Make the logical entry reference the physical value */
> > -	entry->value = &out->entries[out->valid_entries].value;
> > +	entry->value = (u32 __iomem *)&out->entries[out->valid_entries].value;
> >  
> >  	out->valid_entries++;
> >  

      reply	other threads:[~2026-07-07  3:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23  8:59 Ben Dooks
2026-06-23  9:30 ` Konrad Dybcio
2026-07-07  3:29   ` Bjorn Andersson [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=akxyWw03z9fGqO64@baldur \
    --to=andersson@kernel.org \
    --cc=ben.dooks@codethink.co.uk \
    --cc=christopher.lew@oss.qualcomm.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome