Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp61261iof; Sun, 5 Jun 2022 21:08:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxACRex+XksA3s+Y+BU/8rRjCsusNAjP0FhLd0FQguX6sQ/7PzX0AxCUCELmzIBMEcTlnxA X-Received: by 2002:a17:90a:7381:b0:1e2:ff0f:df07 with SMTP id j1-20020a17090a738100b001e2ff0fdf07mr24619039pjg.160.1654488507081; Sun, 05 Jun 2022 21:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654488507; cv=none; d=google.com; s=arc-20160816; b=aQk8t0EQUhnBA07bAECc4/+H6pc89hxJDLQxj5BbnlIuenzNPXl4lDZSVtghkJTdMY kreOYyxsxV8SUyFqLwuU+72FvI0FeRLkT7PIFGFTgoHbW1pJKNmlVP6CeKo/6jvxcFX7 dru/at0al4Tae5x4dWWVhcvlVxLgADhJzHsNRPeeBnaN7Thsq3W3lR9+jLpD7jj4wvlX /V9ABHS+G6Bc8XtrMb4Ndjxr2V4m+yqqPkPsPNm0FqTDgf6UkcQdYml/rK3BoZ89mQL8 01PurCx3NvMfy/HbfsjgJUZqbHNHE+SI8UOYrDKbKocqIDfa2U9EDt0UIhuPsw44ieMX uAgA== 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=SgziN80QKT/6ZTdY+jXMFBLux/lKmu7Xgdvgx86XEoE2iLkEPiW+1cSDpRW6cTrzGM /VWGT+57PYocdaUpxaY+cp1/lGeYvrKMdj8mHevE4x2KFH5+L3SmJ2W289fFBE3EPtj3 ikXE9s9ulqyz0/d1FW9YBWPVLPt6lw04H/ExktL/Hi484AV7PWkhTth46j7me8itROM/ fdQGBlQY4sqLXLctR6cHWkvuWCu/XsLbBQ0/WXkRaxdt94JdYVZ5sBohg6t+OsKEnnxi shdR626g8rsF6dUJ+MePojB/10hI4V7prl18BHu8o4tlAMjOxVnKubDW7ukufE+IDTVN hOFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="urgzThK/"; 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 g126-20020a636b84000000b003fd55609127si9450303pgc.524.2022.06.05.21.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:08:27 -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="urgzThK/"; 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 5A7006B093; Sun, 5 Jun 2022 20:48:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244194AbiFCMPj (ORCPT + 99 others); Fri, 3 Jun 2022 08:15:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240041AbiFCMPh (ORCPT ); Fri, 3 Jun 2022 08:15:37 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 576B839826; Fri, 3 Jun 2022 05:15:36 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 253CFTTv122110; Fri, 3 Jun 2022 07:15:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1654258529; bh=4Z/SWcBdgq7gJXZF6aYCxpS+F1uJ0waLtD4QLHJH0F4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=urgzThK/GESeFMPn7ZrCMnYHvnkLI2lYcjjgxk43IXIXOm1QmwyIMEz2DhdcuQAMc XPyfWD8bNAEkvg5/XJ35pbBNXkxIfolsN/NNmx/JW71pQJ0Llt+N/ugvPjmcdzYFiT CH16CA2x94OrfNVEPmbwgPruulFGVinceDaAfIMs= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 253CFTiM031421 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Jun 2022 07:15:29 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Fri, 3 Jun 2022 07:15:28 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE115.ent.ti.com (10.64.6.36) 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; Fri, 3 Jun 2022 07:15:28 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 253CFRMM025776; Fri, 3 Jun 2022 07:15:28 -0500 From: Puranjay Mohan To: CC: , , , , , , , , , , , , , , Subject: [PATCH v4 3/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Fri, 3 Jun 2022 17:45:17 +0530 Message-ID: <20220603121520.13730-4-p-mohan@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220603121520.13730-1-p-mohan@ti.com> References: <20220603121520.13730-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=-3.1 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=unavailable 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