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

From: Logan Gunthorpe
Date: Thu May 10 2018 - 13:16:17 EST




On 10/05/18 11:11 AM, Stephen Bates wrote:
>> Not to me. In the p2pdma code we specifically program DMA engines with
>> the PCI bus address.
>
> Ah yes of course. Brain fart on my part. We are not programming the P2PDMA initiator with an IOVA but with the PCI bus address...
>
>> So regardless of whether we are using the IOMMU or
>> not, the packets will be forwarded directly to the peer. If the ACS
>> Redir bits are on they will be forced back to the RC by the switch and
>> the transaction will fail. If we clear the ACS bits, the TLPs will go
>> where we want and everything will work (but we lose the isolation of ACS).
>
> Agreed.
>
>> For EPs that support ATS, we should (but don't necessarily have to)
>> program them with the IOVA address so they can go through the
>> translation process which will allow P2P without disabling the ACS Redir
>> bits -- provided the ACS direct translation bit is set. (And btw, if it
>> is, then we lose the benefit of ACS protecting against malicious EPs).
>> But, per above, the ATS transaction should involve only the IOVA address
>> so the ACS bits not being set should not break ATS.
>
> Well we would still have to clear some ACS bits but now we can clear only for translated addresses.

We don't have to clear the ACS Redir bits as we did in the first case.
We just have to make sure the ACS Direct Translated bit is set.

Logan