Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3447329ybi; Tue, 2 Jul 2019 07:58:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxD+Iwl4inldIbv3oHEI18vwHV5TQFFTYdsVdciahmiuJMHwgHtpVIw2kEcp35QhyUjlvAa X-Received: by 2002:a17:902:f64:: with SMTP id 91mr34818438ply.247.1562079511742; Tue, 02 Jul 2019 07:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562079511; cv=none; d=google.com; s=arc-20160816; b=XX4F3snRAkI1VyoxBFIT5VFI+Y/QKAPLxCY+R0kuFcNExtuJ4s32ne+CDcFEnw+Dvn hP2lJ9vDAMcZNGjqjldxo34g5iSbrPaXrF70RGWZLQLZk0JXW+r6gBMvGbFSsvfz9pf3 GR/jd1r/DZBtbpUjdDbXBADpYCG2dJyJf6TLR49W0dGikuLh5oRZH9i48vox6bK3jgDt cvlyXpfrW6RAE/1DZDW9HZtuc8U//B+eik6HmWmLQA/dTQ8aPfg8hE9Ka4e2Bur4SoE1 K/klkQUbpl8phTNb4utkZlx2R2xnhhCTVLh4WGYgbZnhAZ+zi42YltGc1VVP0BU9FWRM u3xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=NUbU5Q6yEBQUCStYjxBrt6KQ8QWKe6FhU2+NRmbzbiQ=; b=tvxZMbRwgO5NzKWvTE6AGzh4sfLn10jb0H0/ZuybfImciTssKMuN1z1BrcUYOa7wPo el/0jpylnVnnb0E23GV68eD50Q2ws03wC+XhtuQHX/zoUtCsm+t6EPjwjaM1afiuJh8e ERXysoF3V0smyPVvwmsSs3TiZGICjaaf4Pkv/2H4qpconR4DHtjyfVebDu8482fVVMCw wIgj6RvZbWxydxuiYH1zRsu9uT6mtZif8J3xjUjfj8DksfJxUg8EnGGU+Sw8ewDyQvfS FB7Utw47eVsaQrrTFSnVWn6ZrKGjFELXgEDr6xQ/PDAnC4ZAUmy3MdIiXip9QgPG037F PPDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=B2ypATqy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j17si14580926pfn.278.2019.07.02.07.58.15; Tue, 02 Jul 2019 07:58:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=B2ypATqy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbfGBO5S (ORCPT + 99 others); Tue, 2 Jul 2019 10:57:18 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:49504 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725981AbfGBO5S (ORCPT ); Tue, 2 Jul 2019 10:57:18 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x62Erf5J017648; Tue, 2 Jul 2019 16:57:05 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=STMicroelectronics; bh=NUbU5Q6yEBQUCStYjxBrt6KQ8QWKe6FhU2+NRmbzbiQ=; b=B2ypATqyrYb6oUh0fO7hB0NcUeGrJtmOvACzS8I4UN8OK/Rlqar2Q/lYpvB7i3ejFeoN 2MIB0fNV4gOIHZkDwRNJAEfdN4ZlMRGNwlMo8tkemA4qL7JDM9o2EJBWzjSwNbJItDWw l1RrdA2g/EIbzPt9ypsT66mH7heTdxa/mV6dw9ctgCXq+pFTPTWyDVeGPvZSiibAmeqM 6jnQ2IPgd4533dQXSjU3ST8QZeeoA4X2lZyQ9QijBxZztGkRdT2zINHgS8fA2NFYyOns w+KIS9TyqjMBBo3Vg5VF4oAw1sFndBJYMRrqbj2K9vBeKl4159SU3LHP5PVqxZ05WmS+ Hg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2tdxvhvrdy-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 02 Jul 2019 16:57:05 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8A1D131; Tue, 2 Jul 2019 14:56:57 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5844C2CA0; Tue, 2 Jul 2019 14:56:57 +0000 (GMT) Received: from [10.48.0.131] (10.75.127.51) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 2 Jul 2019 16:56:56 +0200 Subject: Re: [PATCH v2 2/2] tty: add rpmsg driver To: Bjorn Andersson CC: Ohad Ben-Cohen , Greg Kroah-Hartman , Jiri Slaby , xiang xiao , , , Fabien DESSENNE References: <1557500577-22366-1-git-send-email-arnaud.pouliquen@st.com> <1557500577-22366-3-git-send-email-arnaud.pouliquen@st.com> <20190701060039.GD1263@builder> From: Arnaud Pouliquen Openpgp: preference=signencrypt Autocrypt: addr=arnaud.pouliquen@st.com; prefer-encr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8LNJeqRAR7oAvTexpO70f0Jns9GHzoy8sWbnp/LD BSH5iRCwq6Q0hJiEzrVTnO3bBp0WXfgowjXqR+YR86JPrzw2zjgr1e2zCZ1gHBTOyJZiDwAR AQABwsFlBBgBAgAPBQJWbvhyAhsMBQkJZgGAAAoJEP0ZQ+DAfqbfs5AQAJKIr2+j+U3JaMs3 px9bbxcuxRLtVP5gR3FiPR0onalO0QEOLKkXb1DeJaeHHxDdJnVV7rCJX/Fz5CzkymUJ7GIO gpUGstSpJETi2sxvYvxfmTvE78D76rM5duvnGy8lob6wR2W3IqIRwmd4X0Cy1Gtgo+i2plh2 ttVOM3OoigkCPY3AGD0ts+FbTn1LBVeivaOorezSGpKXy3cTKrEY9H5PC+DRJ1j3nbodC3o6 peWAlfCXVtErSQ17QzNydFDOysL1GIVn0+XY7X4Bq+KpVmhQOloEX5/At4FlhOpsv9AQ30rZ 3F5lo6FG1EqLIvg4FnMJldDmszZRv0bR0RM9Ag71J9bgwHEn8uS2vafuL1hOazZ0eAo7Oyup 2VNRC7Inbc+irY1qXSjmq3ZrD3SSZVa+LhYfijFYuEgKjs4s+Dvk/xVL0JYWbKkpGWRz5M82 Pj7co6u8pTEReGBYSVUBHx7GF1e3L/IMZZMquggEsixD8CYMOzahCEZ7UUwD5LKxRfmBWBgK 36tfTyducLyZtGB3mbJYfWeI7aiFgYsd5ehov6OIBlOz5iOshd97+wbbmziYEp6jWMIMX+Em zqSvS5ETZydayO5JBbw7fFBd1nGVYk1WL6Ll72g+iEnqgIckMtxey1TgfT7GhPkR7hl54ZAe 8mOik8I/F6EW8XyQAA2P Message-ID: Date: Tue, 2 Jul 2019 16:56:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <20190701060039.GD1263@builder> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG2NODE1.st.com (10.75.127.4) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-02_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn, On 7/1/19 8:00 AM, Bjorn Andersson wrote: > On Fri 10 May 08:02 PDT 2019, Arnaud Pouliquen wrote: > >> This driver exposes a standard tty interface on top of the rpmsg >> framework through the "rpmsg-tty-channel" rpmsg service. >> >> This driver supports multi-instances, offering a /dev/ttyRPMSGx entry >> per rpmsg endpoint. >> >> Signed-off-by: Arnaud Pouliquen >> Signed-off-by: Fabien Dessenne >> --- >> Documentation/serial/tty_rpmsg.txt | 38 +++ >> drivers/tty/Kconfig | 9 + >> drivers/tty/Makefile | 1 + >> drivers/tty/rpmsg_tty.c | 479 +++++++++++++++++++++++++++++++++++++ >> 4 files changed, 527 insertions(+) >> create mode 100644 Documentation/serial/tty_rpmsg.txt >> create mode 100644 drivers/tty/rpmsg_tty.c >> >> diff --git a/Documentation/serial/tty_rpmsg.txt b/Documentation/serial/tty_rpmsg.txt >> new file mode 100644 >> index 000000000000..e069ed268a2b >> --- /dev/null >> +++ b/Documentation/serial/tty_rpmsg.txt >> @@ -0,0 +1,38 @@ >> + >> + The rpmsg TTY >> + >> +The rpmsg tty driver implements a serial communication on the rpmsg bus, >> +to communicate with a remote processor devices in asymmetric multiprocessing >> +(AMP) configurations. >> + >> +The remote processor can instantiate a new tty by requesting a new "rpmsg-tty-channel" RPMsg service. Information related to the RPMsg and >> +associated tty device is available in /sys/bus/rpmsg/devices/virtio0.rpmsg-tty-channel.-1., with >> + corresponding to the ttyRPMSG instance. >> + >> +RPMsg data/control structure >> +---------------------------- >> + >> +The RPMsg is used to send data or control messages. Differentiation between the >> +stream and the control messages is done thanks to the first byte of the >> +RPMsg payload: >> + >> + >> +RPMSG_DATA - rest of messages contains data >> + >> +RPMSG_CTRL - message contains control. >> + >> + >> +To be compliant with this driver, the remote firmware has to respect this RPMsg >> +payload structure. At least the RPMSG_DATA type has to be supported. The >> +RPMSG_CTRL is optional. >> + > > This scheme prevents us from using this driver to expose any existing > tty-like channels without having to modify such firmware. An alternative could be to define a channel for the control and another for the data. This would avoid to reserved the first bytes for message type. > >> +Flow control type >> +----------------- >> + >> +A minimum flow control can be implemented to allow/block communication with the remote processor. >> + >> +DATA_TERM_READY - one parameter: >> + - u8 state >> + Set to indicate to remote side that terminal is >> + ready for communication. >> + Reset to block communication with remote side. > > And as shown in discussions following Qualcomm's proposed flow-control > addition to the rpmsg API the need for flow control is not limited to > this custom tty like interface Yes i remember discussions around the flow control, how to set priorities, bandwidth, etc... Did you start something on Qualcomm side to support flow control? RPMsg flow control would also impact the remote side (a.e. OpenAMP). This subject can be quite extensive, so perhaps, it should be better to treat it in a separate thread to be sure that design integrate all requirements. What about integrating rpmsg tty in a first step (with flow control in rpmsg tty)? Then in a second step, adapt it on the rpmsg flow control, and so use it to validate the feature. This would avoid to block the rpmsg_tty integration... As you mention seems that several companies have already their own rpmsg tty implementation... > > > So I really would like to see an implementation of a side-band flow > control mechanism in the virtio rpmsg bus. > >> diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig >> index e0a04bfc873e..d7b426939f69 100644 >> --- a/drivers/tty/Kconfig >> +++ b/drivers/tty/Kconfig >> @@ -442,6 +442,15 @@ config VCC >> help >> Support for Sun logical domain consoles. >> >> +config RPMSG_TTY >> + tristate "RPMSG tty driver" >> + depends on RPMSG >> + help >> + Say y here to export rpmsg endpoints as tty devices, usually found >> + in /dev/ttyRPMSGx. >> + This makes it possible for user-space programs to send and receive >> + rpmsg messages as a standard tty protocol. >> + >> config LDISC_AUTOLOAD >> bool "Automatically load TTY Line Disciplines" >> default y >> diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile >> index c72cafdf32b4..90a98a20714d 100644 >> --- a/drivers/tty/Makefile >> +++ b/drivers/tty/Makefile >> @@ -33,5 +33,6 @@ obj-$(CONFIG_PPC_EPAPR_HV_BYTECHAN) += ehv_bytechan.o >> obj-$(CONFIG_GOLDFISH_TTY) += goldfish.o >> obj-$(CONFIG_MIPS_EJTAG_FDC_TTY) += mips_ejtag_fdc.o >> obj-$(CONFIG_VCC) += vcc.o >> +obj-$(CONFIG_RPMSG_TTY) += rpmsg_tty.o >> >> obj-y += ipwireless/ >> diff --git a/drivers/tty/rpmsg_tty.c b/drivers/tty/rpmsg_tty.c > [..] >> +static struct rpmsg_device_id rpmsg_driver_tty_id_table[] = { >> + { .name = "rpmsg-tty-channel" }, > > I really would like a mechanism that does not depend on a fixed channel > name, as this required that firmware is written specifically for being > paired with this driver. > > In other words this is exactly the same problem that we worked around in > rpmsg_charTo be sure... What you propose here is to implement an attribute for the channel (as rpmsg_eptdevd defined in rpmsg_char), allowing application could define the channel name? This point is similar to the one we discussed with Xiang. What should we consider: the tty service associated to a tty channel or the service on top of the tty which would be in this case based on rpmsg? I considered that the service is the tty, as we create a /dev/tty when service is requested by the remoteproc firmware, so that the service name is fixed in consequence. Using attribute for channel name would mean that user registers a service that will be on top of a tty. In this case, is the TTY is the good communication channel? why not directly use rpmsg_char? So perhaps could be better to extend the rpmsg char device for this kind of requirement, allowing to probe it without associate it to an existing rpmsg device...? Thank, Arnaud > > Regards, > Bjorn >