From patchwork Thu Jan 5 09:21:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MD Danish Anwar X-Patchwork-Id: 13090404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A67D1C4708E for ; Thu, 5 Jan 2023 19:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cTZ0Jwv+1SK40rOusM9evam/rOITogIURY69cCDLGdw=; b=cdFCMKAktxIqze 7/eXsWu4K1X78cpjwTUCcQz4HqXYEx4Xiy7MCW4ArLjnFz/WjT3R858rbNz2tlHAX+bkq0z8OPREg RFzIT+SqL+ZNIWi/LeNQ1+ZjvGwOmy6ZcmVeftXXBxP4NfEUKkdgS6+wEoawKQBClPfdD6j0mukPy C8EuxwsneiL3PDbjQt52BF5mA8YKvU95mzzaAA+KEy6MROlY6YXkj2WUVarty6FUka/9Z5lN+0/6R y8i6g/T63L5onE0G5P/hemWaN5cMKgHqtNdJDNCTs30pcyzDwsfazosh8qUKXQjl2o8I44gHp/nPA rHDZ8ffmY/qMOzEm00nA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDWFJ-00EFlj-OK; Thu, 05 Jan 2023 19:49:50 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDMRt-009UJy-GZ for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 09:22:12 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3059M2oD027107; Thu, 5 Jan 2023 03:22:02 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1672910522; bh=3CVAF0YUIn9kWZnuCfApdgCPhBQWukCJOKb27YrfUWI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OhHicPVQZca+/1ujj5hHzR46y+PqDf9b54wOzt6U6gfnnZVvIkC5RHJ9Uyh9Sw/Wr nVHFQp/U0YYvcN9pMYpljPvssITtlaoLsNZOjty9vYZel26zZuWHH+TQIhk2xQE4s2 n6mM36wWnQuy7i9mac5q9GoLDte4soRqIfVIYbIU= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3059M2BF025528 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 5 Jan 2023 03:22:02 -0600 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Thu, 5 Jan 2023 03:22:02 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE111.ent.ti.com (10.64.6.32) 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; Thu, 5 Jan 2023 03:22:02 -0600 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3059M1oU063030; Thu, 5 Jan 2023 03:22:01 -0600 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 3059M07e018146; Thu, 5 Jan 2023 03:22:01 -0600 From: MD Danish Anwar To: Mathieu Poirier , Krzysztof Kozlowski , Rob Herring Subject: [PATCH v13 4/6] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Thu, 5 Jan 2023 14:51:47 +0530 Message-ID: <20230105092149.686201-5-danishanwar@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105092149.686201-1-danishanwar@ti.com> References: <20230105092149.686201-1-danishanwar@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_012209_824370_67C595FC X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nm@ti.com, srk@ti.com, vigneshr@ti.com, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, MD Danish Anwar , "Andrew F . Davis" , Roger Quadros , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 fe4ca1584e91..8e2fbe392ef3 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);