Merge tag 'vfio-v3.15-rc1' of git://github.com/awilliam/linux-vfio
Pull VFIO updates from Alex Williamson: "VFIO updates for v3.15 include: - Allow the vfio-type1 IOMMU to support multiple domains within a container - Plumb path to query whether all domains are cache-coherent - Wire query into kvm-vfio device to avoid KVM x86 WBINVD emulation - Always select CONFIG_ANON_INODES, vfio depends on it (Arnd) The first patch also makes the vfio-type1 IOMMU driver completely independent of the bus_type of the devices it's handling, which enables it to be used for both vfio-pci and a future vfio-platform (and hopefully combinations involving both simultaneously)" * tag 'vfio-v3.15-rc1' of git://github.com/awilliam/linux-vfio: vfio: always select ANON_INODES kvm/vfio: Support for DMA coherent IOMMUs vfio: Add external user check extension interface vfio/type1: Add extension to test DMA cache coherence of IOMMU vfio/iommu_type1: Multi-IOMMU domain support
This commit is contained in:
@@ -59,6 +59,22 @@ static void kvm_vfio_group_put_external_user(struct vfio_group *vfio_group)
|
||||
symbol_put(vfio_group_put_external_user);
|
||||
}
|
||||
|
||||
static bool kvm_vfio_group_is_coherent(struct vfio_group *vfio_group)
|
||||
{
|
||||
long (*fn)(struct vfio_group *, unsigned long);
|
||||
long ret;
|
||||
|
||||
fn = symbol_get(vfio_external_check_extension);
|
||||
if (!fn)
|
||||
return false;
|
||||
|
||||
ret = fn(vfio_group, VFIO_DMA_CC_IOMMU);
|
||||
|
||||
symbol_put(vfio_external_check_extension);
|
||||
|
||||
return ret > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Groups can use the same or different IOMMU domains. If the same then
|
||||
* adding a new group may change the coherency of groups we've previously
|
||||
@@ -75,13 +91,10 @@ static void kvm_vfio_update_coherency(struct kvm_device *dev)
|
||||
mutex_lock(&kv->lock);
|
||||
|
||||
list_for_each_entry(kvg, &kv->group_list, node) {
|
||||
/*
|
||||
* TODO: We need an interface to check the coherency of
|
||||
* the IOMMU domain this group is using. For now, assume
|
||||
* it's always noncoherent.
|
||||
*/
|
||||
noncoherent = true;
|
||||
break;
|
||||
if (!kvm_vfio_group_is_coherent(kvg->vfio_group)) {
|
||||
noncoherent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (noncoherent != kv->noncoherent) {
|
||||
|
Verwijs in nieuw issue
Block a user