RE: [PATCH v3 6/9] iommu/vt-d: Refuse system suspend while acquired by the TDX module
From: Tian, Kevin
Date: Tue Nov 24 2026 - 23:01:56 EST
> 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().