drm/nouveau/core: switch to gpuobj accessor macros
authorBen Skeggs <bskeggs@redhat.com>
Thu, 20 Aug 2015 04:54:14 +0000 (14:54 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:40:27 +0000 (12:40 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c
drivers/gpu/drm/nouveau/nvkm/core/ramht.c

index c6e5f7a7f00529ac2361ba7a65b4660edad78460..f99b446c1e10f524b5632f1c753b2a530736a8c4 100644 (file)
@@ -34,8 +34,10 @@ nvkm_gpuobj_destroy(struct nvkm_gpuobj *gpuobj)
        int i;
 
        if (gpuobj->flags & NVOBJ_FLAG_ZERO_FREE) {
+               nvkm_kmap(gpuobj);
                for (i = 0; i < gpuobj->size; i += 4)
-                       nv_wo32(gpuobj, i, 0x00000000);
+                       nvkm_wo32(gpuobj, i, 0x00000000);
+               nvkm_done(gpuobj);
        }
 
        if (gpuobj->node)
@@ -123,8 +125,10 @@ nvkm_gpuobj_create_(struct nvkm_object *parent, struct nvkm_object *engine,
        }
 
        if (flags & NVOBJ_FLAG_ZERO_ALLOC) {
+               nvkm_kmap(gpuobj);
                for (i = 0; i < gpuobj->size; i += 4)
-                       nv_wo32(gpuobj, i, 0x00000000);
+                       nvkm_wo32(gpuobj, i, 0x00000000);
+               nvkm_done(gpuobj);
        }
 
        return ret;
index ebd4d15479bdb1038d69b86e0908bf69a1368593..c61bb0fa93f66d5bbed1364446b11963a4458e8d 100644 (file)
@@ -42,35 +42,43 @@ nvkm_ramht_hash(struct nvkm_ramht *ramht, int chid, u32 handle)
 int
 nvkm_ramht_insert(struct nvkm_ramht *ramht, int chid, u32 handle, u32 context)
 {
+       struct nvkm_gpuobj *gpuobj = &ramht->gpuobj;
        struct nvkm_bar *bar = nvkm_bar(ramht);
+       int ret = -ENOSPC;
        u32 co, ho;
 
        co = ho = nvkm_ramht_hash(ramht, chid, handle);
+       nvkm_kmap(gpuobj);
        do {
-               if (!nv_ro32(ramht, co + 4)) {
-                       nv_wo32(ramht, co + 0, handle);
-                       nv_wo32(ramht, co + 4, context);
+               if (!nvkm_ro32(gpuobj, co + 4)) {
+                       nvkm_wo32(gpuobj, co + 0, handle);
+                       nvkm_wo32(gpuobj, co + 4, context);
                        if (bar)
                                bar->flush(bar);
-                       return co;
+                       ret = co;
+                       break;
                }
 
                co += 8;
                if (co >= nv_gpuobj(ramht)->size)
                        co = 0;
        } while (co != ho);
+       nvkm_done(gpuobj);
 
-       return -ENOMEM;
+       return ret;
 }
 
 void
 nvkm_ramht_remove(struct nvkm_ramht *ramht, int cookie)
 {
+       struct nvkm_gpuobj *gpuobj = &ramht->gpuobj;
        struct nvkm_bar *bar = nvkm_bar(ramht);
-       nv_wo32(ramht, cookie + 0, 0x00000000);
-       nv_wo32(ramht, cookie + 4, 0x00000000);
+       nvkm_kmap(gpuobj);
+       nvkm_wo32(gpuobj, cookie + 0, 0x00000000);
+       nvkm_wo32(gpuobj, cookie + 4, 0x00000000);
        if (bar)
                bar->flush(bar);
+       nvkm_done(gpuobj);
 }
 
 static struct nvkm_oclass