From: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
To: Timo Witte <timo.witte@gmail.com>, iommu@lists.linux.dev
Cc: m.szyprowski@samsung.com,
"robin.murphy@arm.com" <robin.murphy@arm.com>,
joro@8bytes.org,
"alexander.deucher@amd.com" <alexander.deucher@amd.com>
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, 02 Sep 2026 15:45:36 +0530 [thread overview]
Message-ID: <yq5ao6egyn5j.fsf@kernel.org> (raw)
In-Reply-To: <CANB4YXR7h8V5Xp=MXVZeSdvw9UiriSagp=E+ju5RRDNghoPHLQ@mail.gmail.com>
Timo Witte <timo.witte@gmail.com> writes:
> 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.
>
This means that, with host memory encryption, DMA does not need to be
forced unencrypted when the device uses the IOMMU?
modified arch/x86/mm/mem_encrypt.c
@@ -13,6 +13,7 @@
#include <linux/cc_platform.h>
#include <linux/mem_encrypt.h>
#include <linux/virtio_anchor.h>
+#include <linux/iommu-dma.h>
#include <asm/sev.h>
@@ -30,7 +31,7 @@ bool force_dma_unencrypted(struct device *dev)
* device does not support DMA to addresses that include the
* encryption mask.
*/
- if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
+ if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) && !use_dma_iommu(dev)) {
u64 dma_enc_mask = DMA_BIT_MASK(__ffs64(sme_me_mask));
u64 dma_dev_mask = min_not_zero(dev->coherent_dma_mask,
dev->bus_dma_limit);
-aneesh
next prev parent reply other threads:[~2026-09-02 10:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CANB4YXR7h8V5Xp=MXVZeSdvw9UiriSagp=E+ju5RRDNghoPHLQ@mail.gmail.com>
2026-09-02 9:59 ` [BUG] iommu/dma: "Not yet supported" CC_SHARED rejection regresses dma_alloc_attrs() on SME hosts with IOMMU-attached GPUs (commit 8277a12d0d60) Aneesh Kumar K.V
2026-09-02 10:15 ` Aneesh Kumar K.V [this message]
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
2026-09-01 21:09 Timo Witte
2026-09-02 10:20 ` Mostafa Saleh
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=yq5ao6egyn5j.fsf@kernel.org \
--to=aneesh.kumar@kernel.org \
--cc=alexander.deucher@amd.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
--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.