GLINK intent preallocation support
Subsystems (4)
v2 cover GLINK intent preallocation support
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(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 1/3 dt-bindings: soc: qcom: Support GLINK intents
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.
---
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(+)
Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt +10 -0
@@ -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>; ... }; };
Signature · 7 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/3] dt-bindings: soc: qcom: Support GLINK intents
Quoted 6 lines · Chris Lew
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 <[email protected]>
Quoted 8 lines
---
Changes since v1:
- Change intents property to qcom,intents and update example
- Change second sentence in definition to better describe usageDocumentation/devicetree/bindings/soc/qcom/qcom,glink.txt | 10 ++++++++++ 1 file changed, 10 insertions(+)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 2/3 rpmsg: glink: Add support to preallocate intents
In reply to Chris LewThe 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.
---
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(-)
drivers/rpmsg/qcom_glink_native.c +29 -8
@@ -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 ; }
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 3/3 rpmsg: glink: Use best fit intent during tx
In reply to Chris LewIntents can vary in size, try to find the best fitting remote intent instead of first fit when sending a message to the remote proc.
--- drivers/rpmsg/qcom_glink_native.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/rpmsg/qcom_glink_native.c +8 -3
@@ -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 */
Signature · 7 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Chris Lew
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
Quoted 13 lines
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(-)Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project