Re: [RFC PATCH 10/15] virt: tdx-guest: Set up and accept private MMIO ranges

From: Edgecombe, Rick P

Date: Mon Nov 02 2026 - 17:40:50 EST


On Thu, 2026-10-29 at 09:56 +0000, Duan, Zhenzhong wrote:
> After thinking about this further, a second .run() attempt cannot recover
> from partial MMIO acceptance with the current implementation. It starts
> accepting ranges from the beginning, so it will encounter a re-acceptance
> error on the first range successfully accepted by the previous attempt,
> before reaching the range that originally failed.

How does MMIO acceptance fail? Whose fault is it?

>
> When .run() fails, the device is not accepted for driver attachment, so
> there should be no driver MMIO accesses. Therefore, removing the
> guest-side MMIO resource entries and freeing the descriptors in
> tdx_tdi_mmio_teardown() should be safe. However, this cleanup does not
> undo the MMIO acceptance already performed by the TDX module.
>
> There is no TDG.MMIO.UNACCEPT ABI to roll back those successful
> acceptances. Recovery therefore requires unlocking the device through
> the UNBIND hypercall, which asks the host to tear down the associated
> MMIO mappings, before locking and accepting the device again.