Re: [PATCH v7 17/22] dma-direct: set decrypted flag for remapped DMA allocations
Jason Gunthorpe <[email protected]>
| Newsgroups | dev.linux.lists.linux-coco,dev.linux.lists.iommu,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-s390,org.ozlabs.lists.linuxppc-dev |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jul 01, 2026 at 11:19:21AM +0530, Aneesh Kumar K.V (Arm) wrote: > Devices that are DMA non-coherent and require a remap were skipping > dma_set_decrypted(), leaving DMA buffers encrypted even when the device > requires unencrypted access. Move the call after the if (remap) branch > so that both the direct and remapped allocation paths correctly mark the > allocation as decrypted (or fail cleanly) before use. > > Fix dma_direct_alloc() and dma_direct_free() to apply set_memory_*() to the > linear-map alias of the backing pages instead of the remapped CPU address. > Also disallow highmem pages for __DMA_ATTR_ALLOC_CC_SHARED, because highmem > buffers do not provide a usable linear-map address. > > Tested-by: Jiri Pirko <[email protected]> > Tested-by: Michael Kelley <[email protected]> > Tested-by: Mostafa Saleh <[email protected]> > Signed-off-by: Aneesh Kumar K.V (Arm) <[email protected]> > --- > kernel/dma/direct.c | 56 +++++++++++++++++++++++++++++++++++---------- > 1 file changed, 44 insertions(+), 12 deletions(-) Reviewed-by: Jason Gunthorpe <[email protected]> Jason