devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Manivannan Sadhasivam" <mani@kernel.org>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Chester Lin" <chester62515@gmail.com>,
	"Matthias Brugger" <mbrugger@suse.com>,
	"Ghennadi Procopciuc" <ghennadi.procopciuc@oss.nxp.com>,
	"NXP S32 Linux Team" <s32@nxp.com>,
	bhelgaas@google.com, jingoohan1@gmail.com,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	krzk+dt@kernel.org, "Conor Dooley" <conor+dt@kernel.org>,
	Ionut.Vicovan@nxp.com, "Larisa Grigore" <larisa.grigore@nxp.com>,
	"Ghennadi Procopciuc" <Ghennadi.Procopciuc@nxp.com>,
	ciprianmarian.costea@nxp.com,
	"Bogdan Hamciuc" <bogdan.hamciuc@nxp.com>,
	"Frank Li" <Frank.li@nxp.com>,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, "Niklas Cassel" <cassel@kernel.org>
Subject: Re: [PATCH 1/3 v2] dt-bindings: PCI: s32g: Add NXP PCIe controller
Date: Thu, 09 Oct 2025 23:16:02 +0200	[thread overview]
Message-ID: <839e3878-ae62-4c8b-a74b-ac4f6f060d98@app.fastmail.com> (raw)
In-Reply-To: <4kvo2qg2til22hlssv7lt2ugo63emr5c4hfjur5m3vnxvpdekx@jcbhaxb2d2j2>

On Thu, Oct 9, 2025, at 20:47, Manivannan Sadhasivam wrote:
> On Wed, Oct 08, 2025 at 07:56:44PM +0200, Arnd Bergmann wrote:
>> On Wed, Oct 8, 2025, at 17:19, Manivannan Sadhasivam wrote:
>>
>> That is not my impression from reading the code: At least for
>> the case where both devices are on the same bridge and they
>> use map_type=PCI_P2PDMA_MAP_BUS_ADDR, I would expect the DMA
>> to use the plain PCI bus address, not going through the
>> dma-ranges+ranges translation that would apply when they are
>> on different host bridges.
>> 
>
> Right, but I don't get the overlap issue still. If the P2P client triggers a
> write to a P2P PCI address (let's assume 0x8000_0000), and if that address
> belongs to a an endpoint in a different domain, the host bridge should still
> forward it to the endpoint without triggering write to the RAM.

If 0x8000_0000 is an endpoint in a different domain, I would expect the
DMA transfer to go to the RAM at that address since the DMA has to leave
the PCI host bridge upstream by following its inbound windows.

This is not the problem I'm talking about though, since cross-domain
P2P is not particularly well-defined.

> Atleast, I don't see any concern from the outbound memory translation point of
> view.
>
> Please let me know if there is any gap in my understanding.

To clarify: I don't think that programming the output translation this
way is the problem here, but assigning memory resources to ambiguous
addresses is. The host bridge probe uses the 'ranges' both for
setting up the outbound window and the bus resources. 

If the PCI bus scan assigns address 0x8000_0000 to the memory BAR
of a device, and that device or any other one in the /same/
domain tries to DMA to DRAM at address 0x8000_0000, it would likely
reach the memory BAR instead of DRAM. If for some reason it does reach
DRAM after all, it would be unable to do a P2P DMA into the BAR when
it tries.

If the PCI scan already checks for overlap between the DT "ranges"
and other resources (DRAM or MMIO) before assigning a BAR, this may
be a non-issue, but I haven't found the code that does this.
Looking at pci_bus_allocate_dev_resources() it seems that it would
attempt to assign an overlapping address to a BAR but then fail
to claim it because of the resource conflict. If that is the
case, it would not actually have an ambiguous DMA routing
but instead the device would fail to be probed because of the
conflict.

    Arnd

  reply	other threads:[~2025-10-09 21:16 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 15:58 [PATCH 0/4 v2] PCI: s32g: Add support for PCIe controller Vincent Guittot
2025-09-19 15:58 ` [PATCH 1/3 v2] dt-bindings: PCI: s32g: Add NXP " Vincent Guittot
2025-09-19 16:39   ` Frank Li
2025-09-23 14:49     ` Vincent Guittot
2025-09-23 16:28       ` Frank Li
2025-09-22  6:21   ` Manivannan Sadhasivam
2025-09-23 17:40     ` Vincent Guittot
2025-10-07 15:41     ` Lorenzo Pieralisi
2025-10-07 22:28       ` Manivannan Sadhasivam
2025-10-08  8:26         ` Arnd Bergmann
2025-10-08  8:35           ` Arnd Bergmann
2025-10-08 15:19             ` Manivannan Sadhasivam
2025-10-08 17:56               ` Arnd Bergmann
2025-10-09 18:47                 ` Manivannan Sadhasivam
2025-10-09 21:16                   ` Arnd Bergmann [this message]
2025-10-17 15:12                     ` Manivannan Sadhasivam
2025-10-08 15:14           ` Manivannan Sadhasivam
2025-09-19 15:58 ` [PATCH 2/3 v2] PCI: s32g: Add initial PCIe support (RC) Vincent Guittot
2025-09-19 17:03   ` [External] : " ALOK TIWARI
2025-09-19 18:37   ` Frank Li
2025-09-25 17:09     ` Vincent Guittot
2025-09-22  4:07   ` kernel test robot
2025-09-22  7:56   ` Manivannan Sadhasivam
2025-09-25 16:52     ` Vincent Guittot
2025-09-29 13:57       ` Manivannan Sadhasivam
2025-09-29 16:23         ` Vincent Guittot
2025-09-29 16:32           ` Manivannan Sadhasivam
2025-09-30 16:11             ` Vincent Guittot
2025-09-22 14:52   ` Rob Herring
2025-09-25 16:56     ` Vincent Guittot
2025-09-25 19:15     ` Bjorn Helgaas
2025-09-26 14:18       ` Rob Herring
2025-09-19 15:58 ` [PATCH 3/3 v2] MAINTAINERS: Add MAINTAINER for NXP S32G PCIe driver Vincent Guittot
2025-09-19 16:58   ` Frank Li
2025-09-25 17:16     ` Vincent Guittot

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=839e3878-ae62-4c8b-a74b-ac4f6f060d98@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=Frank.li@nxp.com \
    --cc=Ghennadi.Procopciuc@nxp.com \
    --cc=Ionut.Vicovan@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=bogdan.hamciuc@nxp.com \
    --cc=cassel@kernel.org \
    --cc=chester62515@gmail.com \
    --cc=ciprianmarian.costea@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ghennadi.procopciuc@oss.nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=jingoohan1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=larisa.grigore@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mbrugger@suse.com \
    --cc=robh@kernel.org \
    --cc=s32@nxp.com \
    --cc=vincent.guittot@linaro.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;
as well as URLs for NNTP newsgroup(s).