linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Niklas Cassel <cassel@kernel.org>
Cc: "Bjorn Helgaas" <helgaas@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	linux-pci@vger.kernel.org,
	"Rick Wertenbroek" <rick.wertenbroek@gmail.com>
Subject: Re: [PATCH v6 0/6] Improve PCI memory mapping API
Date: Wed, 23 Oct 2024 07:12:40 +0900	[thread overview]
Message-ID: <edacb9ce-8cba-4017-9c1a-c010d5d930fc@kernel.org> (raw)
In-Reply-To: <20241022153033.uizmuvqzamfninlr@thinkpad>

On 10/23/24 00:30, Manivannan Sadhasivam wrote:
> On Tue, Oct 22, 2024 at 04:16:24PM +0200, Niklas Cassel wrote:
>> On Tue, Oct 22, 2024 at 07:26:31PM +0530, Manivannan Sadhasivam wrote:
>>> On Tue, Oct 22, 2024 at 10:38:58AM +0200, Niklas Cassel wrote:
>>>> On Tue, Oct 22, 2024 at 10:51:53AM +0900, Damien Le Moal wrote:
>>>>> On 10/22/24 07:19, Bjorn Helgaas wrote:
>>>>>> On Sat, Oct 12, 2024 at 08:32:40PM +0900, Damien Le Moal wrote:
>>>
>>>> However, if you think about a generic DMA controller, e.g. an ARM primecell
>>>> pl330, I don't see how it that DMA controller will be able to perform
>>>> transfers correctly if there is not an iATU mapping for the region that it
>>>> is reading/writing to.
>>>>
>>>
>>> I don't think the generic DMA controller can be used to read/write to remote
>>> memory. It needs to be integrated with the PCIe IP so that it can issue PCIe
>>> transactions.
>>
>> I'm not an expert, so I might of course be misunderstanding how things work.
>>
> 
> Neither am I :) I'm just sharing my understanding based on reading the DWC spec
> and open to get corrected if I'm wrong.
> 
>> When the CPU performs an AXI read/write to a MMIO address within the PCIe
>> controller (specifically the PCIe controller's outbound memory window),
>> the PCIe controller translates that incoming read/write to a read/write on the
>> PCIe bus.
>>
> 
> I don't think the *PCIe controller* translates the read/writes, but the iATU. If
> we use iATU, then the remote address needs to be mapped to the endpoint DDR and
> if CPU performs AXI read/write to that address, then iATU will translate the DDR
> address to remote address and then issue PCIe transactions (together with the
> PCIe controller).
> 
> And if DMA is used, then DMA controller can issue PCIe transactions to the
> remote memory itself (again, together with the PCIe controller). So no mapping
> is required here.

Caveat: DMA here cannot be the case "using the generic memory copy offload DMA
channel". It must be DMA driven by hardware rx/tx DMA channels. For memory copy
offload DMA channel, an EPF must map the address range to "DMA" to (which is
really memcpy_toio/fromio() but the DMA API will hide that...).

Would love to have so EPF wrapper API around all that mess to simplify EPF
drivers. They all end up having to do the exact same things.

> 
> - Mani
> 


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2024-10-22 22:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-12 11:32 [PATCH v6 0/6] Improve PCI memory mapping API Damien Le Moal
2024-10-12 11:32 ` [PATCH v6 1/6] PCI: endpoint: Introduce pci_epc_function_is_valid() Damien Le Moal
2024-10-12 11:32 ` [PATCH v6 2/6] PCI: endpoint: Improve pci_epc_mem_alloc_addr() Damien Le Moal
2024-10-12 11:32 ` [PATCH v6 3/6] PCI: endpoint: Introduce pci_epc_mem_map()/unmap() Damien Le Moal
2024-10-12 11:47   ` Manivannan Sadhasivam
2024-10-13  9:06   ` Niklas Cassel
2024-10-14 13:09     ` Damien Le Moal
2024-10-15  6:01       ` Manivannan Sadhasivam
2024-10-12 11:32 ` [PATCH v6 4/6] PCI: endpoint: Update documentation Damien Le Moal
2024-10-12 11:48   ` Manivannan Sadhasivam
2024-10-12 11:32 ` [PATCH v6 5/6] PCI: endpoint: test: Use pci_epc_mem_map/unmap() Damien Le Moal
2024-10-12 11:32 ` [PATCH v6 6/6] PCI: dwc: endpoint: Implement the pci_epc_ops::align_addr() operation Damien Le Moal
2024-10-12 11:53   ` Manivannan Sadhasivam
2024-10-12 11:57 ` [PATCH v6 0/6] Improve PCI memory mapping API Manivannan Sadhasivam
2024-10-12 12:03   ` Damien Le Moal
2024-10-21 22:19 ` Bjorn Helgaas
2024-10-22  1:51   ` Damien Le Moal
2024-10-22  8:38     ` Niklas Cassel
2024-10-22 11:57       ` Damien Le Moal
2024-10-22 13:56       ` Manivannan Sadhasivam
2024-10-22 14:16         ` Niklas Cassel
2024-10-22 15:18           ` Frank Li
2024-10-22 15:30           ` Manivannan Sadhasivam
2024-10-22 22:12             ` Damien Le Moal [this message]
2024-10-22 20:47     ` Bjorn Helgaas
2024-10-22 22:05       ` Damien Le Moal
2024-10-22 23:49         ` Bjorn Helgaas
2024-10-23  2:51           ` Damien Le Moal
2024-10-23  9:29             ` Niklas Cassel

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=edacb9ce-8cba-4017-9c1a-c010d5d930fc@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=corbet@lwn.net \
    --cc=helgaas@kernel.org \
    --cc=jingoohan1@gmail.com \
    --cc=kishon@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=rick.wertenbroek@gmail.com \
    --cc=robh@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;
as well as URLs for NNTP newsgroup(s).