Skip to contentSkip to conversation

soc: qcom: smp2p: fix __iomem annotation on entry->value pointer

PATCH Applied Ben Dooks 3 participants 4 messages Jun 23 – Sep 3

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 soc: qcom: smp2p: fix __iomem annotation on entry->value pointer

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

---
 drivers/soc/qcom/smp2p.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/soc/qcom/smp2p.c +4 -4
index af0ceeaf6e07..fef6f17c3257 100644
@@ -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++;
 
Signature · 1 line
2.37.2.352.g3c44437643
#1 lore raw
Quoted 20 lines · Ben Dooks

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

Quoted 2 lines

---

+Chris, is this actually iomem, or should this be treated as normal memory (since this is just coming from SMEM, perhaps just memmap()?)

Konrad

Quoted 43 lines
 drivers/soc/qcom/smp2p.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/soc/qcom/smp2p.c +4 -4
index af0ceeaf6e07..fef6f17c3257 100644
@@ -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++;
 
maintainer
#2 lore raw
Quoted 21 lines · Konrad Dybcio
Quoted 20 lines · Ben Dooks

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

Quoted 6 lines
Quoted 2 lines

---

+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

Quoted 45 lines

Konrad

Quoted 43 lines
 drivers/soc/qcom/smp2p.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/soc/qcom/smp2p.c +4 -4
index af0ceeaf6e07..fef6f17c3257 100644
@@ -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++;
 
maintainer Applied
#3 lore raw
In reply to Ben Dooks
Quoted 20 lines · Ben Dooks

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

Quoted 1 line

[...]

Applied, thanks!

[1/1] soc: qcom: smp2p: fix __iomem annotation on entry->value pointer

      commit: c5b0ca559afa50ce4ab39e85da927261814373e2

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>