mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Xu Yilun <yilun.xu@linux.intel.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>
Cc: baolu.lu@linux.intel.com,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Kiryl Shutsemau <kas@kernel.org>,
	"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
	"Li, Xiaoyao" <xiaoyao.li@intel.com>,
	"Gao, Chao" <chao.gao@intel.com>,
	Binbin Wu <binbin.wu@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/4] coco/tdx-host: Initialize trusted DMA on all capable IOMMUs
Date: Thu, 5 Nov 2026 14:10:44 +0800	[thread overview]
Message-ID: <f60d1d10-b2cb-465d-8588-a61d26bbd648@linux.intel.com> (raw)
In-Reply-To: <CO1PR11MB48354B1C84A6BD16CA2FFCA88C652@CO1PR11MB4835.namprd11.prod.outlook.com>

On 10/22/2026 12:07 PM, Tian, Kevin wrote:
>> From: Baolu Lu<baolu.lu@linux.intel.com>
>> Sent: Monday, October 19, 2026 4:12 PM
>>
>> On 10/16/2026 3:17 PM, Tian, Kevin wrote:
>>>>     - The TDX Connect architecture places requirements on the host
>>>>       iommu driver while the secure IOMMU is being set up. For example,
>>>>       the host iommu driver must block the enhanced command (ECMD)
>>>>       interface while the TDH.IOMMU.SETUP SEAMCALL runs, and it must
>>>>       reserve the upper half of the domain ID space. These steps have
>>>>       to happen atomically under the iommu driver's own locks. As a
>>>>       result, the Intel iommu driver needs to merge the two steps above
>>>>       into one.
>>> Didn't get this. Both ECMD and DID reservation are TDX specific things.
>>> How are they related to the two steps in the ARM sides and why calls
>>> for merging?
>>>
>>> and why are they must be done atomically? they are conditions to
>>> execute TDH.IOMMU.SETUP, but it is perfectly fine to reserve DID
>>> at an early point then block ECMD later...
>> You are right, "atomically" was too strong. Only the ECMD block has to
>> bracket TDH.IOMMU.SETUP. So I plan to restructure it as follows:
>>
>> - dmar_tdxcs_init_prepare(dev, &params): resolve the device's DRHD and
>>     take a reference on its secure-mode state. For the first user,
>>     validate the preconditions (TE/QI/SM enabled), reserve the upper half
>>     of the DID space (failing with -EBUSY if any of it is in use), block
>>     ECMD and return what tdx-host needs (register base, NUMA node, etc).
>>     If the unit is already in Secure TDX mode, just report that so
>>     tdx-host skips TDH.IOMMU.SETUP.
>>
>> - dmar_tdxcs_init_done(dev, result): unblock ECMD, then either mark the
>>     unit as being in Secure TDX mode or roll back (including the DID
>>     reservation), based on the SEAMCALL result. It must be called
>>     whenever init_prepare() returns success.
> We should continue blocking ECMD after the IOMMU successfully
> enters the TDX mode.

Updated.

Thanks,
baolu

  reply	other threads:[~2026-11-05  6:10 UTC|newest]

Thread overview: 23+ 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-11-05  6:06     ` Baolu Lu
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-22  4:02             ` Tian, Kevin
2026-10-19  8:12           ` Baolu Lu
2026-10-22  4:07             ` Tian, Kevin
2026-11-05  6:10               ` Baolu Lu [this message]
2026-10-16 14:58         ` Jason Gunthorpe
2026-10-19  8:17           ` Baolu Lu
2026-10-19  7:03   ` Chao Gao
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=f60d1d10-b2cb-465d-8588-a61d26bbd648@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=binbin.wu@linux.intel.com \
    --cc=chao.gao@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®