On Mon, Jan 16, 2017 at 02:30:20PM +0800, Jason Wang wrote: [...]
> > } > > /* Flush IOTLB > >@@ -2244,15 +2274,34 @@ static void > >vtd_iommu_notify_flag_changed(MemoryRegion *iommu, > > IOMMUNotifierFlag new) > > { > > VTDAddressSpace *vtd_as = container_of(iommu, VTDAddressSpace, iommu); > >+ IntelIOMMUState *s = vtd_as->iommu_state; > >+ IntelIOMMUNotifierNode *node = NULL; > >+ IntelIOMMUNotifierNode *next_node = NULL; > >- if (new & IOMMU_NOTIFIER_MAP) { > >- error_report("Device at bus %s addr %02x.%d requires iommu " > >- "notifier which is currently not supported by " > >- "intel-iommu emulation", > >- vtd_as->bus->qbus.name, PCI_SLOT(vtd_as->devfn), > >- PCI_FUNC(vtd_as->devfn)); > >+ if (!s->cache_mode_enabled && new & IOMMU_NOTIFIER_MAP) { > >+ error_report("We need to set cache_mode=1 for intel-iommu to enable > >" > >+ "device assignment with IOMMU protection."); > > exit(1); > > } > >+ > >+ /* Add new ndoe if no mapping was exising before this call */ > > "node"? Sorry I missed this one - let me just remove above comment since it just describes what the codes has done below. Thanks, > > >+ if (old == IOMMU_NOTIFIER_NONE) { > >+ node = g_malloc0(sizeof(*node)); > >+ node->vtd_as = vtd_as; > >+ QLIST_INSERT_HEAD(&s->notifiers_list, node, next); > >+ return; > >+ } -- peterx