From: Vasant Hegde <vasant.hegde@amd.com>
To: Matt Fleming <matt@readmodwrite.com>, Joerg Roedel <joro@8bytes.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Ashish Kalra <ashish.kalra@amd.com>,
Sairaj Kodilkar <sarunkod@amd.com>, Baoquan He <bhe@redhat.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, kernel-team@cloudflare.com,
Matt Fleming <mfleming@cloudflare.com>
Subject: Re: [PATCH 1/2] iommu/amd: Program device table when kdump reuse fails
Date: Tue, 13 Oct 2026 16:02:31 +0530 [thread overview]
Message-ID: <25da2a40-e197-4415-bcde-48f71d0e1f84@amd.com> (raw)
In-Reply-To: <20261002133143.3628181-2-matt@readmodwrite.com>
On 10/2/2026 7:01 PM, Matt Fleming wrote:
> From: Matt Fleming <mfleming@cloudflare.com>
>
> Commit 38e5f33ee359 ("iommu/amd: Reuse device table for kdump") made
> iommu_set_device_table() return early in every kdump kernel. That is
> needed when the previous kernel's device table is reused: the base
> register already points at it, and on SNP-enabled systems the register
> is locked.
>
> But if reuse isn't possible, early_enable_iommus() falls back to the
> freshly allocated table and calls early_enable_iommu(). Because of the
> early return, that table is never written to the base register. The
> IOMMU keeps using whatever table the register pointed at before, while
> the driver writes entries into the new one.
>
> Only skip the write when the previous kernel's table was reused.
>
> Fixes: 38e5f33ee359 ("iommu/amd: Reuse device table for kdump")
> Cc: stable@vger.kernel.org
> Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
> ---
> drivers/iommu/amd/init.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
> index c07c3a01b978..0572e1a674f0 100644
> --- a/drivers/iommu/amd/init.c
> +++ b/drivers/iommu/amd/init.c
> @@ -409,7 +409,13 @@ static void iommu_set_device_table(struct amd_iommu *iommu)
>
> BUG_ON(iommu->mmio_base == NULL);
>
> - if (is_kdump_kernel())
> + /*
> + * A kdump kernel that reuses the previous kernel's device table must
> + * leave the base register alone. It already points at that table, and
> + * with SNP enabled the register is locked. If reuse failed, program
> + * the freshly allocated table like a normal boot.
> + */
> + if (iommu->pci_seg->old_dev_tbl_cpy)
Yes. It fixes the regression and I am OK to pick this patch.
Ideally these low level functions shouldn't be called if we are reusing existing
device table. With so many combinations (like normal, kdump, snp, etc) its
becoming very hard. I had done prototype to get these init path somewhat clean
with ops structure. I will try to rework and post that series soon. With that
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
-Vasant
next prev parent reply other threads:[~2026-10-13 10:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 13:31 [PATCH 0/2] iommu/amd: Fix device table setup in kdump kernels Matt Fleming
2026-10-02 13:31 ` [PATCH 1/2] iommu/amd: Program device table when kdump reuse fails Matt Fleming
2026-10-09 20:18 ` Kalra, Ashish
2026-10-10 5:23 ` Ankit Soni
2026-10-13 10:32 ` Vasant Hegde [this message]
2026-10-02 13:31 ` [PATCH 2/2] iommu/amd: Don't allocate kdump device table from DMA32 Matt Fleming
2026-10-09 20:51 ` Kalra, Ashish
2026-10-10 5:26 ` Ankit Soni
2026-10-09 9:35 ` [PATCH 0/2] iommu/amd: Fix device table setup in kdump kernels Matt Fleming
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=25da2a40-e197-4415-bcde-48f71d0e1f84@amd.com \
--to=vasant.hegde@amd.com \
--cc=ashish.kalra@amd.com \
--cc=bhe@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kernel-team@cloudflare.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@readmodwrite.com \
--cc=mfleming@cloudflare.com \
--cc=sarunkod@amd.com \
--cc=stable@vger.kernel.org \
--cc=suravee.suthikulpanit@amd.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.