On Mon, Oct 17, 2016 at 10:07:36AM -0600, Alex Williamson wrote: > On Mon, 17 Oct 2016 18:44:21 +0300 > "Aviv B.D" <bd.a...@gmail.com> wrote: > > > From: "Aviv Ben-David" <bd.a...@gmail.com> > > > > * Advertize Cache Mode capability in iommu cap register. > > This capability is controlled by "cache-mode" property of intel-iommu > > device. > > To enable this option call QEMU with "-device > > intel-iommu,cache-mode=true". > > > > * On page cache invalidation in intel vIOMMU, check if the domain belong to > > registered notifier, and notify accordingly. > > > > Currently this patch still doesn't enabling VFIO devices support with > > vIOMMU > > present. Current problems: > > * vfio_iommu_map_notify is not aware about memory range belong to specific > > VFIOGuestIOMMU. > > Could you elaborate on why this is an issue? > > > * memory_region_iommu_replay hangs QEMU on start up while it itterate over > > 64bit address space. Commenting out the call to this function enables > > workable VFIO device while vIOMMU present. > > This has been discussed previously, it would be incorrect for vfio not > to call the replay function. The solution is to add an iommu driver > callback to efficiently walk the mappings within a MemoryRegion.
Right, replay is a bit of a hack. There are a couple of other approaches that might be adequate without a new callback: - Make the VFIOGuestIOMMU aware of the guest address range mapped by the vIOMMU. Intel currently advertises that as a full 64-bit address space, but I bet that's not actually true in practice. - Have the IOMMU MR advertise a (minimum) page size for vIOMMU mappings. That may let you stpe through the range with greater strides > Thanks, > > Alex > > > Changes from v1 to v2: > > * remove assumption that the cache do not clears > > * fix lockup on high load. > > > > Changes from v2 to v3: > > * remove debug leftovers > > * split to sepearate commits > > * change is_write to flags in vtd_do_iommu_translate, add IOMMU_NO_FAIL > > to suppress error propagating to guest. > > > > Changes from v3 to v4: > > * Add property to intel_iommu device to control the CM capability, > > default to False. > > * Use s->iommu_ops.notify_flag_changed to register notifiers. > > > > Changes from v4 to v4 RESEND: > > * Fix codding style pointed by checkpatch.pl script. > > > > Aviv Ben-David (3): > > IOMMU: add option to enable VTD_CAP_CM to vIOMMU capility exposoed to > > guest > > IOMMU: change iommu_op->translate's is_write to flags, add support to > > NO_FAIL flag mode > > IOMMU: enable intel_iommu map and unmap notifiers > > > > exec.c | 3 +- > > hw/i386/amd_iommu.c | 4 +- > > hw/i386/intel_iommu.c | 175 > > +++++++++++++++++++++++++++++++++-------- > > hw/i386/intel_iommu_internal.h | 3 + > > include/exec/memory.h | 6 +- > > include/hw/i386/intel_iommu.h | 11 +++ > > memory.c | 3 +- > > 7 files changed, 168 insertions(+), 37 deletions(-) > > > > -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature