Re: [PATCH v3 6/9] iommu/vt-d: Refuse system suspend while acquired by the TDX module
From: Baolu Lu
Date: Wed Nov 25 2026 - 01:31:27 EST
On 11/25/2026 12:01 PM, Tian, Kevin wrote:
From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
Sent: Thursday, November 12, 2026 12:31 PM
While tdx-host has acquired an IOMMU, the VT-d driver blocks its GCMD
writes. TDX disables S3 by clearing acpi_suspend_lowlevel, but that is
only checked after the syscore suspend callbacks have run, so an S3
request, e.g. "echo mem > /sys/power/state", still runs iommu_suspend()
and then iommu_resume():
suspend_enter()
syscore_suspend()
iommu_suspend() <- runs on the acquired IOMMU
suspend_ops->enter() = acpi_suspend_enter()
if (!acpi_suspend_lowlevel) <- TDX's "S3 disabled" check
return -ENOSYS
syscore_resume()
iommu_resume() <- runs on the acquired IOMMU
Register a PM notifier for each DMAR unit that supports trusted DMA and
refuse PM_SUSPEND_PREPARE with -EBUSY while the unit is acquired. The
suspend then fails before tasks are frozen and before syscore callbacks
run.
what about directly returning error in iommu_suspend() if any acquired
IOMMU exists? at this point all other processes are frozen so no contention
exists at this point.
or introduce a new flag or counter (intel_iommu_suspend_disabled) which
is set/cleared or incremented/decremented along with acquire/release,
then just check this flag/counter in iommu_suspend().
I'm fine with this. It's actually what I did at first. The only downside
is that iommu_suspend() runs very late. By then, every device has
already been suspended, and suspending a device that is assigned to a TD
may affect its TDISP state. That shouldn't be the IOMMU driver's concern
anyway, so let's start with the simpler approach.
Thanks,
baolu