From: Arun Kumar Neelakantam <aneela@codeaurora.org>
To: Sricharan R <sricharan@codeaurora.org>,
ohad@wizery.com, bjorn.andersson@linaro.org,
linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 10/20] rpmsg: glink: Add support for transport version negotiation
Date: Mon, 28 Aug 2017 17:18:59 +0530 [thread overview]
Message-ID: <aead6e9a-110a-35be-7cae-b617b7ac3192@codeaurora.org> (raw)
In-Reply-To: <1503559302-3744-11-git-send-email-sricharan@codeaurora.org>
On 8/24/2017 12:51 PM, Sricharan R wrote:
> G-link supports a version number and feature flags for each transport.
> A combination of the version number and feature flags enable/disable:
>
> (*) G-Link software updates for each edge
> (*) Individual features for each edge
>
> Endpoints negotiate both the version and the supported flags when
> the transport is opened and they cannot be changed after negotiation has
> been completed.
>
> Each full implementation of G-Link must support a minimum of the current
> version, the previous version, and the base negotiation version called v0.
>
> Signed-off-by: Sricharan R <sricharan@codeaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Regards,
Arun N
> ---
> drivers/rpmsg/qcom_glink_native.c | 75 ++++++++++++++++++++++++++++++++++++---
> drivers/rpmsg/qcom_glink_native.h | 5 +++
> drivers/rpmsg/qcom_glink_rpm.c | 4 ++-
> drivers/rpmsg/qcom_glink_smem.c | 1 +
> 4 files changed, 79 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
> index 9a58925..777ac6b 100644
> --- a/drivers/rpmsg/qcom_glink_native.c
> +++ b/drivers/rpmsg/qcom_glink_native.c
> @@ -31,6 +31,7 @@
> #include "qcom_glink_native.h"
>
> #define GLINK_NAME_SIZE 32
> +#define GLINK_VERSION_1 1
>
> #define RPM_GLINK_CID_MIN 1
> #define RPM_GLINK_CID_MAX 65536
> @@ -94,6 +95,9 @@ struct qcom_glink {
> struct mutex idr_lock;
> struct idr lcids;
> struct idr rcids;
> + unsigned long features;
> +
> + bool intentless;
> };
>
> enum {
> @@ -256,8 +260,8 @@ static int qcom_glink_send_version(struct qcom_glink *glink)
> struct glink_msg msg;
>
> msg.cmd = cpu_to_le16(RPM_CMD_VERSION);
> - msg.param1 = cpu_to_le16(1);
> - msg.param2 = cpu_to_le32(GLINK_FEATURE_INTENTLESS);
> + msg.param1 = cpu_to_le16(GLINK_VERSION_1);
> + msg.param2 = cpu_to_le32(glink->features);
>
> return qcom_glink_tx(glink, &msg, sizeof(msg), NULL, 0, true);
> }
> @@ -267,8 +271,8 @@ static void qcom_glink_send_version_ack(struct qcom_glink *glink)
> struct glink_msg msg;
>
> msg.cmd = cpu_to_le16(RPM_CMD_VERSION_ACK);
> - msg.param1 = cpu_to_le16(1);
> - msg.param2 = cpu_to_le32(0);
> + msg.param1 = cpu_to_le16(GLINK_VERSION_1);
> + msg.param2 = cpu_to_le32(glink->features);
>
> qcom_glink_tx(glink, &msg, sizeof(msg), NULL, 0, true);
> }
> @@ -362,6 +366,63 @@ static void qcom_glink_send_close_ack(struct qcom_glink *glink,
> qcom_glink_tx(glink, &req, sizeof(req), NULL, 0, true);
> }
>
> +/**
> + * qcom_glink_receive_version() - receive version/features from remote system
> + *
> + * @glink: pointer to transport interface
> + * @r_version: remote version
> + * @r_features: remote features
> + *
> + * This function is called in response to a remote-initiated version/feature
> + * negotiation sequence.
> + */
> +static void qcom_glink_receive_version(struct qcom_glink *glink,
> + u32 version,
> + u32 features)
> +{
> + switch (version) {
> + case 0:
> + break;
> + case GLINK_VERSION_1:
> + glink->features &= features;
> + /* FALLTHROUGH */
> + default:
> + qcom_glink_send_version_ack(glink);
> + break;
> + }
> +}
> +
> +/**
> + * qcom_glink_receive_version_ack() - receive negotiation ack from remote system
> + *
> + * @glink: pointer to transport interface
> + * @r_version: remote version response
> + * @r_features: remote features response
> + *
> + * This function is called in response to a local-initiated version/feature
> + * negotiation sequence and is the counter-offer from the remote side based
> + * upon the initial version and feature set requested.
> + */
> +static void qcom_glink_receive_version_ack(struct qcom_glink *glink,
> + u32 version,
> + u32 features)
> +{
> + switch (version) {
> + case 0:
> + /* Version negotiation failed */
> + break;
> + case GLINK_VERSION_1:
> + if (features == glink->features)
> + break;
> +
> + glink->features &= features;
> + /* FALLTHROUGH */
> + default:
> + qcom_glink_send_version(glink);
> + break;
> + }
> +}
> +
> static int qcom_glink_rx_defer(struct qcom_glink *glink, size_t extra)
> {
> struct glink_defer_cmd *dcmd;
> @@ -909,9 +970,10 @@ static void qcom_glink_work(struct work_struct *work)
>
> switch (cmd) {
> case RPM_CMD_VERSION:
> - qcom_glink_send_version_ack(glink);
> + qcom_glink_receive_version(glink, param1, param2);
> break;
> case RPM_CMD_VERSION_ACK:
> + qcom_glink_receive_version_ack(glink, param1, param2);
> break;
> case RPM_CMD_OPEN:
> qcom_glink_rx_open(glink, param1, msg->data);
> @@ -932,6 +994,7 @@ static void qcom_glink_work(struct work_struct *work)
> }
>
> struct qcom_glink *qcom_glink_native_probe(struct device *dev,
> + unsigned long features,
> struct qcom_glink_pipe *rx,
> struct qcom_glink_pipe *tx)
> {
> @@ -947,6 +1010,8 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev,
> glink->tx_pipe = tx;
> glink->rx_pipe = rx;
>
> + glink->features = features;
> +
> mutex_init(&glink->tx_lock);
> spin_lock_init(&glink->rx_lock);
> INIT_LIST_HEAD(&glink->rx_queue);
> diff --git a/drivers/rpmsg/qcom_glink_native.h b/drivers/rpmsg/qcom_glink_native.h
> index 197bb9d..456ec79 100644
> --- a/drivers/rpmsg/qcom_glink_native.h
> +++ b/drivers/rpmsg/qcom_glink_native.h
> @@ -14,6 +14,10 @@
> #ifndef __QCOM_GLINK_NATIVE_H__
> #define __QCOM_GLINK_NATIVE_H__
>
> +#define GLINK_FEATURE_INTENT_REUSE BIT(0)
> +#define GLINK_FEATURE_MIGRATION BIT(1)
> +#define GLINK_FEATURE_TRACER_PKT BIT(2)
> +
> struct qcom_glink_pipe {
> size_t length;
>
> @@ -31,6 +35,7 @@ struct qcom_glink_pipe {
> struct qcom_glink;
>
> struct qcom_glink *qcom_glink_native_probe(struct device *dev,
> + unsigned long features,
> struct qcom_glink_pipe *rx,
> struct qcom_glink_pipe *tx);
> void qcom_glink_native_remove(struct qcom_glink *glink);
> diff --git a/drivers/rpmsg/qcom_glink_rpm.c b/drivers/rpmsg/qcom_glink_rpm.c
> index cc73af0..7d039cd 100644
> --- a/drivers/rpmsg/qcom_glink_rpm.c
> +++ b/drivers/rpmsg/qcom_glink_rpm.c
> @@ -302,7 +302,9 @@ static int glink_rpm_probe(struct platform_device *pdev)
> writel(0, tx_pipe->head);
> writel(0, rx_pipe->tail);
>
> - glink = qcom_glink_native_probe(&pdev->dev, &rx_pipe->native,
> + glink = qcom_glink_native_probe(&pdev->dev,
> + 0,
> + &rx_pipe->native,
> &tx_pipe->native);
> if (IS_ERR(glink))
> return PTR_ERR(glink);
> diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c
> index 19179a1..b78874b 100644
> --- a/drivers/rpmsg/qcom_glink_smem.c
> +++ b/drivers/rpmsg/qcom_glink_smem.c
> @@ -284,6 +284,7 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent,
> *tx_pipe->head = 0;
>
> glink = qcom_glink_native_probe(dev,
> + GLINK_FEATURE_TRACER_PKT,
> &rx_pipe->native, &tx_pipe->native);
> if (IS_ERR(glink)) {
> ret = PTR_ERR(glink);
next prev parent reply other threads:[~2017-08-28 11:48 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-24 7:21 [PATCH v2 00/20] rpmsg: glink: Add glink smem based transport Sricharan R
2017-08-24 7:21 ` [PATCH v2 01/20] rpmsg: glink: Rename glink_rpm_xx functions to qcom_glink_xx Sricharan R
2017-08-28 11:42 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 02/20] rpmsg: glink: Associate indirections for pipe fifo accessor's Sricharan R
2017-08-28 11:44 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 03/20] rpmsg: glink: Split rpm_probe to reuse the common code Sricharan R
2017-08-28 11:44 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 04/20] rpmsg: glink: Move the common glink protocol implementation to glink_native.c Sricharan R
2017-08-28 11:45 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 05/20] rpmsg: glink: Allow unaligned data access Sricharan R
2017-08-28 11:46 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 06/20] rpmsg: glink: Return -EAGAIN when there is no FIFO space Sricharan R
2017-08-28 11:47 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 07/20] rpmsg: glink: Do a mbox_free_channel in remove Sricharan R
2017-08-28 11:47 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 08/20] rpmsg: glink: Introduce glink smem based transport Sricharan R
2017-08-28 11:48 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 09/20] rpmsg: glink: Fix default case while handling received commands Sricharan R
2017-08-28 11:48 ` Arun Kumar Neelakantam
2017-08-29 20:57 ` Bjorn Andersson
2017-08-24 7:21 ` [PATCH v2 10/20] rpmsg: glink: Add support for transport version negotiation Sricharan R
2017-08-28 11:48 ` Arun Kumar Neelakantam [this message]
2017-08-24 7:21 ` [PATCH v2 11/20] rpmsg: glink: Fix idr_lock from mutex to spinlock Sricharan R
2017-08-28 11:49 ` Arun Kumar Neelakantam
2017-08-28 21:51 ` Chris Lew
2017-08-28 23:13 ` Sricharan R
2017-08-24 7:21 ` [PATCH v2 12/20] rpmsg: glink: Add support for TX intents Sricharan R
2017-08-28 11:49 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 13/20] rpmsg: glink: Use the local intents when receiving data Sricharan R
2017-08-28 11:49 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 14/20] rpmsg: glink: Make RX FIFO peak accessor to take an offset Sricharan R
2017-08-28 11:50 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 15/20] rpmsg: glink: Add rx done command Sricharan R
2017-08-28 11:50 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 16/20] rpmsg: glink: Add announce_create ops and preallocate intents Sricharan R
2017-08-28 11:50 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 17/20] rpmsg: glink: Receive and store the remote intent buffers Sricharan R
2017-08-28 11:51 ` Arun Kumar Neelakantam
2017-08-24 7:21 ` [PATCH v2 18/20] rpmsg: glink: Use the intents passed by remote Sricharan R
2017-08-24 7:21 ` [PATCH v2 19/20] rpmsg: glink: Request for intents when unavailable Sricharan R
2017-08-24 7:21 ` [PATCH v2 20/20] rpmsg: glink: Handle remote rx done command Sricharan R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aead6e9a-110a-35be-7cae-b617b7ac3192@codeaurora.org \
--to=aneela@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
--cc=sricharan@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox