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

From: Michael Kelley

Date: Tue Sep 08 2026 - 14:11:47 EST


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.

Michael

> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@xxxxxxxxxx>
> ---
> arch/x86/mm/mem_encrypt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)