forked from Minki/linux
15b244a88e
We are adding support for DMA memory pre-registration to be used in conjunction with VFIO. The idea is that the userspace which is going to run a guest may want to pre-register a user space memory region so it all gets pinned once and never goes away. Having this done, a hypervisor will not have to pin/unpin pages on every DMA map/unmap request. This is going to help with multiple pinning of the same memory. Another use of it is in-kernel real mode (mmu off) acceleration of DMA requests where real time translation of guest physical to host physical addresses is non-trivial and may fail as linux ptes may be temporarily invalid. Also, having cached host physical addresses (compared to just pinning at the start and then walking the page table again on every H_PUT_TCE), we can be sure that the addresses which we put into TCE table are the ones we already pinned. This adds a list of memory regions to mm_context_t. Each region consists of a header and a list of physical addresses. This adds API to: 1. register/unregister memory regions; 2. do final cleanup (which puts all pre-registered pages); 3. do userspace to physical address translation; 4. manage usage counters; multiple registration of the same memory is allowed (once per container). This implements 2 counters per registered memory region: - @mapped: incremented on every DMA mapping; decremented on unmapping; initialized to 1 when a region is just registered; once it becomes zero, no more mappings allowe; - @used: incremented on every "register" ioctl; decremented on "unregister"; unregistration is allowed for DMA mapped regions unless it is the very last reference. For the very last reference this checks that the region is still mapped and returns -EBUSY so the userspace gets to know that memory is still pinned and unregistration needs to be retried; @used remains 1. Host physical addresses are stored in vmalloc'ed array. In order to access these in the real mode (mmu off), there is a real_vmalloc_addr() helper. In-kernel acceleration patchset will move it from KVM to MMU code. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
40 lines
1.5 KiB
Makefile
40 lines
1.5 KiB
Makefile
#
|
|
# Makefile for the linux ppc-specific parts of the memory manager.
|
|
#
|
|
|
|
subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
|
|
|
|
ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
|
|
|
|
obj-y := fault.o mem.o pgtable.o mmap.o \
|
|
init_$(CONFIG_WORD_SIZE).o \
|
|
pgtable_$(CONFIG_WORD_SIZE).o
|
|
obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \
|
|
tlb_nohash_low.o
|
|
obj-$(CONFIG_PPC_BOOK3E) += tlb_low_$(CONFIG_WORD_SIZE)e.o
|
|
hash64-$(CONFIG_PPC_NATIVE) := hash_native_64.o
|
|
obj-$(CONFIG_PPC_STD_MMU_64) += hash_utils_64.o slb_low.o slb.o $(hash64-y)
|
|
obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o
|
|
obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \
|
|
tlb_hash$(CONFIG_WORD_SIZE).o \
|
|
mmu_context_hash$(CONFIG_WORD_SIZE).o
|
|
obj-$(CONFIG_PPC_ICSWX) += icswx.o
|
|
obj-$(CONFIG_PPC_ICSWX_PID) += icswx_pid.o
|
|
obj-$(CONFIG_40x) += 40x_mmu.o
|
|
obj-$(CONFIG_44x) += 44x_mmu.o
|
|
obj-$(CONFIG_PPC_FSL_BOOK3E) += fsl_booke_mmu.o
|
|
obj-$(CONFIG_NEED_MULTIPLE_NODES) += numa.o
|
|
obj-$(CONFIG_PPC_SPLPAR) += vphn.o
|
|
obj-$(CONFIG_PPC_MM_SLICES) += slice.o
|
|
obj-y += hugetlbpage.o
|
|
ifeq ($(CONFIG_HUGETLB_PAGE),y)
|
|
obj-$(CONFIG_PPC_STD_MMU_64) += hugetlbpage-hash64.o
|
|
obj-$(CONFIG_PPC_BOOK3E_MMU) += hugetlbpage-book3e.o
|
|
endif
|
|
obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += hugepage-hash64.o
|
|
obj-$(CONFIG_PPC_SUBPAGE_PROT) += subpage-prot.o
|
|
obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
|
|
obj-$(CONFIG_HIGHMEM) += highmem.o
|
|
obj-$(CONFIG_PPC_COPRO_BASE) += copro_fault.o
|
|
obj-$(CONFIG_SPAPR_TCE_IOMMU) += mmu_context_iommu.o
|