Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1328806rwb; Tue, 27 Sep 2022 11:25:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+U5Xl9j2RFpZDT3zJUnGVT2asF1T6hzZ5lm1tjaco4fDbVbxy+ey5jvxRmhIQzGghDINs X-Received: by 2002:a17:90b:3ec2:b0:202:b123:29cc with SMTP id rm2-20020a17090b3ec200b00202b12329ccmr6028520pjb.167.1664303099939; Tue, 27 Sep 2022 11:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664303099; cv=none; d=google.com; s=arc-20160816; b=SdmFOq727xlVEEN3HlhVeiUKEw8w9tLCU22DeZW/j6/wAxzdIQFuo5cMg7PXd9Vo8g 07im/R8sfhTrDht13fAI2/7FrXUsAkQ1qBsqsQIpJ/C6m5OJrLnk9GkltJPIprpGNNz6 iCoTKqeZ1sC69GRMCn/SLFvj2hKh9x62sS4cGe1lhwqxFsiRaAWyW4XMfRwMJcgyl2H9 f6qjO9NuPlLJgOflRuNrBtJBmTB+6wvR94ipyVSCU+svEeFgdCKwaxbiq9BDMJw/Pm6U fYLx3u1ndgA3UmS2M5xuMFqNvACgEK1lz/NR1HrrFmOQw6QEYlfGi7ci1BK+c9PdomqF ZSXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=rD4y2aPZL9H2rI1cgqR6FuahNGMelbQE/NQpAY11yOg=; b=KyRlfIa1AuKl5i8tWigJIgpHe3gIo3z/K5aJMTFAFi3tsbIyIP61Oefkrk/Oqr28BU UZ8/LEW/5S8I6Ec+uSCEnCIrBW3PqLe6ZWrTG5hLbLDXamV40ot7QIL8T7iXJ7DcRAB3 tNNILDUfy8sZEwP5PTBqjzOXallrvE7WHouVD1CnfNIa4PFz1txB+ZQiM8DaGu1/mAYQ hLP3TpuG0f2/asBjcX7phA/+cIwrnFG6XyLo/aYfFxX9svhGhKfCjT2Bsm7Znqg/x/ov FTj1VqMYQeO+EnV+iql3GKeMy1F974trAZ/tC1HxrnlNpVIcMGtLDq+agQLJYai70kbD Mf2A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a17090a2c4500b00205d0348e7fsi2319866pjm.93.2022.09.27.11.24.47; Tue, 27 Sep 2022 11:24:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232505AbiI0RzE (ORCPT + 99 others); Tue, 27 Sep 2022 13:55:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232245AbiI0Ryv (ORCPT ); Tue, 27 Sep 2022 13:54:51 -0400 Received: from mx.gpxsee.org (mx.gpxsee.org [37.205.14.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5BFDE117F; Tue, 27 Sep 2022 10:54:40 -0700 (PDT) Received: from [192.168.4.25] (unknown [62.77.71.229]) by mx.gpxsee.org (Postfix) with ESMTPSA id 2B618544C; Tue, 27 Sep 2022 19:54:38 +0200 (CEST) Message-ID: <68fdd2a3-b881-470b-c5b3-0f2fc881ed27@gpxsee.org> Date: Tue, 27 Sep 2022 19:54:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH V4 XDMA 2/2] dmaengine: xilinx: xdma: Add user logic interrupt support Content-Language: en-US To: Lizhi Hou , vkoul@kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com Cc: max.zhen@amd.com, sonal.santan@amd.com, larry.liu@amd.com, brian.xu@amd.com References: <1663871905-60498-1-git-send-email-lizhi.hou@amd.com> <1663871905-60498-3-git-send-email-lizhi.hou@amd.com> <64388266-1707-ee20-c3ab-edb67ada68dc@amd.com> <5f77987e-49bc-e035-19e0-52c25f4adc7e@amd.com> From: =?UTF-8?Q?Martin_T=c5=afma?= In-Reply-To: <5f77987e-49bc-e035-19e0-52c25f4adc7e@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE 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 27. 09. 22 19:18, Lizhi Hou wrote: > > On 9/27/22 09:46, Martin Tůma wrote: >> On 27. 09. 22 18:28, Lizhi Hou wrote: >> >>> Okay, I got the point. How about changing request/remove APIs to >>> enable/disable APIs as below >>> >>>       xdma_enable_user_irq(struct platform_device *pdev, u32 >>> user_irq_index, u32 *irq) >>> >>>              user_irq_index: user logic interrupt wire index. (XDMA >>> driver determines how system IRQs are mapped to DMA channels and user >>> logic wires) >>> >>>              irq: IRQ number returned for registering interrupt >>> handler (request_irq()) or passing to existing platform driver. >>> >>>      xdma_disable_user_irq(struct platform_device *pdev, u32 >>> user_irq_index) >>> >>> Does this make sense to you? >>> >> >> I think even the "irq" parameter in the enable function is surplus as >> the parent driver (the driver of the actual PCIe card) knows* what PCI >> irq he has to allocate without XDMA providing the number. >> >> xdma_enable_user_irq(struct platform_device *pdev, u32 user_irq_index); >> xdma_disable_user_irq(struct platform_device *pdev, u32 user_irq_index); >> >> should be all that is needed. >> >> M. >> >> * something like: >> pci_irq_vector((pdev), PCI_BAR_ID) + NUM_C2H_CHANNELS + NUM_H2C_CHANNELS >> can be used from the PCIe driver > > How does parent driver know the first few vectors will be assigned to > DMA channel?  Parent diver should not assume the first > (NUM_C2H_CHANNELS+NUM_H2C_CHANNELS) are for DMA channel. > > Parent driver passes the system IRQ range  to XDMA driver, and only XDMA > driver knows what IRQs are used by DMA channel and what IRQs are mapped > to user logic wires. I would keep the "u32 *irq" argument. > The parent driver knows how much DMA channels it wants/allocates. If it is possible to allocate different IRQs than the first NUM_C2H_CHANNELS + NUM_H2C_CHANNELS to the XDMA IP core, than that parameter may be needed, but I haven't seen such HW. Moreover, every parent driver author should IMHO know how the channel and user IRQs are mapped in their specific HW configuration so this info can be "hard-wired" in the parent driver, but I'm fine with it when the irq parameter is kept anyway. All I really need is that the enable/disable logic is split from the irq allocate/register logic so I can use the other platform drivers. M.