Revert "gpu: nvgpu: WAR for bad GPFIFO entries from userspace"
Terje Bergstrom [Mon, 5 Oct 2015 21:51:13 +0000 (14:51 -0700)]
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 <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/815440
Reviewed-by: Donghan Ryu <dryu@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/gpu/nvgpu/gk20a/channel_gk20a.c

index 5db372b..3f610de 100644 (file)
@@ -1808,51 +1808,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);