From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33E17C433DF for ; Tue, 7 Jul 2020 19:08:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15C4C206E9 for ; Tue, 7 Jul 2020 19:08:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="SXyzudWM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728607AbgGGTIS (ORCPT ); Tue, 7 Jul 2020 15:08:18 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:33401 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728067AbgGGTIS (ORCPT ); Tue, 7 Jul 2020 15:08:18 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1594148898; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=9IrwGFZJCY5EJx1yIfyu048oORHtxrhYqRHCpxZifu4=; b=SXyzudWMXfdyWfvjDIkFb4d8n1Pr1gcRSSSXjvhOPhmpO19EjGNgU0AggOPauhKvOtdRR9qs 6FLFH7UORX4hKkygPvADUm1pXzTIaAChlOgwTtQZNIAnuDU8gHwf6m6ZYgW5Z2uRQDaMnTuB gkgnsl8n6PxMKOnnTNUFw0DrnOg= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI4ZWZiZiIsICJsaW51eC1yZW1vdGVwcm9jQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n10.prod.us-west-2.postgun.com with SMTP id 5f04c8156e56afc68dc78fd2 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 07 Jul 2020 19:08:05 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E06A8C433CB; Tue, 7 Jul 2020 19:08:04 +0000 (UTC) Received: from sidgup-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sidgup) by smtp.codeaurora.org (Postfix) with ESMTPSA id C1B6BC433C8; Tue, 7 Jul 2020 19:08:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C1B6BC433C8 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=sidgup@codeaurora.org From: Siddharth Gupta To: agross@kernel.org, bjorn.andersson@linaro.org, ohad@wizery.com, corbet@lwn.net Cc: Siddharth Gupta , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tsoni@codeaurora.org, psodagud@codeaurora.org, rishabhb@codeaurora.org, linux-doc@vger.kernel.org Subject: [PATCH v4 0/2] Add character device interface to remoteproc Date: Tue, 7 Jul 2020 12:07:48 -0700 Message-Id: <1594148870-27276-1-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org This patch series adds a character device interface to remoteproc framework. Currently there is only a sysfs interface which the userspace clients can use. If a usersapce application crashes after booting the remote processor through the sysfs interface the remote processor does not get any indication about the crash. It might still assume that the application is running. For example modem uses remotefs service to data from disk/flash memory. If the remotefs service crashes, modem still keeps on requesting data which might lead to crash on modem. Even if the service is restarted the file handles modem requested previously would become stale. Adding a character device interface makes the remote processor tightly coupled with the user space application. A crash of the application leads to a close on the file descriptors therefore shutting down the remoteproc. Changelog: v3 -> v4: - Addressed comments from Mathieu and Arnaud. - Added locks while writing/reading from the automatic-shutdown-on-release bool. - Changed return value when failing to copy to/from userspace. - Changed logic for calling shutdown on release. - Moved around code after the increase of max line length from 80 to 100. - Moved the call adding character device before device_add in rproc_add to add both sysfs and character device interface together. v2 -> v3: - Move booting of remoteproc from open to a write call. - Add ioctl interface for future functionality extension. - Add an ioctl call to default to rproc shutdown on release. v1 -> v2: - Fixed comments from Bjorn and Matthew. Siddharth Gupta (2): remoteproc: Add remoteproc character device interface remoteproc: core: Register the character device interface Documentation/userspace-api/ioctl/ioctl-number.rst | 1 + drivers/remoteproc/Kconfig | 9 ++ drivers/remoteproc/Makefile | 1 + drivers/remoteproc/remoteproc_cdev.c | 146 +++++++++++++++++++++ drivers/remoteproc/remoteproc_core.c | 10 ++ drivers/remoteproc/remoteproc_internal.h | 28 ++++ include/linux/remoteproc.h | 5 + include/uapi/linux/remoteproc_cdev.h | 37 ++++++ 8 files changed, 237 insertions(+) create mode 100644 drivers/remoteproc/remoteproc_cdev.c create mode 100644 include/uapi/linux/remoteproc_cdev.h -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06305C433DF for ; Tue, 7 Jul 2020 19:09:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB749206E9 for ; Tue, 7 Jul 2020 19:09:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="x80diyk+"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="HdTOQkAP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB749206E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=f+q980nPuRm2pMXiSDiZlNTfA3qrAtuzKzL9+kGA764=; b=x80diyk+8jrtFVhgjn5RG63NfM HodzM9B/Kru1ltuHfzZeVLSBY7mH+tc6XDNCwYeCzmI3TP1aIHVOEAmsfSrIWkYaFvGOcdzTaA4zO CKB3BZ8f26duVABu9fcaSS/rxSn6EdaDTzhF37fvTvLjmCdl40DV2CucXtjISw+s17pL82qlGzsu4 jjjKWYmi9xVzWQYVlkjr+YsvDiARjC9BzRIrvouv3BTsUrcuoTPxjVnixjODL5fWF+v1U+V59A2Ab QyfuNJG1W+hQzKRcIDny/CygvBM7ILHMyRXVSYN4fD+byeQM0fpfADmwNOP3YtqOgktnX28Z/9X5u QKiPd7sg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsswu-0001Kp-7q; Tue, 07 Jul 2020 19:08:12 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsswq-0001J8-My for linux-arm-kernel@lists.infradead.org; Tue, 07 Jul 2020 19:08:09 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1594148887; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=9IrwGFZJCY5EJx1yIfyu048oORHtxrhYqRHCpxZifu4=; b=HdTOQkAPQH1bGaN6BM4PGMATZVqY7fem5AqmnDomWRG1FnLN/XHmjOO6B4q75pw5cpz8babF iWTw/Xjfd9gXxJmFoH4b2IUdvxq8bt3Get0X9gbEDC8U1tGaqBmu+5ZW7gdFEhhpYUtZBay6 +a3+L5EcZggwo3iWsdyfq+lq/Rg= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJiYzAxZiIsICJsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n19.prod.us-west-2.postgun.com with SMTP id 5f04c8159b7f1f3df7831b1b (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 07 Jul 2020 19:08:05 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E6FACC4339C; Tue, 7 Jul 2020 19:08:04 +0000 (UTC) Received: from sidgup-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sidgup) by smtp.codeaurora.org (Postfix) with ESMTPSA id C1B6BC433C8; Tue, 7 Jul 2020 19:08:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C1B6BC433C8 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=sidgup@codeaurora.org From: Siddharth Gupta To: agross@kernel.org, bjorn.andersson@linaro.org, ohad@wizery.com, corbet@lwn.net Subject: [PATCH v4 0/2] Add character device interface to remoteproc Date: Tue, 7 Jul 2020 12:07:48 -0700 Message-Id: <1594148870-27276-1-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200707_150808_817107_114243F4 X-CRM114-Status: GOOD ( 16.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tsoni@codeaurora.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, rishabhb@codeaurora.org, Siddharth Gupta , psodagud@codeaurora.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch series adds a character device interface to remoteproc framework. Currently there is only a sysfs interface which the userspace clients can use. If a usersapce application crashes after booting the remote processor through the sysfs interface the remote processor does not get any indication about the crash. It might still assume that the application is running. For example modem uses remotefs service to data from disk/flash memory. If the remotefs service crashes, modem still keeps on requesting data which might lead to crash on modem. Even if the service is restarted the file handles modem requested previously would become stale. Adding a character device interface makes the remote processor tightly coupled with the user space application. A crash of the application leads to a close on the file descriptors therefore shutting down the remoteproc. Changelog: v3 -> v4: - Addressed comments from Mathieu and Arnaud. - Added locks while writing/reading from the automatic-shutdown-on-release bool. - Changed return value when failing to copy to/from userspace. - Changed logic for calling shutdown on release. - Moved around code after the increase of max line length from 80 to 100. - Moved the call adding character device before device_add in rproc_add to add both sysfs and character device interface together. v2 -> v3: - Move booting of remoteproc from open to a write call. - Add ioctl interface for future functionality extension. - Add an ioctl call to default to rproc shutdown on release. v1 -> v2: - Fixed comments from Bjorn and Matthew. Siddharth Gupta (2): remoteproc: Add remoteproc character device interface remoteproc: core: Register the character device interface Documentation/userspace-api/ioctl/ioctl-number.rst | 1 + drivers/remoteproc/Kconfig | 9 ++ drivers/remoteproc/Makefile | 1 + drivers/remoteproc/remoteproc_cdev.c | 146 +++++++++++++++++++++ drivers/remoteproc/remoteproc_core.c | 10 ++ drivers/remoteproc/remoteproc_internal.h | 28 ++++ include/linux/remoteproc.h | 5 + include/uapi/linux/remoteproc_cdev.h | 37 ++++++ 8 files changed, 237 insertions(+) create mode 100644 drivers/remoteproc/remoteproc_cdev.c create mode 100644 include/uapi/linux/remoteproc_cdev.h -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel