drm/nouveau/bar/gf100: 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/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.h

index 8077e1a5017a0bde1612ab9a42497f2c24518f13..a3ba7f50198be90ed7357a7c26f3ddb01a3c3955 100644 (file)
@@ -31,7 +31,7 @@
 struct nvkm_vmm *
 gf100_bar_bar1_vmm(struct nvkm_bar *base)
 {
-       return gf100_bar(base)->bar[1].vm;
+       return gf100_bar(base)->bar[1].vmm;
 }
 
 void
@@ -60,7 +60,7 @@ gf100_bar_bar1_init(struct nvkm_bar *base)
 struct nvkm_vmm *
 gf100_bar_bar2_vmm(struct nvkm_bar *base)
 {
-       return gf100_bar(base)->bar[0].vm;
+       return gf100_bar(base)->bar[0].vmm;
 }
 
 void
@@ -85,7 +85,6 @@ gf100_bar_oneinit_bar(struct gf100_bar *bar, struct gf100_barN *bar_vm,
                      struct lock_class_key *key, int bar_nr)
 {
        struct nvkm_device *device = bar->base.subdev.device;
-       struct nvkm_vm *vm;
        resource_size_t bar_len;
        int ret;
 
@@ -98,29 +97,24 @@ gf100_bar_oneinit_bar(struct gf100_bar *bar, struct gf100_barN *bar_vm,
        if (bar_nr == 3 && bar->bar2_halve)
                bar_len >>= 1;
 
-       ret = nvkm_vm_new(device, 0, bar_len, 0, key, &vm);
+       ret = nvkm_vmm_new(device, 0, bar_len, NULL, 0, key,
+                          (bar_nr == 3) ? "bar2" : "bar1", &bar_vm->vmm);
        if (ret)
                return ret;
 
-       atomic_inc(&vm->engref[NVKM_SUBDEV_BAR]);
+       atomic_inc(&bar_vm->vmm->engref[NVKM_SUBDEV_BAR]);
+       bar_vm->vmm->debug = bar->base.subdev.debug;
 
        /*
         * Bootstrap page table lookup.
         */
        if (bar_nr == 3) {
-               ret = nvkm_vm_boot(vm, bar_len);
-               if (ret) {
-                       nvkm_vm_ref(NULL, &vm, NULL);
+               ret = nvkm_vmm_boot(bar_vm->vmm);
+               if (ret)
                        return ret;
-               }
        }
 
-       ret = nvkm_vm_ref(vm, &bar_vm->vm, bar_vm->inst);
-       nvkm_vm_ref(NULL, &vm, NULL);
-       if (ret)
-               return ret;
-
-       return 0;
+       return nvkm_vmm_join(bar_vm->vmm, bar_vm->inst);
 }
 
 int
@@ -154,10 +148,12 @@ gf100_bar_dtor(struct nvkm_bar *base)
 {
        struct gf100_bar *bar = gf100_bar(base);
 
-       nvkm_vm_ref(NULL, &bar->bar[1].vm, bar->bar[1].inst);
+       nvkm_vmm_part(bar->bar[1].vmm, bar->bar[1].inst);
+       nvkm_vmm_unref(&bar->bar[1].vmm);
        nvkm_memory_unref(&bar->bar[1].inst);
 
-       nvkm_vm_ref(NULL, &bar->bar[0].vm, bar->bar[0].inst);
+       nvkm_vmm_part(bar->bar[0].vmm, bar->bar[0].inst);
+       nvkm_vmm_unref(&bar->bar[0].vmm);
        nvkm_memory_unref(&bar->bar[0].inst);
        return bar;
 }
index 9ce80c6b6fec1ebc745afc9469a7bb07723fcd3e..e4da39139e959a182b27480adc8f8de1ead29581 100644 (file)
@@ -5,7 +5,7 @@
 
 struct gf100_barN {
        struct nvkm_memory *inst;
-       struct nvkm_vm *vm;
+       struct nvkm_vmm *vmm;
 };
 
 struct gf100_bar {