drm/nouveau/bar/nv50: initialise vmm with new interfaces
authorBen Skeggs <bskeggs@redhat.com>
Tue, 31 Oct 2017 17:56:19 +0000 (03:56 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 2 Nov 2017 03:32:30 +0000 (13:32 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.h

index 9300529917fce0ad9bbc73d3476b5faf4f865b24..157b076a1272300f648cd0502eafee675f69f270 100644 (file)
@@ -46,7 +46,7 @@ nv50_bar_flush(struct nvkm_bar *base)
 struct nvkm_vmm *
 nv50_bar_bar1_vmm(struct nvkm_bar *base)
 {
-       return nv50_bar(base)->bar1_vm;
+       return nv50_bar(base)->bar1_vmm;
 }
 
 void
@@ -72,7 +72,7 @@ nv50_bar_bar1_init(struct nvkm_bar *base)
 struct nvkm_vmm *
 nv50_bar_bar2_vmm(struct nvkm_bar *base)
 {
-       return nv50_bar(base)->bar2_vm;
+       return nv50_bar(base)->bar2_vmm;
 }
 
 void
@@ -109,7 +109,6 @@ nv50_bar_oneinit(struct nvkm_bar *base)
        struct nvkm_device *device = bar->base.subdev.device;
        static struct lock_class_key bar1_lock;
        static struct lock_class_key bar2_lock;
-       struct nvkm_vm *vm;
        u64 start, limit;
        int ret;
 
@@ -130,18 +129,19 @@ nv50_bar_oneinit(struct nvkm_bar *base)
        start = 0x0100000000ULL;
        limit = start + device->func->resource_size(device, 3);
 
-       ret = nvkm_vm_new(device, start, limit - start, start, &bar2_lock, &vm);
+       ret = nvkm_vmm_new(device, start, limit-- - start, NULL, 0,
+                          &bar2_lock, "bar2", &bar->bar2_vmm);
        if (ret)
                return ret;
 
-       atomic_inc(&vm->engref[NVKM_SUBDEV_BAR]);
+       atomic_inc(&bar->bar2_vmm->engref[NVKM_SUBDEV_BAR]);
+       bar->bar2_vmm->debug = bar->base.subdev.debug;
 
-       ret = nvkm_vm_boot(vm, limit-- - start);
+       ret = nvkm_vmm_boot(bar->bar2_vmm);
        if (ret)
                return ret;
 
-       ret = nvkm_vm_ref(vm, &bar->bar2_vm, bar->mem->memory);
-       nvkm_vm_ref(NULL, &vm, NULL);
+       ret = nvkm_vmm_join(bar->bar2_vmm, bar->mem->memory);
        if (ret)
                return ret;
 
@@ -166,14 +166,13 @@ nv50_bar_oneinit(struct nvkm_bar *base)
        start = 0x0000000000ULL;
        limit = start + device->func->resource_size(device, 1);
 
-       ret = nvkm_vm_new(device, start, limit-- - start, start, &bar1_lock, &vm);
-       if (ret)
-               return ret;
+       ret = nvkm_vmm_new(device, start, limit-- - start, NULL, 0,
+                          &bar1_lock, "bar1", &bar->bar1_vmm);
 
-       atomic_inc(&vm->engref[NVKM_SUBDEV_BAR]);
+       atomic_inc(&bar->bar1_vmm->engref[NVKM_SUBDEV_BAR]);
+       bar->bar1_vmm->debug = bar->base.subdev.debug;
 
-       ret = nvkm_vm_ref(vm, &bar->bar1_vm, bar->mem->memory);
-       nvkm_vm_ref(NULL, &vm, NULL);
+       ret = nvkm_vmm_join(bar->bar1_vmm, bar->mem->memory);
        if (ret)
                return ret;
 
@@ -199,9 +198,11 @@ nv50_bar_dtor(struct nvkm_bar *base)
        struct nv50_bar *bar = nv50_bar(base);
        if (bar->mem) {
                nvkm_gpuobj_del(&bar->bar1);
-               nvkm_vm_ref(NULL, &bar->bar1_vm, bar->mem->memory);
+               nvkm_vmm_part(bar->bar1_vmm, bar->mem->memory);
+               nvkm_vmm_unref(&bar->bar1_vmm);
                nvkm_gpuobj_del(&bar->bar2);
-               nvkm_vm_ref(NULL, &bar->bar2_vm, bar->mem->memory);
+               nvkm_vmm_part(bar->bar2_vmm, bar->mem->memory);
+               nvkm_vmm_unref(&bar->bar2_vmm);
                nvkm_gpuobj_del(&bar->pgd);
                nvkm_gpuobj_del(&bar->pad);
                nvkm_gpuobj_del(&bar->mem);
index b5fe26aab118a2af28b6fc64a2ee294ae19a2d29..140b76f588b6ad0cabfe043e9cf28dcaa1bd8f26 100644 (file)
@@ -9,9 +9,9 @@ struct nv50_bar {
        struct nvkm_gpuobj *mem;
        struct nvkm_gpuobj *pad;
        struct nvkm_gpuobj *pgd;
-       struct nvkm_vm *bar1_vm;
+       struct nvkm_vmm *bar1_vmm;
        struct nvkm_gpuobj *bar1;
-       struct nvkm_vm *bar2_vm;
+       struct nvkm_vmm *bar2_vmm;
        struct nvkm_gpuobj *bar2;
 };