Message ID | 20221031073801.130541-4-danishanwar@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2165700wru; Mon, 31 Oct 2022 00:41:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JuePmW4FaO7kLYCNK6AOSmPgjPw3b/fPnFPEGr/FimIT6yoK7UVA731tHs2u4VWSGf9Jp X-Received: by 2002:a17:906:db02:b0:780:24e:cf9 with SMTP id xj2-20020a170906db0200b00780024e0cf9mr11383487ejb.460.1667202080599; Mon, 31 Oct 2022 00:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667202080; cv=none; d=google.com; s=arc-20160816; b=duJarIxCeg0SDrIHNm3NLuXNPrw7LnvMlrqWrftNDdIYltHUax6NbgJeS3j/j+Bcuo yFofpfQsaEzrIn8vpgSiDmZGxj/XucTOA8jybCOOYkGqyINl8cfAYiSCywGXFU2T6nc2 4eI6Dv+R+fGT7bCX+IkoxBJIFn3cVIuEac8yNcCCpWeP31G0PPQ/dtCJ1Qj6GEL8grco os0wh+8D+G8hp9OiIjs4rotTqG/mh+1V1gHy6u0dddZqzcoFk3VZrGgNMkkWXbZPJB9a C0nwX2IEXulHyssmdGb1pqiEqxcpNaMsJR7TVGWck8FLwmK2X0gDJ4Sk0wrxsHFVE/DG ycvw== 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=zosTV+337dxVZj5RGDxl0uQj3sayrhu56Dfv762qcZU=; b=rPt7RBW9NFfy9rXYgsHCUEsuiE9QeMKhMiWqML5a+/u6JCfJ3nd8dAnsfgOnqsIqV7 S+WHYc+OvVHvg6OwFiHUV80r2mEyQ0pAITf6l8hu59yRyTFaTVX4D2aDfG1MyKljijYJ lBX4kBHV126J+kzSuBDk4DZWralVCuuKdd2bPXgfJ+b1Q0nfus6lJnsPPMAFiREktAG/ lH0IMkAHryVqzNd/rZrCJfw29iL/rNCWtOhTG0brgyJVR3DFj0LTU19V5zBLXNilbI75 L5aOoZOUWtJWhwgSHGp+Chip0uLK75KthD1I5FybA5/r2dQR37unoZHYyVQTmHSzMq+D SMiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=b45HS78K; 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 du10-20020a17090772ca00b0073d751c96adsi7142301ejc.1000.2022.10.31.00.40.55; Mon, 31 Oct 2022 00:41:20 -0700 (PDT) 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=b45HS78K; 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 S229730AbiJaHiZ (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Mon, 31 Oct 2022 03:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbiJaHiV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 31 Oct 2022 03:38:21 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9704224; Mon, 31 Oct 2022 00:38:20 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 29V7cEAu028748; Mon, 31 Oct 2022 02:38:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1667201894; bh=zosTV+337dxVZj5RGDxl0uQj3sayrhu56Dfv762qcZU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=b45HS78KPFeIK5v0JLW7SgdPo0J1AVC81np1nT/xRrYiyV6jp8HnoPbvzLmACDryp qR6P1fgBZ4Dtyvwq4hGfmgTctQip9RNle4Xhx2iCwoOozpxhPgoQ8wNmd2zu8jr5VH 377haweHYJDNWkdbMfveQPdYX7j4a2QydeujS64I= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 29V7cEPj000624 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 31 Oct 2022 02:38:14 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Mon, 31 Oct 2022 02:38:13 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE102.ent.ti.com (157.170.170.32) 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; Mon, 31 Oct 2022 02:38:13 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 29V7cDva016253; Mon, 31 Oct 2022 02:38:13 -0500 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 29V7cB5X012833; Mon, 31 Oct 2022 02:38:12 -0500 From: MD Danish Anwar <danishanwar@ti.com> To: Mathieu Poirier <mathieu.poirier@linaro.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Rob Herring <robh+dt@kernel.org> CC: Suman Anna <s-anna@ti.com>, Roger Quadros <rogerq@kernel.org>, "Andrew F . Davis" <afd@ti.com>, <nm@ti.com>, <vigneshr@ti.com>, <srk@ti.com>, <linux-remoteproc@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, MD Danish Anwar <danishanwar@ti.com> Subject: [PATCH v7 3/5] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Mon, 31 Oct 2022 13:07:59 +0530 Message-ID: <20221031073801.130541-4-danishanwar@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031073801.130541-1-danishanwar@ti.com> References: <20221031073801.130541-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=-5.5 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748188088699404581?= X-GMAIL-MSGID: =?utf-8?q?1748188088699404581?= |
Series |
Introduce PRU remoteproc consumer API
|
|
Commit Message
MD Danish Anwar
Oct. 31, 2022, 7:37 a.m. UTC
From: Suman Anna <s-anna@ti.com> 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 <s-anna@ti.com> Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org> Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org> Signed-off-by: Puranjay Mohan <p-mohan@ti.com> --- drivers/remoteproc/pru_rproc.c | 2 ++ 1 file changed, 2 insertions(+)
Comments
On 31/10/2022 09:37, MD Danish Anwar wrote: > From: Suman Anna <s-anna@ti.com> > > 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 <s-anna@ti.com> > Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org> > Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org> > Signed-off-by: Puranjay Mohan <p-mohan@ti.com> Reviewed-by: Roger Quadros <rogerq@kernel.org> > --- > 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 9ba73cfc29e2..14eb27bb5f3f 100644 > --- a/drivers/remoteproc/pru_rproc.c > +++ b/drivers/remoteproc/pru_rproc.c > @@ -230,6 +230,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); > > @@ -268,6 +269,7 @@ void pru_rproc_put(struct rproc *rproc) > } > > pru->client_np = NULL; > + rproc->sysfs_read_only = false; > mutex_unlock(&pru->lock); > > rproc_put(rproc);
diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index 9ba73cfc29e2..14eb27bb5f3f 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -230,6 +230,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); @@ -268,6 +269,7 @@ void pru_rproc_put(struct rproc *rproc) } pru->client_np = NULL; + rproc->sysfs_read_only = false; mutex_unlock(&pru->lock); rproc_put(rproc);