mbox series

[RFC,0/3] Deal with alignment restriction on EP side

Message ID 20230113090350.1103494-1-mie@igel.co.jp (mailing list archive)
Headers show
Series Deal with alignment restriction on EP side | expand

Message

Shunsuke Mie Jan. 13, 2023, 9:03 a.m. UTC
Some PCIe EPC controllers have restriction to map PCIe address space to the
local memory space. The mapping is needed to access memory of other side.
On epf test, RC module prepares an aligned memory, and EP module maps the
region. However, a EP module which emulate a device (e.g. VirtIO, NVMe and
etc) cannot expect that a driver for the device prepares an aligned memory.
So, a EP side should deal with the alignment restriction.

This patchset addresses with the alignment restriction on EP size. A
content as follows:
1. Improve a pci epc unmap/map functions to cover the alignment restriction
with adding epc driver support as EPC ops.
2. Implement the support function for DWC EPC driver.
3. Adapt the pci-epf-test to the map/unmap function updated at first patch.

I tested this changes on RENESAS board has DWC PCIeC.

This is a RFC, and it has patches for testing only. Following changes are
not included yet:
1. Removing alignment codes on RC side completely
2. Adapting map/unmap() changes to pci-epf-ntb/vntb

Best,
Shunsuke

Shunsuke Mie (3):
  PCI: endpoint: support an alignment aware map/unmaping
  PCI: dwc: support align_mem() callback for pci_epc_epc
  PCI: endpoint: support pci_epc_mem_map/unmap API changes

 .../pci/controller/dwc/pcie-designware-ep.c   | 13 +++
 drivers/pci/endpoint/functions/pci-epf-test.c | 89 +++++--------------
 drivers/pci/endpoint/pci-epc-core.c           | 57 +++++++++---
 include/linux/pci-epc.h                       | 10 ++-
 4 files changed, 90 insertions(+), 79 deletions(-)

Comments

Bjorn Helgaas Jan. 17, 2023, 8:32 p.m. UTC | #1
On Fri, Jan 13, 2023 at 06:03:47PM +0900, Shunsuke Mie wrote:
> Some PCIe EPC controllers have restriction to map PCIe address space to the
> local memory space. The mapping is needed to access memory of other side.
> On epf test, RC module prepares an aligned memory, and EP module maps the
> region. However, a EP module which emulate a device (e.g. VirtIO, NVMe and
> etc) cannot expect that a driver for the device prepares an aligned memory.
> So, a EP side should deal with the alignment restriction.
> 
> This patchset addresses with the alignment restriction on EP size. A
> content as follows:
> 1. Improve a pci epc unmap/map functions to cover the alignment restriction
> with adding epc driver support as EPC ops.
> 2. Implement the support function for DWC EPC driver.
> 3. Adapt the pci-epf-test to the map/unmap function updated at first patch.
> 
> I tested this changes on RENESAS board has DWC PCIeC.
> 
> This is a RFC, and it has patches for testing only. Following changes are
> not included yet:
> 1. Removing alignment codes on RC side completely
> 2. Adapting map/unmap() changes to pci-epf-ntb/vntb
> 
> Best,
> Shunsuke
> 
> Shunsuke Mie (3):
>   PCI: endpoint: support an alignment aware map/unmaping
>   PCI: dwc: support align_mem() callback for pci_epc_epc
>   PCI: endpoint: support pci_epc_mem_map/unmap API changes

s/unmaping/unmapping/

Capitalize subject lines ("Support ...").

Would be nice to say something more specific than "support ... API
changes."

The last patch seems to be for a test case.  Some previous changes to
it use the "PCI: pci-epf-test" prefix so it's distinct from the
pci-epc-core changes.

>  .../pci/controller/dwc/pcie-designware-ep.c   | 13 +++
>  drivers/pci/endpoint/functions/pci-epf-test.c | 89 +++++--------------
>  drivers/pci/endpoint/pci-epc-core.c           | 57 +++++++++---
>  include/linux/pci-epc.h                       | 10 ++-
>  4 files changed, 90 insertions(+), 79 deletions(-)
> 
> -- 
> 2.25.1
>
Shunsuke Mie Jan. 18, 2023, 10:17 a.m. UTC | #2
On 2023/01/18 5:32, Bjorn Helgaas wrote:
> On Fri, Jan 13, 2023 at 06:03:47PM +0900, Shunsuke Mie wrote:
>> Some PCIe EPC controllers have restriction to map PCIe address space to the
>> local memory space. The mapping is needed to access memory of other side.
>> On epf test, RC module prepares an aligned memory, and EP module maps the
>> region. However, a EP module which emulate a device (e.g. VirtIO, NVMe and
>> etc) cannot expect that a driver for the device prepares an aligned memory.
>> So, a EP side should deal with the alignment restriction.
>>
>> This patchset addresses with the alignment restriction on EP size. A
>> content as follows:
>> 1. Improve a pci epc unmap/map functions to cover the alignment restriction
>> with adding epc driver support as EPC ops.
>> 2. Implement the support function for DWC EPC driver.
>> 3. Adapt the pci-epf-test to the map/unmap function updated at first patch.
>>
>> I tested this changes on RENESAS board has DWC PCIeC.
>>
>> This is a RFC, and it has patches for testing only. Following changes are
>> not included yet:
>> 1. Removing alignment codes on RC side completely
>> 2. Adapting map/unmap() changes to pci-epf-ntb/vntb
>>
>> Best,
>> Shunsuke
>>
>> Shunsuke Mie (3):
>>    PCI: endpoint: support an alignment aware map/unmaping
>>    PCI: dwc: support align_mem() callback for pci_epc_epc
>>    PCI: endpoint: support pci_epc_mem_map/unmap API changes
> s/unmaping/unmapping/
>
> Capitalize subject lines ("Support ...").
>
> Would be nice to say something more specific than "support ... API
> changes."
I'll reflect this remarks.
>
> The last patch seems to be for a test case.  Some previous changes to
> it use the "PCI: pci-epf-test" prefix so it's distinct from the
> pci-epc-core changes.
I'll follow the previous changes.
>>   .../pci/controller/dwc/pcie-designware-ep.c   | 13 +++
>>   drivers/pci/endpoint/functions/pci-epf-test.c | 89 +++++--------------
>>   drivers/pci/endpoint/pci-epc-core.c           | 57 +++++++++---
>>   include/linux/pci-epc.h                       | 10 ++-
>>   4 files changed, 90 insertions(+), 79 deletions(-)
>>
>> -- 
>> 2.25.1
>>
Best,

Shunsuke