From: Damien Le Moal <dlemoal@kernel.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: "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>,
"Niklas Cassel" <cassel@kernel.org>
Subject: Re: [PATCH v6 0/6] Improve PCI memory mapping API
Date: Sat, 12 Oct 2024 21:03:22 +0900 [thread overview]
Message-ID: <94bbd606-86c5-470f-80c2-6db3bc0f1d9a@kernel.org> (raw)
In-Reply-To: <20241012115737.qxwnsxy6pts6iyza@thinkpad>
On 10/12/24 20:57, Manivannan Sadhasivam wrote:
> On Sat, Oct 12, 2024 at 08:32:40PM +0900, Damien Le Moal wrote:
>> This series introduces the new functions pci_epc_mem_map() and
>> pci_epc_mem_unmap() to improve handling of the PCI address mapping
>> alignment constraints of endpoint controllers in a controller
>> independent manner.
>>
>> The issue fixed is that the fixed alignment defined by the "align" field
>> of struct pci_epc_features is defined for inbound ATU entries (e.g.
>> BARs) and is a fixed value, whereas some controllers need a PCI address
>> alignment that depends on the PCI address itself. For instance, the
>> rk3399 SoC controller in endpoint mode uses the lower bits of the local
>> endpoint memory address as the lower bits for the PCI addresses for data
>> transfers. That is, when mapping local memory, one must take into
>> account the number of bits of the RC PCI address that change from the
>> start address of the mapping.
>>
>> To fix this, the new endpoint controller method .align_addr is
>> introduced and called from the new pci_epc_mem_map() function. This
>> method is optional and for controllers that do not define it, it is
>> assumed that the controller has no PCI address constraint.
>>
>> The functions pci_epc_mem_map() is a helper function which obtains
>> the mapping information, allocates endpoint controller memory according
>> to the mapping size obtained and maps the memory. pci_epc_mem_unmap()
>> unmaps and frees the endpoint memory.
>>
>> This series is organized as follows:
>> - Patch 1 introduces a small helper to clean up the epc core code
>> - Patch 2 improves pci_epc_mem_alloc_addr()
>> - Patch 3 introduce the new align_addr() endpoint controller method
>> and the epc functions pci_epc_mem_map() and pci_epc_mem_unmap().
>> - Patch 4 documents these new functions.
>> - Patch 5 modifies the test endpoint function driver to use
>> pci_epc_mem_map() and pci_epc_mem_unmap() to illustrate the use of
>> these functions.
>> - Finally, patch 6 implements the RK3588 endpoint controller driver
>> .align_addr() operation to satisfy that controller PCI address
>> alignment constraint.
>>
>> This patch series was tested using the pci endpoint test driver (as-is
>> and a modified version removing memory allocation alignment on the host
>> side) as well as with a prototype NVMe endpoint function driver (where
>> data transfers use addresses that are never aligned to any specific
>> boundary).
>>
>
> Applied to pci/endpoint!
Awesome ! Thanks a lot !
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2024-10-12 12:03 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 [this message]
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
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=94bbd606-86c5-470f-80c2-6db3bc0f1d9a@kernel.org \
--to=dlemoal@kernel.org \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=corbet@lwn.net \
--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).