diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c index 763a2db..cbb8d24 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c @@ -27,6 +27,7 @@ #include <core/engctx.h> #include <core/enum.h> #include <core/handle.h> +#include <subdev/bar.h> #include <subdev/fb.h> #include <subdev/mmu.h> #include <subdev/timer.h> @@ -42,13 +43,13 @@ struct gf100_fifo { u64 mask; struct { - struct nvkm_gpuobj *mem[2]; + struct nvkm_memory *mem[2]; int active; wait_queue_head_t wait; } runlist; struct { - struct nvkm_gpuobj *mem; + struct nvkm_memory *mem; struct nvkm_vma bar; } user; int spoon_nr; @@ -78,7 +79,7 @@ gf100_fifo_runlist_update(struct gf100_fifo *fifo) { struct nvkm_subdev *subdev = &fifo->base.engine.subdev; struct nvkm_device *device = subdev->device; - struct nvkm_gpuobj *cur; + struct nvkm_memory *cur; int i, p; mutex_lock(&nv_subdev(fifo)->mutex); @@ -96,7 +97,7 @@ gf100_fifo_runlist_update(struct gf100_fifo *fifo) } nvkm_done(cur); - nvkm_wr32(device, 0x002270, cur->addr >> 12); + nvkm_wr32(device, 0x002270, nvkm_memory_addr(cur) >> 12); nvkm_wr32(device, 0x002274, 0x01f00000 | (p >> 3)); if (wait_event_timeout(fifo->runlist.wait, @@ -238,10 +239,11 @@ gf100_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine, for (i = 0; i < 0x1000; i += 4) nvkm_wo32(fifo->user.mem, usermem + i, 0x00000000); nvkm_done(fifo->user.mem); + usermem = nvkm_memory_addr(fifo->user.mem) + usermem; nvkm_kmap(ramfc); - nvkm_wo32(ramfc, 0x08, lower_32_bits(fifo->user.mem->addr + usermem)); - nvkm_wo32(ramfc, 0x0c, upper_32_bits(fifo->user.mem->addr + usermem)); + nvkm_wo32(ramfc, 0x08, lower_32_bits(usermem)); + nvkm_wo32(ramfc, 0x0c, upper_32_bits(usermem)); nvkm_wo32(ramfc, 0x10, 0x0000face); nvkm_wo32(ramfc, 0x30, 0xfffff902); nvkm_wo32(ramfc, 0x48, lower_32_bits(ioffset)); @@ -879,6 +881,8 @@ gf100_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine, struct nvkm_oclass *oclass, void *data, u32 size, struct nvkm_object **pobject) { + struct nvkm_device *device = (void *)parent; + struct nvkm_bar *bar = device->bar; struct gf100_fifo *fifo; int ret; @@ -889,28 +893,29 @@ gf100_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine, INIT_WORK(&fifo->fault, gf100_fifo_recover_work); - ret = nvkm_gpuobj_new(nv_object(fifo), NULL, 0x1000, 0x1000, 0, - &fifo->runlist.mem[0]); + ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x1000, 0x1000, + false, &fifo->runlist.mem[0]); if (ret) return ret; - ret = nvkm_gpuobj_new(nv_object(fifo), NULL, 0x1000, 0x1000, 0, - &fifo->runlist.mem[1]); + ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x1000, 0x1000, + false, &fifo->runlist.mem[1]); if (ret) return ret; init_waitqueue_head(&fifo->runlist.wait); - ret = nvkm_gpuobj_new(nv_object(fifo), NULL, 128 * 0x1000, 0x1000, 0, - &fifo->user.mem); + ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 128 * 0x1000, + 0x1000, false, &fifo->user.mem); if (ret) return ret; - ret = nvkm_gpuobj_map(fifo->user.mem, NV_MEM_ACCESS_RW, - &fifo->user.bar); + ret = bar->umap(bar, 128 * 0x1000, 12, &fifo->user.bar); if (ret) return ret; + nvkm_memory_map(fifo->user.mem, &fifo->user.bar, 0); + ret = nvkm_event_init(&gf100_fifo_uevent_func, 1, 1, &fifo->base.uevent); if (ret) return ret; @@ -927,10 +932,10 @@ gf100_fifo_dtor(struct nvkm_object *object) { struct gf100_fifo *fifo = (void *)object; - nvkm_gpuobj_unmap(&fifo->user.bar); - nvkm_gpuobj_ref(NULL, &fifo->user.mem); - nvkm_gpuobj_ref(NULL, &fifo->runlist.mem[0]); - nvkm_gpuobj_ref(NULL, &fifo->runlist.mem[1]); + nvkm_vm_put(&fifo->user.bar); + nvkm_memory_del(&fifo->user.mem); + nvkm_memory_del(&fifo->runlist.mem[0]); + nvkm_memory_del(&fifo->runlist.mem[1]); nvkm_fifo_destroy(&fifo->base); } |