Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lu Baolu" <baolu.lu@linux.intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 5/5] iommu/vt-d: Reserve MSB of domain ID space for TDX module
Date: Tue, 15 Sep 2026 08:11:50 +0000	[thread overview]
Message-ID: <20260915081150.D79E21F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915074235.1219183-6-baolu.lu@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] iommu: missing TDX teardown and mt_pages leak on IOMMU hot-remove
--

commit 8a16aba70396ddc74c834953ff8123fae8be9bad
Author: Lu Baolu <baolu.lu@linux.intel.com>

iommu/vt-d: Reserve MSB of domain ID space for TDX module

When an Intel IOMMU is enabled for TDX Connect, the VT-d DID namespace
must be split so the TDX module can use the MSB-tagged half for trusted
DMA translations, while the host/VMM uses the lower half.

> diff --git a/drivers/iommu/intel/tdxc.c b/drivers/iommu/intel/tdxc.c
> index b5dfdeeb23dba..1ca03257d4563 100644
> --- a/drivers/iommu/intel/tdxc.c
> +++ b/drivers/iommu/intel/tdxc.c
[ ... ]
> @@ -154,17 +159,27 @@ static int intel_iommu_bringup_tdxc(struct intel_iommu *iommu, unsigned int nr_p
>  		return -EFAULT;
>  	}
>  
> +	/*
> +	 * Intel TDX Connect Architecture Specification, Section 2.2 Trusted DMA
> +	 *
> +	 * When IOMMU is enabled to support TDX Connect, the IOMMU restricts
> +	 * the VMM’s DID setting, reserving the MSB bit for the TDX module. The
> +	 * TDX module always sets this reserved bit on the trusted DMA table.
> +	 */
> +	iommu->max_domain_id = ndoms >> 1;
>  	iommu->tdx_iommu_id = tdx_iommu_id;
>  	iommu->mt_pages = no_free_ptr(iommu_mt);
>  
> -	/* Bring-up is not complete yet; report as unsupported for now. */
> -	return -EOPNOTSUPP;
> +	pr_info("%s: trusted DMA for TEE/IO initialized\n", iommu->name);
> +
> +	return 0;

[Severity: High]
With TDX bring-up now successfully completing here, if this IOMMU is later
hot-removed, does this leak the TDX metadata pages (iommu->mt_pages) and leave
dangling hardware state in the SEAM firmware?

When ACPI hotplug invokes dmar_iommu_hotplug() with insert=false, the IOMMU
is destroyed via:

drivers/iommu/intel/iommu.c:dmar_iommu_hotplug() {
    ...
		disable_dmar_iommu(iommu);
		free_dmar_iommu(iommu);
    ...
}

Because this hot-remove path never calls intel_iommu_teardown_tdxc(), it
appears iommu->mt_pages is leaked and tdh_iommu_clear() is never called before
the IOMMU structure itself is freed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915074235.1219183-1-baolu.lu@linux.intel.com?part=5

  reply	other threads:[~2026-09-15  8:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  7:42 [PATCH 0/5] iommu/vt-d: Introduce trusted DMA initialization support Lu Baolu
2026-09-15  7:42 ` [PATCH 1/5] x86/virt/tdx: Add SEAMCALL wrappers for IOMMU setup/clear Lu Baolu
2026-09-15  7:42 ` [PATCH 2/5] x86/virt/tdx: Read global metadata for trusted IOMMU Lu Baolu
2026-09-15  7:42 ` [PATCH 3/5] iommu/vt-d: Add interfaces for trusted DMA initialization Lu Baolu
2026-09-15  7:42 ` [PATCH 4/5] iommu/vt-d: Add helpers to set up and tear down TDX extensions Lu Baolu
2026-09-15  8:04   ` sashiko-bot
2026-09-16  8:37     ` Baolu Lu
2026-09-15  7:42 ` [PATCH 5/5] iommu/vt-d: Reserve MSB of domain ID space for TDX module Lu Baolu
2026-09-15  8:11   ` sashiko-bot [this message]
2026-09-16  8:25     ` Baolu Lu
2026-09-18  2:30 ` [PATCH 0/5] iommu/vt-d: Introduce trusted DMA initialization support Tian, Kevin
2026-09-19  4:04   ` Baolu Lu

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=20260915081150.D79E21F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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