diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2013-10-30 13:02:30 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-10-30 14:02:23 -0400 |
commit | e0f0bbc527f6e9c0261f1d16b2a0b47612b7f235 (patch) | |
tree | 623b954e7571767c4d5f0581ad8ba6eacd48785d /virt/kvm/iommu.c | |
parent | d96eb2c6f480769bff32054e78b964860dae4d56 (diff) |
kvm: Create non-coherent DMA registeration
We currently use some ad-hoc arch variables tied to legacy KVM device
assignment to manage emulation of instructions that depend on whether
non-coherent DMA is present. Create an interface for this, adapting
legacy KVM device assignment and adding VFIO via the KVM-VFIO device.
For now we assume that non-coherent DMA is possible any time we have a
VFIO group. Eventually an interface can be developed as part of the
VFIO external user interface to query the coherency of a group.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm/iommu.c')
-rw-r--r-- | virt/kvm/iommu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index d32d156a423a..c7d9ce122529 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
@@ -140,6 +140,9 @@ static int kvm_iommu_map_memslots(struct kvm *kvm) | |||
140 | struct kvm_memslots *slots; | 140 | struct kvm_memslots *slots; |
141 | struct kvm_memory_slot *memslot; | 141 | struct kvm_memory_slot *memslot; |
142 | 142 | ||
143 | if (kvm->arch.iommu_noncoherent) | ||
144 | kvm_arch_register_noncoherent_dma(kvm); | ||
145 | |||
143 | idx = srcu_read_lock(&kvm->srcu); | 146 | idx = srcu_read_lock(&kvm->srcu); |
144 | slots = kvm_memslots(kvm); | 147 | slots = kvm_memslots(kvm); |
145 | 148 | ||
@@ -327,6 +330,9 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm) | |||
327 | 330 | ||
328 | srcu_read_unlock(&kvm->srcu, idx); | 331 | srcu_read_unlock(&kvm->srcu, idx); |
329 | 332 | ||
333 | if (kvm->arch.iommu_noncoherent) | ||
334 | kvm_arch_unregister_noncoherent_dma(kvm); | ||
335 | |||
330 | return 0; | 336 | return 0; |
331 | } | 337 | } |
332 | 338 | ||