linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
@ 2017-03-24 19:22 Wendy Liang
  2017-03-24 19:22 ` [RFC LINUX PATCH 1/3] remoteproc: add rproc mem resource entry Wendy Liang
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Wendy Liang @ 2017-03-24 19:22 UTC (permalink / raw)
  To: bjorn.andersson; +Cc: linux-remoteproc, linux-kernel, Wendy Liang

This patch enables the remoteproc to specify the shared memory.
Remoteproc declared this memory as DMA memory.
It can be used for virtio, or shared buffers.

Wendy Liang (3):
  remoteproc: add rproc mem resource entry
  remoteproc: add rproc_mem resource entry handler
  remoteproc: Release DMA declare mem when cleanup rsc

 drivers/remoteproc/remoteproc_core.c | 40 ++++++++++++++++++++++++++++++++++++
 include/linux/remoteproc.h           | 23 ++++++++++++++++++++-
 2 files changed, 62 insertions(+), 1 deletion(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RFC LINUX PATCH 1/3] remoteproc: add rproc mem resource entry
  2017-03-24 19:22 [RFC LINUX PATCH 0/3] Allow remote to specify shared memory Wendy Liang
@ 2017-03-24 19:22 ` Wendy Liang
  2017-03-24 19:22 ` [RFC LINUX PATCH 2/3] remoteproc: add rproc_mem resource entry handler Wendy Liang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Wendy Liang @ 2017-03-24 19:22 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: linux-remoteproc, linux-kernel, Wendy Liang, Wendy Liang, Michal Simek

From: Wendy Liang <wendy.liang@xilinx.com>

Add a resource entry to the resource table to tells the host the remote
processor's memory which can be used as shared memory.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 include/linux/remoteproc.h | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 81da495..799f041 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -115,7 +115,8 @@ enum fw_resource_type {
 	RSC_DEVMEM	= 1,
 	RSC_TRACE	= 2,
 	RSC_VDEV	= 3,
-	RSC_LAST	= 4,
+	RSC_RPROC_MEM	= 4,
+	RSC_LAST	= 5,
 };
 
 #define FW_RSC_ADDR_ANY (-1)
@@ -306,6 +307,26 @@ struct fw_rsc_vdev {
 } __packed;
 
 /**
+ * struct fw_rsc_rproc_mem - remote processor memory
+ * @da: device address
+ * @pa: physical address
+ * @len: length (in bytes)
+ * @reserved: reserved (must be zero)
+ *
+ * This resource entry tells the host to the remote processor
+ * memory that the host can be used as shared memory.
+ *
+ * These request entries should precede other shared resource entries
+ * such as vdevs, vrings.
+ */
+struct fw_rsc_rproc_mem {
+	u32 da;
+	u32 pa;
+	u32 len;
+	u32 reserved;
+} __packed;
+
+/**
  * struct rproc_mem_entry - memory entry descriptor
  * @va:	virtual address
  * @dma: dma address
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [RFC LINUX PATCH 2/3] remoteproc: add rproc_mem resource entry handler
  2017-03-24 19:22 [RFC LINUX PATCH 0/3] Allow remote to specify shared memory Wendy Liang
  2017-03-24 19:22 ` [RFC LINUX PATCH 1/3] remoteproc: add rproc mem resource entry Wendy Liang
@ 2017-03-24 19:22 ` Wendy Liang
  2017-03-24 19:22 ` [RFC LINUX PATCH 3/3] remoteproc: Release DMA declare mem when cleanup rsc Wendy Liang
  2017-03-27 15:54 ` [RFC LINUX PATCH 0/3] Allow remote to specify shared memory Suman Anna
  3 siblings, 0 replies; 10+ messages in thread
From: Wendy Liang @ 2017-03-24 19:22 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: linux-remoteproc, linux-kernel, Wendy Liang, Wendy Liang, Michal Simek

From: Wendy Liang <wendy.liang@xilinx.com>

Add resource table handler to handle fw_rsc_rproc_mem entry.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/remoteproc/remoteproc_core.c | 37 ++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 3dabb20..0ffd9dc 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -720,6 +720,42 @@ static int rproc_handle_carveout(struct rproc *rproc,
 	return ret;
 }
 
+/**
+ * rproc_handle_rproc_mem() - handle remote processor memory
+ * @rproc: rproc handle
+ * @rsc: the resource entry
+ * @avail: size of available data (for image validation)
+ *
+ * This function will handle declare the remote procesor's memory
+ * as DMA memory of the remoteproc, and then, the host can use it
+ * as shared memory, e.g. vrings ahre shared buffers.
+ */
+static int rproc_handle_rproc_mem(struct rproc *rproc,
+				 struct fw_rsc_rproc_mem *rsc,
+				 int offset, int avail)
+{
+	struct device *dev = &rproc->dev;
+	int ret;
+
+	if (sizeof(*rsc) > avail) {
+		dev_err(dev, "rproc_mem rsc is truncated\n");
+		return -EINVAL;
+	}
+
+	if (rsc->pa == FW_RSC_ADDR_ANY) {
+		dev_err(dev, "not able to declare rproc mem, pa is 0x%x\n",
+			rsc->pa);
+		return -EINVAL;
+	}
+	ret = dma_declare_coherent_memory(dev->parent, rsc->pa,
+		rsc->pa, rsc->len, DMA_MEMORY_MAP);
+	if (!ret) {
+		dev_err(dev, "failed to declare rproc mem as DMA mem.\n");
+		return -ENOMEM;
+	}
+	return 0;
+}
+
 /*
  * A lookup table for resource handlers. The indices are defined in
  * enum fw_resource_type.
@@ -729,6 +765,7 @@ static int rproc_handle_carveout(struct rproc *rproc,
 	[RSC_DEVMEM] = (rproc_handle_resource_t)rproc_handle_devmem,
 	[RSC_TRACE] = (rproc_handle_resource_t)rproc_handle_trace,
 	[RSC_VDEV] = (rproc_handle_resource_t)rproc_handle_vdev,
+	[RSC_RPROC_MEM] = (rproc_handle_resource_t)rproc_handle_rproc_mem,
 };
 
 /* handle firmware resource entries before booting the remote processor */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [RFC LINUX PATCH 3/3] remoteproc: Release DMA declare mem when cleanup rsc
  2017-03-24 19:22 [RFC LINUX PATCH 0/3] Allow remote to specify shared memory Wendy Liang
  2017-03-24 19:22 ` [RFC LINUX PATCH 1/3] remoteproc: add rproc mem resource entry Wendy Liang
  2017-03-24 19:22 ` [RFC LINUX PATCH 2/3] remoteproc: add rproc_mem resource entry handler Wendy Liang
@ 2017-03-24 19:22 ` Wendy Liang
  2017-03-27 15:54 ` [RFC LINUX PATCH 0/3] Allow remote to specify shared memory Suman Anna
  3 siblings, 0 replies; 10+ messages in thread
From: Wendy Liang @ 2017-03-24 19:22 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: linux-remoteproc, linux-kernel, Wendy Liang, Wendy Liang, Michal Simek

From: Wendy Liang <wendy.liang@xilinx.com>

Release the declared DMA memory in the end of resource
cleanup.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/remoteproc/remoteproc_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 0ffd9dc..9d32737 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -882,6 +882,9 @@ static void rproc_resource_cleanup(struct rproc *rproc)
 	/* clean up remote vdev entries */
 	list_for_each_entry_safe(rvdev, rvtmp, &rproc->rvdevs, node)
 		kref_put(&rvdev->refcount, rproc_vdev_release);
+
+	/* Release declared DMA memory */
+	dma_release_declared_memory(dev->parent);
 }
 
 /*
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
  2017-03-24 19:22 [RFC LINUX PATCH 0/3] Allow remote to specify shared memory Wendy Liang
                   ` (2 preceding siblings ...)
  2017-03-24 19:22 ` [RFC LINUX PATCH 3/3] remoteproc: Release DMA declare mem when cleanup rsc Wendy Liang
@ 2017-03-27 15:54 ` Suman Anna
  2017-03-28 18:52   ` Wendy Liang
  3 siblings, 1 reply; 10+ messages in thread
From: Suman Anna @ 2017-03-27 15:54 UTC (permalink / raw)
  To: Wendy Liang, bjorn.andersson; +Cc: linux-remoteproc, linux-kernel, Wendy Liang

Hi Wendy,

On 03/24/2017 02:22 PM, Wendy Liang wrote:
> This patch enables the remoteproc to specify the shared memory.
> Remoteproc declared this memory as DMA memory.
> It can be used for virtio, or shared buffers.

You should be able to achieve this without any remoteproc core changes.
You can do this by defining a reserved-memory node in your DTS file (can
be a CMA pool or a DMA pool), assigning the node using memory-region in
your remoteproc DT node and using the function,
of_reserved_mem_device_init() in your remoteproc driver.

regards
Suman

> 
> Wendy Liang (3):
>   remoteproc: add rproc mem resource entry
>   remoteproc: add rproc_mem resource entry handler
>   remoteproc: Release DMA declare mem when cleanup rsc
> 
>  drivers/remoteproc/remoteproc_core.c | 40 ++++++++++++++++++++++++++++++++++++
>  include/linux/remoteproc.h           | 23 ++++++++++++++++++++-
>  2 files changed, 62 insertions(+), 1 deletion(-)
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
  2017-03-27 15:54 ` [RFC LINUX PATCH 0/3] Allow remote to specify shared memory Suman Anna
@ 2017-03-28 18:52   ` Wendy Liang
  2017-03-28 23:24     ` Suman Anna
  0 siblings, 1 reply; 10+ messages in thread
From: Wendy Liang @ 2017-03-28 18:52 UTC (permalink / raw)
  To: Suman Anna
  Cc: Wendy Liang, Bjorn Andersson, linux-remoteproc, linux-kernel,
	Wendy Liang

Thanks Suman for your comments.


On Mon, Mar 27, 2017 at 8:54 AM, Suman Anna <s-anna@ti.com> wrote:
> Hi Wendy,
>
> On 03/24/2017 02:22 PM, Wendy Liang wrote:
>> This patch enables the remoteproc to specify the shared memory.
>> Remoteproc declared this memory as DMA memory.
>> It can be used for virtio, or shared buffers.
>
> You should be able to achieve this without any remoteproc core changes.
> You can do this by defining a reserved-memory node in your DTS file (can
> be a CMA pool or a DMA pool), assigning the node using memory-region in
> your remoteproc DT node and using the function,
> of_reserved_mem_device_init() in your remoteproc driver.

The idea to introduce the rproc_mem is to let the remote to specify
the shared memory.
I am trying to see if there is a way to specify this software attribute without
touching the device tree as it doesn't look like it is hardware related.
And try to see if there is a way that when I change the firmware, i
don't need to change the device tree.

Thanks,
Wendy

>
> regards
> Suman
>
>>
>> Wendy Liang (3):
>>   remoteproc: add rproc mem resource entry
>>   remoteproc: add rproc_mem resource entry handler
>>   remoteproc: Release DMA declare mem when cleanup rsc
>>
>>  drivers/remoteproc/remoteproc_core.c | 40 ++++++++++++++++++++++++++++++++++++
>>  include/linux/remoteproc.h           | 23 ++++++++++++++++++++-
>>  2 files changed, 62 insertions(+), 1 deletion(-)
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
  2017-03-28 18:52   ` Wendy Liang
@ 2017-03-28 23:24     ` Suman Anna
  2017-03-29 16:41       ` Jiaying Liang
  0 siblings, 1 reply; 10+ messages in thread
From: Suman Anna @ 2017-03-28 23:24 UTC (permalink / raw)
  To: Wendy Liang
  Cc: Wendy Liang, Bjorn Andersson, linux-remoteproc, linux-kernel,
	Wendy Liang

Hi Wendy,

On 03/28/2017 01:52 PM, Wendy Liang wrote:
> Thanks Suman for your comments.
> 
> On Mon, Mar 27, 2017 at 8:54 AM, Suman Anna <s-anna@ti.com> wrote:
>> Hi Wendy,
>>
>> On 03/24/2017 02:22 PM, Wendy Liang wrote:
>>> This patch enables the remoteproc to specify the shared memory.
>>> Remoteproc declared this memory as DMA memory.
>>> It can be used for virtio, or shared buffers.
>>
>> You should be able to achieve this without any remoteproc core changes.
>> You can do this by defining a reserved-memory node in your DTS file (can
>> be a CMA pool or a DMA pool), assigning the node using memory-region in
>> your remoteproc DT node and using the function,
>> of_reserved_mem_device_init() in your remoteproc driver.
> 
> The idea to introduce the rproc_mem is to let the remote to specify
> the shared memory.
> I am trying to see if there is a way to specify this software attribute without
> touching the device tree as it doesn't look like it is hardware related.
> And try to see if there is a way that when I change the firmware, i
> don't need to change the device tree.

So is this shared memory going to be accessed through an MMU by the
remote processor? If not, don't you need a specific carveout, which
would then in turn mean boot-time memory reservation?

regards
Suman

> 
> Thanks,
> Wendy
> 
>>
>> regards
>> Suman
>>
>>>
>>> Wendy Liang (3):
>>>   remoteproc: add rproc mem resource entry
>>>   remoteproc: add rproc_mem resource entry handler
>>>   remoteproc: Release DMA declare mem when cleanup rsc
>>>
>>>  drivers/remoteproc/remoteproc_core.c | 40 ++++++++++++++++++++++++++++++++++++
>>>  include/linux/remoteproc.h           | 23 ++++++++++++++++++++-
>>>  2 files changed, 62 insertions(+), 1 deletion(-)
>>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
  2017-03-28 23:24     ` Suman Anna
@ 2017-03-29 16:41       ` Jiaying Liang
  2017-03-29 18:56         ` Loic PALLARDY
  0 siblings, 1 reply; 10+ messages in thread
From: Jiaying Liang @ 2017-03-29 16:41 UTC (permalink / raw)
  To: Suman Anna, Wendy Liang; +Cc: Bjorn Andersson, linux-remoteproc, linux-kernel

Hi Suman,

> -----Original Message-----
> From: Suman Anna [mailto:s-anna@ti.com]
> Sent: Tuesday, March 28, 2017 4:24 PM
> To: Wendy Liang
> Cc: Jiaying Liang; Bjorn Andersson; linux-remoteproc@vger.kernel.org; linux-
> kernel@vger.kernel.org; Jiaying Liang
> Subject: Re: [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
>
> Hi Wendy,
>
> On 03/28/2017 01:52 PM, Wendy Liang wrote:
> > Thanks Suman for your comments.
> >
> > On Mon, Mar 27, 2017 at 8:54 AM, Suman Anna <s-anna@ti.com> wrote:
> >> Hi Wendy,
> >>
> >> On 03/24/2017 02:22 PM, Wendy Liang wrote:
> >>> This patch enables the remoteproc to specify the shared memory.
> >>> Remoteproc declared this memory as DMA memory.
> >>> It can be used for virtio, or shared buffers.
> >>
> >> You should be able to achieve this without any remoteproc core changes.
> >> You can do this by defining a reserved-memory node in your DTS file
> >> (can be a CMA pool or a DMA pool), assigning the node using
> >> memory-region in your remoteproc DT node and using the function,
> >> of_reserved_mem_device_init() in your remoteproc driver.
> >
> > The idea to introduce the rproc_mem is to let the remote to specify
> > the shared memory.
> > I am trying to see if there is a way to specify this software
> > attribute without touching the device tree as it doesn't look like it is
> hardware related.
> > And try to see if there is a way that when I change the firmware, i
> > don't need to change the device tree.
>
> So is this shared memory going to be accessed through an MMU by the
> remote processor? If not, don't you need a specific carveout, which would
> then in turn mean boot-time memory reservation?
[Wendy] This memory is not accessed through MMU by remote.
Here is the usecase, the number of remotes can be changed at run time,
Also the firmware running on the remotes can be changed. And the remote will
Need to memory map those memory before it can use it.

>From what you have suggested, we reserved memory from the device node, and then remoteproc driver linked to that reserved memory with "memory-region", I suppose different remoteproc drivers can share one "memory-region". However, now the question is how the remote knows the shared memory.
Let say I use rpmsg for the communication between the two. But how can remote knows about the shared buffers before it can used it.

I  saw Loic has a patch to add virtio config to specify this buffer, however, it is not in the latest linux kernel master. And thus, trying to see if there is another way to solve this issue. Use existing carveout to specify this memory?

Thanks,
Wendy

>
> regards
> Suman
>
> >
> > Thanks,
> > Wendy
> >
> >>
> >> regards
> >> Suman
> >>
> >>>
> >>> Wendy Liang (3):
> >>>   remoteproc: add rproc mem resource entry
> >>>   remoteproc: add rproc_mem resource entry handler
> >>>   remoteproc: Release DMA declare mem when cleanup rsc
> >>>
> >>>  drivers/remoteproc/remoteproc_core.c | 40
> ++++++++++++++++++++++++++++++++++++
> >>>  include/linux/remoteproc.h           | 23 ++++++++++++++++++++-
> >>>  2 files changed, 62 insertions(+), 1 deletion(-)
> >>>
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe
> >> linux-remoteproc" in the body of a message to
> >> majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
  2017-03-29 16:41       ` Jiaying Liang
@ 2017-03-29 18:56         ` Loic PALLARDY
  2017-03-30 17:39           ` Jiaying Liang
  0 siblings, 1 reply; 10+ messages in thread
From: Loic PALLARDY @ 2017-03-29 18:56 UTC (permalink / raw)
  To: Jiaying Liang, Suman Anna, Wendy Liang
  Cc: Bjorn Andersson, linux-remoteproc, linux-kernel



> -----Original Message-----
> From: linux-remoteproc-owner@vger.kernel.org [mailto:linux-remoteproc-
> owner@vger.kernel.org] On Behalf Of Jiaying Liang
> Sent: Wednesday, March 29, 2017 6:41 PM
> To: Suman Anna <s-anna@ti.com>; Wendy Liang <sunnyliangjy@gmail.com>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>; linux-
> remoteproc@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: RE: [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
> 
> Hi Suman,
> 
> > -----Original Message-----
> > From: Suman Anna [mailto:s-anna@ti.com]
> > Sent: Tuesday, March 28, 2017 4:24 PM
> > To: Wendy Liang
> > Cc: Jiaying Liang; Bjorn Andersson; linux-remoteproc@vger.kernel.org;
> > linux- kernel@vger.kernel.org; Jiaying Liang
> > Subject: Re: [RFC LINUX PATCH 0/3] Allow remote to specify shared
> > memory
> >
> > Hi Wendy,
> >
> > On 03/28/2017 01:52 PM, Wendy Liang wrote:
> > > Thanks Suman for your comments.
> > >
> > > On Mon, Mar 27, 2017 at 8:54 AM, Suman Anna <s-anna@ti.com> wrote:
> > >> Hi Wendy,
> > >>
> > >> On 03/24/2017 02:22 PM, Wendy Liang wrote:
> > >>> This patch enables the remoteproc to specify the shared memory.
> > >>> Remoteproc declared this memory as DMA memory.
> > >>> It can be used for virtio, or shared buffers.
> > >>
> > >> You should be able to achieve this without any remoteproc core
> changes.
> > >> You can do this by defining a reserved-memory node in your DTS file
> > >> (can be a CMA pool or a DMA pool), assigning the node using
> > >> memory-region in your remoteproc DT node and using the function,
> > >> of_reserved_mem_device_init() in your remoteproc driver.
> > >
> > > The idea to introduce the rproc_mem is to let the remote to specify
> > > the shared memory.
> > > I am trying to see if there is a way to specify this software
> > > attribute without touching the device tree as it doesn't look like
> > > it is
> > hardware related.
> > > And try to see if there is a way that when I change the firmware, i
> > > don't need to change the device tree.
> >
> > So is this shared memory going to be accessed through an MMU by the
> > remote processor? If not, don't you need a specific carveout, which
> > would then in turn mean boot-time memory reservation?
> [Wendy] This memory is not accessed through MMU by remote.
> Here is the usecase, the number of remotes can be changed at run time, Also
> the firmware running on the remotes can be changed. And the remote will
> Need to memory map those memory before it can use it.
> 
> From what you have suggested, we reserved memory from the device node,
> and then remoteproc driver linked to that reserved memory with "memory-
> region", I suppose different remoteproc drivers can share one "memory-
> region". However, now the question is how the remote knows the shared
> memory.
> Let say I use rpmsg for the communication between the two. But how can
> remote knows about the shared buffers before it can used it.
> 
> I  saw Loic has a patch to add virtio config to specify this buffer, however, it is
> not in the latest linux kernel master. And thus, trying to see if there is
> another way to solve this issue. Use existing carveout to specify this
> memory?
Hi Wendy,

Potential issue with this proposal if the order resource table is proceed. This memory region should be assigned to device driver first before starting any allocation.
Moreover you can assign only one region to a device. But you need different memory regions with different attributes: one for firmware and one for vring for example.
That's why we propose sub-dev mechanism some months ago.

I think we need to find a central mechanism to manage "fixed" memory region for firmware (carveout) vring as both are handled by rproc.
For rpmsg buffer, one proposal will be to assigned a dedicated region to vring device as mentioned in 
"[PATCH v4 0/5] virtio_rpmsg: make rpmsg channel configurable" cover letter.
It will be rproc responsibility to provide this specific memory region based either on DT or an firmware resource table information to virtio device.

Regards,
Loic
> 
> Thanks,
> Wendy
> 
> >
> > regards
> > Suman
> >
> > >
> > > Thanks,
> > > Wendy
> > >
> > >>
> > >> regards
> > >> Suman
> > >>
> > >>>
> > >>> Wendy Liang (3):
> > >>>   remoteproc: add rproc mem resource entry
> > >>>   remoteproc: add rproc_mem resource entry handler
> > >>>   remoteproc: Release DMA declare mem when cleanup rsc
> > >>>
> > >>>  drivers/remoteproc/remoteproc_core.c | 40
> > ++++++++++++++++++++++++++++++++++++
> > >>>  include/linux/remoteproc.h           | 23 ++++++++++++++++++++-
> > >>>  2 files changed, 62 insertions(+), 1 deletion(-)
> > >>>
> > >>
> > >> --
> > >> To unsubscribe from this list: send the line "unsubscribe
> > >> linux-remoteproc" in the body of a message to
> > >> majordomo@vger.kernel.org More majordomo info at
> > http://vger.kernel.org/majordomo-info.html
> 
> 
> 
> This email and any attachments are intended for the sole use of the named
> recipient(s) and contain(s) confidential information that may be proprietary,
> privileged or copyrighted under applicable law. If you are not the intended
> recipient, do not read, copy, or forward this email message or any
> attachments. Delete this email message and any attachments immediately.
> 
> N     r  y   b X  ǧv ^ )޺{.n +    {  騵 k ȧ \x17  ܨ}   Ơz &j:+v        zZ+  +zf   h   ~    i   z \x1e w   ?
> & )ߢ^[f

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
  2017-03-29 18:56         ` Loic PALLARDY
@ 2017-03-30 17:39           ` Jiaying Liang
  0 siblings, 0 replies; 10+ messages in thread
From: Jiaying Liang @ 2017-03-30 17:39 UTC (permalink / raw)
  To: Loic PALLARDY, Suman Anna, Wendy Liang
  Cc: Bjorn Andersson, linux-remoteproc, linux-kernel

HI Loic,

> -----Original Message-----
> From: Loic PALLARDY [mailto:loic.pallardy@st.com]
> Sent: Wednesday, March 29, 2017 11:57 AM
> To: Jiaying Liang; Suman Anna; Wendy Liang
> Cc: Bjorn Andersson; linux-remoteproc@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: RE: [RFC LINUX PATCH 0/3] Allow remote to specify shared memory
>
>
>
> > -----Original Message-----
> > From: linux-remoteproc-owner@vger.kernel.org [mailto:linux-remoteproc-
> > owner@vger.kernel.org] On Behalf Of Jiaying Liang
> > Sent: Wednesday, March 29, 2017 6:41 PM
> > To: Suman Anna <s-anna@ti.com>; Wendy Liang <sunnyliangjy@gmail.com>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>; linux-
> > remoteproc@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: RE: [RFC LINUX PATCH 0/3] Allow remote to specify shared
> > memory
> >
> > Hi Suman,
> >
> > > -----Original Message-----
> > > From: Suman Anna [mailto:s-anna@ti.com]
> > > Sent: Tuesday, March 28, 2017 4:24 PM
> > > To: Wendy Liang
> > > Cc: Jiaying Liang; Bjorn Andersson;
> > > linux-remoteproc@vger.kernel.org;
> > > linux- kernel@vger.kernel.org; Jiaying Liang
> > > Subject: Re: [RFC LINUX PATCH 0/3] Allow remote to specify shared
> > > memory
> > >
> > > Hi Wendy,
> > >
> > > On 03/28/2017 01:52 PM, Wendy Liang wrote:
> > > > Thanks Suman for your comments.
> > > >
> > > > On Mon, Mar 27, 2017 at 8:54 AM, Suman Anna <s-anna@ti.com>
> wrote:
> > > >> Hi Wendy,
> > > >>
> > > >> On 03/24/2017 02:22 PM, Wendy Liang wrote:
> > > >>> This patch enables the remoteproc to specify the shared memory.
> > > >>> Remoteproc declared this memory as DMA memory.
> > > >>> It can be used for virtio, or shared buffers.
> > > >>
> > > >> You should be able to achieve this without any remoteproc core
> > changes.
> > > >> You can do this by defining a reserved-memory node in your DTS
> > > >> file (can be a CMA pool or a DMA pool), assigning the node using
> > > >> memory-region in your remoteproc DT node and using the function,
> > > >> of_reserved_mem_device_init() in your remoteproc driver.
> > > >
> > > > The idea to introduce the rproc_mem is to let the remote to
> > > > specify the shared memory.
> > > > I am trying to see if there is a way to specify this software
> > > > attribute without touching the device tree as it doesn't look like
> > > > it is
> > > hardware related.
> > > > And try to see if there is a way that when I change the firmware,
> > > > i don't need to change the device tree.
> > >
> > > So is this shared memory going to be accessed through an MMU by the
> > > remote processor? If not, don't you need a specific carveout, which
> > > would then in turn mean boot-time memory reservation?
> > [Wendy] This memory is not accessed through MMU by remote.
> > Here is the usecase, the number of remotes can be changed at run time,
> > Also the firmware running on the remotes can be changed. And the
> > remote will Need to memory map those memory before it can use it.
> >
> > From what you have suggested, we reserved memory from the device node,
> > and then remoteproc driver linked to that reserved memory with
> > "memory- region", I suppose different remoteproc drivers can share one
> > "memory- region". However, now the question is how the remote knows
> > the shared memory.
> > Let say I use rpmsg for the communication between the two. But how can
> > remote knows about the shared buffers before it can used it.
> >
> > I  saw Loic has a patch to add virtio config to specify this buffer,
> > however, it is not in the latest linux kernel master. And thus, trying
> > to see if there is another way to solve this issue. Use existing
> > carveout to specify this memory?
> Hi Wendy,
>
> Potential issue with this proposal if the order resource table is proceed. This
> memory region should be assigned to device driver first before starting any
> allocation.
[Wendy] User will need to put it to the first entry in the resource table. So that
It can be declared first before device driver to allocate memory.
> Moreover you can assign only one region to a device. But you need different
> memory regions with different attributes: one for firmware and one for vring
> for example.
> That's why we propose sub-dev mechanism some months ago.
[Wendy]  Just in our case, we only use virtio devices. But I agree, there can be
Limitations if you have other sub-devices.

>
> I think we need to find a central mechanism to manage "fixed" memory
> region for firmware (carveout) vring as both are handled by rproc.
> For rpmsg buffer, one proposal will be to assigned a dedicated region to
> vring device as mentioned in "[PATCH v4 0/5] virtio_rpmsg: make rpmsg
> channel configurable" cover letter.
> It will be rproc responsibility to provide this specific memory region based
> either on DT or an firmware resource table information to virtio device.
[Wendy] Just the virtio_rpmsg is not in the latest Linux kernel master. Is there
Any plan to apply the patch?

I agree we need to find a central mechanism to manage "fixed" memory.
Here are some questions:
* Shall we reuse carveout resource for "fixed" memory?
    * Although "fixed" memory doesn't sound like the same as "carveout" memory to me.
       We may consider "fixed" memory as carveout resource with pre-defined addresses. Is this ok?
* How to linked the fixed memory to the target device (e.g. virtio device)?, Can we use "name" of the memory resource?
   * how to "formalize" the name? "virtio_<id>"?

Maybe Bjorn can provide some suggestions on the "fixed" memory solution.

Thanks,
Wendy


>
> Regards,
> Loic
> >
> > Thanks,
> > Wendy
> >
> > >
> > > regards
> > > Suman
> > >
> > > >
> > > > Thanks,
> > > > Wendy
> > > >
> > > >>
> > > >> regards
> > > >> Suman
> > > >>
> > > >>>
> > > >>> Wendy Liang (3):
> > > >>>   remoteproc: add rproc mem resource entry
> > > >>>   remoteproc: add rproc_mem resource entry handler
> > > >>>   remoteproc: Release DMA declare mem when cleanup rsc
> > > >>>
> > > >>>  drivers/remoteproc/remoteproc_core.c | 40
> > > ++++++++++++++++++++++++++++++++++++
> > > >>>  include/linux/remoteproc.h           | 23 ++++++++++++++++++++-
> > > >>>  2 files changed, 62 insertions(+), 1 deletion(-)
> > > >>>
> > > >>
> > > >> --
> > > >> To unsubscribe from this list: send the line "unsubscribe
> > > >> linux-remoteproc" in the body of a message to
> > > >> majordomo@vger.kernel.org More majordomo info at
> > > http://vger.kernel.org/majordomo-info.html
> >
> >
> >
> > This email and any attachments are intended for the sole use of the
> > named
> > recipient(s) and contain(s) confidential information that may be
> > proprietary, privileged or copyrighted under applicable law. If you
> > are not the intended recipient, do not read, copy, or forward this
> > email message or any attachments. Delete this email message and any
> attachments immediately.
> >
> > N     r  y   b X  ǧv ^ )޺{.n +    {  騵 k ȧ \x17  ܨ}   Ơz &j:+v        zZ+  +zf   h   ~    i
> z \x1e w   ?
> > & )ߢ^[f


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-03-30 17:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 19:22 [RFC LINUX PATCH 0/3] Allow remote to specify shared memory Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 1/3] remoteproc: add rproc mem resource entry Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 2/3] remoteproc: add rproc_mem resource entry handler Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 3/3] remoteproc: Release DMA declare mem when cleanup rsc Wendy Liang
2017-03-27 15:54 ` [RFC LINUX PATCH 0/3] Allow remote to specify shared memory Suman Anna
2017-03-28 18:52   ` Wendy Liang
2017-03-28 23:24     ` Suman Anna
2017-03-29 16:41       ` Jiaying Liang
2017-03-29 18:56         ` Loic PALLARDY
2017-03-30 17:39           ` Jiaying Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).