Commit 2606f291 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/mmu: support initialisation of client-managed address-spaces

NVKM is currently responsible for managing the allocation of a client's
GPU address-space, but there's various use-cases (ie. HMM address-space
mirroring) where giving a client more direct control is desirable.

This commit allows for a VMM to be created where the area allocated for
NVKM is limited to a client-specified window, the remainder of address-
space is controlled directly by the client.

Leaving a window is necessary to support various internal requirements,
but also to support existing allocation interfaces as not all of the HW
is capable of working with a HMM allocation.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent ae5ea7f6
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
struct nvif_vmm_v0 { struct nvif_vmm_v0 {
__u8 version; __u8 version;
__u8 page_nr; __u8 page_nr;
__u8 pad02[6]; __u8 managed;
__u8 pad03[5];
__u64 addr; __u64 addr;
__u64 size; __u64 size;
__u8 data[]; __u8 data[];
......
...@@ -30,8 +30,8 @@ struct nvif_vmm { ...@@ -30,8 +30,8 @@ struct nvif_vmm {
int page_nr; int page_nr;
}; };
int nvif_vmm_init(struct nvif_mmu *, s32 oclass, u64 addr, u64 size, int nvif_vmm_init(struct nvif_mmu *, s32 oclass, bool managed, u64 addr,
void *argv, u32 argc, struct nvif_vmm *); u64 size, void *argv, u32 argc, struct nvif_vmm *);
void nvif_vmm_fini(struct nvif_vmm *); void nvif_vmm_fini(struct nvif_vmm *);
int nvif_vmm_get(struct nvif_vmm *, enum nvif_vmm_get, bool sparse, int nvif_vmm_get(struct nvif_vmm *, enum nvif_vmm_get, bool sparse,
u8 page, u8 align, u64 size, struct nvif_vma *); u8 page, u8 align, u64 size, struct nvif_vma *);
......
...@@ -126,7 +126,7 @@ nouveau_vmm_fini(struct nouveau_vmm *vmm) ...@@ -126,7 +126,7 @@ nouveau_vmm_fini(struct nouveau_vmm *vmm)
int int
nouveau_vmm_init(struct nouveau_cli *cli, s32 oclass, struct nouveau_vmm *vmm) nouveau_vmm_init(struct nouveau_cli *cli, s32 oclass, struct nouveau_vmm *vmm)
{ {
int ret = nvif_vmm_init(&cli->mmu, oclass, PAGE_SIZE, 0, NULL, 0, int ret = nvif_vmm_init(&cli->mmu, oclass, false, PAGE_SIZE, 0, NULL, 0,
&vmm->vmm); &vmm->vmm);
if (ret) if (ret)
return ret; return ret;
......
...@@ -112,8 +112,8 @@ nvif_vmm_fini(struct nvif_vmm *vmm) ...@@ -112,8 +112,8 @@ nvif_vmm_fini(struct nvif_vmm *vmm)
} }
int int
nvif_vmm_init(struct nvif_mmu *mmu, s32 oclass, u64 addr, u64 size, nvif_vmm_init(struct nvif_mmu *mmu, s32 oclass, bool managed, u64 addr,
void *argv, u32 argc, struct nvif_vmm *vmm) u64 size, void *argv, u32 argc, struct nvif_vmm *vmm)
{ {
struct nvif_vmm_v0 *args; struct nvif_vmm_v0 *args;
u32 argn = sizeof(*args) + argc; u32 argn = sizeof(*args) + argc;
...@@ -125,6 +125,7 @@ nvif_vmm_init(struct nvif_mmu *mmu, s32 oclass, u64 addr, u64 size, ...@@ -125,6 +125,7 @@ nvif_vmm_init(struct nvif_mmu *mmu, s32 oclass, u64 addr, u64 size,
if (!(args = kmalloc(argn, GFP_KERNEL))) if (!(args = kmalloc(argn, GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
args->version = 0; args->version = 0;
args->managed = managed;
args->addr = addr; args->addr = addr;
args->size = size; args->size = size;
memcpy(args->data, argv, argc); memcpy(args->data, argv, argc);
......
...@@ -28,7 +28,7 @@ struct nvkm_mmu_func { ...@@ -28,7 +28,7 @@ struct nvkm_mmu_func {
struct { struct {
struct nvkm_sclass user; struct nvkm_sclass user;
int (*ctor)(struct nvkm_mmu *, u64 addr, u64 size, int (*ctor)(struct nvkm_mmu *, bool managed, u64 addr, u64 size,
void *argv, u32 argc, struct lock_class_key *, void *argv, u32 argc, struct lock_class_key *,
const char *name, struct nvkm_vmm **); const char *name, struct nvkm_vmm **);
bool global; bool global;
......
...@@ -304,8 +304,10 @@ nvkm_uvmm_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, ...@@ -304,8 +304,10 @@ nvkm_uvmm_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
struct nvkm_uvmm *uvmm; struct nvkm_uvmm *uvmm;
int ret = -ENOSYS; int ret = -ENOSYS;
u64 addr, size; u64 addr, size;
bool managed;
if (!(ret = nvif_unpack(ret, &argv, &argc, args->v0, 0, 0, more))) { if (!(ret = nvif_unpack(ret, &argv, &argc, args->v0, 0, 0, more))) {
managed = args->v0.managed != 0;
addr = args->v0.addr; addr = args->v0.addr;
size = args->v0.size; size = args->v0.size;
} else } else
...@@ -317,7 +319,7 @@ nvkm_uvmm_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, ...@@ -317,7 +319,7 @@ nvkm_uvmm_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
*pobject = &uvmm->object; *pobject = &uvmm->object;
if (!mmu->vmm) { if (!mmu->vmm) {
ret = mmu->func->vmm.ctor(mmu, addr, size, argv, argc, ret = mmu->func->vmm.ctor(mmu, managed, addr, size, argv, argc,
NULL, "user", &uvmm->vmm); NULL, "user", &uvmm->vmm);
if (ret) if (ret)
return ret; return ret;
......
...@@ -972,16 +972,32 @@ nvkm_vmm_dtor(struct nvkm_vmm *vmm) ...@@ -972,16 +972,32 @@ nvkm_vmm_dtor(struct nvkm_vmm *vmm)
} }
} }
static int
nvkm_vmm_ctor_managed(struct nvkm_vmm *vmm, u64 addr, u64 size)
{
struct nvkm_vma *vma;
if (!(vma = nvkm_vma_new(addr, size)))
return -ENOMEM;
vma->mapref = true;
vma->sparse = false;
vma->used = true;
vma->user = true;
nvkm_vmm_node_insert(vmm, vma);
list_add_tail(&vma->head, &vmm->list);
return 0;
}
int int
nvkm_vmm_ctor(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu, nvkm_vmm_ctor(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu,
u32 pd_header, u64 addr, u64 size, struct lock_class_key *key, u32 pd_header, bool managed, u64 addr, u64 size,
const char *name, struct nvkm_vmm *vmm) struct lock_class_key *key, const char *name,
struct nvkm_vmm *vmm)
{ {
static struct lock_class_key _key; static struct lock_class_key _key;
const struct nvkm_vmm_page *page = func->page; const struct nvkm_vmm_page *page = func->page;
const struct nvkm_vmm_desc *desc; const struct nvkm_vmm_desc *desc;
struct nvkm_vma *vma; struct nvkm_vma *vma;
int levels, bits = 0; int levels, bits = 0, ret;
vmm->func = func; vmm->func = func;
vmm->mmu = mmu; vmm->mmu = mmu;
...@@ -1009,11 +1025,6 @@ nvkm_vmm_ctor(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu, ...@@ -1009,11 +1025,6 @@ nvkm_vmm_ctor(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu,
if (WARN_ON(levels > NVKM_VMM_LEVELS_MAX)) if (WARN_ON(levels > NVKM_VMM_LEVELS_MAX))
return -EINVAL; return -EINVAL;
vmm->start = addr;
vmm->limit = size ? (addr + size) : (1ULL << bits);
if (vmm->start > vmm->limit || vmm->limit > (1ULL << bits))
return -EINVAL;
/* Allocate top-level page table. */ /* Allocate top-level page table. */
vmm->pd = nvkm_vmm_pt_new(desc, false, NULL); vmm->pd = nvkm_vmm_pt_new(desc, false, NULL);
if (!vmm->pd) if (!vmm->pd)
...@@ -1036,22 +1047,61 @@ nvkm_vmm_ctor(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu, ...@@ -1036,22 +1047,61 @@ nvkm_vmm_ctor(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu,
vmm->free = RB_ROOT; vmm->free = RB_ROOT;
vmm->root = RB_ROOT; vmm->root = RB_ROOT;
if (managed) {
/* Address-space will be managed by the client for the most
* part, except for a specified area where NVKM allocations
* are allowed to be placed.
*/
vmm->start = 0;
vmm->limit = 1ULL << bits;
if (addr + size < addr || addr + size > vmm->limit)
return -EINVAL;
/* Client-managed area before the NVKM-managed area. */
if (addr && (ret = nvkm_vmm_ctor_managed(vmm, 0, addr)))
return ret;
/* NVKM-managed area. */
if (size) {
if (!(vma = nvkm_vma_new(addr, size)))
return -ENOMEM;
nvkm_vmm_free_insert(vmm, vma);
list_add_tail(&vma->head, &vmm->list);
}
/* Client-managed area after the NVKM-managed area. */
addr = addr + size;
size = vmm->limit - addr;
if (size && (ret = nvkm_vmm_ctor_managed(vmm, addr, size)))
return ret;
} else {
/* Address-space fully managed by NVKM, requiring calls to
* nvkm_vmm_get()/nvkm_vmm_put() to allocate address-space.
*/
vmm->start = addr;
vmm->limit = size ? (addr + size) : (1ULL << bits);
if (vmm->start > vmm->limit || vmm->limit > (1ULL << bits))
return -EINVAL;
if (!(vma = nvkm_vma_new(vmm->start, vmm->limit - vmm->start))) if (!(vma = nvkm_vma_new(vmm->start, vmm->limit - vmm->start)))
return -ENOMEM; return -ENOMEM;
nvkm_vmm_free_insert(vmm, vma); nvkm_vmm_free_insert(vmm, vma);
list_add(&vma->head, &vmm->list); list_add(&vma->head, &vmm->list);
}
return 0; return 0;
} }
int int
nvkm_vmm_new_(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu, nvkm_vmm_new_(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu,
u32 hdr, u64 addr, u64 size, struct lock_class_key *key, u32 hdr, bool managed, u64 addr, u64 size,
const char *name, struct nvkm_vmm **pvmm) struct lock_class_key *key, const char *name,
struct nvkm_vmm **pvmm)
{ {
if (!(*pvmm = kzalloc(sizeof(**pvmm), GFP_KERNEL))) if (!(*pvmm = kzalloc(sizeof(**pvmm), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
return nvkm_vmm_ctor(func, mmu, hdr, addr, size, key, name, *pvmm); return nvkm_vmm_ctor(func, mmu, hdr, managed, addr, size, key, name, *pvmm);
} }
void void
...@@ -1584,7 +1634,8 @@ nvkm_vmm_new(struct nvkm_device *device, u64 addr, u64 size, void *argv, ...@@ -1584,7 +1634,8 @@ nvkm_vmm_new(struct nvkm_device *device, u64 addr, u64 size, void *argv,
struct nvkm_mmu *mmu = device->mmu; struct nvkm_mmu *mmu = device->mmu;
struct nvkm_vmm *vmm = NULL; struct nvkm_vmm *vmm = NULL;
int ret; int ret;
ret = mmu->func->vmm.ctor(mmu, addr, size, argv, argc, key, name, &vmm); ret = mmu->func->vmm.ctor(mmu, false, addr, size, argv, argc,
key, name, &vmm);
if (ret) if (ret)
nvkm_vmm_unref(&vmm); nvkm_vmm_unref(&vmm);
*pvmm = vmm; *pvmm = vmm;
......
...@@ -153,11 +153,12 @@ struct nvkm_vmm_join { ...@@ -153,11 +153,12 @@ struct nvkm_vmm_join {
}; };
int nvkm_vmm_new_(const struct nvkm_vmm_func *, struct nvkm_mmu *, int nvkm_vmm_new_(const struct nvkm_vmm_func *, struct nvkm_mmu *,
u32 pd_header, u64 addr, u64 size, struct lock_class_key *, u32 pd_header, bool managed, u64 addr, u64 size,
const char *name, struct nvkm_vmm **); struct lock_class_key *, const char *name,
struct nvkm_vmm **);
int nvkm_vmm_ctor(const struct nvkm_vmm_func *, struct nvkm_mmu *, int nvkm_vmm_ctor(const struct nvkm_vmm_func *, struct nvkm_mmu *,
u32 pd_header, u64 addr, u64 size, struct lock_class_key *, u32 pd_header, bool managed, u64 addr, u64 size,
const char *name, struct nvkm_vmm *); struct lock_class_key *, const char *name, struct nvkm_vmm *);
struct nvkm_vma *nvkm_vmm_node_search(struct nvkm_vmm *, u64 addr); struct nvkm_vma *nvkm_vmm_node_search(struct nvkm_vmm *, u64 addr);
struct nvkm_vma *nvkm_vmm_node_split(struct nvkm_vmm *, struct nvkm_vma *, struct nvkm_vma *nvkm_vmm_node_split(struct nvkm_vmm *, struct nvkm_vma *,
u64 addr, u64 size); u64 addr, u64 size);
...@@ -171,7 +172,7 @@ void nvkm_vmm_unmap_region(struct nvkm_vmm *vmm, struct nvkm_vma *vma); ...@@ -171,7 +172,7 @@ void nvkm_vmm_unmap_region(struct nvkm_vmm *vmm, struct nvkm_vma *vma);
struct nvkm_vma *nvkm_vma_tail(struct nvkm_vma *, u64 tail); struct nvkm_vma *nvkm_vma_tail(struct nvkm_vma *, u64 tail);
int nv04_vmm_new_(const struct nvkm_vmm_func *, struct nvkm_mmu *, u32, int nv04_vmm_new_(const struct nvkm_vmm_func *, struct nvkm_mmu *, u32,
u64, u64, void *, u32, struct lock_class_key *, bool, u64, u64, void *, u32, struct lock_class_key *,
const char *, struct nvkm_vmm **); const char *, struct nvkm_vmm **);
int nv04_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *); int nv04_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *);
...@@ -181,7 +182,7 @@ int nv50_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *); ...@@ -181,7 +182,7 @@ int nv50_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *);
void nv50_vmm_flush(struct nvkm_vmm *, int); void nv50_vmm_flush(struct nvkm_vmm *, int);
int gf100_vmm_new_(const struct nvkm_vmm_func *, const struct nvkm_vmm_func *, int gf100_vmm_new_(const struct nvkm_vmm_func *, const struct nvkm_vmm_func *,
struct nvkm_mmu *, u64, u64, void *, u32, struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int gf100_vmm_join_(struct nvkm_vmm *, struct nvkm_memory *, u64 base); int gf100_vmm_join_(struct nvkm_vmm *, struct nvkm_memory *, u64 base);
int gf100_vmm_join(struct nvkm_vmm *, struct nvkm_memory *); int gf100_vmm_join(struct nvkm_vmm *, struct nvkm_memory *);
...@@ -195,7 +196,7 @@ void gf100_vmm_invalidate_pdb(struct nvkm_vmm *, u64 addr); ...@@ -195,7 +196,7 @@ void gf100_vmm_invalidate_pdb(struct nvkm_vmm *, u64 addr);
int gk20a_vmm_aper(enum nvkm_memory_target); int gk20a_vmm_aper(enum nvkm_memory_target);
int gm200_vmm_new_(const struct nvkm_vmm_func *, const struct nvkm_vmm_func *, int gm200_vmm_new_(const struct nvkm_vmm_func *, const struct nvkm_vmm_func *,
struct nvkm_mmu *, u64, u64, void *, u32, struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int gm200_vmm_join_(struct nvkm_vmm *, struct nvkm_memory *, u64 base); int gm200_vmm_join_(struct nvkm_vmm *, struct nvkm_memory *, u64 base);
int gm200_vmm_join(struct nvkm_vmm *, struct nvkm_memory *); int gm200_vmm_join(struct nvkm_vmm *, struct nvkm_memory *);
...@@ -207,46 +208,46 @@ void gp100_vmm_invalidate_pdb(struct nvkm_vmm *, u64 addr); ...@@ -207,46 +208,46 @@ void gp100_vmm_invalidate_pdb(struct nvkm_vmm *, u64 addr);
int gv100_vmm_join(struct nvkm_vmm *, struct nvkm_memory *); int gv100_vmm_join(struct nvkm_vmm *, struct nvkm_memory *);
int nv04_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int nv04_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int nv41_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int nv41_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int nv44_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int nv44_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int nv50_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int nv50_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int mcp77_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int mcp77_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int g84_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int g84_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int gf100_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int gf100_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int gk104_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int gk104_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int gk20a_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int gk20a_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct nvkm_vmm **); struct lock_class_key *, const char *, struct nvkm_vmm **);
int gm200_vmm_new_fixed(struct nvkm_mmu *, u64, u64, void *, u32, int gm200_vmm_new_fixed(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct lock_class_key *, const char *,
struct nvkm_vmm **); struct nvkm_vmm **);
int gm200_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int gm200_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct lock_class_key *, const char *,
struct nvkm_vmm **); struct nvkm_vmm **);
int gm20b_vmm_new_fixed(struct nvkm_mmu *, u64, u64, void *, u32, int gm20b_vmm_new_fixed(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct lock_class_key *, const char *,
struct nvkm_vmm **); struct nvkm_vmm **);
int gm20b_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int gm20b_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct lock_class_key *, const char *,
struct nvkm_vmm **); struct nvkm_vmm **);
int gp100_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int gp100_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct lock_class_key *, const char *,
struct nvkm_vmm **); struct nvkm_vmm **);
int gp10b_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int gp10b_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct lock_class_key *, const char *,
struct nvkm_vmm **); struct nvkm_vmm **);
int gv100_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int gv100_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct lock_class_key *, const char *,
struct nvkm_vmm **); struct nvkm_vmm **);
int tu102_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, int tu102_vmm_new(struct nvkm_mmu *, bool, u64, u64, void *, u32,
struct lock_class_key *, const char *, struct lock_class_key *, const char *,
struct nvkm_vmm **); struct nvkm_vmm **);
......
...@@ -400,14 +400,14 @@ gf100_vmm_16 = { ...@@ -400,14 +400,14 @@ gf100_vmm_16 = {
int int
gf100_vmm_new_(const struct nvkm_vmm_func *func_16, gf100_vmm_new_(const struct nvkm_vmm_func *func_16,
const struct nvkm_vmm_func *func_17, const struct nvkm_vmm_func *func_17,
struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
switch (mmu->subdev.device->fb->page) { switch (mmu->subdev.device->fb->page) {
case 16: return nv04_vmm_new_(func_16, mmu, 0, addr, size, case 16: return nv04_vmm_new_(func_16, mmu, 0, managed, addr, size,
argv, argc, key, name, pvmm); argv, argc, key, name, pvmm);
case 17: return nv04_vmm_new_(func_17, mmu, 0, addr, size, case 17: return nv04_vmm_new_(func_17, mmu, 0, managed, addr, size,
argv, argc, key, name, pvmm); argv, argc, key, name, pvmm);
default: default:
WARN_ON(1); WARN_ON(1);
...@@ -416,10 +416,10 @@ gf100_vmm_new_(const struct nvkm_vmm_func *func_16, ...@@ -416,10 +416,10 @@ gf100_vmm_new_(const struct nvkm_vmm_func *func_16,
} }
int int
gf100_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, gf100_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return gf100_vmm_new_(&gf100_vmm_16, &gf100_vmm_17, mmu, addr, return gf100_vmm_new_(&gf100_vmm_16, &gf100_vmm_17, mmu, managed, addr,
size, argv, argc, key, name, pvmm); size, argv, argc, key, name, pvmm);
} }
...@@ -95,10 +95,10 @@ gk104_vmm_16 = { ...@@ -95,10 +95,10 @@ gk104_vmm_16 = {
}; };
int int
gk104_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, gk104_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return gf100_vmm_new_(&gk104_vmm_16, &gk104_vmm_17, mmu, addr, return gf100_vmm_new_(&gk104_vmm_16, &gk104_vmm_17, mmu, managed, addr,
size, argv, argc, key, name, pvmm); size, argv, argc, key, name, pvmm);
} }
...@@ -64,10 +64,10 @@ gk20a_vmm_16 = { ...@@ -64,10 +64,10 @@ gk20a_vmm_16 = {
}; };
int int
gk20a_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, gk20a_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return gf100_vmm_new_(&gk20a_vmm_16, &gk20a_vmm_17, mmu, addr, return gf100_vmm_new_(&gk20a_vmm_16, &gk20a_vmm_17, mmu, managed, addr,
size, argv, argc, key, name, pvmm); size, argv, argc, key, name, pvmm);
} }
...@@ -141,9 +141,9 @@ gm200_vmm_16 = { ...@@ -141,9 +141,9 @@ gm200_vmm_16 = {
int int
gm200_vmm_new_(const struct nvkm_vmm_func *func_16, gm200_vmm_new_(const struct nvkm_vmm_func *func_16,
const struct nvkm_vmm_func *func_17, const struct nvkm_vmm_func *func_17,
struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
const struct nvkm_vmm_func *func; const struct nvkm_vmm_func *func;
union { union {
...@@ -165,23 +165,23 @@ gm200_vmm_new_(const struct nvkm_vmm_func *func_16, ...@@ -165,23 +165,23 @@ gm200_vmm_new_(const struct nvkm_vmm_func *func_16,
} else } else
return ret; return ret;
return nvkm_vmm_new_(func, mmu, 0, addr, size, key, name, pvmm); return nvkm_vmm_new_(func, mmu, 0, managed, addr, size, key, name, pvmm);
} }
int int
gm200_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, gm200_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return gm200_vmm_new_(&gm200_vmm_16, &gm200_vmm_17, mmu, addr, return gm200_vmm_new_(&gm200_vmm_16, &gm200_vmm_17, mmu, managed, addr,
size, argv, argc, key, name, pvmm); size, argv, argc, key, name, pvmm);
} }
int int
gm200_vmm_new_fixed(struct nvkm_mmu *mmu, u64 addr, u64 size, gm200_vmm_new_fixed(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
void *argv, u32 argc, struct lock_class_key *key, void *argv, u32 argc, struct lock_class_key *key,
const char *name, struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return gf100_vmm_new_(&gm200_vmm_16, &gm200_vmm_17, mmu, addr, return gf100_vmm_new_(&gm200_vmm_16, &gm200_vmm_17, mmu, managed, addr,
size, argv, argc, key, name, pvmm); size, argv, argc, key, name, pvmm);
} }
...@@ -54,19 +54,19 @@ gm20b_vmm_16 = { ...@@ -54,19 +54,19 @@ gm20b_vmm_16 = {
}; };
int int
gm20b_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, gm20b_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return gm200_vmm_new_(&gm20b_vmm_16, &gm20b_vmm_17, mmu, addr, return gm200_vmm_new_(&gm20b_vmm_16, &gm20b_vmm_17, mmu, managed, addr,
size, argv, argc, key, name, pvmm); size, argv, argc, key, name, pvmm);
} }
int int
gm20b_vmm_new_fixed(struct nvkm_mmu *mmu, u64 addr, u64 size, gm20b_vmm_new_fixed(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
void *argv, u32 argc, struct lock_class_key *key, void *argv, u32 argc, struct lock_class_key *key,
const char *name, struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return gf100_vmm_new_(&gm20b_vmm_16, &gm20b_vmm_17, mmu, addr, return gf100_vmm_new_(&gm20b_vmm_16, &gm20b_vmm_17, mmu, managed, addr,
size, argv, argc, key, name, pvmm); size, argv, argc, key, name, pvmm);
} }
...@@ -352,10 +352,10 @@ gp100_vmm = { ...@@ -352,10 +352,10 @@ gp100_vmm = {
}; };
int int
gp100_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, gp100_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return nv04_vmm_new_(&gp100_vmm, mmu, 0, addr, size, return nv04_vmm_new_(&gp100_vmm, mmu, 0, managed, addr, size,
argv, argc, key, name, pvmm); argv, argc, key, name, pvmm);
} }
...@@ -41,10 +41,10 @@ gp10b_vmm = { ...@@ -41,10 +41,10 @@ gp10b_vmm = {
}; };
int int
gp10b_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, gp10b_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return nv04_vmm_new_(&gp10b_vmm, mmu, 0, addr, size, return nv04_vmm_new_(&gp10b_vmm, mmu, 0, managed, addr, size,
argv, argc, key, name, pvmm); argv, argc, key, name, pvmm);
} }
...@@ -79,10 +79,10 @@ gv100_vmm = { ...@@ -79,10 +79,10 @@ gv100_vmm = {
}; };
int int
gv100_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, gv100_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return nv04_vmm_new_(&gv100_vmm, mmu, 0, addr, size, return nv04_vmm_new_(&gv100_vmm, mmu, 0, managed, addr, size,
argv, argc, key, name, pvmm); argv, argc, key, name, pvmm);
} }
...@@ -36,10 +36,10 @@ mcp77_vmm = { ...@@ -36,10 +36,10 @@ mcp77_vmm = {
}; };
int int
mcp77_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, mcp77_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return nv04_vmm_new_(&mcp77_vmm, mmu, 0, addr, size, return nv04_vmm_new_(&mcp77_vmm, mmu, 0, managed, addr, size,
argv, argc, key, name, pvmm); argv, argc, key, name, pvmm);
} }
...@@ -100,16 +100,17 @@ nv04_vmm = { ...@@ -100,16 +100,17 @@ nv04_vmm = {
int int
nv04_vmm_new_(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu, nv04_vmm_new_(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu,
u32 pd_header, u64 addr, u64 size, void *argv, u32 argc, u32 pd_header, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key,
struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
union { union {
struct nv04_vmm_vn vn; struct nv04_vmm_vn vn;
} *args = argv; } *args = argv;
int ret; int ret;
ret = nvkm_vmm_new_(func, mmu, pd_header, addr, size, key, name, pvmm); ret = nvkm_vmm_new_(func, mmu, pd_header, managed, addr, size,
key, name, pvmm);
if (ret) if (ret)
return ret; return ret;
...@@ -117,15 +118,15 @@ nv04_vmm_new_(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu, ...@@ -117,15 +118,15 @@ nv04_vmm_new_(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu,
} }
int int
nv04_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, nv04_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key, const char *name,
struct nvkm_vmm **pvmm) struct nvkm_vmm **pvmm)
{ {
struct nvkm_memory *mem; struct nvkm_memory *mem;
struct nvkm_vmm *vmm; struct nvkm_vmm *vmm;
int ret; int ret;
ret = nv04_vmm_new_(&nv04_vmm, mmu, 8, addr, size, ret = nv04_vmm_new_(&nv04_vmm, mmu, 8, managed, addr, size,
argv, argc, key, name, &vmm); argv, argc, key, name, &vmm);
*pvmm = vmm; *pvmm = vmm;
if (ret) if (ret)
......
...@@ -104,10 +104,10 @@ nv41_vmm = { ...@@ -104,10 +104,10 @@ nv41_vmm = {
}; };
int int
nv41_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, nv41_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key, const char *name,
struct nvkm_vmm **pvmm) struct nvkm_vmm **pvmm)
{ {
return nv04_vmm_new_(&nv41_vmm, mmu, 0, addr, size, return nv04_vmm_new_(&nv41_vmm, mmu, 0, managed, addr, size,
argv, argc, key, name, pvmm); argv, argc, key, name, pvmm);
} }
...@@ -205,15 +205,15 @@ nv44_vmm = { ...@@ -205,15 +205,15 @@ nv44_vmm = {
}; };
int int
nv44_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, nv44_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key, const char *name,
struct nvkm_vmm **pvmm) struct nvkm_vmm **pvmm)
{ {
struct nvkm_subdev *subdev = &mmu->subdev; struct nvkm_subdev *subdev = &mmu->subdev;
struct nvkm_vmm *vmm; struct nvkm_vmm *vmm;
int ret; int ret;
ret = nv04_vmm_new_(&nv44_vmm, mmu, 0, addr, size, ret = nv04_vmm_new_(&nv44_vmm, mmu, 0, managed, addr, size,
argv, argc, key, name, &vmm); argv, argc, key, name, &vmm);
*pvmm = vmm; *pvmm = vmm;
if (ret) if (ret)
......
...@@ -376,10 +376,10 @@ nv50_vmm = { ...@@ -376,10 +376,10 @@ nv50_vmm = {
}; };
int int
nv50_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc, nv50_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
struct lock_class_key *key, const char *name, void *argv, u32 argc, struct lock_class_key *key, const char *name,
struct nvkm_vmm **pvmm) struct nvkm_vmm **pvmm)
{ {
return nv04_vmm_new_(&nv50_vmm, mmu, 0, addr, size, return nv04_vmm_new_(&nv50_vmm, mmu, 0, managed, addr, size,
argv, argc, key, name, pvmm); argv, argc, key, name, pvmm);
} }
...@@ -68,10 +68,10 @@ tu102_vmm = { ...@@ -68,10 +68,10 @@ tu102_vmm = {
}; };
int int
tu102_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, tu102_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
void *argv, u32 argc, struct lock_class_key *key, void *argv, u32 argc, struct lock_class_key *key,
const char *name, struct nvkm_vmm **pvmm) const char *name, struct nvkm_vmm **pvmm)
{ {
return nv04_vmm_new_(&tu102_vmm, mmu, 0, addr, size, return nv04_vmm_new_(&tu102_vmm, mmu, 0, managed, addr, size,
argv, argc, key, name, pvmm); argv, argc, key, name, pvmm);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment