Re: [PATCH v2 08/18] PCI/CMA: Authenticate devices on enumeration

Alexey Kardashevskiy
2024-07-23T04:26:40Z

On 22/7/24 22:06, Jason Gunthorpe wrote:
> On Mon, Jul 22, 2024 at 08:19:23PM +1000, Alexey Kardashevskiy wrote:
>
>> If there is vIOMMU, then the driver in the VM can decide whether it wants
>> private or shared memory for DMA, pass that new flag to dma_map() and 1)
>> have DMA memory allocated from the private pool (== no page state changes)
>> and 2) have C-bit set in the vIOMMU page table (which is in the VM memory).
>
> Not all HW supports a flow like that.

Fair point but still, under what imaginary circumstance a driver could
decide to flip T=0/1 when up and running?

>> My V1 says "all IOVA below X are private and above - shared" (which is a hw
>> knob in absence of vIOMMU) and I set the X to all '1's just to mark it all
>> private.
> Is that portable to other implementations?

Well, when used as a big knob - 0 or the max (== flip private/shared),
then yes :)

--
Alexey