Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2260169rwl; Fri, 6 Jan 2023 04:13:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXuCQ7wsWJ5IM9kNqsMKj1O2A+5dxSojMQupB5iKqruR2B8npqfn61QOJrNiWEKSRcmTqngG X-Received: by 2002:a17:902:e845:b0:189:fd83:eb80 with SMTP id t5-20020a170902e84500b00189fd83eb80mr78740041plg.62.1673007232543; Fri, 06 Jan 2023 04:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673007232; cv=none; d=google.com; s=arc-20160816; b=ckfDfgdhPc1zQcKjYWQjePqnGxZN6AswYRaV8zU4/H4Er5a2ECkLiC3CtlWvHSKi1Z gvsbnqmVX72W9mLQML2G17YizphCuvqOl4B07QPVqtre9TjvqUHjKkoVZfIXom8hkJqZ ARourQPg3dmbJn/F965FJk8t0wclQAEAtomAqdll3gVaxGuYjbhBnzqZoaYTlWfz/mVK xFFOgQSxf/q91TbqCi/W8iktdC70/aq0RJsVxNuWdO9rhn33X2tHFOzY69X5a6bXWGWP fG/JNmtvNUV6F+SZqvRbHaS8F1petRbWTA2oqB5UuX4IA4sjuWzg4IsrFGkYR78ef+IT n1zg== 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=nfQx8l/CZDGe5fseL6BugjP9ZU7esGK81kOQzHFYf38=; b=fQqMpbFZzncF6KiHTMFWccRKjTWpQFeArWFX9b0mXE9HZHNcTrabzRg7zhROXuAbVC WQMbRQopPF7n2K9Tbfrj10nAeklHhQksNYYHZoewHdSrZfq/aFYVV+SqILqPQ7o3vzLn 8LCHVH8LQUqHRC+zYM2BBPreEW6MbzOezdW1lM5UHU7H+jBjHJjPhPV+RM7R5UbuS8bc 0ThsaqLq6w8uJ1Mtfv07Skv1UHCLhS71qJvzmgYP9bVqZlBEhv4Ra00Xu5aa40pOgAZa 18PpIml8eDgz86FD4kXvTJ0hRqjvl0goRBvQ+MRBMKhbjD5RvNqJAgjYEsXnAbx459qp 3f8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=a7J36rxN; 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 142-20020a630394000000b004774a855372si1275642pgd.694.2023.01.06.04.13.45; Fri, 06 Jan 2023 04:13:52 -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=a7J36rxN; 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 S233697AbjAFMLe (ORCPT + 54 others); Fri, 6 Jan 2023 07:11:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232784AbjAFMLO (ORCPT ); Fri, 6 Jan 2023 07:11:14 -0500 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DF2D736C8; Fri, 6 Jan 2023 04:11:11 -0800 (PST) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 306CAxZA099602; Fri, 6 Jan 2023 06:10:59 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1673007059; bh=nfQx8l/CZDGe5fseL6BugjP9ZU7esGK81kOQzHFYf38=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=a7J36rxNaTJI26FNNhvWQ3q78sm+erReqsTUBNDBdKQd7DO+Aq9blEwpIQHPpk30K JJ4ICFIU29sY3v45/1BtciLu7IZajQXOyhIIyZGbdW7f6q7YjJ0agmVHrGRfkBuKvC Qfwk/jREjFz7vXCgjvze/BXXz3D8nx3texGU47OE= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 306CAx8I089056 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 6 Jan 2023 06:10:59 -0600 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Fri, 6 Jan 2023 06:10:58 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE106.ent.ti.com (157.170.170.36) 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, 6 Jan 2023 06:10:58 -0600 Received: from fllv0122.itg.ti.com (fllv0122.itg.ti.com [10.247.120.72]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 306CAwGP097078; Fri, 6 Jan 2023 06:10:58 -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 306CAvmj028616; Fri, 6 Jan 2023 06:10:58 -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 v14 4/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Fri, 6 Jan 2023 17:40:44 +0530 Message-ID: <20230106121046.886863-5-danishanwar@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230106121046.886863-1-danishanwar@ti.com> References: <20230106121046.886863-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 1036bfd446b6..c16242e2d435 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