Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6799677rwb; Wed, 18 Jan 2023 09:28:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXtiCJVy99bbotwwGmN05Zgh3b/42MDQbaqdXorbKvd2BrDy0uQAq3RtMn0kBC0am60b9xlk X-Received: by 2002:a05:6402:2b9b:b0:49d:34ae:c7aa with SMTP id fj27-20020a0564022b9b00b0049d34aec7aamr8002319edb.29.1674062937222; Wed, 18 Jan 2023 09:28:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674062937; cv=none; d=google.com; s=arc-20160816; b=vurPTcG5eucoKUq2KkjeORpOaCjkcz6tX+GOaGywizpZtFprkaqi/3OL412qPYE0bP faoEOQq+V4n4yVuIqY5P34wqepaDgLaaMGFuBAyfLpPzuf4iBgfkQ8+Ye6/0dW+e7UGO QkRER5Id8Hpbb60RSe+nmr9YWAm6qrROwYZgjAq00LwukEmoUpbR9Kp7QxJlGyiuIn0z hIFGvi0OaExQxHK8PaVr5/JWnTffCuhJZMjEDC7j3zGeRc3+ONIb1LgR7MdRAehYd9I2 SSFfLTYuTrF1rN7+MFJg13bL55wMWuq4A1K6Y2zWTm8U9Lbg9XpZxJ/a32j7GatTuefB jiBA== 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=SmZtD0k1aVnB14ZP4vxjtgbCTs8pnpFmBp9a5HnbRjk=; b=oi/kBjQvSSeJYyFSQ4/8h3YuRBgCtKNeA0i81RNWYGe3XefYjgiFZyFo0rd+V+FL2r h/+OhKZUOf90UdkZFR+bFGRae+fXlD5ewXvi9354Mlzj3insaTa8Fbrbzcpt12GxKClp ib7kULsXRNAPwpBWPrtU+mRsrUfxUJ9GW90nt/bCcPNe6t88jaeO/XqZZkRoMxuspY64 3Bp9+hm2MO55HiOCihsDqe4e/dmpV0MKKBFeAFCvGd20aykyg3K7YSQoIFr6IB/3rTpY C4SpG4BcbemGLfknzt3dl06fnssJiNY7ueva01VD4JMIF1U+MM+++F4g+nCGaMF9H9sr IdvA== 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 m10-20020a056402430a00b0049e2d504b95si8672852edc.456.2023.01.18.09.28.46; Wed, 18 Jan 2023 09:28:57 -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; 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 S230147AbjARQkc (ORCPT + 45 others); Wed, 18 Jan 2023 11:40:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231178AbjARQj5 (ORCPT ); Wed, 18 Jan 2023 11:39:57 -0500 Received: from mx.gpxsee.org (mx.gpxsee.org [37.205.14.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DAD6312F29; Wed, 18 Jan 2023 08:39:54 -0800 (PST) Received: from [192.168.4.25] (unknown [62.77.71.229]) by mx.gpxsee.org (Postfix) with ESMTPSA id C9735356E6; Wed, 18 Jan 2023 17:39:52 +0100 (CET) Message-ID: Date: Wed, 18 Jan 2023 17:39:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [RESEND PATCH V11 XDMA 2/2] dmaengine: xilinx: xdma: Add user logic interrupt support Content-Language: en-US To: Lars-Peter Clausen , Vinod Koul , Lizhi Hou Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, max.zhen@amd.com, sonal.santan@amd.com, larry.liu@amd.com, brian.xu@amd.com References: <1673988842-43631-1-git-send-email-lizhi.hou@amd.com> <1673988842-43631-3-git-send-email-lizhi.hou@amd.com> <85d1e660-1df4-6e84-a329-751197ef7eec@gpxsee.org> <483c7088-1ac1-6924-9cfb-a131e82276ee@metafoo.de> From: =?UTF-8?Q?Martin_T=c5=afma?= In-Reply-To: <483c7088-1ac1-6924-9cfb-a131e82276ee@metafoo.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 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 18. 01. 23 16:33, Lars-Peter Clausen wrote: > On 1/18/23 07:28, Martin Tůma wrote: >>>> +++ b/include/linux/dma/amd_xdma.h >>>> @@ -0,0 +1,16 @@ >>>> +/* SPDX-License-Identifier: GPL-2.0-or-later */ >>>> +/* >>>> + * Copyright (C) 2022, Advanced Micro Devices, Inc. >>>> + */ >>>> + >>>> +#ifndef _DMAENGINE_AMD_XDMA_H >>>> +#define _DMAENGINE_AMD_XDMA_H >>>> + >>>> +#include >>>> +#include >>>> + >>>> +int xdma_enable_user_irq(struct platform_device *pdev, u32 irq_num); >>>> +void xdma_disable_user_irq(struct platform_device *pdev, u32 irq_num); >>>> +int xdma_get_user_irq(struct platform_device *pdev, u32 >>>> user_irq_index); >>> >>> who is the user of these APIs? It is not clear to me how this is to be >>> used... >>> >> >> The APIs are used by the PCIe card devices/drivers that use XDMA. >> Without them the "user IRQs" provided by the XDMA HW can not be used >> by the PCIe card drivers. If you look at the XDMA HW overview: >> https://docs.xilinx.com/r/en-US/pg195-pcie-dma/Overview?tocId=O_EMX26J5IsdubL4i3XJ_w >> those APIs control the "IRQ module" block. >> >> For a linux driver using them see the mgb4 v4l2 driver: >> https://patchwork.kernel.org/project/linux-media/patch/20230113172636.2590-2-tumic@gpxsee.org/ > > > Rather than custom functions this should probably be integrated with the > generic IRQ framework registering a IRQ chip that provides IRQs that can > be requested by the consumer. > I'm not sure if this makes sense. Those IRQs are "special" as they control the user logic (there are additional IRQs in XDMA used by the DMA engine itself). Only the "user IRQs" have this control logic but all the IRQs are available as standard MSI/MSI-X IRQs in the kernel. There is also the problem with the IRQ numbering as the XDMA HW can be configured with a variable number of total IRQs and "user IRQ #X" can be a different MSI/MSI-X IRQ depending on the number of configured DMA channels. This API ensures that you get the correct user logic "wire" independent of the XDMA configuration you have. Finally, I'm not sure how hard or even if possible it is to integrate the special handling of some MSI/MSI-X IRQs into the generic IRQ framework as the "IRQ chip" will be some generic PCIe IRQ chip (depending on the mainboard). But maybe that's not a problem. M.