linux/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#ifndef __NVKM_MMU_H__
   3#define __NVKM_MMU_H__
   4#include <core/subdev.h>
   5#include <core/mm.h>
   6struct nvkm_device;
   7struct nvkm_mem;
   8
   9struct nvkm_vm_pgt {
  10        struct nvkm_memory *mem[2];
  11        u32 refcount[2];
  12};
  13
  14struct nvkm_vm_pgd {
  15        struct list_head head;
  16        struct nvkm_gpuobj *obj;
  17};
  18
  19struct nvkm_vma {
  20        struct list_head head;
  21        int refcount;
  22        struct nvkm_vm *vm;
  23        struct nvkm_mm_node *node;
  24        u64 offset;
  25        u32 access;
  26};
  27
  28struct nvkm_vm {
  29        struct nvkm_mmu *mmu;
  30
  31        struct mutex mutex;
  32        struct nvkm_mm mm;
  33        struct kref refcount;
  34
  35        struct list_head pgd_list;
  36        atomic_t engref[NVKM_SUBDEV_NR];
  37
  38        struct nvkm_vm_pgt *pgt;
  39        u32 fpde;
  40        u32 lpde;
  41};
  42
  43int  nvkm_vm_new(struct nvkm_device *, u64 offset, u64 length, u64 mm_offset,
  44                 struct lock_class_key *, struct nvkm_vm **);
  45int  nvkm_vm_ref(struct nvkm_vm *, struct nvkm_vm **, struct nvkm_gpuobj *pgd);
  46int  nvkm_vm_boot(struct nvkm_vm *, u64 size);
  47int  nvkm_vm_get(struct nvkm_vm *, u64 size, u32 page_shift, u32 access,
  48                 struct nvkm_vma *);
  49void nvkm_vm_put(struct nvkm_vma *);
  50void nvkm_vm_map(struct nvkm_vma *, struct nvkm_mem *);
  51void nvkm_vm_map_at(struct nvkm_vma *, u64 offset, struct nvkm_mem *);
  52void nvkm_vm_unmap(struct nvkm_vma *);
  53void nvkm_vm_unmap_at(struct nvkm_vma *, u64 offset, u64 length);
  54
  55struct nvkm_mmu {
  56        const struct nvkm_mmu_func *func;
  57        struct nvkm_subdev subdev;
  58
  59        u64 limit;
  60        u8  dma_bits;
  61        u8  lpg_shift;
  62};
  63
  64int nv04_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
  65int nv41_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
  66int nv44_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
  67int nv50_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
  68int gf100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
  69#endif
  70