Thread (67 messages) 67 messages, 6 authors, 9d ago

Re: [PATCH v4 04/13] dma: swiotlb: track pool encryption state and honor DMA_ATTR_CC_SHARED

From: Mostafa Saleh <smostafa@google.com>
Date: 2026-05-21 17:06:25
Also in: linux-arm-kernel, linux-coco, linux-iommu, linux-s390, lkml

On Tue, May 12, 2026 at 10:05 AM Aneesh Kumar K.V (Arm)
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
@@ -1411,6 +1436,16 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr,
        if (cc_platform_has(CC_ATTR_MEM_ENCRYPT))
                pr_warn_once("Memory encryption is active and system is using DMA bounce buffers\n");

+       /*
+        * if we are trying to swiotlb map a decrypted paddr or the paddr is encrypted
+        * but the device is forcing decryption, use decrypted io_tlb_mem
+        */
+       if ((attrs & DMA_ATTR_CC_SHARED) || force_dma_unencrypted(dev))
I don't think swiotlb needs to know about force_dma_unencrypted(), the
dma/direct caller should have all the information to pass the
appropriate flags.

Thanks.
Mostafa
+               require_decrypted = true;
+
+       if (require_decrypted != mem->unencrypted)
+               return (phys_addr_t)DMA_MAPPING_ERROR;
+
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help