Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp950812pxj; Fri, 4 Jun 2021 02:15:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3Y9VQxMdL1juaUQzUE5rtKPh8/gaF6rYVSKHrLRQjTKSpF4sf4ma7NPbn7Gog+HhsAYlg X-Received: by 2002:aa7:cc97:: with SMTP id p23mr3609963edt.372.1622798134177; Fri, 04 Jun 2021 02:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622798134; cv=none; d=google.com; s=arc-20160816; b=RQZyLTeRVOQj4Iov2eQtGKy+IDWu+zsBOslXirKIDtTwEyceIJxsfDRh6JnnKkEO0D r8znjz+dV3y7sE3TtRjVGe7JoCNSi0JORoirRKKfUL0zQaSeGWd/lckt10YtVmkMxbJz 7nlMiOiZiBbS5gOc05orr/zJM3iAhsewMdeIYImAU+7RFP6gvEXEk6dkHO16WjlfimzI 1JfL7srGVbrnvtD+pWC7pRsGdZJaMuGgECwUj1K3+6esEZMvIUdrcdm/QuLWxnYvfa6G 84JbZ7dehpoxBdaiE6pHVgI434Ny77NU5ITjba6zm6wKryT0q3P/yT6iCD0TaL3t+n+5 zSiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=EohvLLi/iGWwChJWs40a6J2SceXgPMqxbBWZsq2O7Hc=; b=Ze4YJz4R/8YajCA/52RjuBETySeNxDJM/GtMgCVupuGGtt9g4Vl5LQfBsmvOTRX/G6 fUT/l1AOSY46tXLnXfvoPx81JZkBZBF712Qlqu6NKz9pp/UtLT0/1s1JxRSJV9y3PzRb ZsUMywmL+cw7v82OcoCpSEP5c9W+vsfqGOZ6ROjM0mzGpBwwW19muovqYbvWRwaPHMVx thwfB5o8kBiYZNc7D66J5Z/I2K15rl6QsTIo5nMaF8glKFTNMxsv2F/Ttf8IGFrApuuw KRR3HjARWi+VW+Fln0nWuHsj+HQkGtnQ01E0JET5+JeUUTizwROHrgC4y13gdKa3nDqg O65A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=GS1IIk8G; 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=foss.st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ka15si4479206ejc.148.2021.06.04.02.15.11; Fri, 04 Jun 2021 02:15:34 -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=@foss.st.com header.s=selector1 header.b=GS1IIk8G; 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=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbhFDJQH (ORCPT + 99 others); Fri, 4 Jun 2021 05:16:07 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:57380 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229959AbhFDJQG (ORCPT ); Fri, 4 Jun 2021 05:16:06 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15496stS028635; Fri, 4 Jun 2021 11:14:18 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=selector1; bh=EohvLLi/iGWwChJWs40a6J2SceXgPMqxbBWZsq2O7Hc=; b=GS1IIk8GSTX7QIDj+6dqIk/oizRBSph9varKDyYKW4+MyM7CJc2a42WRiSTj0IpIhdUW ZHY7pijSePDe5Nkou/h2BevQMmLH9fSguUVbJ5znlo1uBaCtQRqL6dz5LkiO2rN+1WaB sWUEKx6Ij6ydPe6ZbMNIwi/gyzUgOHPPBvgjcUdo+0N895fmVGq3OYuqQNJNDMwb791A 2SErsnwyYI2oK4ST8kU24maN+IavY/VKKb4nmN0hHVzqTXiGEEyB8rLC0Ywmb1RnNhmy UpJFcmeHBwahqc6tL27XGSnS0WA3LwUl6nfTOmmq/zyl34N68u+rbhM+j76MFcE2PrIw eA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 38yg960gr9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Jun 2021 11:14:18 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D07B610002A; Fri, 4 Jun 2021 11:14:16 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id C0793216EEF; Fri, 4 Jun 2021 11:14:16 +0200 (CEST) Received: from localhost (10.75.127.51) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 4 Jun 2021 11:14:16 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Ohad Ben-Cohen , Mathieu Poirier CC: , , , Subject: [PATCH 0/4] rpmsg: ctrl: Add ability to instantiate rpmsg device locally Date: Fri, 4 Jun 2021 11:14:02 +0200 Message-ID: <20210604091406.15901-1-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-04_05:2021-06-04,2021-06-04 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Purpose: Allow the user space application to create and release an rpmsg device by adding rpmsg ioctrl to the /dev/rpmsg_ctrl interface Aim: The current implementation is based on the enumeration of services by the remote processor to create a new channel and instantiate associated rpmsg device. There is no solution to create a rpmsg channel on user application request. If the rpmsg char driver allows adding a new endpoint over an existing channel, it does not offer the ability to create a new one. Adding the IOCTRL to instantiate rpmsg channels from the user application will allow to dynamically create and destroy rpmsg devices. Some examples of use are: - activate the service at the initiative of the application, - remove the communication on a specific channel before entering the suspend mode, - creating a temporary channel for debugging purposes. Concerns: This implementation is very simple but allows the user application to create rpmsg devices without any limitations. - A device can be created even if there is no match with the driver (and it is difficult to check a match with module drivers). - It is not really possible to add a counter to limit the number of devices, because a device can be released by the remote side. The question is: should we add protection? Notice that there is no protection for RPMSG_CREATE_EPT_IOCTL. If this is not considered safe, another approach could be to create an rpmsg_ctrl API to add controls. This API would be used by a rpmsg driver to add is own user controls, such as creating/deleting devices. How to test it: - This series can be applied on git/andersson/remoteproc.git for-next branch (dc0e14fa833b) + the "Restructure the rpmsg char to decorrelate the control part" series[1] - to test the ioctrl, a rpmsgexportdev tool is available here: https://github.com/arnopo/rpmsgexport [1]https://patchwork.kernel.org/project/linux-remoteproc/list/?series=483793 Arnaud Pouliquen (4): rpmsg: ctrl: Introduce RPMSG_CREATE_DEV_IOCTL rpmsg: ctrl: Introduce RPMSG_RELEASE_DEV_IOCTL rpmsg: ctrl: Add check on rpmsg device removability from user space rpmsg: Add a removable attribute to the rpmsg device drivers/rpmsg/rpmsg_core.c | 2 ++ drivers/rpmsg/rpmsg_ctrl.c | 52 +++++++++++++++++++++++++++++++++++--- include/linux/rpmsg.h | 2 ++ include/uapi/linux/rpmsg.h | 10 ++++++++ 4 files changed, 62 insertions(+), 4 deletions(-) -- 2.17.1