Commit 93dbed91 authored by Andy Gross's avatar Andy Gross

soc: qcom: smd: Use correct remote processor ID

This patch fixes SMEM addressing issues when remote processors need to use
secure SMEM partitions.
Signed-off-by: default avatarAndy Gross <agross@codeaurora.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@sonymobile.com>
parent 18912806
...@@ -37,6 +37,12 @@ The edge is described by the following properties: ...@@ -37,6 +37,12 @@ The edge is described by the following properties:
Definition: the identifier of the remote processor in the smd channel Definition: the identifier of the remote processor in the smd channel
allocation table allocation table
- qcom,remote-pid:
Usage: optional
Value type: <u32>
Definition: the identifier for the remote processor as known by the rest
of the system.
= SMD DEVICES = SMD DEVICES
In turn, subnodes of the "edges" represent devices tied to SMD channels on that In turn, subnodes of the "edges" represent devices tied to SMD channels on that
......
...@@ -96,6 +96,7 @@ static const struct { ...@@ -96,6 +96,7 @@ static const struct {
* @smd: handle to qcom_smd * @smd: handle to qcom_smd
* @of_node: of_node handle for information related to this edge * @of_node: of_node handle for information related to this edge
* @edge_id: identifier of this edge * @edge_id: identifier of this edge
* @remote_pid: identifier of remote processor
* @irq: interrupt for signals on this edge * @irq: interrupt for signals on this edge
* @ipc_regmap: regmap handle holding the outgoing ipc register * @ipc_regmap: regmap handle holding the outgoing ipc register
* @ipc_offset: offset within @ipc_regmap of the register for ipc * @ipc_offset: offset within @ipc_regmap of the register for ipc
...@@ -111,6 +112,7 @@ struct qcom_smd_edge { ...@@ -111,6 +112,7 @@ struct qcom_smd_edge {
struct qcom_smd *smd; struct qcom_smd *smd;
struct device_node *of_node; struct device_node *of_node;
unsigned edge_id; unsigned edge_id;
unsigned remote_pid;
int irq; int irq;
...@@ -572,7 +574,7 @@ static irqreturn_t qcom_smd_edge_intr(int irq, void *data) ...@@ -572,7 +574,7 @@ static irqreturn_t qcom_smd_edge_intr(int irq, void *data)
* have to scan if the amount of available space in smem have changed * have to scan if the amount of available space in smem have changed
* since last scan. * since last scan.
*/ */
available = qcom_smem_get_free_space(edge->edge_id); available = qcom_smem_get_free_space(edge->remote_pid);
if (available != edge->smem_available) { if (available != edge->smem_available) {
edge->smem_available = available; edge->smem_available = available;
edge->need_rescan = true; edge->need_rescan = true;
...@@ -976,7 +978,8 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed ...@@ -976,7 +978,8 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed
spin_lock_init(&channel->recv_lock); spin_lock_init(&channel->recv_lock);
init_waitqueue_head(&channel->fblockread_event); init_waitqueue_head(&channel->fblockread_event);
ret = qcom_smem_get(edge->edge_id, smem_info_item, (void **)&info, &info_size); ret = qcom_smem_get(edge->remote_pid, smem_info_item, (void **)&info,
&info_size);
if (ret) if (ret)
goto free_name_and_channel; goto free_name_and_channel;
...@@ -997,7 +1000,8 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed ...@@ -997,7 +1000,8 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed
goto free_name_and_channel; goto free_name_and_channel;
} }
ret = qcom_smem_get(edge->edge_id, smem_fifo_item, &fifo_base, &fifo_size); ret = qcom_smem_get(edge->remote_pid, smem_fifo_item, &fifo_base,
&fifo_size);
if (ret) if (ret)
goto free_name_and_channel; goto free_name_and_channel;
...@@ -1041,7 +1045,7 @@ static void qcom_discover_channels(struct qcom_smd_edge *edge) ...@@ -1041,7 +1045,7 @@ static void qcom_discover_channels(struct qcom_smd_edge *edge)
int i; int i;
for (tbl = 0; tbl < SMD_ALLOC_TBL_COUNT; tbl++) { for (tbl = 0; tbl < SMD_ALLOC_TBL_COUNT; tbl++) {
ret = qcom_smem_get(edge->edge_id, ret = qcom_smem_get(edge->remote_pid,
smem_items[tbl].alloc_tbl_id, smem_items[tbl].alloc_tbl_id,
(void **)&alloc_tbl, (void **)&alloc_tbl,
NULL); NULL);
...@@ -1184,6 +1188,10 @@ static int qcom_smd_parse_edge(struct device *dev, ...@@ -1184,6 +1188,10 @@ static int qcom_smd_parse_edge(struct device *dev,
return -EINVAL; return -EINVAL;
} }
edge->remote_pid = QCOM_SMEM_HOST_ANY;
key = "qcom,remote-pid";
of_property_read_u32(node, key, &edge->remote_pid);
syscon_np = of_parse_phandle(node, "qcom,ipc", 0); syscon_np = of_parse_phandle(node, "qcom,ipc", 0);
if (!syscon_np) { if (!syscon_np) {
dev_err(dev, "no qcom,ipc node\n"); dev_err(dev, "no qcom,ipc node\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment