Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp15250685rwb; Mon, 28 Nov 2022 09:26:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf4wUoWdze3qDCVwtmgTqbHByUnx/4nTJwfEuHOefWC3pyaiiyaFq5EtJkwUlkRgWAEx5vij X-Received: by 2002:a17:907:b014:b0:7b4:86be:f3e3 with SMTP id fu20-20020a170907b01400b007b486bef3e3mr37366428ejc.741.1669656407129; Mon, 28 Nov 2022 09:26:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669656407; cv=none; d=google.com; s=arc-20160816; b=MapzVS8RC7Vd+CEsyDesc8kIRuXjHe9mWVpe35MGEXFx3bMCfFvs1Mw4wfEMw7sqEL szthqNlpuWMEFdNgOSJo9PvOtmHclQUCGgjoB9JPioez4f7/6H2fvCQZTj8fUfjXDYNS C+M4HGf0O6evXe4AzCEZRREgHa2NYwJ0uafqQ7+QUFMnLT7qyVuiuYVqfCyVnfQOXWz/ wzrVEFm+eBNlKH5Do6q6s8FWcoA5No92HHj+9biufRE+UAB0pgicMleAYNI5CylY4970 K3a1hCJCS9C/XLoiniMsj07QaWm/hudwfisKqc6F92KIqOv7pZ/acazja3mxBybIcnSG 5FLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yXIPAzmyDAZ8+Yt+mdIKfYzYf8GpnFdRWmFlTziLPXg=; b=IXF2zk0qP0vYeWMrKkKC2yO7d5FXgwT9idxlikqG/uhI/QnnfzmYBJxGmUMjmc4SDK w2f/rx8s9Ol3uEKtKJEd7FCxPpJIrOLW3VtH1QyLdDqpE+Rctw3CHIRwI9uXHh1GbBhZ v6Q1+PdmGBJmyxGI+1PG/g4DXsfQVxIP0ikzkRFF9V2TjPId96l3UuNpdsQdEcx0/ZlS 9rydVdAhl5EtKNnwR+DXvZQR7X2h7TRY31ELEizQwTVN2PQqaJYgIeazxWLT2d2pGLFU /cWSxm7BnChS70Xh3R4FkzOy2i6Ux1Iz4CQCV6EwB9CBrZYlhlHjnGgRlVgNHlmuO8O6 vc4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AS242zFD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg15-20020a170907a40f00b007bf9dd57b5csi3283628ejc.645.2022.11.28.09.26.26; Mon, 28 Nov 2022 09:26:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AS242zFD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232504AbiK1Qig (ORCPT + 84 others); Mon, 28 Nov 2022 11:38:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232333AbiK1Qie (ORCPT ); Mon, 28 Nov 2022 11:38:34 -0500 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DD6224F16 for ; Mon, 28 Nov 2022 08:38:32 -0800 (PST) Received: by mail-il1-x136.google.com with SMTP id f6so5268089ilu.13 for ; Mon, 28 Nov 2022 08:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yXIPAzmyDAZ8+Yt+mdIKfYzYf8GpnFdRWmFlTziLPXg=; b=AS242zFDSXrjnkDSDOd4HCh+DxQhjEj++DoANtzghOgH1Dhbr+D6SBJRVaUMJ2Hhr3 DBOE55TmEQsNUe3h0QEqbLWHv66CNpRkhh3KVULoHFjXmZ4HtUirB4INY02b2kvvvUkl 9turIca2kOmmbcLCY9s33Uphqh0Yn3tV488UgIWU9KjtFeyCW2gfwVgL++yWDcK0x//g 6T8Il64zJQ+pQ4ICgjpd/puAZI3rfOsQapqeGkAtSxCR8pxNQbAq5LUbN+fy+jjnsNXG QWByrD8AHaYtay/CuVr6JaWtoA/KB2TNMd2bRXDwBjjWEDTbGAIZkAbmo+mq6ynQQiRx cUUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yXIPAzmyDAZ8+Yt+mdIKfYzYf8GpnFdRWmFlTziLPXg=; b=lx75645iV7CMPf/WHiYBV5kxXBupZx6GSNIyVzHeX8vM0+9jQpqDmGOY/8BKEqTvUx UUJis5Dh2dwvPEFTta4aPTGbVadBppuuJQbl+MgykVqtW4rqFQ+QzzNVOlEsgtDZGrrT +0u+caRw7OfNKQdZFlrOBcG9HE2VPoNLVGDqMz7zSIbUcxkj7dYcLTfPYmS1eJ6VHtr0 fFUyI6URep0j8cLgDiEVX1rQan2UV+AIkX2npn4qQJIQ2uV7OjdjTlJ1d9GYujtVJl6h Pl0bXMh803YZ4qHpLSTP9BJCsxI2mxe6c61nY0qDti8UCypWC2DE/1N7xubcPIjtVzc2 lRaw== X-Gm-Message-State: ANoB5plLySVl1+cfOB3EYxy/oD90F8JbrYX1WNhba9J2jndTizCVwmEo I8c7SIwyzTNxU6IUuTTRFrPqRjQK0GXhWOkwwF9qEQ== X-Received: by 2002:a92:1948:0:b0:302:4d37:9e66 with SMTP id e8-20020a921948000000b003024d379e66mr15861054ilm.277.1669653511879; Mon, 28 Nov 2022 08:38:31 -0800 (PST) MIME-Version: 1.0 References: <1669642093-20399-1-git-send-email-quic_sarannya@quicinc.com> In-Reply-To: <1669642093-20399-1-git-send-email-quic_sarannya@quicinc.com> From: Mathieu Poirier Date: Mon, 28 Nov 2022 09:38:20 -0700 Message-ID: Subject: Re: [PATCH V4 1/3] rpmsg: core: Add signal API support To: Sarannya S Cc: bjorn.andersson@linaro.org, arnaud.pouliquen@foss.st.com, swboyd@chromium.org, quic_clew@quicinc.com, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Deepak Kumar Singh , Catalin Marinas , Will Deacon , Bjorn Andersson , Shawn Guo , Arnd Bergmann , Krzysztof Kozlowski , Marcel Ziswiler , Vinod Koul , Dmitry Baryshkov , Mark Brown , "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Please send another revision with a proper cover letter that details the changes made between the last version. On Mon, 28 Nov 2022 at 06:28, Sarannya S wrote: > > Some transports like Glink support the state notifications between > clients using flow control signals similar to serial protocol signals. > Local glink client drivers can send and receive flow control status > to glink clients running on remote processors. > > Add APIs to support sending and receiving of flow control status by > rpmsg clients. > > Signed-off-by: Deepak Kumar Singh > --- > arch/arm64/configs/defconfig | 2 ++ > drivers/rpmsg/rpmsg_core.c | 20 ++++++++++++++++++++ > drivers/rpmsg/rpmsg_internal.h | 2 ++ > include/linux/rpmsg.h | 15 +++++++++++++++ > 4 files changed, 39 insertions(+) > > diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig > index 0b6af33..2df3778 100644 > --- a/arch/arm64/configs/defconfig > +++ b/arch/arm64/configs/defconfig > @@ -26,6 +26,8 @@ CONFIG_CGROUP_CPUACCT=y > CONFIG_CGROUP_PERF=y > CONFIG_CGROUP_BPF=y > CONFIG_USER_NS=y > +CONFIG_RPMSG=y > +CONFIG_RPMSG_CHAR=y > CONFIG_SCHED_AUTOGROUP=y > CONFIG_BLK_DEV_INITRD=y > CONFIG_KALLSYMS_ALL=y > diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c > index d6dde00e..0c5bf67 100644 > --- a/drivers/rpmsg/rpmsg_core.c > +++ b/drivers/rpmsg/rpmsg_core.c > @@ -331,6 +331,24 @@ int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, > EXPORT_SYMBOL(rpmsg_trysend_offchannel); > > /** > + * rpmsg_set_flow_control() - sets/clears serial flow control signals > + * @ept: the rpmsg endpoint > + * @enable: enable or disable serial flow control > + * > + * Return: 0 on success and an appropriate error value on failure. > + */ > +int rpmsg_set_flow_control(struct rpmsg_endpoint *ept, bool enable) > +{ > + if (WARN_ON(!ept)) > + return -EINVAL; > + if (!ept->ops->set_flow_control) > + return -ENXIO; > + > + return ept->ops->set_flow_control(ept, enable); > +} > +EXPORT_SYMBOL(rpmsg_set_flow_control); > + > +/** > * rpmsg_get_mtu() - get maximum transmission buffer size for sending message. > * @ept: the rpmsg endpoint > * > @@ -539,6 +557,8 @@ static int rpmsg_dev_probe(struct device *dev) > > rpdev->ept = ept; > rpdev->src = ept->addr; > + > + ept->flow_cb = rpdrv->flowcontrol; > } > > err = rpdrv->probe(rpdev); > diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h > index 39b646d..4fea45a 100644 > --- a/drivers/rpmsg/rpmsg_internal.h > +++ b/drivers/rpmsg/rpmsg_internal.h > @@ -55,6 +55,7 @@ struct rpmsg_device_ops { > * @trysendto: see @rpmsg_trysendto(), optional > * @trysend_offchannel: see @rpmsg_trysend_offchannel(), optional > * @poll: see @rpmsg_poll(), optional > + * @set_flow_control: see @rpmsg_set_flow_control(), optional > * @get_mtu: see @rpmsg_get_mtu(), optional > * > * Indirection table for the operations that a rpmsg backend should implement. > @@ -75,6 +76,7 @@ struct rpmsg_endpoint_ops { > void *data, int len); > __poll_t (*poll)(struct rpmsg_endpoint *ept, struct file *filp, > poll_table *wait); > + int (*set_flow_control)(struct rpmsg_endpoint *ept, bool enable); > ssize_t (*get_mtu)(struct rpmsg_endpoint *ept); > }; > > diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h > index 523c98b..cc7a917 100644 > --- a/include/linux/rpmsg.h > +++ b/include/linux/rpmsg.h > @@ -64,12 +64,14 @@ struct rpmsg_device { > }; > > typedef int (*rpmsg_rx_cb_t)(struct rpmsg_device *, void *, int, void *, u32); > +typedef int (*rpmsg_flowcontrol_cb_t)(struct rpmsg_device *, void *, bool); > > /** > * struct rpmsg_endpoint - binds a local rpmsg address to its user > * @rpdev: rpmsg channel device > * @refcount: when this drops to zero, the ept is deallocated > * @cb: rx callback handler > + * @flow_cb: remote flow control callback handler > * @cb_lock: must be taken before accessing/changing @cb > * @addr: local rpmsg address > * @priv: private data for the driver's use > @@ -92,6 +94,7 @@ struct rpmsg_endpoint { > struct rpmsg_device *rpdev; > struct kref refcount; > rpmsg_rx_cb_t cb; > + rpmsg_flowcontrol_cb_t flow_cb; > struct mutex cb_lock; > u32 addr; > void *priv; > @@ -106,6 +109,7 @@ struct rpmsg_endpoint { > * @probe: invoked when a matching rpmsg channel (i.e. device) is found > * @remove: invoked when the rpmsg channel is removed > * @callback: invoked when an inbound message is received on the channel > + * @flowcontrol: invoked when remote side flow control status is received > */ > struct rpmsg_driver { > struct device_driver drv; > @@ -113,6 +117,7 @@ struct rpmsg_driver { > int (*probe)(struct rpmsg_device *dev); > void (*remove)(struct rpmsg_device *dev); > int (*callback)(struct rpmsg_device *, void *, int, void *, u32); > + int (*flowcontrol)(struct rpmsg_device *, void *, bool); > }; > > static inline u16 rpmsg16_to_cpu(struct rpmsg_device *rpdev, __rpmsg16 val) > @@ -192,6 +197,8 @@ __poll_t rpmsg_poll(struct rpmsg_endpoint *ept, struct file *filp, > > ssize_t rpmsg_get_mtu(struct rpmsg_endpoint *ept); > > +int rpmsg_set_flow_control(struct rpmsg_endpoint *ept, bool enable); > + > #else > > static inline int rpmsg_register_device_override(struct rpmsg_device *rpdev, > @@ -316,6 +323,14 @@ static inline ssize_t rpmsg_get_mtu(struct rpmsg_endpoint *ept) > return -ENXIO; > } > > +static inline int rpmsg_set_flow_control(struct rpmsg_endpoint *ept, bool enable) > +{ > + /* This shouldn't be possible */ > + WARN_ON(1); > + > + return -ENXIO; > +} > + > #endif /* IS_ENABLED(CONFIG_RPMSG) */ > > /* use a macro to avoid include chaining to get THIS_MODULE */ > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >