Re: [PATCH] x86/mm: Don't force unencrypted DMA for IOMMU-backed devices

From: Marek Szyprowski

Date: Tue Sep 08 2026 - 10:32:28 EST


On 08.09.2026 16:24, Michael Kelley wrote:
> From: Aneesh Kumar K.V (Arm) <aneesh.kumar@xxxxxxxxxx> Sent: Tuesday, September 8, 2026 4:33 AM
>> Commit 8277a12d0d60 ("dma-pool: track decrypted atomic pools and select
>> them via attrs") exposed an issue with force_dma_unencrypted() on
>> systems using host memory encryption.
>>
>> force_dma_unencrypted() checks whether the device DMA mask can address
>> the encryption bit and, if not, requires DMA allocations to use
>> unencrypted memory. However, this check is not applicable when the
>> device is using the IOMMU. In that case, the device DMA mask constrains
>> the IOVA seen by the device, not the backing physical address, so it
>> does not need to cover the C-bit.
>>
>> This currently causes dma_alloc_attrs() to set
>> __DMA_ATTR_ALLOC_CC_SHARED for such devices. iommu_dma_alloc() does not
>> support that attribute and rejects the allocation, causing DMA
>> allocations to fail.
>>
>> Do not force DMA allocations to be unencrypted when the device is using
>> the IOMMU. This allows the IOMMU to map the encrypted physical pages as
>> before and avoids incorrectly requesting CC_SHARED allocations.
>>
>> Fixes: 8277a12d0d60 ("dma-pool: track decrypted atomic pools and select them via attrs")
>> Reported-by: Timo Witte <timo.witte@xxxxxxxxx>
>> Link: https://lore.kernel.org/all/CANB4YXR7h8V5Xp=MXVZeSdvw9UiriSagp=E+ju5RRDNghoPHLQ@xxxxxxxxxxxxxx
> There seems to be something wrong with this link. Just viewing the
> email thread in lore.kernel.org shows a [not found] error in the thread.

Indeed, this one works better:

https://lore.kernel.org/all/CANB4YXS=Nf-co3t8eMHtqrW4sn=1BDcP6o=EoTrgZm0WYMYTyw@xxxxxxxxxxxxxx/

I will amend it while applying, but I want give everyone some time for comments.

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland