Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp585610rwl; Thu, 5 Jan 2023 01:27:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXso/sL2AGZ85BcZt+zjv3SkllUJyyCPxDKdHBjdXaaZGUWe9ev+oVG8WapKO7LWNtrE1GRz X-Received: by 2002:a17:90b:238d:b0:225:cc25:8037 with SMTP id mr13-20020a17090b238d00b00225cc258037mr46769824pjb.31.1672910835557; Thu, 05 Jan 2023 01:27:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672910835; cv=none; d=google.com; s=arc-20160816; b=Fgnwj2XAhCnl8SjPAZD495vD3DYNc8yfOIPUgwolP8c29i+9d9skhVj9QN7s1icy2Z mowvTq4zAtH6YRTaeXYpG1zbIrJN96TrfqfhEV3W0/Cc9FDL7mytaQ9TYBs/59flc2jG gye/tS7LQzmtkt3AMtJOTuBBZ9fZTESzn+dKSFgevp1G/nCGu+FEiBSypS819OoIPO3A GAcOStAjHcAr/a80C48YsQVCKFzPojHDDLF1Zreo/AmgT56QtXJ4qtsNo934d+yKv2mv 4fMuu5gONm1oTdzSC+DA6rmGsGnJ5PD+CNC9k4b9XEQFQdzEMTael4hqh8P/hftYfEF/ kx5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3CVAF0YUIn9kWZnuCfApdgCPhBQWukCJOKb27YrfUWI=; b=oX0dxPRP7jDaYrTTBYAsQZJvm+5Tt7niS9L/r5XxSy8L64QrP0CKXlAipwKI/clhYv V9i8UM8J6oU+QSVTjhjt0Wgua0NPu96cY0F/gggHsB0RIHyHHRrz6vRGkTOZJA8j2Zcu G4o9BgI00/In/6RJf0Y+9w2OC/LKxGAnZnIHd4I8dNpWGrQghCab15+o8k8j7onfINuo ABmv10sSrV0R7pgLAA3jtA51gejGQ77pL8J53+786XO/sjEn7JAoNeUmmhdCy6HeqLZf Thg/7oGkOn1IJ/tS4mAJsCin3/pzqTNCKs8i7vFe7SzqdNAnsng/3VaL0+rWAXOyGZem vIyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=OhHicPVQ; 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 hg14-20020a17090b300e00b001fb706e96afsi1253513pjb.182.2023.01.05.01.27.08; Thu, 05 Jan 2023 01:27:15 -0800 (PST) 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=OhHicPVQ; 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 S232230AbjAEJWc (ORCPT + 55 others); Thu, 5 Jan 2023 04:22:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232091AbjAEJWO (ORCPT ); Thu, 5 Jan 2023 04:22:14 -0500 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65B6D54701; Thu, 5 Jan 2023 01:22:13 -0800 (PST) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3059M2oD027107; Thu, 5 Jan 2023 03:22:02 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1672910522; bh=3CVAF0YUIn9kWZnuCfApdgCPhBQWukCJOKb27YrfUWI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OhHicPVQZca+/1ujj5hHzR46y+PqDf9b54wOzt6U6gfnnZVvIkC5RHJ9Uyh9Sw/Wr nVHFQp/U0YYvcN9pMYpljPvssITtlaoLsNZOjty9vYZel26zZuWHH+TQIhk2xQE4s2 n6mM36wWnQuy7i9mac5q9GoLDte4soRqIfVIYbIU= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3059M2BF025528 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 5 Jan 2023 03:22:02 -0600 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Thu, 5 Jan 2023 03:22:02 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Thu, 5 Jan 2023 03:22:02 -0600 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3059M1oU063030; Thu, 5 Jan 2023 03:22:01 -0600 Received: from localhost (a0501179-pc.dhcp.ti.com [10.24.69.114]) by lelv0854.itg.ti.com (8.14.7/8.14.7) with ESMTP id 3059M07e018146; Thu, 5 Jan 2023 03:22:01 -0600 From: MD Danish Anwar To: Mathieu Poirier , Krzysztof Kozlowski , Rob Herring CC: Suman Anna , Roger Quadros , "Andrew F . Davis" , , , , , , , , MD Danish Anwar Subject: [PATCH v13 4/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Thu, 5 Jan 2023 14:51:47 +0530 Message-ID: <20230105092149.686201-5-danishanwar@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105092149.686201-1-danishanwar@ti.com> References: <20230105092149.686201-1-danishanwar@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 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 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 Signed-off-by: Grzegorz Jaszczyk Signed-off-by: MD Danish Anwar Reviewed-by: Roger Quadros --- 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 fe4ca1584e91..8e2fbe392ef3 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -223,6 +223,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); @@ -261,6 +262,7 @@ void pru_rproc_put(struct rproc *rproc) } pru->client_np = NULL; + rproc->sysfs_read_only = false; mutex_unlock(&pru->lock); rproc_put(rproc); -- 2.25.1