From: Zhenzhong Duan <[email protected]> When x-flts=on, we set up bindings to nested HWPT in host, after migration, VFIO device binds to nesting parent HWPT by default. We need to re-establish the bindings to nested HWPT, or else device DMA will break.
Signed-off-by: Zhenzhong Duan <[email protected]> Reviewed-by: Eric Auger <[email protected]> Reviewed-by: Yi Liu <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Link: https://lore.kernel.org/qemu-devel/[email protected] Signed-off-by: Cédric Le Goater <[email protected]> --- hw/i386/intel_iommu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 08236b85ee67bdb41fb6a9ccbd60ac164e825064..f971cdd14c78fd80df26c0f67d4abc8cfb35645d 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4090,6 +4090,13 @@ static int vtd_post_load(void *opaque, int version_id) */ vtd_switch_address_space_all(iommu); + /* + * Bindings to nested HWPT in host is set up dynamically depending + * on pasid entry configuration from guest. After migration, we + * need to re-establish the bindings before restoring device's DMA. + */ + vtd_replay_pasid_bindings_all(iommu); + return 0; } -- 2.52.0
