drm/nouveau/falcon: directly use instmem for ucode image
authorBen Skeggs <bskeggs@redhat.com>
Thu, 20 Aug 2015 04:54:17 +0000 (14:54 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:40:36 +0000 (12:40 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h
drivers/gpu/drm/nouveau/nvkm/engine/falcon.c

index 3ce0ffc8ef8692788857655cb17f735f47d0d971..5e6f1f518ea5bf7887caecbe97ba01c3e57373b4 100644 (file)
@@ -35,7 +35,7 @@ struct nvkm_falcon {
        u8  version;
        u8  secret;
 
-       struct nvkm_gpuobj *core;
+       struct nvkm_memory *core;
        bool external;
 
        struct {
index ac39cb7e7299bb3bf24d50b942c9c6ba842a325d..27bc50e80a56b49c40f43ede1e9ace9b0d5c44fa 100644 (file)
@@ -168,8 +168,9 @@ _nvkm_falcon_init(struct nvkm_object *object)
 
        /* ensure any "self-bootstrapping" firmware image is in vram */
        if (!falcon->data.data && !falcon->core) {
-               ret = nvkm_gpuobj_new(object->parent, NULL, falcon->code.size,
-                                     256, 0, &falcon->core);
+               ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
+                                     falcon->code.size, 256, false,
+                                     &falcon->core);
                if (ret) {
                        nvkm_error(subdev, "core allocation failed, %d\n", ret);
                        return ret;
@@ -183,12 +184,13 @@ _nvkm_falcon_init(struct nvkm_object *object)
 
        /* upload firmware bootloader (or the full code segments) */
        if (falcon->core) {
+               u64 addr = nvkm_memory_addr(falcon->core);
                if (device->card_type < NV_C0)
                        nvkm_wr32(device, base + 0x618, 0x04000000);
                else
                        nvkm_wr32(device, base + 0x618, 0x00000114);
                nvkm_wr32(device, base + 0x11c, 0);
-               nvkm_wr32(device, base + 0x110, falcon->core->addr >> 8);
+               nvkm_wr32(device, base + 0x110, addr >> 8);
                nvkm_wr32(device, base + 0x114, 0);
                nvkm_wr32(device, base + 0x118, 0x00006610);
        } else {
@@ -243,7 +245,7 @@ _nvkm_falcon_fini(struct nvkm_object *object, bool suspend)
        const u32 base = falcon->addr;
 
        if (!suspend) {
-               nvkm_gpuobj_ref(NULL, &falcon->core);
+               nvkm_memory_del(&falcon->core);
                if (falcon->external) {
                        vfree(falcon->data.data);
                        vfree(falcon->code.data);