Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp737135rwd; Wed, 7 Jun 2023 06:20:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/BD09Qz32Fl5mLy55NTiKeJVJk+E704iQkyJ6JOoZlWIiCl17NsIzdQyeT5EoL4vZYBnu X-Received: by 2002:a05:6a20:3c8e:b0:101:282c:2b with SMTP id b14-20020a056a203c8e00b00101282c002bmr1058896pzj.32.1686144032920; Wed, 07 Jun 2023 06:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686144032; cv=none; d=google.com; s=arc-20160816; b=YQskE/K5amZT0QaK/ehE9GBw17D7Oqbq1/P5h3AgSyxiiWBunWPH0b4PGA3EnP4bV1 t3zIhBQVe7Mes3WuyTOjHqS32lyEb2XYW5khXW2cALcmB0UFS31cjHFKgwDFqSkSLOe2 2rg/pzLqeRXyNiydfVwMAS9kkqrIuXQlD/sivY2+5Lq1QoBd79YUnMrBhhwH8fV7qm78 WQBHiXRpV7LpyiNnpB6pNjys84oNFvtJEIO2ypiMe5TnDJZwY0OLXBChPq1/1JYHfKld ucP561P3Iqx0fHLzsHpUJLe+M6qR0wh8AGHfiAb9rsJ8dHsTK3PQ9sUxLIWPvj9vBEsL I+ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eVqzqKRxOOSH01gk2xNCMDidxypcD2q3gKimT9RM4+k=; b=buB+k8HEI8RoTV0si0S2rrd+mRaRCk5Z6D7PJ23ClTFvXr23oC2WSKocdsd4xhIKUk yuI7RAfl/E4BypazHDghJvY2EjTDKWYZdtAZMEvCvAvex+su4eegZNrwqXV5uHwXPg8r 7EtLzWYXaaA0X64LJzlPNkuRIqvtvezmYG59TW4e/Ph1H9+LgoSzXJdnW6yFXKzrgzK3 wEPiUgSZ8nrfIZSFYqBqnzX0I8b5ElE3DHBK1qnbw+f0kJuYReEgyOYnqNGAX2cxsY70 FLAfRJyJH5Jj8mUckYv1NrgxqwCIypt1QsXqKaXlQRp+8VLI+9oAHh1ioVROQoYe2+hJ Fq9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=nBWgvoDT; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o2-20020a170902d4c200b0019955f0dc48si332055plg.527.2023.06.07.06.20.16; Wed, 07 Jun 2023 06:20:32 -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=@gmail.com header.s=20221208 header.b=nBWgvoDT; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239841AbjFGNHD (ORCPT + 99 others); Wed, 7 Jun 2023 09:07:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239651AbjFGNHB (ORCPT ); Wed, 7 Jun 2023 09:07:01 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C69D188; Wed, 7 Jun 2023 06:06:58 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f61d79b0f2so5468793e87.3; Wed, 07 Jun 2023 06:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686143216; x=1688735216; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=eVqzqKRxOOSH01gk2xNCMDidxypcD2q3gKimT9RM4+k=; b=nBWgvoDTBM8BU6Km/vGwg3UUgfsXLIrlBfoRdHNeXtmng/myi5+Ld1ezT7XW83byLt pNwdZxebb7SDxqivpL1pUZBf+vXUeSvrjdWjIefpiL3AMjkNxFgsx8pAtXaXW+1sCvlJ 9/D1QrTRRwkPj2mFiL7YO8VsdOvSBA2dHc72WG5ZsdSv9KfBZHXyh9AvlJgLR5NHXWv1 +JGl2TlnpypVAePh3msVyJhsvXH0+pHSLyRUqOfAzF67U3KopqFmVS6xzaPtN1d2CLPc aPkj9V41/DCpByRLpr39DbImGyA8YAS4rYxOxxhEqtDw8EnvVz8UAT32pND9Hh9Gx8t4 cdZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686143216; x=1688735216; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eVqzqKRxOOSH01gk2xNCMDidxypcD2q3gKimT9RM4+k=; b=E7THm+mSGvI5KaHWzRXJqiV5MaURUzKFmdaVJ6oDcEAjiNEjelYVdOmi48Z+pTaWxM OQxCPwAw5PehVeXOtg8aAoFQWiop5JkK2AXAP5EkJafhRt5zyJtBe1GHsXvty73YsobZ 1bJ/hxUSn96iar4oxDr/TMA2QZEmMm9WX3eTnTT4m+cxCVlxo7p8nTsfh/BMGsTIqxVI 6ozFfXFmzp2+PzJT3TpTuy3vt4CbGcP1KXfWYrhOyzG08UHSAwuDny+Q49wc8CvFoKeC X+xrhpCpQvipi7BlkMnRqE6NPeY9W1kX7iPbO3Djumq1kZwrlgIaKAO4+CIhmIL/yz1r g/1w== X-Gm-Message-State: AC+VfDzxZNUOtQSf6t4RKIwxLcB0X4Jo9p3taRK2g0SvpjGHvE5M2os8 likYlPi9+gJfmwBb3xHmUEc= X-Received: by 2002:ac2:559c:0:b0:4f3:8143:765 with SMTP id v28-20020ac2559c000000b004f381430765mr2283763lfg.27.1686143216337; Wed, 07 Jun 2023 06:06:56 -0700 (PDT) Received: from mobilestation ([91.144.185.176]) by smtp.gmail.com with ESMTPSA id m1-20020ac24ac1000000b004f13634da05sm1806099lfp.180.2023.06.07.06.06.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 06:06:55 -0700 (PDT) Date: Wed, 7 Jun 2023 16:06:53 +0300 From: Serge Semin To: =?utf-8?B?S8O2cnk=?= Maincent , Cai Huoqing Cc: vkoul@kernel.org, Manivannan Sadhasivam , Manivannan Sadhasivam , Gustavo Pimentel , Jingoo Han , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-pci@vger.kernel.org, Thomas Petazzoni Subject: Re: [PATCH v11 3/4] dmaengine: dw-edma: Add support for native HDMA Message-ID: <20230607130653.5hueky3rfih6cnze@mobilestation> References: <20230520050854.73160-1-cai.huoqing@linux.dev> <20230520050854.73160-4-cai.huoqing@linux.dev> <20230607095832.6d6b1a73@kmaincent-XPS-13-7390> <20230607114950.zml4l2rs77cbeesy@mobilestation> <20230607144014.6356a197@kmaincent-XPS-13-7390> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230607144014.6356a197@kmaincent-XPS-13-7390> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, Jun 07, 2023 at 02:40:14PM +0200, K?ry Maincent wrote: > On Wed, 7 Jun 2023 14:49:50 +0300 > Serge Semin wrote: > > > Hi K?ry > > First of all. What is akida platform you are referring to? I failed to > > find any mention in the mainline kernel repo. > > Yes, sorry akida is the project prefix I am currently working on. > It is simply a prefix for the symbol export to be different than mainline, > don't take it into account. > > > > channels by doing the minimum between ll_wr_cnt and the ch_count callback. > > > The hdma ch_count callback is counting the number of channels enabled by > > > reading the number of ch_en registers set. At probe time there is no > > > channels registers that has been set as it is done later in the > > > dw_hdma_v0_core_start function. Then the dw_hdma_v0_core_ch_count will > > > always return 0 at probe time and the number of channels will be set to 0 > > > which is not what we want. Could I miss something? > > > > Based on the HDMA patches content you are right. The channels must be > > pre-enabled in order to have the dw_hdma_v0_core_ch_count() procedure > > to work correctly otherwise you'll indeed end up with an empty list of > > channels. I don't have any device with the HDMA engine embedded so I > > couldn't have possibly tracked that peculiarity on review. Anyway > > AFAICS Cai just implemented a method which seemed to work for his > > hardware setup. > > Alright, on my side I have a board using this FPGA implementation and it > indeed doesn't work as is. > > > If you think it doesn't work correctly or it isn't portable enough > > then you are free to provide your own implementation of the method and > > submit a patch. I hope Cai will be willing to test it out to make sure > > that it works correctly for you and his platforms. > > > > As for me if I were on your place I would have implemented a loop > > which would walk over all possible HDMA channels (HDMA_V0_MAX_NR_CH) > > and counted all channels which could be enabled. If the ch_en CSR is > > writable (that is the channel could be enabled) then it shall be > > considered as existent. Of course before that I would have made sure > > that the non-existent channels had non-writable ch_en CSR. > > This could be a nice idea but it doesn't work, non-existent channels seems to > be writable. The datasheet of the HDMA IP doesn't have any register to find out > the maximum existent channel. > As there is no way to know this, the dw_hdma_v0_core_ch_count will simply > return HDMA_V0_MAX_NR_CH. What about some other CSRs (llp, etc)? Are they all writable even if the respective channel doesn't exist? If it isn't possible to auto-detect a number of channels then indeed we need to come up with a strategy to rely on the platform settings instead. Your suggestion seems to be the best choice seeing there is a commit 16b90dd94d3f ("dmaengine: dw-edma: Improve number of channels check") which converts the rely-on-platform-settings pattern to the current rely-on-min-between-plat-and-hw-capability. Cai? -Serge(y) > Cai how does it works on your side? does the ch_en register already enabled by > the implementation?