diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 17:05:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 17:05:02 -0400 |
commit | d0cb5f71c5cde8e1ef6d03983641366800ceabdb (patch) | |
tree | 893fcbb069bb255cf320b4e4c61a0515d02c4bed /virt/kvm | |
parent | a372c967a38a789caf52d4b1d2a78781e1b25d91 (diff) | |
parent | 4379d2ae152860e023b42257fd60b5e235047f63 (diff) |
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
Diffstat (limited to 'virt/kvm')
-rw-r--r-- | virt/kvm/vfio.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c index b4f9507ae650..ba1a93f935c7 100644 --- a/virt/kvm/vfio.c +++ b/virt/kvm/vfio.c | |||
@@ -59,6 +59,22 @@ static void kvm_vfio_group_put_external_user(struct vfio_group *vfio_group) | |||
59 | symbol_put(vfio_group_put_external_user); | 59 | symbol_put(vfio_group_put_external_user); |
60 | } | 60 | } |
61 | 61 | ||
62 | static bool kvm_vfio_group_is_coherent(struct vfio_group *vfio_group) | ||
63 | { | ||
64 | long (*fn)(struct vfio_group *, unsigned long); | ||
65 | long ret; | ||
66 | |||
67 | fn = symbol_get(vfio_external_check_extension); | ||
68 | if (!fn) | ||
69 | return false; | ||
70 | |||
71 | ret = fn(vfio_group, VFIO_DMA_CC_IOMMU); | ||
72 | |||
73 | symbol_put(vfio_external_check_extension); | ||
74 | |||
75 | return ret > 0; | ||
76 | } | ||
77 | |||
62 | /* | 78 | /* |
63 | * Groups can use the same or different IOMMU domains. If the same then | 79 | * Groups can use the same or different IOMMU domains. If the same then |
64 | * adding a new group may change the coherency of groups we've previously | 80 | * 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) | |||
75 | mutex_lock(&kv->lock); | 91 | mutex_lock(&kv->lock); |
76 | 92 | ||
77 | list_for_each_entry(kvg, &kv->group_list, node) { | 93 | list_for_each_entry(kvg, &kv->group_list, node) { |
78 | /* | 94 | if (!kvm_vfio_group_is_coherent(kvg->vfio_group)) { |
79 | * TODO: We need an interface to check the coherency of | 95 | noncoherent = true; |
80 | * the IOMMU domain this group is using. For now, assume | 96 | break; |
81 | * it's always noncoherent. | 97 | } |
82 | */ | ||
83 | noncoherent = true; | ||
84 | break; | ||
85 | } | 98 | } |
86 | 99 | ||
87 | if (noncoherent != kv->noncoherent) { | 100 | if (noncoherent != kv->noncoherent) { |