From 87adfb4963182830e4fd32d2859659afedafb214 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 5 Oct 2015 14:51:13 -0700 Subject: Revert "gpu: nvgpu: WAR for bad GPFIFO entries from userspace" This reverts commit aeb74fc7952718ffab6281c687951499510c4333. User space was fixed not to send zero-length GPFIFO entries. Bug 1662670 Change-Id: Iec6bf1870a19db4e8daa2ed4512650b92a37ba92 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/811783 --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 52 ++++++++------------------------- 1 file changed, 12 insertions(+), 40 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 92b4b3de..6dad412a 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -1948,51 +1948,23 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, start = c->gpfifo.put; end = start + num_entries; - /* - * This WAR is in place for handling invalid simulation GPFIFO entries - * passed to us from userspace. This will be removed once these invalid - * GPFIFO entries are handled in userspace. - */ - if (tegra_platform_is_linsim()) { - int i; - struct gpfifo *gpfifo_entries = c->gpfifo.mem.cpu_va; + if (end > c->gpfifo.entry_num) { + int length0 = c->gpfifo.entry_num - start; + int length1 = num_entries - length0; - for (i = 0; i < num_entries; i++) { - int index = (start + i) & (c->gpfifo.entry_num - 1); + memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, gpfifo, + length0 * sizeof(*gpfifo)); - /* Copy the entry... */ - gpfifo_entries[index].entry0 = gpfifo[i].entry0; - gpfifo_entries[index].entry1 = gpfifo[i].entry1; + memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va, gpfifo + length0, + length1 * sizeof(*gpfifo)); - /* - * And here's the WAR: if the length is 0 clear the - * opcode field (bottom 8 bits). - */ - if (!pbdma_gp_entry1_length_v(gpfifo[i].entry1)) - gpfifo_entries[index].entry1 &= ~0xff; - - trace_write_pushbuffer_range(c, gpfifo, num_entries); - } + trace_write_pushbuffer_range(c, gpfifo, length0); + trace_write_pushbuffer_range(c, gpfifo + length0, length1); } else { - if (end > c->gpfifo.entry_num) { - int length0 = c->gpfifo.entry_num - start; - int length1 = num_entries - length0; + memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, gpfifo, + num_entries * sizeof(*gpfifo)); - memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, - gpfifo, length0 * sizeof(*gpfifo)); - - memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va, - gpfifo + length0, length1 * sizeof(*gpfifo)); - - trace_write_pushbuffer_range(c, gpfifo, length0); - trace_write_pushbuffer_range(c, gpfifo + length0, - length1); - } else { - memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, - gpfifo, num_entries * sizeof(*gpfifo)); - - trace_write_pushbuffer_range(c, gpfifo, num_entries); - } + trace_write_pushbuffer_range(c, gpfifo, num_entries); } c->gpfifo.put = (c->gpfifo.put + num_entries) & (c->gpfifo.entry_num - 1); -- cgit v1.2.2