Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp422686rwb; Fri, 18 Nov 2022 03:33:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XyKTpvkDU0ZMdwQSsX8bUkAvDphlr/j4z1YcytbANJttAymsgIsJl9kxlVZRqh02Hayq7 X-Received: by 2002:a05:6402:3807:b0:45c:a651:87f1 with SMTP id es7-20020a056402380700b0045ca65187f1mr5776457edb.359.1668771186134; Fri, 18 Nov 2022 03:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668771186; cv=none; d=google.com; s=arc-20160816; b=bfZThq9GtDOrE9brLk43D9hSP34XOxUnhkngkXwwVWOv0Z3mX8YA4vzzDG48b6D+S8 BnqR+oG3igrJYKgrECOEhCU0oE9F3EUAQlHxrKWrUk4y5+V/NL0FAqTWyAZj+0u+/A4m /z4opdCNdTFngsNmBSgjBbuAsFkgKHZneKNw9YmuwBaHtiwa8tPwbAMjf1iVJaJKBeXb KCD1agocuK5NnYYafrD5ts+NQSWKB05ZZ9aSM38ZIm6L0y0yzKvRgt+XzbKLysy0/ia1 kUyjc1ZJ+QkkgaLC3xwHx8VZND8cDdgzs5akancI/3LV1/vkZpB2KBdoHiGCkUwPqPg2 s2ng== 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=moSwcrtdc2VcL4UbDo5DFCfc4fFaFAeMJQwGjXExzgA=; b=vFEhCtsNK1TFWsLPl7n4u/J7no/ojoi+7rCylH06vj3CQy7S1VkDPWtkLPfo9aw5LG h6jtkissk9u4KfkPOFiTw67yT6xncRTfwBE8IetNRQIJtiVHw4+0tV7esSSYPvjElOiP 7YQ0OE0FjXYXlL2C06j6YqHGzFH7weP0flMaAWzsWO9jEhriLZG7mHoURJI8Qj2pvaku 5JQil6Hb3qYYyGYh1pHJ26kJwUydvh3K8O8jJnh7Bahr+Kd3XImqWh323R7zNjoxgn1w UmlcH+DeVx5jQt4ikyY92OfrJ6cSKeEkrpTUMaraCOCuRi336/wUqJ/eD4gd9vehYlS1 l02w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ObVNTPt8; 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 r17-20020a05640251d100b0046356ff4d4esi3171532edd.593.2022.11.18.03.32.42; Fri, 18 Nov 2022 03:33:06 -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=ObVNTPt8; 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 S235357AbiKRLVI (ORCPT + 92 others); Fri, 18 Nov 2022 06:21:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241873AbiKRLTx (ORCPT ); Fri, 18 Nov 2022 06:19:53 -0500 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 265A1140DA; Fri, 18 Nov 2022 03:19:41 -0800 (PST) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2AIBJav4117796; Fri, 18 Nov 2022 05:19:36 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1668770376; bh=moSwcrtdc2VcL4UbDo5DFCfc4fFaFAeMJQwGjXExzgA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ObVNTPt8dXCRWhnW0cDdn1zGZrcZkV+aUs1PWT1F4TttHfq0rxlWjh2Oy+F/D6K3Y CEmHk5M5yka7uFaTKMsFmHZ3EMvr+dduq7jmGfsy58YdRCJOnutHtpyYlwqfa7oeOv LuMfIleWsK1FZPsECFOv50wiNYEstiH+SFrDYJmU= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2AIBJaPV036864 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Nov 2022 05:19:36 -0600 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Fri, 18 Nov 2022 05:19:35 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE114.ent.ti.com (157.170.170.25) 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; Fri, 18 Nov 2022 05:19:36 -0600 Received: from fllv0122.itg.ti.com (fllv0122.itg.ti.com [10.247.120.72]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2AIBJZ92031341; Fri, 18 Nov 2022 05:19:35 -0600 Received: from localhost (a0501179-pc.dhcp.ti.com [10.24.69.114]) by fllv0122.itg.ti.com (8.14.7/8.14.7) with ESMTP id 2AIBJYKi029490; Fri, 18 Nov 2022 05:19:35 -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 v9 4/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Fri, 18 Nov 2022 16:49:22 +0530 Message-ID: <20221118111924.3277838-5-danishanwar@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221118111924.3277838-1-danishanwar@ti.com> References: <20221118111924.3277838-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 7d4ed39b3772..bca7550d79d2 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -228,6 +228,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); @@ -266,6 +267,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