Linux IOMMU Development
 help / color / mirror / Atom feed
* [BUG] iommu/dma: "Not yet supported" CC_SHARED rejection regresses dma_alloc_attrs() on SME hosts with IOMMU-attached GPUs (commit 8277a12d0d60)
@ 2026-09-01 21:09 Timo Witte
  2026-09-02 10:20 ` Mostafa Saleh
  0 siblings, 1 reply; 9+ messages in thread
From: Timo Witte @ 2026-09-01 21:09 UTC (permalink / raw)
  To: iommu

Commit 8277a12d0d60 ("dma-pool: track decrypted atomic pools and select
them via attrs") added to iommu_dma_alloc():

    /* Not yet supported */
    if (is_alloc_cc_shared)
        return NULL;

dma_alloc_attrs() auto-sets __DMA_ATTR_ALLOC_CC_SHARED whenever
force_dma_unencrypted() is true. On an SME host (mem_encrypt=on) an AMD
GPU with a 44-bit DMA mask hits that condition, so every GTT (system-RAM)
allocation fails with NULL/-ENOMEM, amdgpu init aborts and the system
boots without a display.
IOMMU in Translated/DMA-FQ mode (iommu group 29).

Before the mentioned patch it worked: the IOMMU PTE carries the SME C-bit,
so the memory controller transparently decrypts for the device while pages stay
encrypted at rest. For IOMMU-backed devices force_dma_unencrypted() is a
false positive - the device DMA mask does not limit addressing once the
IOMMU translates, so CC_SHARED should not be auto-set for them.

When i remove the rejection and clear __DMA_ATTR_ALLOC_CC_SHARED
in iommu_dma_alloc(), so encrypted pages are mapped with the C-bit and
everything works again.

Maybe we can implement real CC_SHARED support in the IOMMU path,
so SEV + IOMMU works on x86?

I already reported this in the amdgpu driver:
https://gitlab.freedesktop.org/drm/amd/-/work_items/5735
But i think it should be fixed in the iommu code as it's a regression.

^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <CANB4YXR7h8V5Xp=MXVZeSdvw9UiriSagp=E+ju5RRDNghoPHLQ@mail.gmail.com>]

end of thread, other threads:[~2026-09-09 11:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 21:09 [BUG] iommu/dma: "Not yet supported" CC_SHARED rejection regresses dma_alloc_attrs() on SME hosts with IOMMU-attached GPUs (commit 8277a12d0d60) Timo Witte
2026-09-02 10:20 ` Mostafa Saleh
     [not found] <CANB4YXR7h8V5Xp=MXVZeSdvw9UiriSagp=E+ju5RRDNghoPHLQ@mail.gmail.com>
2026-09-02  9:59 ` Aneesh Kumar K.V
2026-09-02 10:15 ` Aneesh Kumar K.V
2026-09-02 18:26   ` Deucher, Alexander
2026-09-07  8:25     ` Marek Szyprowski
2026-09-07 13:55       ` Aneesh Kumar K.V
2026-09-07 20:35         ` Timo Witte
2026-09-09 11:26     ` Vasant Hegde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox