From patchwork Wed Nov 16 12:16:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MD Danish Anwar X-Patchwork-Id: 21014 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp108683wru; Wed, 16 Nov 2022 04:22:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf4U0k5vzFHmBhqRq3u46GW7yBJeHY3eWusnWu8GwuGPwoQNijnKGM/otJDVpNUPpBfNl8Yx X-Received: by 2002:a17:906:5a0c:b0:7ad:86f9:14c7 with SMTP id mx12-20020a1709065a0c00b007ad86f914c7mr16936294ejc.300.1668601343795; Wed, 16 Nov 2022 04:22:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668601343; cv=none; d=google.com; s=arc-20160816; b=H/XcA2yJviAz+dr9s05zFgaF08peIG9JqQEiVJd9RNlSef0O9ny+Slo1dCiJpUU1We nHFhCAFI4vNzCxqf3nZ6t40bWbNS47wV56SH1atnWgN1tDnSp0SLDIe7TW6zBZx48jNY 65wabmjxvxzm8P9JjxqlHrWZ+LwqnWPUoR2dFvgJgGyLmsysmHqSqm3OClbXZa7t0QGU OJwZmiGt52LrPQT4dNqJIiePl2jrbwoAgejx0HixTBYuTi0eACD0LjGQXNMIdnl0Mx4M JSX7o5eY7dxr5CYjhjBqSpF727Z3tDB45FSj16mg+IUmcAHdVUI5nXg66vDBYwLl/oUO 6hAQ== 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=cLDcxht+GZb1N7QGNbVmOg3psxKJsN5LhlYIFPJxwHM=; b=yihyguW1gq4xH2BXakE8vKkWPfGKGtmc5HBvNpP/B1ogBt3WVzlKN6HKtrlDcIwJeh IbkeGxnaH0+vxLwrOk8hJO74PUWL40CjF85JhZOAm0RsF24rm6yUNXU7wpuRJHHK/P2D Xfb8g8P4+x9L9egZeKqiQtDUQdkmGzJF6NBFnR2tIhEyP3xh5aolsBVSchhC48p+FLXG bol2Df80l8GsIYbt76sr8pZ7p6EhK66fIgih8VeOGldNLr45nsnjQU9l+/CbFtr7c7NV BvcEnjhOKa+sMu74f0ruUrTdI1ynSvvV4VyblnyX4TTjh7Y0vnPBaZgAw0Oc/r45vw+1 6uCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=SiKg5Erf; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz12-20020a1709077d8c00b007707b853e46si14068635ejc.882.2022.11.16.04.21.54; Wed, 16 Nov 2022 04:22:23 -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=SiKg5Erf; 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 S233715AbiKPMTp (ORCPT + 99 others); Wed, 16 Nov 2022 07:19:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238266AbiKPMTC (ORCPT ); Wed, 16 Nov 2022 07:19:02 -0500 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C981818E36; Wed, 16 Nov 2022 04:16:55 -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 2AGCGkwR058271; Wed, 16 Nov 2022 06:16:46 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1668601006; bh=cLDcxht+GZb1N7QGNbVmOg3psxKJsN5LhlYIFPJxwHM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=SiKg5ErfBQ+amsib/kAMOuklIbJ6GDDAVx9UCpsRI2AdV2I29f+t2wwax+qxiMNU9 QHtxfWsVpjtU3ri2iUxnuALze6GhqTxNXRh2S4Y/4O8Z27jzfWJryFzdZc7FD9IOUK 9x166AjPi3hA91QCTzZcJ6D6JWLlRryxxkZCnoyk= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2AGCGkcn080326 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 16 Nov 2022 06:16:46 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Wed, 16 Nov 2022 06:16:46 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Wed, 16 Nov 2022 06:16:46 -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 2AGCGk7f080233; Wed, 16 Nov 2022 06:16:46 -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 2AGCGjmg013735; Wed, 16 Nov 2022 06:16:45 -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 v8 4/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Wed, 16 Nov 2022 17:46:32 +0530 Message-ID: <20221116121634.2901265-5-danishanwar@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221116121634.2901265-1-danishanwar@ti.com> References: <20221116121634.2901265-1-danishanwar@ti.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749655322754429974?= X-GMAIL-MSGID: =?utf-8?q?1749655322754429974?= 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. Co-developed-by: Suman Anna Co-developed-by: Grzegorz Jaszczyk Co-developed-by: Puranjay Mohan Signed-off-by: MD Danish Anwar --- 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);