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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE2DBC43334 for ; Tue, 7 Jun 2022 04:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236671AbiFGE5K (ORCPT ); Tue, 7 Jun 2022 00:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236663AbiFGE5H (ORCPT ); Tue, 7 Jun 2022 00:57:07 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7F56D4137; Mon, 6 Jun 2022 21:57:04 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2574v0PI026471; Mon, 6 Jun 2022 23:57:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1654577820; bh=4Z/SWcBdgq7gJXZF6aYCxpS+F1uJ0waLtD4QLHJH0F4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Q3shm+6vCzVgcbYDe2xbK9YyOxSYwUt5IYFwwhRVXVRgNsu+MFAB50yupILinyoqb y5ecjWHC1UvyrsV22fPTZ6J4cSVRc2jOvtVt4e4HulNL0DY78adsligL4FZTNQ63bb nvrq4Vd8ACSTpc80F8EG7AKF8fYVbiYXbf4KQnhI= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2574v0jC030391 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 6 Jun 2022 23:57:00 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 6 Jun 2022 23:57:00 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Mon, 6 Jun 2022 23:57:00 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2574uxxP025473; Mon, 6 Jun 2022 23:56:59 -0500 From: Puranjay Mohan To: CC: , , , , , , , , , , , , , , Subject: [PATCH v5 3/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Tue, 7 Jun 2022 10:26:47 +0530 Message-ID: <20220607045650.4999-4-p-mohan@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220607045650.4999-1-p-mohan@ti.com> References: <20220607045650.4999-1-p-mohan@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Suman Anna The PRU remoteproc driver is not configured for 'auto-boot' by default, and allows to be booted either by in-kernel PRU client drivers or by userspace using the generic remoteproc sysfs interfaces. The sysfs interfaces should not be permitted to change the remoteproc firmwares or states when a PRU is being managed by an in-kernel client driver. Use the newly introduced remoteproc generic 'sysfs_read_only' flag to provide these restrictions by setting and clearing it appropriately during the PRU acquire and release steps. Signed-off-by: Suman Anna Co-developed-by: Grzegorz Jaszczyk Signed-off-by: Grzegorz Jaszczyk Signed-off-by: Puranjay Mohan --- drivers/remoteproc/pru_rproc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index 7a35b400287a..9fed3e0372d3 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -231,6 +231,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, } pru->client_np = np; + rproc->sysfs_read_only = true; mutex_unlock(&pru->lock); @@ -265,6 +266,7 @@ void pru_rproc_put(struct rproc *rproc) } pru->client_np = NULL; + rproc->sysfs_read_only = false; mutex_unlock(&pru->lock); put_device(&rproc->dev); -- 2.17.1 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43E0EC433EF for ; Tue, 7 Jun 2022 04:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=5oMccFd1PGXKxYpXk45b0pYh4wbjvcArQyr/bwCLoKE=; b=ScLHuuIFRZu8Gw 5kHHt/nK1qlF9kuBUn34PEvuRoJv307MEaCbI1POzmo4LjVSb5IBHaVQLmF7f5QxaDMliwgc5dlCa pB4IVPSkBcoQcIRdbdCmYGn1tPrZjg2dqAK+1ntveYZCuXAumAvqO/gMmH90uls9pDkBh4JIhBTYy Qe61DTo/KE/xfHAe3MZs9LTeZYObVXBptx3zZ/2bIqimbkZU3VzGjnlMmazt05D73mONKKygIwxE1 thN1QJ25gjniRYYAAse/4/0cuNCbOUQ9hleQzohbE+CK4dwQBlmm04qLM//YcWDIJIaHj7Iw1qkUd 9GWBS7ji3D30CzMnrTzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyRHG-004hrp-KT; Tue, 07 Jun 2022 04:57:14 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyRH5-004hlU-0T for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2022 04:57:04 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2574v0PI026471; Mon, 6 Jun 2022 23:57:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1654577820; bh=4Z/SWcBdgq7gJXZF6aYCxpS+F1uJ0waLtD4QLHJH0F4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Q3shm+6vCzVgcbYDe2xbK9YyOxSYwUt5IYFwwhRVXVRgNsu+MFAB50yupILinyoqb y5ecjWHC1UvyrsV22fPTZ6J4cSVRc2jOvtVt4e4HulNL0DY78adsligL4FZTNQ63bb nvrq4Vd8ACSTpc80F8EG7AKF8fYVbiYXbf4KQnhI= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2574v0jC030391 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 6 Jun 2022 23:57:00 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 6 Jun 2022 23:57:00 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Mon, 6 Jun 2022 23:57:00 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2574uxxP025473; Mon, 6 Jun 2022 23:56:59 -0500 From: Puranjay Mohan To: Subject: [PATCH v5 3/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Tue, 7 Jun 2022 10:26:47 +0530 Message-ID: <20220607045650.4999-4-p-mohan@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220607045650.4999-1-p-mohan@ti.com> References: <20220607045650.4999-1-p-mohan@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_215703_170595_6006B246 X-CRM114-Status: GOOD ( 11.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nm@ti.com, devicetree@vger.kernel.org, grygorii.strashko@ti.com, vigneshr@ti.com, mathieu.poirier@linaro.org, kishon@ti.com, linux-remoteproc@vger.kernel.org, bjorn.andersson@linaro.org, rogerq@kernel.org, krzysztof.kozlowski+dt@linaro.org, ssantosh@kernel.org, p-mohan@ti.com, robh@kernel.org, linux-arm-kernel@lists.infradead.org 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 From: Suman Anna The PRU remoteproc driver is not configured for 'auto-boot' by default, and allows to be booted either by in-kernel PRU client drivers or by userspace using the generic remoteproc sysfs interfaces. The sysfs interfaces should not be permitted to change the remoteproc firmwares or states when a PRU is being managed by an in-kernel client driver. Use the newly introduced remoteproc generic 'sysfs_read_only' flag to provide these restrictions by setting and clearing it appropriately during the PRU acquire and release steps. Signed-off-by: Suman Anna Co-developed-by: Grzegorz Jaszczyk Signed-off-by: Grzegorz Jaszczyk Signed-off-by: Puranjay Mohan --- drivers/remoteproc/pru_rproc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index 7a35b400287a..9fed3e0372d3 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -231,6 +231,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, } pru->client_np = np; + rproc->sysfs_read_only = true; mutex_unlock(&pru->lock); @@ -265,6 +266,7 @@ void pru_rproc_put(struct rproc *rproc) } pru->client_np = NULL; + rproc->sysfs_read_only = false; mutex_unlock(&pru->lock); put_device(&rproc->dev); -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel