From: Frank Li <Frank.li@nxp.com>
To: Koichiro Den <den@valinux.co.jp>
Cc: vkoul@kernel.org, mani@kernel.org, jingoohan1@gmail.com,
lpieralisi@kernel.org, kwilczynski@kernel.org, robh@kernel.org,
bhelgaas@google.com, dmaengine@vger.kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 03/11] dmaengine: dw-edma: Add per-channel interrupt routing control
Date: Wed, 4 Feb 2026 12:42:41 -0500 [thread overview]
Message-ID: <aYOFEe-zyu4ZHTAl@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260204145440.950609-4-den@valinux.co.jp>
On Wed, Feb 04, 2026 at 11:54:31PM +0900, Koichiro Den wrote:
> DesignWare EP eDMA can generate interrupts both locally and remotely
> (LIE/RIE). Remote eDMA users need to decide, per channel, whether
> completions should be handled locally, remotely, or both. Unless
> carefully configured, the endpoint and host would race to ack the
> interrupt.
>
> Introduce a dw_edma_peripheral_config that holds per-channel interrupt
> routing mode. Update v0 programming so that RIE and local done/abort
> interrupt masking follow the selected mode. The default mode keeps the
> original behavior, so unless the new peripheral_config is explicitly
> used and set, no functional changes.
>
> For now, HDMA is not supported for the peripheral_config. Until the
> support is implemented and validated, explicitly reject it for HDMA to
> avoid silently misconfiguring interrupt routing.
>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
> drivers/dma/dw-edma/dw-edma-core.c | 24 +++++++++++++++++++++++
> drivers/dma/dw-edma/dw-edma-core.h | 13 +++++++++++++
> drivers/dma/dw-edma/dw-edma-v0-core.c | 26 +++++++++++++++++--------
> include/linux/dma/edma.h | 28 +++++++++++++++++++++++++++
> 4 files changed, 83 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 38832d9447fd..b4cb02d545bd 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
> @@ -224,6 +224,29 @@ static int dw_edma_device_config(struct dma_chan *dchan,
> struct dma_slave_config *config)
> {
> struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan);
> + const struct dw_edma_peripheral_config *pcfg;
> +
> + /* peripheral_config is optional, default keeps legacy behaviour. */
> + chan->irq_mode = DW_EDMA_CH_IRQ_DEFAULT;
> +
> + if (config->peripheral_config) {
> + if (chan->dw->chip->mf == EDMA_MF_HDMA_NATIVE)
> + return -EOPNOTSUPP;
> +
> + if (config->peripheral_size < sizeof(*pcfg))
> + return -EINVAL;
It is good to check here.
> +
> + pcfg = config->peripheral_config;
save whole peripheral_config in case need more special peripheral
configuration in future.
> + switch (pcfg->irq_mode) {
> + case DW_EDMA_CH_IRQ_DEFAULT:
> + case DW_EDMA_CH_IRQ_LOCAL:
> + case DW_EDMA_CH_IRQ_REMOTE:
> + chan->irq_mode = pcfg->irq_mode;
> + break;
> + default:
> + return -EINVAL;
> + }
> + }
use helper function to get irq_mode. I posted combine config and prep by
one call.
https://lore.kernel.org/dmaengine/20260105-dma_prep_config-v3-0-a8480362fd42@nxp.com/
So we use such helper to get irq node after above patch merge. It is not
big deal, I can change it later. If provide helper funtions, it will be
slice better.
>
> memcpy(&chan->config, config, sizeof(*config));
> chan->configured = true;
> @@ -750,6 +773,7 @@ static int dw_edma_channel_setup(struct dw_edma *dw, u32 wr_alloc, u32 rd_alloc)
> chan->configured = false;
> chan->request = EDMA_REQ_NONE;
> chan->status = EDMA_ST_IDLE;
> + chan->irq_mode = DW_EDMA_CH_IRQ_DEFAULT;
>
> if (chan->dir == EDMA_DIR_WRITE)
> chan->ll_max = (chip->ll_region_wr[chan->id].sz / EDMA_LL_SZ);
...
>
> +/*
> + * enum dw_edma_ch_irq_mode - per-channel interrupt routing control
> + * @DW_EDMA_CH_IRQ_DEFAULT: LIE=1/RIE=1, local interrupt unmasked
> + * @DW_EDMA_CH_IRQ_LOCAL: LIE=1/RIE=0
keep consistent after "," for each enum
Frank
> + * @DW_EDMA_CH_IRQ_REMOTE: LIE=1/RIE=1, local interrupt masked
> + *
> + * Some implementations require using LIE=1/RIE=1 with the local interrupt
> + * masked to generate a remote-only interrupt (rather than LIE=0/RIE=1).
> + * See the DesignWare endpoint databook 5.40, "Hint" below "Figure 8-22
> + * Write Interrupt Generation".
> + */
> +enum dw_edma_ch_irq_mode {
> + DW_EDMA_CH_IRQ_DEFAULT = 0,
> + DW_EDMA_CH_IRQ_LOCAL,
> + DW_EDMA_CH_IRQ_REMOTE,
> +};
> +
> +/**
> + * struct dw_edma_peripheral_config - dw-edma specific slave configuration
> + * @irq_mode: per-channel interrupt routing control.
> + *
> + * Pass this structure via dma_slave_config.peripheral_config and
> + * dma_slave_config.peripheral_size.
> + */
> +struct dw_edma_peripheral_config {
> + enum dw_edma_ch_irq_mode irq_mode;
> +};
> +
> /**
> * struct dw_edma_chip - representation of DesignWare eDMA controller hardware
> * @dev: struct device of the eDMA controller
> --
> 2.51.0
>
next prev parent reply other threads:[~2026-02-04 17:42 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 14:54 [PATCH v3 00/11] dmaengine, PCI: endpoint: Enable remote use of integrated DesignWare eDMA Koichiro Den
2026-02-04 14:54 ` [PATCH v3 01/11] dmaengine: Add hw_id to dma_slave_caps Koichiro Den
2026-02-04 19:39 ` Frank Li
2026-02-05 6:46 ` Koichiro Den
2026-02-05 16:04 ` Frank Li
2026-02-04 14:54 ` [PATCH v3 02/11] dmaengine: dw-edma: Report channel hw_id in dma_slave_caps Koichiro Den
2026-02-04 14:54 ` [PATCH v3 03/11] dmaengine: dw-edma: Add per-channel interrupt routing control Koichiro Den
2026-02-04 17:42 ` Frank Li [this message]
2026-02-05 6:48 ` Koichiro Den
2026-02-05 16:05 ` Frank Li
2026-02-04 14:54 ` [PATCH v3 04/11] dmaengine: Add selfirq callback registration API Koichiro Den
2026-02-04 17:46 ` Frank Li
2026-02-05 6:50 ` Koichiro Den
2026-02-05 16:07 ` Frank Li
2026-02-04 14:54 ` [PATCH v3 05/11] dmaengine: dw-edma: Implement dmaengine selfirq callbacks using interrupt emulation Koichiro Den
2026-02-04 14:54 ` [PATCH v3 06/11] PCI: endpoint: Add remote resource query API Koichiro Den
2026-02-04 17:55 ` Frank Li
2026-02-05 6:53 ` Koichiro Den
2026-02-05 16:10 ` Frank Li
2026-02-04 14:54 ` [PATCH v3 07/11] PCI: dwc: Record integrated eDMA register window Koichiro Den
2026-02-04 17:57 ` Frank Li
2026-02-04 14:54 ` [PATCH v3 08/11] PCI: dwc: ep: Report integrated DWC eDMA remote resources Koichiro Den
2026-02-04 18:06 ` Frank Li
2026-02-05 6:58 ` Koichiro Den
2026-02-05 16:11 ` Frank Li
2026-02-04 14:54 ` [PATCH v3 09/11] PCI: endpoint: pci-epf-test: Add smoke test for EPC remote resource API Koichiro Den
2026-02-04 19:37 ` Frank Li
2026-02-05 7:01 ` Koichiro Den
2026-02-05 0:01 ` kernel test robot
2026-02-05 2:37 ` kernel test robot
2026-02-04 14:54 ` [PATCH v3 10/11] misc: pci_endpoint_test: Add EPC remote resource API test ioctl Koichiro Den
2026-02-04 14:54 ` [PATCH v3 11/11] selftests: pci_endpoint: Add EPC remote resource API test Koichiro Den
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aYOFEe-zyu4ZHTAl@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=bhelgaas@google.com \
--cc=den@valinux.co.jp \
--cc=dmaengine@vger.kernel.org \
--cc=jingoohan1@gmail.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®