From: Mario Limonciello <superm1@kernel.org>
To: Vasant Hegde <vasant.hegde@amd.com>,
iommu@lists.linux.dev, joro@8bytes.org
Cc: will@kernel.org, robin.murphy@arm.com,
suravee.suthikulpanit@amd.com,
Alex Deucher <alexander.deucher@amd.com>,
Akshata V Unkal <Akshata.VUnkal@amd.com>,
Nathan Blomquist <nblomquist@gmail.com>
Subject: Re: [PATCH] iommu/amd: Mark v2 page tables incoherent on Cezanne
Date: Fri, 20 Nov 2026 09:53:40 -0600 [thread overview]
Message-ID: <25b96bda-edb5-4baf-816c-cfb862b9243b@kernel.org> (raw)
In-Reply-To: <20261120152308.76894-1-vasant.hegde@amd.com>
On 11/20/26 09:23, Vasant Hegde wrote:
> DMA fails on Cezanne (family 19h, model 50h) when a device is placed in
> an IOMMU v2 paging domain due to missing coherency setting in IOMMU HW.
> The IOMMU walks v2 page tables without observing CPU writes still held
> in the cache. v1 PTEs have a Force Coherent bit, which the driver sets
> on every entry, but the v2 format has no equivalent bit, so v2 walks
> are not kept coherent.
>
> Set PT_FEAT_DMA_INCOHERENT for v2 domains on this CPU so the generic
> page-table code clflushes table memory before the IOMMU reads it.
>
Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/6081
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> Link: https://lore.kernel.org/linux-iommu/CACOV87VBwH+R3eSBEOuz8hk7OaT63+A9m6ipPSW5wt1VhHMFPg@mail.gmail.com/
> Cc: Mario Limonciello (AMD) <superm1@kernel.org>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Tested-by: Akshata V Unkal <Akshata.VUnkal@amd.com>
> Co-developed-by: Nathan Blomquist <nblomquist@gmail.com>
> Signed-off-by: Nathan Blomquist <nblomquist@gmail.com>
Much appreciated for all your help here Nathan, you did a great job
narrowing this down.
> Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
> ---
> drivers/iommu/amd/iommu.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index 41ee4ad1dcf8..0f04013f590d 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2792,6 +2792,15 @@ static const struct iommu_domain_ops amdv2_ops = {
> .enforce_cache_coherency = amd_iommu_enforce_cache_coherency,
> };
>
> +/*
> + * Force a clflush on Cezanne (family 19h, model 50h) when the v2
> + * page-table is enabled.
> + */
> +static bool amd_iommu_force_incoherent(void)
> +{
> + return boot_cpu_data.x86 == 0x19 && boot_cpu_data.x86_model == 0x50;
> +}
> +
> static struct iommu_domain *amd_iommu_domain_alloc_paging_v2(struct device *dev,
> u32 flags)
> {
> @@ -2810,6 +2819,13 @@ static struct iommu_domain *amd_iommu_domain_alloc_paging_v2(struct device *dev,
> domain->iommu.nid = dev_to_node(dev);
>
> cfg.common.features = BIT(PT_FEAT_X86_64_AMD_ENCRYPT_TABLES);
> +
> + if (amd_iommu_force_incoherent()) {
> + cfg.common.features |= BIT(PT_FEAT_DMA_INCOHERENT);
> + /* pt_iommu_init() rejects DMA_INCOHERENT without a device */
> + domain->iommu.iommu_device = dev;
> + }
> +
> if (amd_iommu_np_cache)
> cfg.common.features |= BIT(PT_FEAT_FLUSH_RANGE_NO_GAPS);
> else
next prev parent reply other threads:[~2026-11-20 15:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 15:23 [PATCH] iommu/amd: Mark v2 page tables incoherent on Cezanne Vasant Hegde
2026-11-20 15:53 ` Mario Limonciello [this message]
2026-11-20 16:36 ` Nathan Blomquist
2026-11-20 19:26 ` Jason Gunthorpe
2026-11-23 11:24 ` Vasant Hegde
2026-11-23 15:02 ` Jason Gunthorpe
2026-11-23 10:35 ` Jörg Rödel
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=25b96bda-edb5-4baf-816c-cfb862b9243b@kernel.org \
--to=superm1@kernel.org \
--cc=Akshata.VUnkal@amd.com \
--cc=alexander.deucher@amd.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=nblomquist@gmail.com \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.com \
--cc=will@kernel.org \
/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.