Skip to content

Commit d07d4aa

Browse files
Ben Skeggsgregkh
authored andcommitted
drm/nouveau/gr/gk20a,gm200-: add terminators to method lists read from fw
[ Upstream commit 7adc77a ] 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: Ben Skeggs <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent f426db8 commit d07d4aa

File tree

1 file changed

+11
-10
lines changed
  • drivers/gpu/drm/nouveau/nvkm/engine/gr

1 file changed

+11
-10
lines changed

drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,23 +143,24 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
143143

144144
nent = (fuc.size / sizeof(struct gk20a_fw_av));
145145

146-
pack = vzalloc((sizeof(*pack) * max_classes) +
147-
(sizeof(*init) * (nent + 1)));
146+
pack = vzalloc((sizeof(*pack) * (max_classes + 1)) +
147+
(sizeof(*init) * (nent + max_classes + 1)));
148148
if (!pack) {
149149
ret = -ENOMEM;
150150
goto end;
151151
}
152152

153-
init = (void *)(pack + max_classes);
153+
init = (void *)(pack + max_classes + 1);
154154

155-
for (i = 0; i < nent; i++) {
156-
struct gf100_gr_init *ent = &init[i];
155+
for (i = 0; i < nent; i++, init++) {
157156
struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc.data)[i];
158157
u32 class = av->addr & 0xffff;
159158
u32 addr = (av->addr & 0xffff0000) >> 14;
160159

161160
if (prevclass != class) {
162-
pack[classidx].init = ent;
161+
if (prevclass) /* Add terminator to the method list. */
162+
init++;
163+
pack[classidx].init = init;
163164
pack[classidx].type = class;
164165
prevclass = class;
165166
if (++classidx >= max_classes) {
@@ -169,10 +170,10 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
169170
}
170171
}
171172

172-
ent->addr = addr;
173-
ent->data = av->data;
174-
ent->count = 1;
175-
ent->pitch = 1;
173+
init->addr = addr;
174+
init->data = av->data;
175+
init->count = 1;
176+
init->pitch = 1;
176177
}
177178

178179
*ppack = pack;

0 commit comments

Comments
 (0)