Re: [PATCH v4 04/14] PCI/P2PDMA: Clear ACS P2P flags for all devices behind switches

From: Logan Gunthorpe
Date: Fri May 11 2018 - 11:49:02 EST


On 5/11/2018 2:52 AM, Christian KÃnig wrote:
This only works when the IOVA and the PCI bus addresses never overlap. I'm not sure how the IOVA allocation works but I don't think we guarantee that on Linux.

I find this hard to believe. There's always the possibility that some part of the system doesn't support ACS so if the PCI bus addresses and IOVA overlap there's a good chance that P2P and ATS won't work at all on some hardware.


If we really want to enable P2P without ATS and IOMMU enabled I think we should probably approach it like this:

a) Make double sure that IOVA in an IOMMU group never overlap with PCI BARs in that group.

b) Add configuration options to put a whole PCI branch of devices (e.g. a bridge) into a single IOMMU group.

c) Add a configuration option to disable the ACS bit on bridges in the same IOMMU group.

I think a configuration option to manage IOMMU groups as you suggest would be a very complex interface and difficult to implement. I prefer the option to disable the ACS bit on boot and let the existing code put the devices into their own IOMMU group (as it should already do to support hardware that doesn't have ACS support).

Logan