All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] GLINK intent preallocation support
@ 2017-10-19  1:10 Chris Lew
  2017-10-19  1:10 ` [PATCH 1/3] dt-bindings: soc: qcom: Support GLINK intents Chris Lew
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chris Lew @ 2017-10-19  1:10 UTC (permalink / raw)
  To: bjorn.andersson, andy.gross, david.brown, robh+dt, mark.rutland
  Cc: aneela, smaliyap, linux-arm-msm, linux-soc, devicetree,
	linux-kernel, clew

Intents are used to specify when a channel can receive data from a
remoteproc. Add support for channels to customize the size and amount
of prequeued intents.

An audio channel might expect to receive 3 packets of size 4k in rapid
succession. This change allows the channel to prepare for this data instead
of allocating on demand.

Chris Lew (3):
  dt-bindings: soc: qcom: Support GLINK intents
  rpmsg: glink: Add support to preallocate intents
  rpmsg: glink: Use best fit intent during tx

 .../devicetree/bindings/soc/qcom/qcom,glink.txt    | 10 +++++
 drivers/rpmsg/qcom_glink_native.c                  | 47 +++++++++++++++++-----
 2 files changed, 46 insertions(+), 11 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [PATCH 1/3] dt-bindings: soc: qcom: Support GLINK intents
  2017-10-19  1:10 [PATCH 0/3] GLINK intent preallocation support Chris Lew
@ 2017-10-19  1:10 ` Chris Lew
  2017-10-20  5:00   ` Bjorn Andersson
  2017-10-19  1:10 ` [PATCH 2/3] rpmsg: glink: Add support to preallocate intents Chris Lew
  2017-10-19  1:10 ` [PATCH 3/3] rpmsg: glink: Use best fit intent during tx Chris Lew
  2 siblings, 1 reply; 6+ messages in thread
From: Chris Lew @ 2017-10-19  1:10 UTC (permalink / raw)
  To: bjorn.andersson, andy.gross, david.brown, robh+dt, mark.rutland
  Cc: aneela, smaliyap, linux-arm-msm, linux-soc, devicetree,
	linux-kernel, clew

Virtual GLINK channels may know what throughput to expect from a
remoteproc. An intent advertises to the remoteproc this channel is
ready to receive data. Allow a channel to define the size and amount of
intents to be prequeued.

Signed-off-by: Chris Lew <clew@codeaurora.org>
---
 Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
index b277eca861f7..6c21f76822ca 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
@@ -39,6 +39,14 @@ of these nodes are defined by the individual bindings for the specific function
 	Definition: a list of channels tied to this function, used for matching
 		    the function to a set of virtual channels
 
+- intents:
+	Usage: optional
+	Value type: <prop-encoded-array>
+	Definition: a list of size,amount pairs describing what intents should
+		    be preallocated for this virtual channel. If a GLINK node
+		    supports intents, an intent advertises this channel is ready
+		    to receive data.
+
 = EXAMPLE
 The following example represents the GLINK RPM node on a MSM8996 device, with
 the function for the "rpm_request" channel defined, which is used for
@@ -69,6 +77,8 @@ regualtors and root clocks.
 			compatible = "qcom,rpm-msm8996";
 			qcom,glink-channels = "rpm_requests";
 
+			intents = <0x400 5
+				   0x800 1>;
 			...
 		};
 	};
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [PATCH 2/3] rpmsg: glink: Add support to preallocate intents
  2017-10-19  1:10 [PATCH 0/3] GLINK intent preallocation support Chris Lew
  2017-10-19  1:10 ` [PATCH 1/3] dt-bindings: soc: qcom: Support GLINK intents Chris Lew
@ 2017-10-19  1:10 ` Chris Lew
  2017-10-19  1:10 ` [PATCH 3/3] rpmsg: glink: Use best fit intent during tx Chris Lew
  2 siblings, 0 replies; 6+ messages in thread
From: Chris Lew @ 2017-10-19  1:10 UTC (permalink / raw)
  To: bjorn.andersson, andy.gross, david.brown, robh+dt, mark.rutland
  Cc: aneela, smaliyap, linux-arm-msm, linux-soc, devicetree,
	linux-kernel, clew

The base intents prequeued during channel creation may not satisfy a
channel's throughput requirement. Add support for intents dt-binding to
allow channels to specify the size and amount of intents to prequeue
during endpoint announcement.

Signed-off-by: Chris Lew <clew@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 5a5e927ea50f..05e04a8943e3 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1143,19 +1143,39 @@ static struct rpmsg_endpoint *qcom_glink_create_ept(struct rpmsg_device *rpdev,
 static int qcom_glink_announce_create(struct rpmsg_device *rpdev)
 {
 	struct glink_channel *channel = to_glink_channel(rpdev->ept);
-	struct glink_core_rx_intent *intent;
 	struct qcom_glink *glink = channel->glink;
-	int num_intents = glink->intentless ? 0 : 5;
+	struct glink_core_rx_intent *intent;
+	const struct property *prop = NULL;
+	int num_groups = 1;
+	int num_intents;
+	int size;
+	__be32 base[2];
+	int *val = base;
+
+	if (rpdev->dev.of_node)
+		prop = of_find_property(rpdev->dev.of_node, "intents", NULL);
+
+	if (prop && !glink->intentless) {
+		val = prop->value;
+		num_groups = prop->length / sizeof(u32) / 2;
+	} else {
+		base[0] = cpu_to_be32(SZ_1K);
+		base[1] = cpu_to_be32(glink->intentless ? 0 : 5);
+	}
 
 	/* Channel is now open, advertise base set of intents */
-	while (num_intents--) {
-		intent = qcom_glink_alloc_intent(glink, channel, SZ_1K, true);
-		if (!intent)
-			break;
+	while (num_groups--) {
+		size = be32_to_cpup(val++);
+		num_intents = be32_to_cpup(val++);
+		while (num_intents--) {
+			intent = qcom_glink_alloc_intent(glink, channel, size,
+							 true);
+			if (!intent)
+				break;
 
-		qcom_glink_advertise_intent(glink, channel, intent);
+			qcom_glink_advertise_intent(glink, channel, intent);
+		}
 	}
-
 	return 0;
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [PATCH 3/3] rpmsg: glink: Use best fit intent during tx
  2017-10-19  1:10 [PATCH 0/3] GLINK intent preallocation support Chris Lew
  2017-10-19  1:10 ` [PATCH 1/3] dt-bindings: soc: qcom: Support GLINK intents Chris Lew
  2017-10-19  1:10 ` [PATCH 2/3] rpmsg: glink: Add support to preallocate intents Chris Lew
@ 2017-10-19  1:10 ` Chris Lew
  2 siblings, 0 replies; 6+ messages in thread
From: Chris Lew @ 2017-10-19  1:10 UTC (permalink / raw)
  To: bjorn.andersson, andy.gross, david.brown, robh+dt, mark.rutland
  Cc: aneela, smaliyap, linux-arm-msm, linux-soc, devicetree,
	linux-kernel, clew

Intents can vary in size, try to find the best fitting remote intent
instead of first fit when sending a message to the remote proc.

Signed-off-by: Chris Lew <clew@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 05e04a8943e3..650974f85a4c 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1251,11 +1251,16 @@ static int __qcom_glink_send(struct glink_channel *channel,
 			spin_lock_irqsave(&channel->intent_lock, flags);
 			idr_for_each_entry(&channel->riids, tmp, iid) {
 				if (tmp->size >= len && !tmp->in_use) {
-					tmp->in_use = true;
-					intent = tmp;
-					break;
+					if (!intent)
+						intent = tmp;
+					else if (intent->size > tmp->size)
+						intent = tmp;
+					if (intent->size == len)
+						break;
 				}
 			}
+			if (intent)
+				intent->in_use = true;
 			spin_unlock_irqrestore(&channel->intent_lock, flags);
 
 			/* We found an available intent */
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 1/3] dt-bindings: soc: qcom: Support GLINK intents
  2017-10-19  1:10 ` [PATCH 1/3] dt-bindings: soc: qcom: Support GLINK intents Chris Lew
@ 2017-10-20  5:00   ` Bjorn Andersson
  2017-10-23 18:37     ` Chris Lew
  0 siblings, 1 reply; 6+ messages in thread
From: Bjorn Andersson @ 2017-10-20  5:00 UTC (permalink / raw)
  To: Chris Lew
  Cc: Andy Gross, David Brown, Rob Herring, Mark Rutland,
	Arun Kumar Neelakantam, smaliyap, linux-arm-msm,
	open list:ARM/QUALCOMM SUPPORT, devicetree, lkml

On Wed 18 Oct 18:10 PDT 2017, Chris Lew wrote:

> Virtual GLINK channels may know what throughput to expect from a
> remoteproc. An intent advertises to the remoteproc this channel is
> ready to receive data. Allow a channel to define the size and amount of
> intents to be prequeued.
>
> Signed-off-by: Chris Lew <clew@codeaurora.org>
> ---
>  Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
> index b277eca861f7..6c21f76822ca 100644
> --- a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
> +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
> @@ -39,6 +39,14 @@ of these nodes are defined by the individual bindings for the specific function
>   Definition: a list of channels tied to this function, used for matching
>      the function to a set of virtual channels
>
> +- intents:

qcom,intents or qcom,default-intents

> + Usage: optional
> + Value type: <prop-encoded-array>
> + Definition: a list of size,amount pairs describing what intents should
> +    be preallocated for this virtual channel. If a GLINK node
> +    supports intents, an intent advertises this channel is ready
> +    to receive data.

Rather than describing what a GLINK intent is I would suggest that you
replace this second sentence with something like "This can be used to
tweak the default intents available for the channel to meet expectations
of the remote."

> +
>  = EXAMPLE
>  The following example represents the GLINK RPM node on a MSM8996 device, with
>  the function for the "rpm_request" channel defined, which is used for
> @@ -69,6 +77,8 @@ regualtors and root clocks.
>   compatible = "qcom,rpm-msm8996";
>   qcom,glink-channels = "rpm_requests";
>
> + intents = <0x400 5
> +   0x800 1>;
>   ...
>   };
>   };

Regards,
Bjorn

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

* Re: [PATCH 1/3] dt-bindings: soc: qcom: Support GLINK intents
  2017-10-20  5:00   ` Bjorn Andersson
@ 2017-10-23 18:37     ` Chris Lew
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Lew @ 2017-10-23 18:37 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, David Brown, Rob Herring, Mark Rutland,
	Arun Kumar Neelakantam, smaliyap, linux-arm-msm,
	open list:ARM/QUALCOMM SUPPORT, devicetree, lkml



On 10/19/2017 10:00 PM, Bjorn Andersson wrote:
> On Wed 18 Oct 18:10 PDT 2017, Chris Lew wrote:
> 
>> Virtual GLINK channels may know what throughput to expect from a
>> remoteproc. An intent advertises to the remoteproc this channel is
>> ready to receive data. Allow a channel to define the size and amount of
>> intents to be prequeued.
>>
>> Signed-off-by: Chris Lew <clew@codeaurora.org>
>> ---
>>   Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
>> index b277eca861f7..6c21f76822ca 100644
>> --- a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
>> +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
>> @@ -39,6 +39,14 @@ of these nodes are defined by the individual bindings for the specific function
>>    Definition: a list of channels tied to this function, used for matching
>>       the function to a set of virtual channels
>>
>> +- intents:
> 
> qcom,intents or qcom,default-intents
> 

Will use "qcom,intents".

>> + Usage: optional
>> + Value type: <prop-encoded-array>
>> + Definition: a list of size,amount pairs describing what intents should
>> +    be preallocated for this virtual channel. If a GLINK node
>> +    supports intents, an intent advertises this channel is ready
>> +    to receive data.
> 
> Rather than describing what a GLINK intent is I would suggest that you
> replace this second sentence with something like "This can be used to
> tweak the default intents available for the channel to meet expectations
> of the remote."
>

Sounds good, will change.

>> +
>>   = EXAMPLE
>>   The following example represents the GLINK RPM node on a MSM8996 device, with
>>   the function for the "rpm_request" channel defined, which is used for
>> @@ -69,6 +77,8 @@ regualtors and root clocks.
>>    compatible = "qcom,rpm-msm8996";
>>    qcom,glink-channels = "rpm_requests";
>>
>> + intents = <0x400 5
>> +   0x800 1>;
>>    ...
>>    };
>>    };
> 
> Regards,
> Bjorn
> 

Thanks,
Chris

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2017-10-23 18:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19  1:10 [PATCH 0/3] GLINK intent preallocation support Chris Lew
2017-10-19  1:10 ` [PATCH 1/3] dt-bindings: soc: qcom: Support GLINK intents Chris Lew
2017-10-20  5:00   ` Bjorn Andersson
2017-10-23 18:37     ` Chris Lew
2017-10-19  1:10 ` [PATCH 2/3] rpmsg: glink: Add support to preallocate intents Chris Lew
2017-10-19  1:10 ` [PATCH 3/3] rpmsg: glink: Use best fit intent during tx Chris Lew

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.