diff options
author | Janne Hellsten <jhellsten@nvidia.com> | 2015-01-26 10:27:42 -0500 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2015-10-27 11:40:31 -0400 |
commit | 057c6334f7f72071bc87a1793b688b34add7c681 (patch) | |
tree | 95f916f86016dcb9f1f36772ed62907487e8ae18 /drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |
parent | 5c26f72fe18719a6639e1b6064eb013ec37b15ef (diff) |
gpu: nvgpu: Get rid of legacy gpfifo type
Get rid of the duplicate gpfifo struct to emphasize the fact that
nvgpu_gpfifo is the only memory layout for gpfifo entries that works.
This is the same layout that HW uses.
Also, add a local pointer to the gpfifo memory in
gk20a_submit_channel_gpfifo to get rid of repeated typecasts.
Bug 1592391
Bug 1550886
Change-Id: I5432859ef8e7c1aab5907e44098994d7bb807f50
Signed-off-by: Janne Hellsten <jhellsten@nvidia.com>
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/677341
(cherry picked from commit 724c8c6228af81dd440e825bddf545dd6b2b8bd7)
Reviewed-on: http://git-master/r/822548
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index f82c63be..5b5da633 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -1381,7 +1381,8 @@ int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c, | |||
1381 | return -EEXIST; | 1381 | return -EEXIST; |
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | err = gk20a_gmmu_alloc_map(ch_vm, gpfifo_size * sizeof(struct gpfifo), | 1384 | err = gk20a_gmmu_alloc_map(ch_vm, |
1385 | gpfifo_size * sizeof(struct nvgpu_gpfifo), | ||
1385 | &c->gpfifo.mem); | 1386 | &c->gpfifo.mem); |
1386 | if (err) { | 1387 | if (err) { |
1387 | gk20a_err(d, "%s: memory allocation failed\n", __func__); | 1388 | gk20a_err(d, "%s: memory allocation failed\n", __func__); |
@@ -1812,6 +1813,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
1812 | * and one for post fence. */ | 1813 | * and one for post fence. */ |
1813 | const int extra_entries = 2; | 1814 | const int extra_entries = 2; |
1814 | bool need_wfi = !(flags & NVGPU_SUBMIT_GPFIFO_FLAGS_SUPPRESS_WFI); | 1815 | bool need_wfi = !(flags & NVGPU_SUBMIT_GPFIFO_FLAGS_SUPPRESS_WFI); |
1816 | struct nvgpu_gpfifo *gpfifo_mem = c->gpfifo.mem.cpu_va; | ||
1815 | 1817 | ||
1816 | if (c->has_timedout) | 1818 | if (c->has_timedout) |
1817 | return -ETIMEDOUT; | 1819 | return -ETIMEDOUT; |
@@ -1948,10 +1950,8 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
1948 | } | 1950 | } |
1949 | 1951 | ||
1950 | if (wait_cmd) { | 1952 | if (wait_cmd) { |
1951 | ((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry0 = | 1953 | gpfifo_mem[c->gpfifo.put].entry0 = u64_lo32(wait_cmd->gva); |
1952 | u64_lo32(wait_cmd->gva); | 1954 | gpfifo_mem[c->gpfifo.put].entry1 = u64_hi32(wait_cmd->gva) | |
1953 | ((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry1 = | ||
1954 | u64_hi32(wait_cmd->gva) | | ||
1955 | pbdma_gp_entry1_length_f(wait_cmd->size); | 1955 | pbdma_gp_entry1_length_f(wait_cmd->size); |
1956 | trace_gk20a_push_cmdbuf(c->g->dev->name, | 1956 | trace_gk20a_push_cmdbuf(c->g->dev->name, |
1957 | 0, wait_cmd->size, 0, wait_cmd->ptr); | 1957 | 0, wait_cmd->size, 0, wait_cmd->ptr); |
@@ -1975,16 +1975,16 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
1975 | int length0 = c->gpfifo.entry_num - start; | 1975 | int length0 = c->gpfifo.entry_num - start; |
1976 | int length1 = num_entries - length0; | 1976 | int length1 = num_entries - length0; |
1977 | 1977 | ||
1978 | memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, gpfifo, | 1978 | memcpy(gpfifo_mem + start, gpfifo, |
1979 | length0 * sizeof(*gpfifo)); | 1979 | length0 * sizeof(*gpfifo)); |
1980 | 1980 | ||
1981 | memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va, gpfifo + length0, | 1981 | memcpy(gpfifo_mem, gpfifo + length0, |
1982 | length1 * sizeof(*gpfifo)); | 1982 | length1 * sizeof(*gpfifo)); |
1983 | 1983 | ||
1984 | trace_write_pushbuffer_range(c, gpfifo, length0); | 1984 | trace_write_pushbuffer_range(c, gpfifo, length0); |
1985 | trace_write_pushbuffer_range(c, gpfifo + length0, length1); | 1985 | trace_write_pushbuffer_range(c, gpfifo + length0, length1); |
1986 | } else { | 1986 | } else { |
1987 | memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, gpfifo, | 1987 | memcpy(gpfifo_mem + start, gpfifo, |
1988 | num_entries * sizeof(*gpfifo)); | 1988 | num_entries * sizeof(*gpfifo)); |
1989 | 1989 | ||
1990 | trace_write_pushbuffer_range(c, gpfifo, num_entries); | 1990 | trace_write_pushbuffer_range(c, gpfifo, num_entries); |
@@ -1993,10 +1993,8 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
1993 | (c->gpfifo.entry_num - 1); | 1993 | (c->gpfifo.entry_num - 1); |
1994 | 1994 | ||
1995 | if (incr_cmd) { | 1995 | if (incr_cmd) { |
1996 | ((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry0 = | 1996 | gpfifo_mem[c->gpfifo.put].entry0 = u64_lo32(incr_cmd->gva); |
1997 | u64_lo32(incr_cmd->gva); | 1997 | gpfifo_mem[c->gpfifo.put].entry1 = u64_hi32(incr_cmd->gva) | |
1998 | ((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry1 = | ||
1999 | u64_hi32(incr_cmd->gva) | | ||
2000 | pbdma_gp_entry1_length_f(incr_cmd->size); | 1998 | pbdma_gp_entry1_length_f(incr_cmd->size); |
2001 | trace_gk20a_push_cmdbuf(c->g->dev->name, | 1999 | trace_gk20a_push_cmdbuf(c->g->dev->name, |
2002 | 0, incr_cmd->size, 0, incr_cmd->ptr); | 2000 | 0, incr_cmd->size, 0, incr_cmd->ptr); |