Re: [PATCH v2 0/3] PCI: endpoint: Add PCI DMA endpoint function (part 3/3)
From: Niklas Cassel
Date: Tue May 26 2026 - 04:28:33 EST
On Tue, May 26, 2026 at 03:23:57PM +0900, Koichiro Den wrote:
> On Tue, May 26, 2026 at 07:35:06AM +0200, Niklas Cassel wrote:
>
> Yes, I also think the architecture of this series is much cleaner. The option 2
> series may look like it overloads and complicates vNTB a bit too much, and the
> auxiliary device created from ntb_hw_epf only for the channel delegation purpose
> may look awkward to some.
>
> The coverage concern is a real downside of this direction though. This is a
> trade-off between a cleaner PCI/DMA model and broader EPC coverage. On my side,
> R-Car Gen4+ is the main target, so the multi-function requirement is acceptable.
> In that sense, I am also curious whether future DWC-based SoCs will typically
> support more than one function or not.
It seems that the number of supported physical functions is controlled by
the configurable PCIe IP-core synthesize parameter CX_NFUNC.
Looking at the code, if the device tree property 'max-functions' is missing,
it will set epc->max_functions to 1:
$ git show f8aed6ec624f
It has been like this since the initial EP support in the DWC driver, added
in 2017.
However, a missing 'max-functions' device tree property does not necessarily
mean that the IP-core was configured with CX_NFUNC == 1.
Right now, I don't see any register to get CX_NFUNC.
Perhaps it is possible to write some code that figures out CX_NFUNC, by
writing different values to the iATU registers, somewhat similar to how we
detect the number of inbound and outbound iATUs:
https://github.com/torvalds/linux/blob/v7.1-rc5/drivers/pci/controller/dwc/pcie-designware.c#L998-L1001
I added EP mode support for the pcie-dw-rockchip driver, but I don't know
the CX_NFUNC parameter value, so I could not add a 'max-functions' property.
While it is possible that some DWC-based PCIe endpoint controllers are
configured with CX_NFUNC == 1, it is also possible that some people simply
did now add a 'max-functions' property, because they did not know the CX_NFUNC
value, just like me.
Shawn Lin, do you perhaps know the CX_NFUNC value for rk3588 and rk3568 ?
Kind regards,
Niklas