drm/nouveau/graph: pad firmware code at load time
authorAlexandre Courbot <acourbot@nvidia.com>
Fri, 2 May 2014 09:32:40 +0000 (18:32 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 10 Jun 2014 06:05:50 +0000 (16:05 +1000)
Pad the microcode to a multiple of 0x40 words, otherwise firmware will
fail to run from non-prepadded firmware files.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c

index 83dca0700ae504a1a2cf4d53c68a0eb8981acdb4..bf7bdb1f291efd9e7a2f5c92db554be638f62e4a 100644 (file)
@@ -894,6 +894,10 @@ nvc0_graph_init_fw(struct nvc0_graph_priv *priv, u32 fuc_base,
                        nv_wr32(priv, fuc_base + 0x0188, i >> 6);
                nv_wr32(priv, fuc_base + 0x0184, code->data[i]);
        }
+
+       /* code must be padded to 0x40 words */
+       for (; i & 0x3f; i++)
+               nv_wr32(priv, fuc_base + 0x0184, 0);
 }
 
 static void