Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp257293rwb; Wed, 14 Dec 2022 17:02:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf4nWmLk4avu8z5BEQP4CL2Yv2Xo51d6/pSh3pOJVBjEq/kSVybU0DhOX0+xJ/cDMkcnGU25 X-Received: by 2002:a17:906:57c3:b0:78d:f454:3856 with SMTP id u3-20020a17090657c300b0078df4543856mr22906359ejr.19.1671066122009; Wed, 14 Dec 2022 17:02:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671066121; cv=none; d=google.com; s=arc-20160816; b=Pny33FAN04lpsCYoZ+MIFdohLB9kSYtRAx1kCpx4PwE+CGepbs2ru6zWqh7KmL5VT1 C5dX9pkSa0CFuzDksEowWRa205D4hGcFqaWqTMVrIQbXvqDIs2qnTY1+ZM4dRSL4dqiA e1duOXgZZfeETxQb3APSu1ZL5DHfFjiKFuwFHfnplZy4yuRqPjmRUw+qS5B1PZiQF9Fj eUHICbpbPNk2LASpzW2ZMq6qUO5QI6KLblwWtWi1RitXZjpnHZJJ1XlXqS5SDs0C3iQf r3ZcZELMVJ6iMjufl2HZm/WdBT9FwzA5xX07jHDGGpu8OmPlFRIjOokdxPymD+K6XlRr KZ/A== 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=epmzGansytPxz5Hgaxj/E76J3uOG4CCTCqPVcuYibtE=; b=Vl3qUiUQKlTwQILs6B9K12n9059sSgkBGOboxAhaLplLL4+i6SALyiPRfYx7rVHjKO hbtCvX4swEiNqCKKTeAsVRQ5mvNEPERCgPv3ZJzddcvujKAh4Pg2o9oYKZwxtLaLIo6g z6vy3VuQn+5qWbWkwYXEixzG7k3NyTaE31BzX2erFAzlw67G/qRn3J2ht1X2s2VAx4G6 CNCeFnBwUTMzeZVvc514Lv13c4LRGg977tXYvhdVH4QEno36h6ImFEa6JDKC3mQbgHQq Nwaei/72uznonA+Yao0Ro9EhiB0X45SpcEqEA8pl20GE4j/Cvg+FxEH3ETSYXnWvsUcb RpTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=post header.b=O8huWyno; 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 pv20-20020a170907209400b007c0a516af79si10009567ejb.313.2022.12.14.17.01.34; Wed, 14 Dec 2022 17:02:01 -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=O8huWyno; 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 S230076AbiLNXyg (ORCPT + 69 others); Wed, 14 Dec 2022 18:54:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229713AbiLNXxS (ORCPT ); Wed, 14 Dec 2022 18:53:18 -0500 Received: from post.baikalelectronics.com (post.baikalelectronics.com [213.79.110.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9D28B4A07E; Wed, 14 Dec 2022 15:53:17 -0800 (PST) Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id 39213E0ED8; Thu, 15 Dec 2022 02:53:17 +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=epmzGansytPxz5Hgaxj/E76J3uOG4CCTCqPVcuYibtE=; b=O8huWynoKiOo 9nL3r0CAahyoRdLTQ3jSQUt5y4yFW0MguXzBw6G2P0or1hoQ0EK0qplMDDVRkTFV /zT81noRhQ9y+sZ3nmhQxCVloU+CHibRNRo6JO5C4OiEwOJQCm1+wMH9wK362IQH CKbfVufZZoLpA2TtG+jHmDwKcsi6QUo= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id 2C922E0E6B; Thu, 15 Dec 2022 02:53:17 +0300 (MSK) Received: from localhost (10.8.30.6) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 15 Dec 2022 02:53:16 +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 v7 13/25] dmaengine: dw-edma: Convert DebugFS descs to being kz-allocated Date: Thu, 15 Dec 2022 02:52:53 +0300 Message-ID: <20221214235305.31744-14-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221214235305.31744-1-Sergey.Semin@baikalelectronics.ru> References: <20221214235305.31744-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.8.30.6] 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.38.1