Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp727892pxj; Tue, 18 May 2021 12:46:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdZaaj71itbfdV5MGY4GUCAyd2ptv7C1i27L1FxmmKq6q6FNgsQEpGbjtRPLGN3Um0KRt4 X-Received: by 2002:a50:ccdc:: with SMTP id b28mr8990847edj.92.1621367177184; Tue, 18 May 2021 12:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621367177; cv=none; d=google.com; s=arc-20160816; b=sd8IF0qpC3xi9JjTg359kSst8bzUab8zfm2volH2bGu2S7JYMgYftF6pp6+JMPWUdx LpaDNfqkkyT1IOQzQtRlrtU/mRD2wSvyuK7TP8qsMyIkIK69AAzBTLpejIiEBVF+lBQI 9JE11Xl1ZSRn+Dnqr44e4YrKyjSRyOF0whDKvvhffu9B7vpS+q+Z3XXbdGoaYfsqfWaW fGLYWakVau6/6XKFzjvT4jF/Ba6y0oEJv8AbEeaE8E4PfKQmhbR0MJVib+5Z1msWTpV3 Kg3mT5HwHFHULcyDjv4d+8JaLZNH6afmdXD+5s7o1k66SyQSKlp9Va756tS+lHtPnKNd hNBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FRBnxsunwKZMN3HF3sG/rPb6rE3SlX3UxhINuxk4Q2g=; b=k6vwMHzCVTM1HKur5isZy1vlgPZPTo7wQ/VA8HT6fLUNKK/b5jmUqo6IC1yKYVNsPb FSn8IndL3BRF/jvRY675bhwq6FKo+XcLRBjVZY1vNaffV2rAhfRWNdxGk2ksO5n24lvc YSW2Z+qTE53ey0/R/cqsqQcKI5jlygS8H3aTAyheWR2YjJFgG76e/FDMl3GBJEV68BKO sk0RP68fJPPn424LhQxnHGArnLwMT3+SVyRYxDaAW+uZzeq14JnNeTAzF1swUD0OqRJ+ NYpe6B9OvR1Cxhrx87ON0Egzfto6f5DOgyDuH9XqnPbFrTyE8wlS55jIgO/pc+Qyelqp Yk3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UiIQMcXU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si4709308edd.373.2021.05.18.12.45.53; Tue, 18 May 2021 12:46:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UiIQMcXU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S242741AbhEQQl5 (ORCPT + 99 others); Mon, 17 May 2021 12:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244019AbhEQQl0 (ORCPT ); Mon, 17 May 2021 12:41:26 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8560C043163 for ; Mon, 17 May 2021 08:47:33 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id lj11-20020a17090b344bb029015bc3073608so3937310pjb.3 for ; Mon, 17 May 2021 08:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=FRBnxsunwKZMN3HF3sG/rPb6rE3SlX3UxhINuxk4Q2g=; b=UiIQMcXUY5269CNue563SejGPAfXEtbk4+D3088yWt3FZ23ZJxavGXVfapk+jydZe+ syNGASpatkACDUf67lQUWay0tml1OK9d2PjKHoroChl6KOkt3GicIWZn16YGxQrqgtE6 sA+iuOG93EiXC8EjHEW9iStuOA7vE34eHb/Idln5OhoHhkwqpRpP/vFtFZv84sjxp885 2ayprXeG9mZ/uMdV9V1hMk1JCJYbCI6hyNuKSrDUtjKDlHauLzR5V+G3flxfo8uUprQb 2lwzHvjDkuN2T7s9yyxvmjYN9OVqGLoRu6MCxa/OsAK0ybZVJ7QwPcQB684ujuyBfJ6b eurA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FRBnxsunwKZMN3HF3sG/rPb6rE3SlX3UxhINuxk4Q2g=; b=eicclS0+P8VlKr88TFg/jq4naU4qBerLD6tUU8laDAm48a/h9KO0bwOp8fenVQuScr bSwUq306Iijrx1bfImpjyMhOG6dYkGSbvNWX2cJSfhMHc3yslDleE9g1wZ2B9hHvCQIk 5RSTXFzCoqBKeMiUXnzDhh9TgL1jyh4puqQSEpsATcn7UIVku5RiWnyj3MDn10KT7Qbi msouuRIX1O3y9gOzcroxEf04TWqG2f1qxe7si4wgAtlwKDWZ+Hk1CJ9I1x1HJNsc35+d uwGL8KJ8Of3pxIqVMlBaFf2GcGXTpkLMc1YecAGYsJoT+svweSj+zrCktFIYiWCVm3WI ylqg== X-Gm-Message-State: AOAM532AuZ2o5mnl/Wj0O0dcBcyk1NJW1Z2rC5QasipILCep1ObhkYyz jD/oNXWY8tMloj4JLzHnFcAe9A== X-Received: by 2002:a17:90a:b945:: with SMTP id f5mr86375pjw.233.1621266453330; Mon, 17 May 2021 08:47:33 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id w2sm4839275pjq.5.2021.05.17.08.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 08:47:32 -0700 (PDT) Date: Mon, 17 May 2021 09:47:30 -0600 From: Mathieu Poirier To: Arnaud POULIQUEN Cc: Bjorn Andersson , Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: Re: [PATCH v3 5/6] rpmsg: char: Introduce a rpmsg driver for the rpmsg char device Message-ID: <20210517154730.GA496383@xps15> References: <20210429135507.8264-1-arnaud.pouliquen@foss.st.com> <20210429135507.8264-6-arnaud.pouliquen@foss.st.com> <20210505164159.GB1766375@xps15> <5a41e653-4d75-c5d5-a8e3-e247a50507f3@foss.st.com> <20210506161125.GA1804623@xps15> <20210507163113.GA1907885@xps15> <17df93bf-a055-5519-f6e5-ab4751a81ebf@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17df93bf-a055-5519-f6e5-ab4751a81ebf@foss.st.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 17, 2021 at 12:04:29PM +0200, Arnaud POULIQUEN wrote: > Hello Mathieu, > > On 5/7/21 6:31 PM, Mathieu Poirier wrote: > > Good morning, > > > > On Fri, May 07, 2021 at 11:30:30AM +0200, Arnaud POULIQUEN wrote: > >> Hi Mathieu, > >> > >> On 5/6/21 6:11 PM, Mathieu Poirier wrote: > >>> Good day, > >>> > >>> On Wed, May 05, 2021 at 08:25:24PM +0200, Arnaud POULIQUEN wrote: > >>>> Hi Mathieu, > >>>> > >>>> On 5/5/21 6:41 PM, Mathieu Poirier wrote: > >>>>> Hi Arnaud, > >>>>> > >>>>> On Thu, Apr 29, 2021 at 03:55:06PM +0200, Arnaud Pouliquen wrote: > > [snip...] > > >>>>>> +}; > >>>>> > >>>>> The sole purpose of doing this is to create instances of rpmsg_chrdevs from the > >>>>> name service - but is it really needed? Up to now and aside from GLINK and SMD, > >>>>> there asn't been other users of it so I'm wondering if it is worth going through > >>>>> all this trouble. > >>>> > >>>> It is a good point. > >>>> > >>>> Just as a reminder, the need of ST and, I assume, some other companies, is to > >>>> have a basic/generic communication channel to control a remote processor > >>>> application. > >>>> > >>>> Nothing generic exists today for a virtio transport based implementation. > >>>> Companies have to create their own driver. > >>>> > >>>> The purpose of my work is to allow our customer to use RPMsg without developing > >>>> a specific driver to control remote applications. > >>>> > >>>> The rpmsg_chrdev char is a good candidate for this. No protocol, just a simple > >>>> inter-processor link to send and receive data. The rpmsg_tty is another one. > >>>> > >>>> Focusing on the rpmsg_chrdev: > >>>> We did a part of the work with the first patch set that would be in 5.13. > >>>> But is it simple to use it for virtio transport based platforms? > >>>> If we don't implement the NS announcement support in rpmsg_chrdev, using > >>>> rpmsg_chrdev for a user application seems rather tricky. > >>>> How to instantiate the communication? > >>> > >>> Since we already have /dev/rpmsg_ctrlX user space can instantiate an > >>> using that interface, which is how things are done in the GLINK/SMD world. > >>> > >>> Wouldn't that cover the usecases you had in mind? > >> > >> I have in mind that to make RPMsg easy to use, we need a generic driver with a > >> basic user interface to send end receive data, that supports the NS announcement: > >> - remote side could instantiate it. > >> - an instantiation of the device by a Linux application generates a NS > >> announcement sent to the remote side (for instance to create a channel for debug > >> trace). > >> > > > > The communication using a rpmsg_chrdev should be happening in two different ways, > > i.e RPMSG_CREATE_EPT_IOCTL and RPMSG_CREATE_DEV_IOCTL (as you had in a previous > > patchset). > > > > From user space communication using a rpmsg_chrdev should be initiated in two > > different ways, i.e RPMSG_CREATE_EPT_IOCTL and RPMSG_CREATE_DEV_IOCTL (as you > > had in a previous patchset). > > > > Regarding RPMSG_CREATE_EPT_IOCTL, patches 1, 2 and 3 take care of the legacy > > compatibility and I am quite happy with that. In this case the driver works the > > same way regardless of the transport mechanism - virtio, GLINK or SMD. > > Ok i will send a new revision including only this ones, and continue the updates > in a new patchset. > > > > > Then there is instantiation with RPMSG_CREATE_DEV_IOCTL. That creates a new > > channel (with endpoint) when coming from /dev/rpmsg_ctrlX. When we have that > > functionality we can make the rpmsg_chrdev available from the name service, making > > sure the end result is the same regardless of source of the request (remote > > processor or user space). I was under the impression that functionality would > > be part of an upcoming patchset. > > > > Unless I'm missing parts of the story, proceeding this way should cover all the > > requirements we talked about. > > From my windows, there are 3 remaining features: > - capability to instantiate rpmsg_chrdev from the remote side (NS announcement) I think this should be #2. > - capability to instantiate rpmsg_chrdev from local user application > (RPMSG_CREATE_DEV_IOCTL) This should be #1. Once this is firmly in place #2 (above) should be relatively easy to implement. #1 and #2 can be in the same patchset, or not, depending on what you prefer. > - capability to send a NS announcement to the remote side on rpmsg_chrdev local > instantiation using RPMSG_CREATE_DEV_IOCTL. This one could be more tricky to > implement as the endpoint can be created after the channel. That should probably come after #1 and #2, and in a separate patchset. > > To simplify the review while keeping the overall picture in mind (and perhaps > prioritize based on other companies' interests), Please, just tell me what would > be your preference in term of splitting and next step. > > > > >> On the other side, the initial work requested by Bjorn seems to be reached: > >> de-correlate the control part to be able to reuse it for other rpmsg devices. > >> > >> I just have the feeling that we are stay in the middle of the road without the > >> patches 4,5 and 6 to have a first basic interface relying on RPMsg. > >> > >>> > >>> As you pointed out above rpmsg_chrdev should be light and simple - eliminating > >>> patches 4, 5 and 6 would yield that. > >>> > >> > >> My concern here is more about the complexity of using it by application, for > >> platforms that rely on virtio rpmsg transport. For instance applications need to > >> know the notion of local and remote RPMsg addressing. > >> > >> Based on your feeling, here is my proposition for next steps: > >> 1- resend a version a version with only patch 1,2 3 + the patch to clean-up the > >> #include in rpmsg_char > >> 2- switch back to the RPMsg TTY upstream. > >> 3- extend rpmsg_ctrl IOCTLs to allow instantiate RPMSG_TTY from Linux userland. > >> > > > > Introducing RPMSG_TTY makes sense if a serial controller is only accessible from > > the remote processor. On the flip side it is an overkill if we just want a raw > > message passing mechanism. For that the rpmsg_chrdev driver, with the above > > extention, should be used. > > > > Yes the rpmsg_chrdev should be the default one to use for basic communication. Perfect, we are on the same page. > The main purpose of the RPMSG_TTY (from ST company POW) is to easy the > transition in term of communication between an external and an internal > processor based on a serial link. It provides an abstraction layer that the > application does not have to manage the transport layer. > Ok > Both seem to me interesting to implement, but let's continue to focus on > rpmsg_chrdev first. > > Thanks, > Arnaud > > >> > >> Then, we can come back to patches 4, 5 and 6 depending on the feedback from the > >> users. > >> > >> Does this proposition would be OK for you? > >> > >> Thanks, > >> Arnaud > >> > >> > >>>> The application will probably has to scan the /sys/bus/rpmsg/devices/ folder to > >>>> determine the services and associated remote address. > >>>> > >>>> I don't think the QCOM drivers have the same problem because they seems to > >>>> initiate the communication and work directly with the RPMsg endpoints ( new > >>>> channel creation on endpoint creation) while Virtio works with the RPMsg channel. > >>>> > >>>> By introducing the ability to instantiate rpmsg_chrdevs through the NS > >>>> announcement, we make this easy for applications to use. > >>>> > >>>> And without rpmsg_chrdevs instantiation, It also means that we can't create an > >>>> RPMsg channel for the rpmsg_chrdevs using a new RPMSG_CREATE_DEV_IOCTL control, > >>>> right? > >>>> > >>>> That said, If we consider that the aim was only to extract the rpmsg_ctrl part, > >>>> I'm not against leaving the rpmsg_char in this state and switching to the > >>>> rpmsg_tty driver upstream including the work on the rpmsg_ctrl to create rpmsg > >>>> channels. > >>>> > >>>> We could come back on this if requested by someone else. > >>>> > >>>> Thanks, > >>>> Arnaud > >>>> > >>>>> > >>>>> As such I suggest we don't go out of our way to expose rpmsg_chrdevs to the name > >>>>> service. That way patches 4, 5 and 6 of this set can be dropped. > >>>>> > >>>>> Thanks, > >>>>> Mathieu > >>>>> >