Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1418958 > unrolled thread

[PATCH 1/2] soc: qcom: smp2p: Correct addressing of outgoing value

Started byBjorn Andersson <bjorn.andersson@linaro.org>
First post2016-06-10 02:30 +0200
Last post2016-06-10 02:30 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] soc: qcom: smp2p: Correct addressing of outgoing value Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-06-10 02:30 +0200
    [PATCH 2/2] soc: qcom: smp2p: Drop io-accessors Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-06-10 02:30 +0200

#1418958 — [PATCH 1/2] soc: qcom: smp2p: Correct addressing of outgoing value

FromBjorn Andersson <bjorn.andersson@linaro.org>
Date2016-06-10 02:30 +0200
Subject[PATCH 1/2] soc: qcom: smp2p: Correct addressing of outgoing value
Message-ID<rIiuJ-5BG-11@gated-at.bofh.it>
The valid_entries index should not be incremented until after we have
acquired the pointer to the value, or we will read and write data one
item off.

Fixes: 50e99641413e ("soc: qcom: smp2p: Qualcomm Shared Memory Point to Point")
Cc: stable@vger.kernel.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/soc/qcom/smp2p.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
index f1eed7f9dd67..9c2788b8f2c3 100644
--- a/drivers/soc/qcom/smp2p.c
+++ b/drivers/soc/qcom/smp2p.c
@@ -344,11 +344,12 @@ static int qcom_smp2p_outbound_entry(struct qcom_smp2p *smp2p,
 	/* Allocate an entry from the smem item */
 	strlcpy(buf, entry->name, SMP2P_MAX_ENTRY_NAME);
 	memcpy_toio(out->entries[out->valid_entries].name, buf, SMP2P_MAX_ENTRY_NAME);
-	out->valid_entries++;
 
 	/* Make the logical entry reference the physical value */
 	entry->value = &out->entries[out->valid_entries].value;
 
+	out->valid_entries++;
+
 	entry->state = qcom_smem_state_register(node, &smp2p_state_ops, entry);
 	if (IS_ERR(entry->state)) {
 		dev_err(smp2p->dev, "failed to register qcom_smem_state\n");
-- 
2.5.0

[toc] | [next] | [standalone]


#1418962 — [PATCH 2/2] soc: qcom: smp2p: Drop io-accessors

FromBjorn Andersson <bjorn.andersson@linaro.org>
Date2016-06-10 02:30 +0200
Subject[PATCH 2/2] soc: qcom: smp2p: Drop io-accessors
Message-ID<rIiuJ-5BG-19@gated-at.bofh.it>
In reply to#1418958
SMEM is now mapped write-combine and we can use memcpy to access the
name of the entires.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/soc/qcom/smp2p.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
index 9c2788b8f2c3..f51fb2ea7200 100644
--- a/drivers/soc/qcom/smp2p.c
+++ b/drivers/soc/qcom/smp2p.c
@@ -196,7 +196,7 @@ static irqreturn_t qcom_smp2p_intr(int irq, void *data)
 	/* Match newly created entries */
 	for (i = smp2p->valid_entries; i < in->valid_entries; i++) {
 		list_for_each_entry(entry, &smp2p->inbound, node) {
-			memcpy_fromio(buf, in->entries[i].name, sizeof(buf));
+			memcpy(buf, in->entries[i].name, sizeof(buf));
 			if (!strcmp(buf, entry->name)) {
 				entry->value = &in->entries[i].value;
 				break;
@@ -343,7 +343,7 @@ static int qcom_smp2p_outbound_entry(struct qcom_smp2p *smp2p,
 
 	/* Allocate an entry from the smem item */
 	strlcpy(buf, entry->name, SMP2P_MAX_ENTRY_NAME);
-	memcpy_toio(out->entries[out->valid_entries].name, buf, SMP2P_MAX_ENTRY_NAME);
+	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;
-- 
2.5.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web