Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2223570rwb; Thu, 15 Dec 2022 22:09:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Sr8DcnC0KkIxbCtjR2N/wWEKzbo9n8lWD8qGRLvkuEX7EinL1WHSsR/HsY6zcgmjaP7Np X-Received: by 2002:a17:907:2458:b0:7c1:1e5a:ed10 with SMTP id yw24-20020a170907245800b007c11e5aed10mr41408628ejb.8.1671170948665; Thu, 15 Dec 2022 22:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671170948; cv=none; d=google.com; s=arc-20160816; b=u5+sb9ziZSVVgnLW+Nwr/z8mVGYgNwI8HedqVQ8ZouVLmkbubRAZDgiEYd29LfOGF+ Smer7lQmniPyyJ9MGPrd7pj4W0rlqxDpAUTydkwUYyiz4yEg3kNN8Y2WQvtXV76Sgf6Q PH5YjUvCtA9A9j87mOcW9ZStotQ2Mtrst1rWkmbduvKYY2Q42o7l9ABdJXweQ2Ibdz4R gYOka4A+I8oFv7Ez7F66SPXL/B/k2F1tjOg+hBAsXzzXEFJd+3JeSbLUxSAgE33v9FbH Gab1C0P7QXoI7vMsMTK6++c+IIllMBTFbcPbyGp9R85JnMRkR7Mf+ogBD6zAVwUnYAx2 aJPA== 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=T3gPnMZKmx0S4/1qKgpqecy34urdcsdVGYw5yyb/MZ/ou1LdYK7i9SWSee4hEinh8y eudWSU7rgf5u1c8DuWif0hsC2kQMJZFq+sxX1oaEVHHZd54+jROl1gGFSGN2Y7/+b4ew prO3CgpRxzmMSbYLR0APiWZ2VcN5btl4c7wmrfr/1UmOEJvt1/m0nFyA07h4E6GCqibk wR377RRTiCPFZker1kblIsU07oJtHTmGLQIqkd0VOG935DcunYPfxNV83n+Dj8FiJJLK 0zDm6zfkEmY6sGrCrnp7SkMDPum3hsRPu8W/fdN9muv2DtPjNd7h8Xr64VDmfT0zRLV+ cFUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=kqFeiR7i; 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 f11-20020a170906084b00b007bf8440bc14si1101657ejd.784.2022.12.15.22.08.52; Thu, 15 Dec 2022 22:09:08 -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=kqFeiR7i; 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 S229988AbiLPFeE (ORCPT + 68 others); Fri, 16 Dec 2022 00:34:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbiLPFdn (ORCPT ); Fri, 16 Dec 2022 00:33:43 -0500 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C397C554C4; Thu, 15 Dec 2022 21:33:42 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2BG5XOc9019021; Thu, 15 Dec 2022 23:33:24 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1671168804; bh=3CVAF0YUIn9kWZnuCfApdgCPhBQWukCJOKb27YrfUWI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kqFeiR7ionueMlNqu978/NMU0Ep773zU9XA25nodpOl4fk5cKht7BR1AckVpTvGIG ylzmCJiCkQwEnRRtAPeDceIF4ppOhmgm0mhGFm7hJmT/JIhxdcdfVW1g9aVt4rNZI5 uOM130D/oQ0xa25g/LH5WaTvsYd+BDF/Ot5VgxAk= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2BG5XOFD112971 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Dec 2022 23:33:24 -0600 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Thu, 15 Dec 2022 23:33:24 -0600 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.2507.16 via Frontend Transport; Thu, 15 Dec 2022 23:33:24 -0600 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2BG5XOOC074190; Thu, 15 Dec 2022 23:33:24 -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 2BG5XNAv008934; Thu, 15 Dec 2022 23:33:24 -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 v12 4/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Fri, 16 Dec 2022 11:03:11 +0530 Message-ID: <20221216053313.2974826-5-danishanwar@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221216053313.2974826-1-danishanwar@ti.com> References: <20221216053313.2974826-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