From: "Kalra, Ashish" <ashish.kalra@amd.com>
To: Matt Fleming <matt@readmodwrite.com>, Joerg Roedel <joro@8bytes.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Vasant Hegde <vasant.hegde@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: Fri, 9 Oct 2026 15:18:24 -0500 [thread overview]
Message-ID: <cef945c4-fa06-4d2d-b1ff-085d8b6fa497@amd.com> (raw)
In-Reply-To: <20261002133143.3628181-2-matt@readmodwrite.com>
On 10/2/2026 8:31 AM, Matt Fleming wrote:
> [You don't often get email from matt@readmodwrite.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> 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)
> return;
>
> entry = iommu_virt_to_phys(dev_table);
> --
> 2.43.0
>
Reviewed-by: Ashish Kalra <ashish.kalra@amd.com>
next prev parent reply other threads:[~2026-10-09 20:18 UTC|newest]
Thread overview: 8+ 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 [this message]
2026-10-10 5:23 ` Ankit Soni
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=cef945c4-fa06-4d2d-b1ff-085d8b6fa497@amd.com \
--to=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 \
--cc=vasant.hegde@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®