drm/nouveau/bar/nv50: initialise vmm with new interfaces

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2017-11-01 03:56:19 +10:00
parent f9463a4bc8
commit fc584e1a4a
2 changed files with 19 additions and 18 deletions

View File

@ -46,7 +46,7 @@ nv50_bar_flush(struct nvkm_bar *base)
struct nvkm_vmm * struct nvkm_vmm *
nv50_bar_bar1_vmm(struct nvkm_bar *base) nv50_bar_bar1_vmm(struct nvkm_bar *base)
{ {
return nv50_bar(base)->bar1_vm; return nv50_bar(base)->bar1_vmm;
} }
void void
@ -72,7 +72,7 @@ nv50_bar_bar1_init(struct nvkm_bar *base)
struct nvkm_vmm * struct nvkm_vmm *
nv50_bar_bar2_vmm(struct nvkm_bar *base) nv50_bar_bar2_vmm(struct nvkm_bar *base)
{ {
return nv50_bar(base)->bar2_vm; return nv50_bar(base)->bar2_vmm;
} }
void void
@ -109,7 +109,6 @@ nv50_bar_oneinit(struct nvkm_bar *base)
struct nvkm_device *device = bar->base.subdev.device; struct nvkm_device *device = bar->base.subdev.device;
static struct lock_class_key bar1_lock; static struct lock_class_key bar1_lock;
static struct lock_class_key bar2_lock; static struct lock_class_key bar2_lock;
struct nvkm_vm *vm;
u64 start, limit; u64 start, limit;
int ret; int ret;
@ -130,18 +129,19 @@ nv50_bar_oneinit(struct nvkm_bar *base)
start = 0x0100000000ULL; start = 0x0100000000ULL;
limit = start + device->func->resource_size(device, 3); 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) if (ret)
return 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) if (ret)
return ret; return ret;
ret = nvkm_vm_ref(vm, &bar->bar2_vm, bar->mem->memory); ret = nvkm_vmm_join(bar->bar2_vmm, bar->mem->memory);
nvkm_vm_ref(NULL, &vm, NULL);
if (ret) if (ret)
return ret; return ret;
@ -166,14 +166,13 @@ nv50_bar_oneinit(struct nvkm_bar *base)
start = 0x0000000000ULL; start = 0x0000000000ULL;
limit = start + device->func->resource_size(device, 1); limit = start + device->func->resource_size(device, 1);
ret = nvkm_vm_new(device, start, limit-- - start, start, &bar1_lock, &vm); ret = nvkm_vmm_new(device, start, limit-- - start, NULL, 0,
if (ret) &bar1_lock, "bar1", &bar->bar1_vmm);
return ret;
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); ret = nvkm_vmm_join(bar->bar1_vmm, bar->mem->memory);
nvkm_vm_ref(NULL, &vm, NULL);
if (ret) if (ret)
return ret; return ret;
@ -199,9 +198,11 @@ nv50_bar_dtor(struct nvkm_bar *base)
struct nv50_bar *bar = nv50_bar(base); struct nv50_bar *bar = nv50_bar(base);
if (bar->mem) { if (bar->mem) {
nvkm_gpuobj_del(&bar->bar1); 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_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->pgd);
nvkm_gpuobj_del(&bar->pad); nvkm_gpuobj_del(&bar->pad);
nvkm_gpuobj_del(&bar->mem); nvkm_gpuobj_del(&bar->mem);

View File

@ -9,9 +9,9 @@ struct nv50_bar {
struct nvkm_gpuobj *mem; struct nvkm_gpuobj *mem;
struct nvkm_gpuobj *pad; struct nvkm_gpuobj *pad;
struct nvkm_gpuobj *pgd; struct nvkm_gpuobj *pgd;
struct nvkm_vm *bar1_vm; struct nvkm_vmm *bar1_vmm;
struct nvkm_gpuobj *bar1; struct nvkm_gpuobj *bar1;
struct nvkm_vm *bar2_vm; struct nvkm_vmm *bar2_vmm;
struct nvkm_gpuobj *bar2; struct nvkm_gpuobj *bar2;
}; };