devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] GLINK intent preallocation support
@ 2017-10-26 22:28 Chris Lew
       [not found] ` <1509056936-26578-1-git-send-email-clew-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chris Lew @ 2017-10-26 22:28 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                  | 48 +++++++++++++++++-----
 2 files changed, 47 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 v2 1/3] dt-bindings: soc: qcom: Support GLINK intents
       [not found] ` <1509056936-26578-1-git-send-email-clew-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2017-10-26 22:28   ` Chris Lew
       [not found]     ` <1509056936-26578-2-git-send-email-clew-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2017-10-26 22:28   ` [PATCH v2 3/3] rpmsg: glink: Use best fit intent during tx Chris Lew
  1 sibling, 1 reply; 6+ messages in thread
From: Chris Lew @ 2017-10-26 22:28 UTC (permalink / raw)
  To: bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A,
	andy.gross-QSEj5FYQhm4dnm+yROfE0A,
	david.brown-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8
  Cc: aneela-sgV2jX0FEOL9JmXXK+q4OQ, smaliyap-sgV2jX0FEOL9JmXXK+q4OQ,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, clew-sgV2jX0FEOL9JmXXK+q4OQ

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-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---

Changes since v1:
- Change intents property to qcom,intents and update example
- Change second sentence in definition to better describe usage

 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..9663cab52246 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
 
+- 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. 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";
 
+			qcom,intents = <0x400 5
+					0x800 1>;
 			...
 		};
 	};
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 2/3] rpmsg: glink: Add support to preallocate intents
  2017-10-26 22:28 [PATCH v2 0/3] GLINK intent preallocation support Chris Lew
       [not found] ` <1509056936-26578-1-git-send-email-clew-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2017-10-26 22:28 ` Chris Lew
  2017-10-31  4:26 ` [PATCH v2 0/3] GLINK intent preallocation support Bjorn Andersson
  2 siblings, 0 replies; 6+ messages in thread
From: Chris Lew @ 2017-10-26 22:28 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>
---

Changes since v1:
- Change intents property string to qcom,intents
- Use np local variable to fit of_find_property call on one line

 drivers/rpmsg/qcom_glink_native.c | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 5a5e927ea50f..7155adad6ab6 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1143,19 +1143,40 @@ 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 device_node *np = rpdev->dev.of_node;
 	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 (np)
+		prop = of_find_property(np, "qcom,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 v2 3/3] rpmsg: glink: Use best fit intent during tx
       [not found] ` <1509056936-26578-1-git-send-email-clew-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2017-10-26 22:28   ` [PATCH v2 1/3] dt-bindings: soc: qcom: Support GLINK intents Chris Lew
@ 2017-10-26 22:28   ` Chris Lew
  1 sibling, 0 replies; 6+ messages in thread
From: Chris Lew @ 2017-10-26 22:28 UTC (permalink / raw)
  To: bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A,
	andy.gross-QSEj5FYQhm4dnm+yROfE0A,
	david.brown-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8
  Cc: aneela-sgV2jX0FEOL9JmXXK+q4OQ, smaliyap-sgV2jX0FEOL9JmXXK+q4OQ,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, clew-sgV2jX0FEOL9JmXXK+q4OQ

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-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.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 7155adad6ab6..0ba1ffe2698f 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1252,11 +1252,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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 1/3] dt-bindings: soc: qcom: Support GLINK intents
       [not found]     ` <1509056936-26578-2-git-send-email-clew-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2017-10-27 14:38       ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2017-10-27 14:38 UTC (permalink / raw)
  To: Chris Lew
  Cc: bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A,
	andy.gross-QSEj5FYQhm4dnm+yROfE0A,
	david.brown-QSEj5FYQhm4dnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	aneela-sgV2jX0FEOL9JmXXK+q4OQ, smaliyap-sgV2jX0FEOL9JmXXK+q4OQ,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, Oct 26, 2017 at 03:28:54PM -0700, 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-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> ---
> 
> Changes since v1:
> - Change intents property to qcom,intents and update example
> - Change second sentence in definition to better describe usage
> 
>  Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 0/3] GLINK intent preallocation support
  2017-10-26 22:28 [PATCH v2 0/3] GLINK intent preallocation support Chris Lew
       [not found] ` <1509056936-26578-1-git-send-email-clew-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2017-10-26 22:28 ` [PATCH v2 2/3] rpmsg: glink: Add support to preallocate intents Chris Lew
@ 2017-10-31  4:26 ` Bjorn Andersson
  2 siblings, 0 replies; 6+ messages in thread
From: Bjorn Andersson @ 2017-10-31  4:26 UTC (permalink / raw)
  To: Chris Lew
  Cc: andy.gross, david.brown, robh+dt, mark.rutland, aneela, smaliyap,
	linux-arm-msm, linux-soc, devicetree, linux-kernel

On Thu 26 Oct 15:28 PDT 2017, Chris Lew wrote:

> 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.
> 

Thanks, tested and applied with some minor modifications to patch 2.

Regards,
Bjorn

> 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                  | 48 +++++++++++++++++-----
>  2 files changed, 47 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

end of thread, other threads:[~2017-10-31  4:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26 22:28 [PATCH v2 0/3] GLINK intent preallocation support Chris Lew
     [not found] ` <1509056936-26578-1-git-send-email-clew-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-10-26 22:28   ` [PATCH v2 1/3] dt-bindings: soc: qcom: Support GLINK intents Chris Lew
     [not found]     ` <1509056936-26578-2-git-send-email-clew-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-10-27 14:38       ` Rob Herring
2017-10-26 22:28   ` [PATCH v2 3/3] rpmsg: glink: Use best fit intent during tx Chris Lew
2017-10-26 22:28 ` [PATCH v2 2/3] rpmsg: glink: Add support to preallocate intents Chris Lew
2017-10-31  4:26 ` [PATCH v2 0/3] GLINK intent preallocation support Bjorn Andersson

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).