mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
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>
This commit is contained in:
committed by
Terje Bergstrom
parent
5c26f72fe1
commit
057c6334f7
@@ -1381,7 +1381,8 @@ int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c,
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
err = gk20a_gmmu_alloc_map(ch_vm, gpfifo_size * sizeof(struct gpfifo),
|
||||
err = gk20a_gmmu_alloc_map(ch_vm,
|
||||
gpfifo_size * sizeof(struct nvgpu_gpfifo),
|
||||
&c->gpfifo.mem);
|
||||
if (err) {
|
||||
gk20a_err(d, "%s: memory allocation failed\n", __func__);
|
||||
@@ -1812,6 +1813,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
|
||||
* and one for post fence. */
|
||||
const int extra_entries = 2;
|
||||
bool need_wfi = !(flags & NVGPU_SUBMIT_GPFIFO_FLAGS_SUPPRESS_WFI);
|
||||
struct nvgpu_gpfifo *gpfifo_mem = c->gpfifo.mem.cpu_va;
|
||||
|
||||
if (c->has_timedout)
|
||||
return -ETIMEDOUT;
|
||||
@@ -1948,10 +1950,8 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
|
||||
}
|
||||
|
||||
if (wait_cmd) {
|
||||
((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry0 =
|
||||
u64_lo32(wait_cmd->gva);
|
||||
((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry1 =
|
||||
u64_hi32(wait_cmd->gva) |
|
||||
gpfifo_mem[c->gpfifo.put].entry0 = u64_lo32(wait_cmd->gva);
|
||||
gpfifo_mem[c->gpfifo.put].entry1 = u64_hi32(wait_cmd->gva) |
|
||||
pbdma_gp_entry1_length_f(wait_cmd->size);
|
||||
trace_gk20a_push_cmdbuf(c->g->dev->name,
|
||||
0, wait_cmd->size, 0, wait_cmd->ptr);
|
||||
@@ -1975,16 +1975,16 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
|
||||
int length0 = c->gpfifo.entry_num - start;
|
||||
int length1 = num_entries - length0;
|
||||
|
||||
memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va + start, gpfifo,
|
||||
memcpy(gpfifo_mem + start, gpfifo,
|
||||
length0 * sizeof(*gpfifo));
|
||||
|
||||
memcpy((struct gpfifo *)c->gpfifo.mem.cpu_va, gpfifo + length0,
|
||||
memcpy(gpfifo_mem, 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,
|
||||
memcpy(gpfifo_mem + start, gpfifo,
|
||||
num_entries * sizeof(*gpfifo));
|
||||
|
||||
trace_write_pushbuffer_range(c, gpfifo, num_entries);
|
||||
@@ -1993,10 +1993,8 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
|
||||
(c->gpfifo.entry_num - 1);
|
||||
|
||||
if (incr_cmd) {
|
||||
((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry0 =
|
||||
u64_lo32(incr_cmd->gva);
|
||||
((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry1 =
|
||||
u64_hi32(incr_cmd->gva) |
|
||||
gpfifo_mem[c->gpfifo.put].entry0 = u64_lo32(incr_cmd->gva);
|
||||
gpfifo_mem[c->gpfifo.put].entry1 = u64_hi32(incr_cmd->gva) |
|
||||
pbdma_gp_entry1_length_f(incr_cmd->size);
|
||||
trace_gk20a_push_cmdbuf(c->g->dev->name,
|
||||
0, incr_cmd->size, 0, incr_cmd->ptr);
|
||||
|
||||
@@ -38,11 +38,6 @@ struct gk20a_fence;
|
||||
#include "gr_gk20a.h"
|
||||
#include "fence_gk20a.h"
|
||||
|
||||
struct gpfifo {
|
||||
u32 entry0;
|
||||
u32 entry1;
|
||||
};
|
||||
|
||||
struct notification {
|
||||
struct {
|
||||
u32 nanoseconds[2];
|
||||
|
||||
@@ -563,6 +563,7 @@ struct nvgpu_dbg_gpu_pc_sampling_args {
|
||||
#define NVGPU_PRIORITY_HIGH 150
|
||||
#define NVGPU_TIMEOUT_FLAG_DISABLE_DUMP 0
|
||||
|
||||
/* this is also the hardware memory format */
|
||||
struct nvgpu_gpfifo {
|
||||
__u32 entry0; /* first word of gpfifo entry */
|
||||
__u32 entry1; /* second word of gpfifo entry */
|
||||
|
||||
Reference in New Issue
Block a user