neuron: ch_haven: Read peer name from device tree

Add support for the primary vm to read the vm peer name from device
tree. This information is needed to share memory to the peer vm.

Change-Id: I9a38370c8b80480bcdd0988c515adf64b36f99c1
Signed-off-by: Chris Lew <clew@codeaurora.org>
This commit is contained in:
Chris Lew 2020-06-11 00:00:39 -07:00
commit 0fc1e59781
3 changed files with 18 additions and 2 deletions

View file

@ -19,6 +19,7 @@
#include <linux/kthread.h>
#include <linux/neuron.h>
#include <asm-generic/barrier.h>
#include <linux/haven/hh_rm_drv.h>
#include <linux/haven/hh_dbl.h>
#include "ch_mq_shmem_common.h"
@ -335,10 +336,16 @@ static int channel_hh_map_memory(struct neuron_mq_data_priv *priv,
return -ENXIO;
}
if (of_property_read_bool(dev->of_node, "qcom,primary"))
if (of_property_read_bool(dev->of_node, "qcom,primary")) {
memset(priv->base, 0,
sizeof(struct neuron_shmem_channel_header));
ret = of_property_read_u32(dev->of_node, "peer-name",
&priv->peer_name);
if (ret)
priv->peer_name = HH_SELF_VM;
}
return 0;
}

View file

@ -19,6 +19,7 @@
#include <linux/kthread.h>
#include <linux/neuron.h>
#include <asm-generic/barrier.h>
#include <linux/haven/hh_rm_drv.h>
#include <linux/haven/hh_dbl.h>
#include "ch_mq_shmem_common.h"
@ -320,10 +321,16 @@ static int channel_hh_map_memory(struct neuron_mq_data_priv *priv,
return -ENXIO;
}
if (of_property_read_bool(dev->of_node, "qcom,primary"))
if (of_property_read_bool(dev->of_node, "qcom,primary")) {
memset(priv->base, 0,
sizeof(struct neuron_shmem_channel_header));
ret = of_property_read_u32(dev->of_node, "peer-name",
&priv->peer_name);
if (ret)
priv->peer_name = HH_SELF_VM;
}
return 0;
}

View file

@ -76,6 +76,8 @@ struct neuron_mq_data_priv {
atomic64_t virq_payload;
/* A counter to calculate the interrupt received. */
u32 interrupt_counter;
/* name of peer vm */
u32 peer_name;
/* haven tx doorbell descriptor */
void *tx_dbl;
/* haven rx doorbell descriptor */