Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1258922iof; Tue, 7 Jun 2022 01:48:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaInF4vmnNUYi9rHOJ01RJ9kdvqal2zTBS7VW5cJvbTEg1+YEuz6ki3JKWKF48JkDAdYIz X-Received: by 2002:a17:907:724c:b0:711:d0bc:2369 with SMTP id ds12-20020a170907724c00b00711d0bc2369mr8257220ejc.23.1654591704781; Tue, 07 Jun 2022 01:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654591704; cv=none; d=google.com; s=arc-20160816; b=HE0LEeo61ysSrHdGO4e35iGK1XPn2FoW6940CzugqJvU6xkzAa+V9YD4U2VHRR+5N2 mEyOEI9pC1G/Sai5t2M8CbWjbNp0aZ61zbuz1811vjlqIiMcPXHi62rySss8WqDEa+1o YYi7rawJ6GjmKt/Va7MbJVmaeo3dsLS7KCSivTE2qA1R1Sa/nyHWjnXZVzo2z7Goe19L ifOqTO0t4dXg8afyBdCdvnRMEgDm/32NDcUC326TPKhvrhPZW6EUrs75/xSKfj42YtOs ybLlb27eyMIPLIqKqXdVbS5BrJT1GsuzrtXianDldBIX46OF2pjfR+cdaGKs1NTPR8M9 MsEg== 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=4Z/SWcBdgq7gJXZF6aYCxpS+F1uJ0waLtD4QLHJH0F4=; b=wDYgqw1n7d8pXGz8GItyzpM36CehSt830feY0wrnV5zy/FVNGy6tLLn0WLrqnviwRX cQDPhz6UyXlJsI+6GmIEgiQlmlCXMho3IeSTwU9NghKSiW4dRdIIN3DMuwqRMwqoUNwK T3yLmsJP56WyA1km1zQOQE0GWHCAFhI3du3f/XAuECYbQNd9TIAYycuFm+2FctvXpgHn bOelPXcWNKZlYoiQ30Jh9MJe86oLx+PsIST5rut5RNmSuiVi922KDOHICdFMcTgUmuMT jH+LZYtS2UTE+oLbL8mbJwWwkiii4rchTo+6oSIwTcKXL7T/aYwQ2wywJBFykhjejFgB hZEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Q3shm+6v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g22-20020a056402425600b0042ad03b5aacsi238349edb.5.2022.06.07.01.47.57; Tue, 07 Jun 2022 01:48:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Q3shm+6v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236651AbiFGE5L (ORCPT + 99 others); Tue, 7 Jun 2022 00:57:11 -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 X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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