drm+dma: cache support for arm, etc
Sorry if the style is messed up, replying from my phone.
Am 15.08.2019 20:27 schrieb Christoph Hellwig <[email protected]>:
Quoted 7 lines · Christian
Quoted 5 lines
(2) Add support for
DMA_ATTR_NO_KERNEL_MAPPINGto this new API instead ofdma_alloc_attrs. The initial difference with that flag is just that we allow highmem, but in the future we could also unmap this memory from the kernel linear mapping entirely on architectures where we can easily do that.Mhm, why would we want to do this?
To avoid the CPU misspeculating into this memory. For example NVMe SSDs have a feature called host memory buffer that is a lot like your stolen main ram for the GPU case. We currently hand the SSD a DMA_ATTR_NO_KERNEL_MAPPING allocation if it requests such a buffer. If possible we'd really like to make sure no speculative execution bug (or intentional attacker with a kernel exploit for that matter) can easily access that memory.
Well, for the graphics case I absolutely need to keep the linear kernel mapping. Because for certain use cases the memory is accessed by the kernel all the time as well.
Why should accessing uncached memory be more of a security problem than accessing cached?
Regards,
Christian
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 215e5cb7-0fcf-48db-a656-817054dde420-2ueSQiBKiTY7tOexoI0I+QC/[email protected]
Quoted 1 line · Christian
Well, for the graphics case I absolutely need to keep the linear kernel mapping. Because for certain use cases the memory is accessed by the kernel all the time as well.
Then don't set DMA_ATTR_NO_KERNEL_MAPPING. At least for x86 and arm64 we should be able to support uncached allocations easily even without that, and I plan to support that for your use case. But if the driver is explicitly saying it doesn't want a permanent kernel mapping it makes sense to (optionally if the architecture can easily do it) unmap the memory from the kernel linear mapping.
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno