Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3631558rwi; Wed, 12 Oct 2022 04:59:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tozwXeWyYg2tyO22eRiXtrijdaPf+FxkTviRzMEDqtCLAQRSuWUEhLZaDMZEloXXsLZpe X-Received: by 2002:a17:907:2c6a:b0:78d:caaa:27a8 with SMTP id ib10-20020a1709072c6a00b0078dcaaa27a8mr9900681ejc.79.1665575960354; Wed, 12 Oct 2022 04:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665575960; cv=none; d=google.com; s=arc-20160816; b=lYqSOvi81R5daB59MOh147SbIp7Nz0RcdDbB/YMqsQO4DtOUFsnncZLHK3flUAQNcq MDREzl4mJZr9zlxEO1UHh7g0j2vPfsCFSfoSHrs/teMOkhf0IX0BpMN3ZuRH5JVoLRRD c0mo2q3MGeyRCX4GNF27wc9S83mHb+0WpBH1D68XbuGdg2a2nRWEmMO6KDquBrMKeCWh 8PrrqnoFNo9Oq2QpHv71RdIeq8DH9ghxaOXRVyo20QyCAycqSBQHTfO6fNhQaK2/oyqa 9KrW1f/zSKH2UR4TzD0yhHuj1BEOWEtZ8j0A1Ky2W83uTbBVbvmDJdgJXm0JDukk/kYg QSMA== 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=yb+wllWXYHpBAf4tOvDRmqYvaCVAmTGz0kbExvDUBMyj7HGnP99whdvDacHdtE3SEK eBECpHF0hH30nShMDp3MwCbqoTein08tmeUzjZM1ib7JqnM/fo391It5Yx4xz3t6nMlU H7N3SnR1YBwlnVLlkjKK3tPxsXIhPYWGbP+ig9rWZbLrLDlX23bqZsl41tOSIuUnpj4l WW56Byao+LJfwiJWYRlhRSbngxRO3WDZWe5qtBfAmX8VnKfQ38WCU2ttW9lzsNuhNrwv gH+u4GDHqB31UIfHp2F59w5Gnv/einVbKmah8whRZ+AxSVGQyNvXf34b0SnPZpvPlM3/ zwBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=IA5app1b; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a0564021e8b00b0044e6b43f044si18981585edf.267.2022.10.12.04.58.53; Wed, 12 Oct 2022 04:59: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=IA5app1b; 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 S229751AbiJLLp1 (ORCPT + 99 others); Wed, 12 Oct 2022 07:45:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbiJLLpJ (ORCPT ); Wed, 12 Oct 2022 07:45:09 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F6051C10C; Wed, 12 Oct 2022 04:45:01 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 29CBimtb014711; Wed, 12 Oct 2022 06:44:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1665575088; bh=zosTV+337dxVZj5RGDxl0uQj3sayrhu56Dfv762qcZU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IA5app1bRcuQsZrJ5iDlOFrTROG7x9AyEohdD/B8PuWvKfTbXWEi2fAZNSFjpOmZc hGZi2jxpe2q2vwhDlSqCSs+pIUV1s9u2yvq8N5X/lvo865LoolDneQFHAdRqXOeq35 +HROOHpSJvPIZdn6v4oAvoQdpN+p9cgj72TGwuSE= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 29CBimNK115958 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Oct 2022 06:44:48 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Wed, 12 Oct 2022 06:44:48 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE102.ent.ti.com (10.64.6.23) 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, 12 Oct 2022 06:44:48 -0500 Received: from fllv0122.itg.ti.com (fllv0122.itg.ti.com [10.247.120.72]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 29CBimMV001099; Wed, 12 Oct 2022 06:44:48 -0500 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 29CBikgt003356; Wed, 12 Oct 2022 06:44:47 -0500 From: MD Danish Anwar To: Bjorn Andersson , Mathieu Poirier , Krzysztof Kozlowski CC: Suman Anna , Roger Quadros , , , , , , , , MD Danish Anwar , Grzegorz Jaszczyk , Puranjay Mohan Subject: [PATCH v6 3/5] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Date: Wed, 12 Oct 2022 17:14:27 +0530 Message-ID: <20221012114429.2341215-4-danishanwar@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221012114429.2341215-1-danishanwar@ti.com> References: <20221012114429.2341215-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=-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 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 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); -- 2.25.1