Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1255748rwb; Fri, 13 Jan 2023 09:46:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXsVj8+tJoyXN/J8bHuP1IXC5YwrJHTDyof1oRMBhMEnJxKZ1ANnUtFroQmmObouCfFOq4CV X-Received: by 2002:a05:6a20:1455:b0:af:e13e:cd67 with SMTP id a21-20020a056a20145500b000afe13ecd67mr121603537pzi.6.1673631968748; Fri, 13 Jan 2023 09:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673631968; cv=none; d=google.com; s=arc-20160816; b=qMej3DbEnlVMj7pdcmW3RBZjfqBg9RE/yfANykRdkkxgMLOijdM7U/hAAKPD9w/7jg bZVCF8nTt62bq502Crx6yWd4FOC6lzxcZRv1RI57jV0x14scqVSwL2a0vmLWcTBA9X4D us1Y/wSobVLwbwULomXLA1y5b9qZkiLSEeUOGUrNpxvW2QmoUBpxUvXHnHRufglPvVJ3 ab6jslZziF3jgyrXcH0gE5wZ354ZSftIMXy63DQX6bKld1ybDe87zPgtRN8wqIkPzG8D /PjxUnVDKtXTiJ9zllg28hghqGvFzzTjtKpK6F42/2d9i6E1IUy392eoIXY2nR0bZthc 44Ew== 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=YasRH7EfjqvX/On4k0TlHJ81hcDgJrbWEwCQC+5rSzM=; b=UQ66SQEfwgMxeo4ffexhKYdekYvlHj6KW9n7B5/vNQ+MydVC9cUVjKl+fVeMjTu2M7 lvLDZ4kL/yU8nH+MH5xLzxUVwlWYbBxKUg8WvYRyuJsZqfiKRCx4jx6d8/4j87MMfqB4 16zucfee2wO/ApDYxkOEPO078TPMI4Sds3J6H9IGFJKQL40I7jzu5GQtVTTobzNJPDsT ArHCW8wewIXMF6G+lNmU0QF0hyVfxtDK2HAKkjVjJsVeZWn+ZMjV7BtDOOi6BvS3RjAj VCFxtQfG17Se4cT4eA2SKIZgFJ5uvq83zYn/b5AvpSEQoT+5jOKkOQ9z7x+cZcewv0dJ k+qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=post header.b=Gzygzbey; 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=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 126-20020a630084000000b00499b89917casi21426600pga.782.2023.01.13.09.46.02; Fri, 13 Jan 2023 09:46:08 -0800 (PST) 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=@baikalelectronics.ru header.s=post header.b=Gzygzbey; 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=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbjAMRYW (ORCPT + 53 others); Fri, 13 Jan 2023 12:24:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230346AbjAMRXi (ORCPT ); Fri, 13 Jan 2023 12:23:38 -0500 Received: from post.baikalelectronics.com (post.baikalelectronics.com [213.79.110.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 36422A41CC; Fri, 13 Jan 2023 09:14:30 -0800 (PST) Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id D2DC8E0F25; Fri, 13 Jan 2023 20:14:28 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=YasRH7EfjqvX/On4k0TlHJ81hcDgJrbWEwCQC+5rSzM=; b=Gzygzbey1yrv DJy+xeyD+1bntDGKzeracoU2Dk3zFnBiAcgWM2tewG877ex0xHB4/MOLEftm1W3e prrc2Uwps5c5cS5uaAMJBI2AQ/jxB+oHw0x1MUm1JH2P8xC2VsxPBuGfC/hoKW41 dYs/aAfEz2fooYQVkQ8KJrIWR3Gb3SQ= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id B3C9BE0F13; Fri, 13 Jan 2023 20:14:28 +0300 (MSK) Received: from localhost (10.8.30.26) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 13 Jan 2023 20:14:28 +0300 From: Serge Semin To: Gustavo Pimentel , Vinod Koul , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Cai Huoqing , Robin Murphy , Jingoo Han , Frank Li , Manivannan Sadhasivam CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , caihuoqing , Yoshihiro Shimoda , , , Subject: [PATCH v9 13/27] dmaengine: dw-edma: Convert DebugFS descs to being kz-allocated Date: Fri, 13 Jan 2023 20:13:55 +0300 Message-ID: <20230113171409.30470-14-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113171409.30470-1-Sergey.Semin@baikalelectronics.ru> References: <20230113171409.30470-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.8.30.26] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 Currently all the DW eDMA DebugFS nodes descriptors are allocated on stack, while the DW eDMA driver private data and CSR limits are statically preserved. Such design won't work for the multi-eDMA platforms. As a preparation to adding the multi-eDMA system setups support we need to have each DebugFS node separately allocated and described. Afterwards we'll put an addition info there like Read/Write channel flag, channel ID, DW eDMA private data reference. Note this conversion is mainly required due to having the legacy DW eDMA controllers with indirect Read/Write channels context CSRs access. If we didn't need to have a synchronized access to these registers the DebugFS code of the driver would have been much simpler. Signed-off-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Tested-by: Manivannan Sadhasivam Acked-by: Vinod Koul --- Changelog v2: - Drop __iomem qualifier from the struct dw_edma_debugfs_entry instance definition in the dw_edma_debugfs_u32_get() method. (@Manivannan) --- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c index 2121ffc33cf3..78f15e4b07ac 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -53,7 +53,8 @@ struct dw_edma_debugfs_entry { static int dw_edma_debugfs_u32_get(void *data, u64 *val) { - void __iomem *reg = data; + struct dw_edma_debugfs_entry *entry = data; + void __iomem *reg = entry->reg; if (dw->chip->mf == EDMA_MF_EDMA_LEGACY && reg >= (void __iomem *)®s->type.legacy.ch) { @@ -94,14 +95,22 @@ static int dw_edma_debugfs_u32_get(void *data, u64 *val) } DEFINE_DEBUGFS_ATTRIBUTE(fops_x32, dw_edma_debugfs_u32_get, NULL, "0x%08llx\n"); -static void dw_edma_debugfs_create_x32(const struct dw_edma_debugfs_entry entries[], +static void dw_edma_debugfs_create_x32(const struct dw_edma_debugfs_entry ini[], int nr_entries, struct dentry *dir) { + struct dw_edma_debugfs_entry *entries; int i; + entries = devm_kcalloc(dw->chip->dev, nr_entries, sizeof(*entries), + GFP_KERNEL); + if (!entries) + return; + for (i = 0; i < nr_entries; i++) { + entries[i] = ini[i]; + debugfs_create_file_unsafe(entries[i].name, 0444, dir, - entries[i].reg, &fops_x32); + &entries[i], &fops_x32); } } -- 2.39.0