On Fri, Jan 06, 2017 at 03:05:47PM +0800, Jason Wang wrote: > > > On 2017年01月06日 12:06, Peter Xu wrote: > >IOMMU needs to be migrated before all the PCI devices (in case there are > >devices that will request for address translation). So marking it with a > >priority higher than the default (which PCI devices and other belong). > >Migration framework handled the rest. > > > >Signed-off-by: Peter Xu <pet...@redhat.com> > >--- > > hw/i386/intel_iommu.c | 22 +++++++++++++++++++++- > > include/migration/vmstate.h | 1 + > > 2 files changed, 22 insertions(+), 1 deletion(-) > > > >diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c > >index 5f3e351..119217b 100644 > >--- a/hw/i386/intel_iommu.c > >+++ b/hw/i386/intel_iommu.c > >@@ -1996,7 +1996,27 @@ static void > >vtd_iommu_notify_flag_changed(MemoryRegion *iommu, > > static const VMStateDescription vtd_vmstate = { > > .name = "iommu-intel", > >- .unmigratable = 1, > >+ .version_id = 1, > >+ .minimum_version_id = 1, > >+ .priority = MIG_PRI_IOMMU, > >+ .fields = (VMStateField[]) { > >+ VMSTATE_UINT64(root, IntelIOMMUState), > >+ VMSTATE_UINT64(intr_root, IntelIOMMUState), > >+ VMSTATE_UINT64(iq, IntelIOMMUState), > >+ VMSTATE_UINT32(intr_size, IntelIOMMUState), > >+ VMSTATE_UINT16(iq_head, IntelIOMMUState), > >+ VMSTATE_UINT16(iq_tail, IntelIOMMUState), > >+ VMSTATE_UINT16(iq_size, IntelIOMMUState), > >+ VMSTATE_UINT16(next_frcd_reg, IntelIOMMUState), > >+ VMSTATE_UINT8_ARRAY(csr, IntelIOMMUState, DMAR_REG_SIZE), > > Do we need migrate wmask, w1cmask, womask too?
Should not. Although we are using arrays here, they should be only configured during vtd_define_*() and should be constant values for the whole lifecycle of the device (which is mostly decided by the spec). Thanks, -- peterx