Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp371930rwb; Thu, 1 Dec 2022 03:21:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf65fiL0/eSQ6MeS/ERheXMY++SqKjNQphD3rpYpLZOx9OgXMoE93VZCmKh6rT6scUzbzbPa X-Received: by 2002:a05:6402:1768:b0:463:ce05:c00e with SMTP id da8-20020a056402176800b00463ce05c00emr58838319edb.46.1669893691205; Thu, 01 Dec 2022 03:21:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669893691; cv=none; d=google.com; s=arc-20160816; b=voa2iMs8Che+jdLXFeu30pvriJpOQO/c7dMfAJuQbyYqP1b5lFjm+H+qxOBWgk2U/Z 8N2F4FGsUuofdAYW1YDM0DS5ofanSMG9XfzFCaZQWxQg3EK3Vec3H+Ll8VQGfq8h/pyM NdJw23/VT2O79l8sn0AwvY3c3a7XimxhE7sZsT4k0FQSFlxYM2lUTsDRdgTDUs5sLkQf 7ZeU9rBXa7kN3EEO1Uk7bP0P/LRxZOGRh5U7xqwlOWkzrP7Rw7MrkRq7XOSCOUpyh+Pe cBP5Zx13jSjN06KvLDdYFGBZWS1u1BOxEA1XlDzBRSWFc0agWsdcvYLoQAxcDr+775/4 qPpw== 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=oBp5cUT9dU0I3g4oUymubJ9lJnR+Uoz2QTcMUdBLxPrVZFQwAsQ1tVjgM4s7txBorT sifP3Ce9ilOTr5kEnsJls+goD3bKF3VS9CFkCKr+Nwso67iOmsJjbcKs3PxaEAGUFEml hvGt6Kqsp8JruwUmcjk2YMUfJ2exWiiCN6k01mYVZGnvXMZ5mkRncRX2D7GIcO2BS60Q A1fIflPLFnydcNkevgjtfzKZKPsMaDPYErsijEgtOFaCdqKy5jiMGJyi4kz/MgVfJMqj +UttkZn45YB48Bc70kSInHFJA5zW+qTDACR2i15cJZiW1UBhPzPodPTpYJWNDnVoFEyE +4zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cZoXN6hc; 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 x21-20020aa7d395000000b004699f3f2f6esi3143132edq.572.2022.12.01.03.21.10; Thu, 01 Dec 2022 03:21:31 -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=cZoXN6hc; 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 S231366AbiLALHg (ORCPT + 82 others); Thu, 1 Dec 2022 06:07:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230488AbiLALGU (ORCPT ); Thu, 1 Dec 2022 06:06:20 -0500 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1D6C167EB; Thu, 1 Dec 2022 03:05:29 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2B1B5ECO045870; Thu, 1 Dec 2022 05:05:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1669892714; bh=moSwcrtdc2VcL4UbDo5DFCfc4fFaFAeMJQwGjXExzgA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cZoXN6hchyuAKztoaz2qOEDTsjXislRL+8kY2MR3lkChp6tY2AWP4BWaorFUipmqf 1phMD9GTpt8PVNYWNH/ri6nBb2vla1zDOiP9kbSgprLlCW4KXqq0/sSGk8XvRPzGJr naAi2bX4akvceKxKo2bryX4chHW7bKZdSsoYYd3I= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2B1B5Ect128666 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Dec 2022 05:05:14 -0600 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Thu, 1 Dec 2022 05:05:14 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) 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 via Frontend Transport; Thu, 1 Dec 2022 05:05:14 -0600 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2B1B5EmF089028; Thu, 1 Dec 2022 05:05:14 -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 2B1B5C4N032672; Thu, 1 Dec 2022 05:05:13 -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 v10 4/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Thu, 1 Dec 2022 16:34:58 +0530 Message-ID: <20221201110500.4017889-5-danishanwar@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221201110500.4017889-1-danishanwar@ti.com> References: <20221201110500.4017889-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