summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2022-05-24 21:11:59 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2022-05-24 21:11:59 -0400
commitee26a2842ca891d3ae8b1de1b066d29234fc0115 (patch)
treea0bf21050569e8d369fc1410860e57158fac761b /drivers/gpu/nvgpu/include
parent46b43d2b2485233397f4f62b9bac6d35434b7aea (diff)
gpu-paging: Initial working implementation
Supports synchronous page out or in of a specific buffer. Includes fast reverse struct mapped_buf lookup. Requires initial set of changes to nvmap as well.
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/gmmu.h17
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/linux/vm.h2
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/vm.h2
3 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/gmmu.h b/drivers/gpu/nvgpu/include/nvgpu/gmmu.h
index 2fc0d44e..81f829ed 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/gmmu.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/gmmu.h
@@ -354,6 +354,23 @@ int __nvgpu_get_pte(struct gk20a *g, struct vm_gk20a *vm, u64 vaddr, u32 *pte);
354 */ 354 */
355int __nvgpu_set_pte(struct gk20a *g, struct vm_gk20a *vm, u64 vaddr, u32 *pte); 355int __nvgpu_set_pte(struct gk20a *g, struct vm_gk20a *vm, u64 vaddr, u32 *pte);
356 356
357/**
358 * __nvgpu_update_paddr - Remap a virtual address to a new physical address
359 *
360 * @g - The GPU.
361 * @vm - VM to look in.
362 * @vaddr - GPU virtual address.
363 * @paddr - The new physical address to map to
364 *
365 * This function is a combination of __nvgpu_get_pte() and __nvgpu_set_pte().
366 * It searches for an existing PTE associated with @vaddr, and then updates
367 * only the physical address pointed to in the PTE to @paddr. All other
368 * attributes/fields of the PTE are preserved.
369 *
370 * This function returns the number of bytes mapped on success and -EINVAL
371 * otherwise.
372 */
373int __nvgpu_update_paddr(struct gk20a *g, struct vm_gk20a *vm, u64 vaddr, u64 paddr);
357 374
358/* 375/*
359 * Internal debugging routines. Probably not something you want to use. 376 * Internal debugging routines. Probably not something you want to use.
diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h
index 6f3beaa9..b86a428a 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h
@@ -49,6 +49,8 @@ struct nvgpu_mapped_buf_priv {
49 struct dma_buf *dmabuf; 49 struct dma_buf *dmabuf;
50 struct dma_buf_attachment *attachment; 50 struct dma_buf_attachment *attachment;
51 struct sg_table *sgt; 51 struct sg_table *sgt;
52 // For fast reverse lookup (FD -> mapped_buf)
53 struct list_head nvmap_priv_entry;
52}; 54};
53 55
54/* NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL must be set */ 56/* NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL must be set */
diff --git a/drivers/gpu/nvgpu/include/nvgpu/vm.h b/drivers/gpu/nvgpu/include/nvgpu/vm.h
index 3867c745..f007d880 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/vm.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/vm.h
@@ -261,6 +261,8 @@ struct nvgpu_mapped_buf *nvgpu_vm_map(struct vm_gk20a *vm,
261 struct vm_gk20a_mapping_batch *batch, 261 struct vm_gk20a_mapping_batch *batch,
262 enum nvgpu_aperture aperture); 262 enum nvgpu_aperture aperture);
263 263
264void nvgpu_vm_remap(struct nvgpu_mapped_buf *m);
265
264void nvgpu_vm_unmap(struct vm_gk20a *vm, u64 offset, 266void nvgpu_vm_unmap(struct vm_gk20a *vm, u64 offset,
265 struct vm_gk20a_mapping_batch *batch); 267 struct vm_gk20a_mapping_batch *batch);
266 268