Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp951555pxj; Fri, 4 Jun 2021 02:16:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwahKNXoNfiq+zgYv4lKoyRVoJvvwG+FzsJiz902NE4/5ddOJ3tbRiR2kvDXWonZ+4PD8MF X-Received: by 2002:a05:6402:1590:: with SMTP id c16mr3704717edv.7.1622798211757; Fri, 04 Jun 2021 02:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622798211; cv=none; d=google.com; s=arc-20160816; b=cERcAt2yj7ZUVBsffrC3UP1NAwn2TdAhEr8hyUeStwGvWDytp2tal+yDHfP7viILrv FuJs85ZmH7MzpBgEWjDGPZmbN01BHJ82BrW5QO0ZkC6N5jgxCI2oDmdTKpxda8eOZTJS Y4ynPouS0bHIayyFFrll+bnpojOJjIRIYFCYILrNdr0+rtsWf/Xa9ZYqMMNSpesTX/NK qWgt226WKHbGCbYWdNAc8064g7GulJ2NO8/JCiA9qy9JLjhl3Lbo5n+f5h/X5AkgwRS1 fo/4PLhi+WHQLl3Y5AlWuGAe4jFWYadARBdEf/lIMYxA3Llpo1uHbV9QLWAiN2JLGnUb ywyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hWeHL/dTAIQeVW4i01Rf5rhS3v5QysYOAQCXNxNaV/M=; b=bwN6YVsJ6SC8eICkkTDmdjoqck9/OGUdFwni0i2erY2jCgiuqOhfBiac0cmsSISfFJ KznUwyANs9wDhGYbnJBFJrUFXUWCxlqNNq5WWGk2je35SlY+hhtRY6LVXzEuqs+sbpJx Z3iCFb9uyo3AjcjUN5V9cddODyMyHRNBekuMxLbQhjbzAYxv3y59fz4Qr61GvtYABy66 IEQ4zFu7lxTpBsn7065lDXFZ6Su6xDeZpfc6w2yyDorkYB7jythrhwR6SdpyeIsV1DEP uUsFwHRc2pkNLbi+t7nNCd6iAZRMdzIaaMSkHhWU9EvtCHeJv4AqXSZYux6mleeXYFGS nzhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=sC0Tmmaj; 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 d12si4243850edq.386.2021.06.04.02.16.27; Fri, 04 Jun 2021 02:16:51 -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=sC0Tmmaj; 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 S230085AbhFDJQJ (ORCPT + 99 others); Fri, 4 Jun 2021 05:16:09 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:57386 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229978AbhFDJQG (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 15496nHi028540; 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 : in-reply-to : references : mime-version : content-type; s=selector1; bh=hWeHL/dTAIQeVW4i01Rf5rhS3v5QysYOAQCXNxNaV/M=; b=sC0Tmmaju6/0qo5098Eflny3cZmxnwAvvb5+hugHxJ8TPw4aNrto4s4FQ1sFnodPVGUh ISQrRkyzJ9+LOG5w81q4qCKdb/KVHnyL8qAZWxcxin9t3tLMiqZuv1Tmp2xmXCbIOEbT 0+JCqdqtnte5iIT+wXdveiuS7N4ronQ+h28pohcsxI09iVBHHS/Kx0fa+yM06kGpphOT VBUNSNFX0swQnGraYCRjzWgz464WemmvZGIxcmmjn/WxAehEeNkEyzjZ423agIMmbjkG 7djwaHqs0MxWmKacF5idk/gbOf6GAeiwkuvlVgUwv1shpr4YqUMnwZgLEcAxU8iWu9gk tA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 38yg960gre-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 733A910003A; Fri, 4 Jun 2021 11:14:18 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6513D216EEF; Fri, 4 Jun 2021 11:14:18 +0200 (CEST) Received: from localhost (10.75.127.50) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 4 Jun 2021 11:14:17 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Ohad Ben-Cohen , Mathieu Poirier CC: , , , Subject: [PATCH 2/4] rpmsg: ctrl: Introduce RPMSG_RELEASE_DEV_IOCTL Date: Fri, 4 Jun 2021 11:14:04 +0200 Message-ID: <20210604091406.15901-3-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210604091406.15901-1-arnaud.pouliquen@foss.st.com> References: <20210604091406.15901-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG1NODE2.st.com (10.75.127.2) 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 Implement the RPMSG_RELEASE_DEV_IOCTL to allow the user application to release a rpmsg device created either by the remote processor or with the RPMSG_CREATE_DEV_IOCTL call. Depending on the back-end implementation, the associated rpmsg driver is removed and a NS destroy rpmsg can be sent to the remote processor. Signed-off-by: Arnaud Pouliquen --- drivers/rpmsg/rpmsg_ctrl.c | 7 +++++++ include/uapi/linux/rpmsg.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/drivers/rpmsg/rpmsg_ctrl.c b/drivers/rpmsg/rpmsg_ctrl.c index 4aa962df3661..cb19e32d05e1 100644 --- a/drivers/rpmsg/rpmsg_ctrl.c +++ b/drivers/rpmsg/rpmsg_ctrl.c @@ -98,6 +98,13 @@ static long rpmsg_ctrldev_ioctl(struct file *fp, unsigned int cmd, } break; + case RPMSG_RELEASE_DEV_IOCTL: + ret = rpmsg_release_channel(ctrldev->rpdev, &chinfo); + if (ret) + dev_err(&ctrldev->dev, "failed to release %s channel (%d)\n", + chinfo.name, ret); + break; + default: ret = -EINVAL; } diff --git a/include/uapi/linux/rpmsg.h b/include/uapi/linux/rpmsg.h index f9d5a74e7801..38639ba37438 100644 --- a/include/uapi/linux/rpmsg.h +++ b/include/uapi/linux/rpmsg.h @@ -38,4 +38,9 @@ struct rpmsg_endpoint_info { */ #define RPMSG_CREATE_DEV_IOCTL _IOW(0xb5, 0x3, struct rpmsg_endpoint_info) +/** + * Release a local rpmsg device. + */ +#define RPMSG_RELEASE_DEV_IOCTL _IOW(0xb5, 0x4, struct rpmsg_endpoint_info) + #endif -- 2.17.1