On Wed, 28 Feb 2024 at 15:17, Zhenzhong Duan <zhenzhong.d...@intel.com> wrote: > When there is VFIO device and vIOMMU cap/ecap is updated based on host
* cap/ecap -> capability/extended capability registers are updated ... > IOMMU cap/ecap, migration should be blocked. * It'll help to mention why migration should be blocked in this case? > Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com> > --- > hw/i386/intel_iommu.c | 16 ++++++++++++++-- > +static Error *vtd_mig_blocker; > + > static int vtd_check_iommufd_hdev(IntelIOMMUState *s, > IOMMUFDDevice *idev, > Error **errp) > @@ -3861,8 +3864,17 @@ static int vtd_check_iommufd_hdev(IntelIOMMUState *s, > tmp_cap |= VTD_CAP_MGAW(host_mgaw + 1); > } > > - s->cap = tmp_cap; > - return 0; > + if (s->cap != tmp_cap) { > + if (vtd_mig_blocker == NULL) { > + error_setg(&vtd_mig_blocker, > + "cap/ecap update from host IOMMU block migration"); > + ret = migrate_add_blocker(&vtd_mig_blocker, errp); > + } > + if (!ret) { > + s->cap = tmp_cap; > + } > + } > + return ret; * I couldn't find vtd_check_* function in the tree, but what happens if vtd_mig_blocker != NULL? What will be 'ret' then? Thank you. --- - Prasad