Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2642574pxb; Mon, 18 Apr 2022 05:24:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3ejez0jBNnOD2KWzcVNNqX7RfhexLiU+5fUlUHHARqakSb4Blw4ehCQP8PLgczucnvsPe X-Received: by 2002:a05:6402:d4:b0:418:7193:da1 with SMTP id i20-20020a05640200d400b0041871930da1mr12020522edu.57.1650284695814; Mon, 18 Apr 2022 05:24:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650284695; cv=none; d=google.com; s=arc-20160816; b=TuDQOlf8Iz1/lHA11MpqvOzPwBGJRdWVpio6fzUhgazOWhBgrIWfgbfnok518Lg1Ll zvozIiCMXgZtd9QEMWm2Yo0tq+4rmqL5VgqrXmfSU8LTxSIF3RzYEO1wWg2OEG2SZXTc jCtEEsYtrTT6Sn6dB+wHwuBfgygR6sR8UFXVKvljkaFTkkBiQ4VGmxBmF225NxUEXPoG oK2IES/tSPH270N+8VztRMfmjH/PAyT5/mLSATD9dZ/ncex60AKYVGElNi2RwGk+IIF6 R0P0mqko7oEB34DU06HCrmTxxCVLYGBQq3kCYQ2Q2sO0j/TTZBQz78hpBnNKqIkxqi6R CaEQ== 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=pL8KP8q5BWLEzGfIXG9EuAUc4+eOk3cNi1ZQJz+SAYvz/fow58oGNrLiBAOapqCc11 48zyMut3V5Tv+6TolzV9BnnNLt7Qx3jcGCdwNHcWKSPJmz6j8Dw7uBS1GOimCTiA7z8q OvIZe7T2wunupQwHBI1gFfUlz2e3LRYs7A7COXCJuyk7i9A7Fb44IF4GOULiVwMrQyQ6 hRRVE8xeVu6+yE6jmYvRDSozvzgvO25wtEe76Frc9HK5jFRjlJSxYuWH4WZVmOccSow6 M1MA4yCJcicK1GxBBU3JvRP/Iy6N+HwXQE+SIoIXtDmJYJp3ptprUqarz2yZrQdrDT4l zFkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xHBFC4f7; 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 s15-20020a056402520f00b00423e004bfa0si3111857edd.473.2022.04.18.05.24.32; Mon, 18 Apr 2022 05:24:55 -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=xHBFC4f7; 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 S236010AbiDRKoh (ORCPT + 99 others); Mon, 18 Apr 2022 06:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237752AbiDRKo3 (ORCPT ); Mon, 18 Apr 2022 06:44:29 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2163915A1E; Mon, 18 Apr 2022 03:41:39 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 23IAfQJ9072649; Mon, 18 Apr 2022 05:41:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1650278486; bh=4Z/SWcBdgq7gJXZF6aYCxpS+F1uJ0waLtD4QLHJH0F4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=xHBFC4f7glaVg3zQ8o0k+8JjGwVyKWFHbDl3fEsn9D/sjoVOZdX4uptOIARe6bNqU LgBvvdO20+Wq/JjZCck9cPb/Ge2qnCsy+gGswOLVULAswFklhg/5R6sBO2LMyocu40 nu+j0mKklOyEHUDLVwU50jVoINgSIT/bVXCj40MQ= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 23IAfQVL103955 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 18 Apr 2022 05:41:26 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 18 Apr 2022 05:41:26 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE105.ent.ti.com (10.64.6.26) 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, 18 Apr 2022 05:41:26 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 23IAfPgt115435; Mon, 18 Apr 2022 05:41:26 -0500 From: Puranjay Mohan To: CC: , , , , , , , , , , , , , Subject: [PATCH v3 3/5] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Mon, 18 Apr 2022 16:11:16 +0530 Message-ID: <20220418104118.12878-4-p-mohan@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220418104118.12878-1-p-mohan@ti.com> References: <20220418104118.12878-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.0 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