]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
powerpc/vfio/iommu/kvm: Do not pin device memory
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Wed, 19 Dec 2018 08:52:15 +0000 (19:52 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 21 Dec 2018 05:20:46 +0000 (16:20 +1100)
commitc10c21efa4bccab486c2e6a047c13dfa6cf7426c
treecd4df28268ab37a3d2aef950b70f8a8a1ffd6388
parente0bf78b0f9594d47dfa7e364a9071442fc1d9445
powerpc/vfio/iommu/kvm: Do not pin device memory

This new memory does not have page structs as it is not plugged to
the host so gup() will fail anyway.

This adds 2 helpers:
- mm_iommu_newdev() to preregister the "memory device" memory so
the rest of API can still be used;
- mm_iommu_is_devmem() to know if the physical address is one of thise
new regions which we must avoid unpinning of.

This adds @mm to tce_page_is_contained() and iommu_tce_xchg() to test
if the memory is device memory to avoid pfn_to_page().

This adds a check for device memory in mm_iommu_ua_mark_dirty_rm() which
does delayed pages dirtying.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/iommu.h
arch/powerpc/include/asm/mmu_context.h
arch/powerpc/kernel/iommu.c
arch/powerpc/kvm/book3s_64_vio.c
arch/powerpc/mm/mmu_context_iommu.c
drivers/vfio/vfio_iommu_spapr_tce.c