summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2015-10-05 17:51:13 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2015-10-08 18:34:48 -0400
commit87adfb4963182830e4fd32d2859659afedafb214 (patch)
treea62a808aa13beeef4e03abc5cad1cb3b0345f93d /drivers
parent2b9d49a7d469de6bbb4d1e6513bf56fd458c3352 (diff)
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 <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/811783
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c52
1 files changed, 12 insertions, 40 deletions
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,
1948 start = c->gpfifo.put; 1948 start = c->gpfifo.put;
1949 end = start + num_entries; 1949 end = start + num_entries;
1950 1950
1951 /* 1951 if (end > c->gpfifo.entry_num) {
1952 * This WAR is in place for handling invalid simulation GPFIFO entries 1952 int length0 = c->gpfifo.entry_num - start;
1953 * passed to us from userspace. This will be removed once these invalid 1953 int length1 = num_entries - length0;
1954 * GPFIFO entries are handled in userspace.
1955 */
1956 if (tegra_platform_is_linsim()) {
1957 int i;
1958 struct gpfifo *gpfifo_entries = c->gpfifo.mem.cpu_va;
1959 1954
1960 for (i = 0; i < num_entries; i++) { 1955 memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, gpfifo,
1961 int index = (start + i) & (c->gpfifo.entry_num - 1); 1956 length0 * sizeof(*gpfifo));
1962 1957
1963 /* Copy the entry... */ 1958 memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va, gpfifo + length0,
1964 gpfifo_entries[index].entry0 = gpfifo[i].entry0; 1959 length1 * sizeof(*gpfifo));
1965 gpfifo_entries[index].entry1 = gpfifo[i].entry1;
1966 1960
1967 /* 1961 trace_write_pushbuffer_range(c, gpfifo, length0);
1968 * And here's the WAR: if the length is 0 clear the 1962 trace_write_pushbuffer_range(c, gpfifo + length0, length1);
1969 * opcode field (bottom 8 bits).
1970 */
1971 if (!pbdma_gp_entry1_length_v(gpfifo[i].entry1))
1972 gpfifo_entries[index].entry1 &= ~0xff;
1973
1974 trace_write_pushbuffer_range(c, gpfifo, num_entries);
1975 }
1976 } else { 1963 } else {
1977 if (end > c->gpfifo.entry_num) { 1964 memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, gpfifo,
1978 int length0 = c->gpfifo.entry_num - start; 1965 num_entries * sizeof(*gpfifo));
1979 int length1 = num_entries - length0;
1980 1966
1981 memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, 1967 trace_write_pushbuffer_range(c, gpfifo, num_entries);
1982 gpfifo, length0 * sizeof(*gpfifo));
1983
1984 memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va,
1985 gpfifo + length0, length1 * sizeof(*gpfifo));
1986
1987 trace_write_pushbuffer_range(c, gpfifo, length0);
1988 trace_write_pushbuffer_range(c, gpfifo + length0,
1989 length1);
1990 } else {
1991 memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start,
1992 gpfifo, num_entries * sizeof(*gpfifo));
1993
1994 trace_write_pushbuffer_range(c, gpfifo, num_entries);
1995 }
1996 } 1968 }
1997 c->gpfifo.put = (c->gpfifo.put + num_entries) & 1969 c->gpfifo.put = (c->gpfifo.put + num_entries) &
1998 (c->gpfifo.entry_num - 1); 1970 (c->gpfifo.entry_num - 1);