ath10k: add trace event for WMI_DEBUG_MESG_EVENTID
[cascardo/linux.git] / virt / kvm / iommu.c
index d32d156..0df7d4b 100644 (file)
@@ -103,6 +103,10 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
                while ((gfn << PAGE_SHIFT) & (page_size - 1))
                        page_size >>= 1;
 
+               /* Make sure hva is aligned to the page size we want to map */
+               while (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1))
+                       page_size >>= 1;
+
                /*
                 * Pin all pages we are about to map in memory. This is
                 * important because we unmap and unpin in 4kb steps later.
@@ -140,6 +144,9 @@ static int kvm_iommu_map_memslots(struct kvm *kvm)
        struct kvm_memslots *slots;
        struct kvm_memory_slot *memslot;
 
+       if (kvm->arch.iommu_noncoherent)
+               kvm_arch_register_noncoherent_dma(kvm);
+
        idx = srcu_read_lock(&kvm->srcu);
        slots = kvm_memslots(kvm);
 
@@ -327,6 +334,9 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm)
 
        srcu_read_unlock(&kvm->srcu, idx);
 
+       if (kvm->arch.iommu_noncoherent)
+               kvm_arch_unregister_noncoherent_dma(kvm);
+
        return 0;
 }