Commit 7adc77aa authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/gr/gk20a,gm200-: add terminators to method lists read from fw

Method init is typically ordered by class in the FW image as ThreeD,
TwoD, Compute.

Due to a bug in parsing the FW into our internal format, we've been
accidentally sending Twod + Compute methods to the ThreeD class, as
well as Compute methods to the TwoD class - oops.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent fef1c0ef
...@@ -143,23 +143,24 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name, ...@@ -143,23 +143,24 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
nent = (fuc.size / sizeof(struct gk20a_fw_av)); nent = (fuc.size / sizeof(struct gk20a_fw_av));
pack = vzalloc((sizeof(*pack) * max_classes) + pack = vzalloc((sizeof(*pack) * (max_classes + 1)) +
(sizeof(*init) * (nent + 1))); (sizeof(*init) * (nent + max_classes + 1)));
if (!pack) { if (!pack) {
ret = -ENOMEM; ret = -ENOMEM;
goto end; goto end;
} }
init = (void *)(pack + max_classes); init = (void *)(pack + max_classes + 1);
for (i = 0; i < nent; i++) { for (i = 0; i < nent; i++, init++) {
struct gf100_gr_init *ent = &init[i];
struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc.data)[i]; struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc.data)[i];
u32 class = av->addr & 0xffff; u32 class = av->addr & 0xffff;
u32 addr = (av->addr & 0xffff0000) >> 14; u32 addr = (av->addr & 0xffff0000) >> 14;
if (prevclass != class) { if (prevclass != class) {
pack[classidx].init = ent; if (prevclass) /* Add terminator to the method list. */
init++;
pack[classidx].init = init;
pack[classidx].type = class; pack[classidx].type = class;
prevclass = class; prevclass = class;
if (++classidx >= max_classes) { if (++classidx >= max_classes) {
...@@ -169,10 +170,10 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name, ...@@ -169,10 +170,10 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
} }
} }
ent->addr = addr; init->addr = addr;
ent->data = av->data; init->data = av->data;
ent->count = 1; init->count = 1;
ent->pitch = 1; init->pitch = 1;
} }
*ppack = pack; *ppack = pack;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment