All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mostafa Saleh <smostafa@google.com>
To: Timo Witte <timo.witte@gmail.com>
Cc: iommu@lists.linux.dev
Subject: Re: [BUG] iommu/dma: "Not yet supported" CC_SHARED rejection regresses dma_alloc_attrs() on SME hosts with IOMMU-attached GPUs (commit 8277a12d0d60)
Date: Wed, 2 Sep 2026 10:20:00 +0000	[thread overview]
Message-ID: <apf4UNuGx-jWd8jH@google.com> (raw)
In-Reply-To: <CANB4YXS=Nf-co3t8eMHtqrW4sn=1BDcP6o=EoTrgZm0WYMYTyw@mail.gmail.com>

On Tue, Sep 01, 2026 at 11:09:03PM +0200, Timo Witte wrote:
> 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 believe that is the way forward, but as the merge window is closed
it won't be possible to land something that big in 7.3, we would
need a fix for the regression for now.

I think your suggestion works be clearing the __DMA_ATTR_ALLOC_CC_SHARED
from iommu_dma_alloc() but no need to remove the rejection then.

Otherwise, force_dma_unencrypted() can check something as
use_dma_iommu() but that feels like the wrong place, as the HW does
need to decrypt the memory and dma-iommu would be the one knowing
how to do that.

So, I'd suggest you send a patch with your fix.

Thanks,
Mostafa

> 
> 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.
> 

  reply	other threads:[~2026-09-02 10:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=apf4UNuGx-jWd8jH@google.com \
    --to=smostafa@google.com \
    --cc=iommu@lists.linux.dev \
    --cc=timo.witte@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.