Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1096495pxb; Wed, 6 Apr 2022 08:37:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0Rs7B716hcFEmUegh7p1O2tmOfNjDgguvKBvtmo3tKdGZWN7x40aRuk9z6u9ak7bkVAC0 X-Received: by 2002:a05:6870:4727:b0:e2:434:6f58 with SMTP id b39-20020a056870472700b000e204346f58mr3984829oaq.259.1649259465772; Wed, 06 Apr 2022 08:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649259465; cv=none; d=google.com; s=arc-20160816; b=YyxI1iUDml8wbKqKh54Uo3OAx3s7fzFUMtu4N++62R9pNtXY1vOwk2Wcx0JSxks30O tdqi6/MI6IFuQ0GVrOeOpEwVkAQZYqpzyPsK+YHc4v1C9fL0EkaPJCWzka2oU1AiLqmo 0CzsgfoFiywO+3bCZSCmdBADsTav+gANeBoAaPMkXBIvKW/YwkfK3xDu2INSwbx3KtMZ hLYqunGnRC2w1TDBzXcUKqnbz1bSa1iI3HNob5L5dt9r0L2aEAF7iU7zsuMWTDFoVeTu xPEA4/+6pHMkelYyFlPSsWKz9jkzwnsT0rmSdgTyZl+NjwZOMyDyso2ch0mbzgoDdGks xMag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4Z/SWcBdgq7gJXZF6aYCxpS+F1uJ0waLtD4QLHJH0F4=; b=kLIrvZKbl8KEidQo4lq2XNDQIS/epPlbNRBGI3I3nBfsN2FohTMqf8w6PTI6nc8FPR 6IwGxwLMWK8upBomabUTLK+x3UGAUNFOu2zLidYAkYwGGoX4VqDp57FnmyJewH8LimMF mdw2dPudzT0FeyuW7rnNiuS6Hu4nxzzmlilVhDMpqiTxnYy7cGPN1ka9P6nI58FT+Iz9 ggiSKU34nDP/uQfWpfVzEQe2nh+rHn9kUCSjmZUqsLdBRrVdiFel4n20WGHbDpVTNMNv o7QyGF0xm1CL02Ei/dSHjrNlC2nb7BTkW+QK9RwyPlqe5QQSVlBLlQzw/HyTLGzDAOwd WguA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qzDoZRJG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w78-20020aca3051000000b002ef0c347603si9094965oiw.131.2022.04.06.08.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 08:37:45 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qzDoZRJG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D181921D7C0; Wed, 6 Apr 2022 06:51:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234097AbiDFNxL (ORCPT + 99 others); Wed, 6 Apr 2022 09:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234434AbiDFNwv (ORCPT ); Wed, 6 Apr 2022 09:52:51 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0DF57A89E; Wed, 6 Apr 2022 04:40:26 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2369iAKI124025; Wed, 6 Apr 2022 04:44:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1649238250; bh=4Z/SWcBdgq7gJXZF6aYCxpS+F1uJ0waLtD4QLHJH0F4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qzDoZRJGYv4ZT2wUdA1kWyW0e7Cd2oVKOZwUtvd4g2dpM7HWa0DsG6FiMyRytmQyf UYyQoh3tJKe5hespHNrqNkbNByZC2pEUOC2Arw8qqIO1sylO0ytm+q8MsDl6s/2r+o muZ++ndTfBNz3sBmoC+Z57XILV6anPN1xD7ZNW+g= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2369iAJ6069701 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 6 Apr 2022 04:44:10 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Wed, 6 Apr 2022 04:44:10 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Wed, 6 Apr 2022 04:44:10 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2369i86x107588; Wed, 6 Apr 2022 04:44:09 -0500 From: Puranjay Mohan To: CC: , , , , , , , , , , , , , , Subject: [RFC 03/13] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Wed, 6 Apr 2022 15:13:48 +0530 Message-ID: <20220406094358.7895-4-p-mohan@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220406094358.7895-1-p-mohan@ti.com> References: <20220406094358.7895-1-p-mohan@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Co-developed-by: Grzegorz Jaszczyk Signed-off-by: Grzegorz Jaszczyk Signed-off-by: Puranjay Mohan --- 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 7a35b400287a..9fed3e0372d3 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -231,6 +231,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); @@ -265,6 +266,7 @@ void pru_rproc_put(struct rproc *rproc) } pru->client_np = NULL; + rproc->sysfs_read_only = false; mutex_unlock(&pru->lock); put_device(&rproc->dev); -- 2.17.1