mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: <iommu@lists.linux.dev>, <x86@kernel.org>,
	<linux-coco@lists.linux.dev>, <kvm@vger.kernel.org>,
	Jason Gunthorpe <jgg@ziepe.ca>, Kevin Tian <kevin.tian@intel.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	<yilun.xu@linux.intel.com>, <xiaoyao.li@intel.com>,
	Binbin Wu <binbin.wu@linux.intel.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/4] coco/tdx-host: Initialize trusted DMA on all capable IOMMUs
Date: Mon, 19 Oct 2026 15:03:35 +0800	[thread overview]
Message-ID: <atXAxzxYdDo6RbHM@intel.com> (raw)
In-Reply-To: <20261015010705.1973284-5-baolu.lu@linux.intel.com>

>+static int tdx_iommu_setup(struct dmar_drhd_unit *drhd)
>+{
>+	const struct tdx_sys_info *tdx_sysinfo = tdx_get_sysinfo();
>+	unsigned int mt_page_count = tdx_sysinfo->tdx_connect.iommu_mt_page_count;
>+	struct tdx_iommu_state *state;
>+	u64 r, tdx_iommu_id;
>+	int ret;
>+
>+	struct tdx_iommu_state *iommu_state __free(kfree) = kzalloc_obj(*iommu_state);
>+	if (!iommu_state)
>+		return -ENOMEM;
>+
>+	struct tdx_iommu_pages *iommu_mt __free(free_mt_pages) =
>+			tdx_iommu_alloc_mt_pages(drhd, mt_page_count);
>+	if (!iommu_mt)
>+		return -ENOMEM;
>+
>+	r = tdh_iommu_setup(drhd->reg_base_addr, iommu_mt->root, &tdx_iommu_id);

Dynamic PAMT was merged in 7.3. With it enabled, the PAMT for 4K pages
is no longer allocated up front, and the kernel must add PAMT backing
before giving a page to the TDX module. So, the IQ buffers and the metadata
pages need tdx_pamt_get() before TDH.IOMMU.SETUP and tdx_pamt_put() after
TDH.IOMMU.CLEAR hands them back.

  parent reply	other threads:[~2026-10-19  7:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  1:07 [PATCH v2 0/4] coco/tdx-host: Introduce trusted DMA initialization support Lu Baolu
2026-10-15  1:07 ` [PATCH v2 1/4] x86/virt/tdx: Add SEAMCALL wrappers for IOMMU setup/clear Lu Baolu
2026-10-15  6:34   ` Xu Yilun
2026-10-15  1:07 ` [PATCH v2 2/4] x86/virt/tdx: Read global metadata for trusted IOMMU Lu Baolu
2026-10-15  6:47   ` Xu Yilun
2026-10-16  7:59     ` Tian, Kevin
2026-10-15  1:07 ` [PATCH v2 3/4] iommu/vt-d: Add an API for tdx-host when enabling trusted DMA Lu Baolu
2026-10-15  1:07 ` [PATCH v2 4/4] coco/tdx-host: Initialize trusted DMA on all capable IOMMUs Lu Baolu
2026-10-15  8:31   ` Xu Yilun
2026-10-15 17:37     ` Jason Gunthorpe
2026-10-16  7:03       ` Baolu Lu
2026-10-16  7:17         ` Tian, Kevin
2026-10-16 14:58           ` Jason Gunthorpe
2026-10-19  8:16             ` Baolu Lu
2026-10-19  8:12           ` Baolu Lu
2026-10-16 14:58         ` Jason Gunthorpe
2026-10-19  8:17           ` Baolu Lu
2026-10-19  7:03   ` Chao Gao [this message]
2026-10-19  8:40     ` 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=atXAxzxYdDo6RbHM@intel.com \
    --to=chao.gao@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=kas@kernel.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.com \
    --cc=yilun.xu@linux.intel.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®