public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Koichiro Den <den@valinux.co.jp>
Cc: vkoul@kernel.org, mani@kernel.org, Frank.Li@nxp.com,
	jingoohan1@gmail.com, lpieralisi@kernel.org,
	kwilczynski@kernel.org, robh@kernel.org, bhelgaas@google.com,
	kishon@kernel.org, jdmason@kudzu.us, allenbh@gmail.com,
	dmaengine@vger.kernel.org, linux-pci@vger.kernel.org,
	ntb@lists.linux.dev, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Manikanta Maddireddy <mmaddireddy@nvidia.com>
Subject: Re: [PATCH v6 0/8] PCI: endpoint: pci-ep-msi: Add embedded doorbell fallback
Date: Wed, 11 Feb 2026 17:52:53 +0100	[thread overview]
Message-ID: <aYyz5WF_iJuNwA35@ryzen> (raw)
In-Reply-To: <23p74hldtvi2xn6aza2rc6kh5hidzutu46ugzt6mzliyjzylka@k5gchw3amcig>

On Thu, Feb 12, 2026 at 12:57:52AM +0900, Koichiro Den wrote:
> Could you try a quick experiment on the Rock 5B EP side?
> 
>   devmem 0xa403800a0 32 1
>   devmem 0xa403800a0 32 2
>   devmem 0xa403800a0 32 4
>   devmem 0xa403800a0 32 8

Here it goes:

# cat /proc/interrupts | grep edma
 53:          0          0          0          0          0          0          0          0    GICv3 303 Level     dw-edma-core:a40000000.pcie-ep, pci-ep-test-doorbell
 54:          0          0          0          0          0          0          0          0    GICv3 304 Level     dw-edma-core:a40000000.pcie-ep
 55:          0          0          0          0          0          0          0          0    GICv3 301 Level     dw-edma-core:a40000000.pcie-ep
 56:          0          0          0          0          0          0          0          0    GICv3 302 Level     dw-edma-core:a40000000.pcie-ep
# devmem 0xa403800a0 32 1
# cat /proc/interrupts | grep edma
 53:          0          0          0          0          0          0          0          0    GICv3 303 Level     dw-edma-core:a40000000.pcie-ep, pci-ep-test-doorbell
 54:          1          0          0          0          0          0          0          0    GICv3 304 Level     dw-edma-core:a40000000.pcie-ep
 55:          0          0          0          0          0          0          0          0    GICv3 301 Level     dw-edma-core:a40000000.pcie-ep
 56:          0          0          0          0          0          0          0          0    GICv3 302 Level     dw-edma-core:a40000000.pcie-ep
# devmem 0xa403800a0 32 1
# cat /proc/interrupts | grep edma
 53:          0          0          0          0          0          0          0          0    GICv3 303 Level     dw-edma-core:a40000000.pcie-ep, pci-ep-test-doorbell
 54:          2          0          0          0          0          0          0          0    GICv3 304 Level     dw-edma-core:a40000000.pcie-ep
 55:          0          0          0          0          0          0          0          0    GICv3 301 Level     dw-edma-core:a40000000.pcie-ep
 56:          0          0          0          0          0          0          0          0    GICv3 302 Level     dw-edma-core:a40000000.pcie-ep
# devmem 0xa403800a0 32 1
[  104.217632] pci_epf_test_doorbell_primary
# cat /proc/interrupts | grep edma
 53:          1          0          0          0          0          0          0          0    GICv3 303 Level     dw-edma-core:a40000000.pcie-ep, pci-ep-test-doorbell
 54:          2          0          0          0          0          0          0          0    GICv3 304 Level     dw-edma-core:a40000000.pcie-ep
 55:          0          0          0          0          0          0          0          0    GICv3 301 Level     dw-edma-core:a40000000.pcie-ep
 56:          0          0          0          0          0          0          0          0    GICv3 302 Level     dw-edma-core:a40000000.pcie-ep
# devmem 0xa403800a0 32 1
# cat /proc/interrupts | grep edma
 53:          1          0          0          0          0          0          0          0    GICv3 303 Level     dw-edma-core:a40000000.pcie-ep, pci-ep-test-doorbell
 54:          2          0          0          0          0          0          0          0    GICv3 304 Level     dw-edma-core:a40000000.pcie-ep
 55:          1          0          0          0          0          0          0          0    GICv3 301 Level     dw-edma-core:a40000000.pcie-ep
 56:          0          0          0          0          0          0          0          0    GICv3 302 Level     dw-edma-core:a40000000.pcie-ep


Seems very random if you ask me.

Same randomness is observed when I write other values, e.g. 2.


Could this randomness be because I do not have:
https://lore.kernel.org/dmaengine/20260105075904.1254012-1-den@valinux.co.jp/

Or do you think that is completely unrelated?



> > RK3588 (pcie-dw-rockchip.c) exposes the DMA registers in BAR4 by default.
> > If I hack pci-epf-test on top of your patch to unconditionally return BAR4 with
> > offset 0xa0, it works. So my best guess is that the fixed inbound translation
> > in BAR4 (to the eDMA registers) somehow messes with the inbound translation if
> > another BAR tries to use an inbound translation to the eDMA registers as well.

Adding Manikanta to CC.

RK3588 is not the only SoC that has the eDMA registers exposed via a BAR,
some other SoCs like Tegra234 also has the eDMA registers exposed via a BAR.

Me and Manikanta were discussing this a few days ago:
https://lore.kernel.org/linux-pci/aYsQu9lQi4IzfBiP@ryzen/


> 
> Thanks a lot for letting me know that. I see two possible ways forward:
> 
>   (a) extend PCI_EPC_AUX_DMA_CTRL_MMIO to optionally describe that the DMA
>       MMIO window is already mapped to a fixed BAR and should be reused, so
>       EPFs avoid creating a second mapping to the same target. I guess it
>       could be treated as a quirk for "rockchip,rk3588-pcie-ep".

I do like the idea that an EPC driver can somehow provide the BAR number
which the eDMA registers are already exposed in, together with the offset
and the size within that BAR. After that pci-epf-test could still work with
the emulated doorbell (only difference is that it would not program the iATU).

(This would also require Manikanta suggestion of having both a BAR_RESERVED and
a BAR_DISABLED type, and support in pci_endpoint_test to ignore RESERVED BARs.)


> 
>   (b) alternatively, clear the default BAR4 mapping on RK3588 at least
>       temporarily when using the pci-epf-msi doorbell fallback.

So for these SoCs like RK3588 and Tegra234, it appears that the option to
expose the eDMA registers in one of the BARs is a Synopsys DWC config that
you set when you synthesize the DWC core.
When you do this, it appear that that BAR will always some kind of fixed
inbound address translation (i.e. even when you disable all inbound iATUs
this translation for BAR4 to eDMA registers is still there).


Kind regards,
Niklas

  reply	other threads:[~2026-02-11 16:52 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-09 12:53 [PATCH v6 0/8] PCI: endpoint: pci-ep-msi: Add embedded doorbell fallback Koichiro Den
2026-02-09 12:53 ` [PATCH v6 1/8] dmaengine: dw-edma: Deassert emulated interrupts in the IRQ handler Koichiro Den
2026-02-09 16:05   ` Frank Li
2026-02-09 12:53 ` [PATCH v6 2/8] dmaengine: dw-edma: Cache per-channel IRQ and emulation doorbell offset Koichiro Den
2026-02-09 16:13   ` Frank Li
2026-02-10  1:48     ` Koichiro Den
2026-02-09 12:53 ` [PATCH v6 3/8] PCI: endpoint: Add auxiliary resource query API Koichiro Den
2026-02-09 15:59   ` Frank Li
2026-02-09 12:53 ` [PATCH v6 4/8] PCI: dwc: Record integrated eDMA register window Koichiro Den
2026-02-09 12:53 ` [PATCH v6 5/8] PCI: dwc: ep: Report integrated eDMA resources via EPC aux-resource API Koichiro Den
2026-02-09 12:53 ` [PATCH v6 6/8] PCI: endpoint: pci-epf-test: Don't free doorbell IRQ unless requested Koichiro Den
2026-02-09 15:57   ` Frank Li
2026-02-10  1:54     ` Koichiro Den
2026-02-10 12:36   ` Niklas Cassel
2026-02-10 13:54     ` Koichiro Den
2026-02-10 16:38       ` Niklas Cassel
2026-02-11 16:08         ` Koichiro Den
2026-02-09 12:53 ` [PATCH v6 7/8] PCI: endpoint: pci-ep-msi: Fix error unwind and prevent double alloc Koichiro Den
2026-02-09 15:53   ` Frank Li
2026-02-09 12:53 ` [PATCH v6 8/8] PCI: endpoint: pci-ep-msi: Add embedded doorbell fallback Koichiro Den
2026-02-09 15:51   ` Frank Li
2026-02-10  2:10     ` Koichiro Den
2026-02-10 15:16       ` Frank Li
2026-02-10 12:24 ` [PATCH v6 0/8] " Niklas Cassel
2026-02-10 14:07   ` Koichiro Den
2026-02-10 16:30     ` Niklas Cassel
2026-02-11 15:57       ` Koichiro Den
2026-02-11 16:52         ` Niklas Cassel [this message]
2026-02-12  3:26           ` Koichiro Den
2026-02-12 10:26             ` Niklas Cassel
2026-02-12 15:14               ` Koichiro Den
2026-02-12 15:38                 ` Niklas Cassel
2026-02-12 16:31         ` 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=aYyz5WF_iJuNwA35@ryzen \
    --to=cassel@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=allenbh@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=den@valinux.co.jp \
    --cc=dmaengine@vger.kernel.org \
    --cc=jdmason@kudzu.us \
    --cc=jingoohan1@gmail.com \
    --cc=kishon@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mmaddireddy@nvidia.com \
    --cc=ntb@lists.linux.dev \
    --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