diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/cde.c | 12 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/cde.h | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ce2.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/channel.c | 33 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/channel.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 13 |
6 files changed, 41 insertions, 27 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/cde.c b/drivers/gpu/nvgpu/common/linux/cde.c index aefef882..dcccafb4 100644 --- a/drivers/gpu/nvgpu/common/linux/cde.c +++ b/drivers/gpu/nvgpu/common/linux/cde.c | |||
@@ -558,7 +558,7 @@ static int gk20a_init_cde_command(struct gk20a_cde_ctx *cde_ctx, | |||
558 | { | 558 | { |
559 | struct nvgpu_os_linux *l = cde_ctx->l; | 559 | struct nvgpu_os_linux *l = cde_ctx->l; |
560 | struct gk20a *g = &l->g; | 560 | struct gk20a *g = &l->g; |
561 | struct nvgpu_gpfifo **gpfifo, *gpfifo_elem; | 561 | struct nvgpu_gpfifo_entry **gpfifo, *gpfifo_elem; |
562 | u32 *num_entries; | 562 | u32 *num_entries; |
563 | unsigned int i; | 563 | unsigned int i; |
564 | 564 | ||
@@ -577,7 +577,7 @@ static int gk20a_init_cde_command(struct gk20a_cde_ctx *cde_ctx, | |||
577 | 577 | ||
578 | /* allocate gpfifo entries to be pushed */ | 578 | /* allocate gpfifo entries to be pushed */ |
579 | *gpfifo = nvgpu_kzalloc(g, | 579 | *gpfifo = nvgpu_kzalloc(g, |
580 | sizeof(struct nvgpu_gpfifo) * num_elems); | 580 | sizeof(struct nvgpu_gpfifo_entry) * num_elems); |
581 | if (!*gpfifo) { | 581 | if (!*gpfifo) { |
582 | nvgpu_warn(g, "cde: could not allocate memory for gpfifo entries"); | 582 | nvgpu_warn(g, "cde: could not allocate memory for gpfifo entries"); |
583 | return -ENOMEM; | 583 | return -ENOMEM; |
@@ -624,11 +624,11 @@ static int gk20a_cde_pack_cmdbufs(struct gk20a_cde_ctx *cde_ctx) | |||
624 | struct nvgpu_os_linux *l = cde_ctx->l; | 624 | struct nvgpu_os_linux *l = cde_ctx->l; |
625 | struct gk20a *g = &l->g; | 625 | struct gk20a *g = &l->g; |
626 | unsigned long init_bytes = cde_ctx->init_cmd_num_entries * | 626 | unsigned long init_bytes = cde_ctx->init_cmd_num_entries * |
627 | sizeof(struct nvgpu_gpfifo); | 627 | sizeof(struct nvgpu_gpfifo_entry); |
628 | unsigned long conv_bytes = cde_ctx->convert_cmd_num_entries * | 628 | unsigned long conv_bytes = cde_ctx->convert_cmd_num_entries * |
629 | sizeof(struct nvgpu_gpfifo); | 629 | sizeof(struct nvgpu_gpfifo_entry); |
630 | unsigned long total_bytes = init_bytes + conv_bytes; | 630 | unsigned long total_bytes = init_bytes + conv_bytes; |
631 | struct nvgpu_gpfifo *combined_cmd; | 631 | struct nvgpu_gpfifo_entry *combined_cmd; |
632 | 632 | ||
633 | /* allocate buffer that has space for both */ | 633 | /* allocate buffer that has space for both */ |
634 | combined_cmd = nvgpu_kzalloc(g, total_bytes); | 634 | combined_cmd = nvgpu_kzalloc(g, total_bytes); |
@@ -753,7 +753,7 @@ static int gk20a_cde_execute_buffer(struct gk20a_cde_ctx *cde_ctx, | |||
753 | { | 753 | { |
754 | struct nvgpu_os_linux *l = cde_ctx->l; | 754 | struct nvgpu_os_linux *l = cde_ctx->l; |
755 | struct gk20a *g = &l->g; | 755 | struct gk20a *g = &l->g; |
756 | struct nvgpu_gpfifo *gpfifo = NULL; | 756 | struct nvgpu_gpfifo_entry *gpfifo = NULL; |
757 | int num_entries = 0; | 757 | int num_entries = 0; |
758 | 758 | ||
759 | /* check command type */ | 759 | /* check command type */ |
diff --git a/drivers/gpu/nvgpu/common/linux/cde.h b/drivers/gpu/nvgpu/common/linux/cde.h index 9ff142ea..5928b624 100644 --- a/drivers/gpu/nvgpu/common/linux/cde.h +++ b/drivers/gpu/nvgpu/common/linux/cde.h | |||
@@ -47,7 +47,7 @@ struct gk20a_fence; | |||
47 | struct nvgpu_channel_fence; | 47 | struct nvgpu_channel_fence; |
48 | struct channel_gk20a; | 48 | struct channel_gk20a; |
49 | struct vm_gk20a; | 49 | struct vm_gk20a; |
50 | struct nvgpu_gpfifo; | 50 | struct nvgpu_gpfifo_entry; |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * this element defines a buffer that is allocated and mapped into gpu address | 53 | * this element defines a buffer that is allocated and mapped into gpu address |
@@ -258,10 +258,10 @@ struct gk20a_cde_ctx { | |||
258 | 258 | ||
259 | u64 backing_store_vaddr; | 259 | u64 backing_store_vaddr; |
260 | 260 | ||
261 | struct nvgpu_gpfifo *init_convert_cmd; | 261 | struct nvgpu_gpfifo_entry *init_convert_cmd; |
262 | int init_cmd_num_entries; | 262 | int init_cmd_num_entries; |
263 | 263 | ||
264 | struct nvgpu_gpfifo *convert_cmd; | 264 | struct nvgpu_gpfifo_entry *convert_cmd; |
265 | int convert_cmd_num_entries; | 265 | int convert_cmd_num_entries; |
266 | 266 | ||
267 | struct kobj_attribute attr; | 267 | struct kobj_attribute attr; |
diff --git a/drivers/gpu/nvgpu/common/linux/ce2.c b/drivers/gpu/nvgpu/common/linux/ce2.c index d1f0ad63..6ffc0532 100644 --- a/drivers/gpu/nvgpu/common/linux/ce2.c +++ b/drivers/gpu/nvgpu/common/linux/ce2.c | |||
@@ -55,7 +55,7 @@ int gk20a_ce_execute_ops(struct gk20a *g, | |||
55 | u32 methodSize; | 55 | u32 methodSize; |
56 | u32 cmd_buf_read_offset; | 56 | u32 cmd_buf_read_offset; |
57 | u32 dma_copy_class; | 57 | u32 dma_copy_class; |
58 | struct nvgpu_gpfifo gpfifo; | 58 | struct nvgpu_gpfifo_entry gpfifo; |
59 | struct nvgpu_channel_fence fence = {0, 0}; | 59 | struct nvgpu_channel_fence fence = {0, 0}; |
60 | struct gk20a_fence *ce_cmd_buf_fence_out = NULL; | 60 | struct gk20a_fence *ce_cmd_buf_fence_out = NULL; |
61 | 61 | ||
diff --git a/drivers/gpu/nvgpu/common/linux/channel.c b/drivers/gpu/nvgpu/common/linux/channel.c index ad127606..db85f66a 100644 --- a/drivers/gpu/nvgpu/common/linux/channel.c +++ b/drivers/gpu/nvgpu/common/linux/channel.c | |||
@@ -328,12 +328,12 @@ void nvgpu_remove_channel_support_linux(struct nvgpu_os_linux *l) | |||
328 | 328 | ||
329 | u32 nvgpu_get_gpfifo_entry_size(void) | 329 | u32 nvgpu_get_gpfifo_entry_size(void) |
330 | { | 330 | { |
331 | return sizeof(struct nvgpu_gpfifo); | 331 | return sizeof(struct nvgpu_gpfifo_entry); |
332 | } | 332 | } |
333 | 333 | ||
334 | #ifdef CONFIG_DEBUG_FS | 334 | #ifdef CONFIG_DEBUG_FS |
335 | static void trace_write_pushbuffer(struct channel_gk20a *c, | 335 | static void trace_write_pushbuffer(struct channel_gk20a *c, |
336 | struct nvgpu_gpfifo *g) | 336 | struct nvgpu_gpfifo_entry *g) |
337 | { | 337 | { |
338 | void *mem = NULL; | 338 | void *mem = NULL; |
339 | unsigned int words; | 339 | unsigned int words; |
@@ -371,15 +371,15 @@ static void trace_write_pushbuffer(struct channel_gk20a *c, | |||
371 | #endif | 371 | #endif |
372 | 372 | ||
373 | static void trace_write_pushbuffer_range(struct channel_gk20a *c, | 373 | static void trace_write_pushbuffer_range(struct channel_gk20a *c, |
374 | struct nvgpu_gpfifo *g, | 374 | struct nvgpu_gpfifo_entry *g, |
375 | struct nvgpu_gpfifo __user *user_gpfifo, | 375 | struct nvgpu_gpfifo_entry __user *user_gpfifo, |
376 | int offset, | 376 | int offset, |
377 | int count) | 377 | int count) |
378 | { | 378 | { |
379 | #ifdef CONFIG_DEBUG_FS | 379 | #ifdef CONFIG_DEBUG_FS |
380 | u32 size; | 380 | u32 size; |
381 | int i; | 381 | int i; |
382 | struct nvgpu_gpfifo *gp; | 382 | struct nvgpu_gpfifo_entry *gp; |
383 | bool gpfifo_allocated = false; | 383 | bool gpfifo_allocated = false; |
384 | 384 | ||
385 | if (!gk20a_debug_trace_cmdbuf) | 385 | if (!gk20a_debug_trace_cmdbuf) |
@@ -389,7 +389,7 @@ static void trace_write_pushbuffer_range(struct channel_gk20a *c, | |||
389 | return; | 389 | return; |
390 | 390 | ||
391 | if (!g) { | 391 | if (!g) { |
392 | size = count * sizeof(struct nvgpu_gpfifo); | 392 | size = count * sizeof(struct nvgpu_gpfifo_entry); |
393 | if (size) { | 393 | if (size) { |
394 | g = nvgpu_big_malloc(c->g, size); | 394 | g = nvgpu_big_malloc(c->g, size); |
395 | if (!g) | 395 | if (!g) |
@@ -553,7 +553,7 @@ static void gk20a_submit_append_priv_cmdbuf(struct channel_gk20a *c, | |||
553 | { | 553 | { |
554 | struct gk20a *g = c->g; | 554 | struct gk20a *g = c->g; |
555 | struct nvgpu_mem *gpfifo_mem = &c->gpfifo.mem; | 555 | struct nvgpu_mem *gpfifo_mem = &c->gpfifo.mem; |
556 | struct nvgpu_gpfifo x = { | 556 | struct nvgpu_gpfifo_entry x = { |
557 | .entry0 = u64_lo32(cmd->gva), | 557 | .entry0 = u64_lo32(cmd->gva), |
558 | .entry1 = u64_hi32(cmd->gva) | | 558 | .entry1 = u64_hi32(cmd->gva) | |
559 | pbdma_gp_entry1_length_f(cmd->size) | 559 | pbdma_gp_entry1_length_f(cmd->size) |
@@ -574,17 +574,18 @@ static void gk20a_submit_append_priv_cmdbuf(struct channel_gk20a *c, | |||
574 | * splitting into two memcpys to handle wrap-around. | 574 | * splitting into two memcpys to handle wrap-around. |
575 | */ | 575 | */ |
576 | static int gk20a_submit_append_gpfifo(struct channel_gk20a *c, | 576 | static int gk20a_submit_append_gpfifo(struct channel_gk20a *c, |
577 | struct nvgpu_gpfifo *kern_gpfifo, | 577 | struct nvgpu_gpfifo_entry *kern_gpfifo, |
578 | struct nvgpu_gpfifo __user *user_gpfifo, | 578 | struct nvgpu_gpfifo_entry __user *user_gpfifo, |
579 | u32 num_entries) | 579 | u32 num_entries) |
580 | { | 580 | { |
581 | /* byte offsets */ | 581 | /* byte offsets */ |
582 | u32 gpfifo_size = c->gpfifo.entry_num * sizeof(struct nvgpu_gpfifo); | 582 | u32 gpfifo_size = |
583 | u32 len = num_entries * sizeof(struct nvgpu_gpfifo); | 583 | c->gpfifo.entry_num * sizeof(struct nvgpu_gpfifo_entry); |
584 | u32 start = c->gpfifo.put * sizeof(struct nvgpu_gpfifo); | 584 | u32 len = num_entries * sizeof(struct nvgpu_gpfifo_entry); |
585 | u32 start = c->gpfifo.put * sizeof(struct nvgpu_gpfifo_entry); | ||
585 | u32 end = start + len; /* exclusive */ | 586 | u32 end = start + len; /* exclusive */ |
586 | struct nvgpu_mem *gpfifo_mem = &c->gpfifo.mem; | 587 | struct nvgpu_mem *gpfifo_mem = &c->gpfifo.mem; |
587 | struct nvgpu_gpfifo *cpu_src; | 588 | struct nvgpu_gpfifo_entry *cpu_src; |
588 | int err; | 589 | int err; |
589 | 590 | ||
590 | if (user_gpfifo && !c->gpfifo.pipe) { | 591 | if (user_gpfifo && !c->gpfifo.pipe) { |
@@ -659,7 +660,7 @@ out: | |||
659 | } | 660 | } |
660 | 661 | ||
661 | int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | 662 | int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, |
662 | struct nvgpu_gpfifo *gpfifo, | 663 | struct nvgpu_gpfifo_entry *gpfifo, |
663 | struct nvgpu_submit_gpfifo_args *args, | 664 | struct nvgpu_submit_gpfifo_args *args, |
664 | u32 num_entries, | 665 | u32 num_entries, |
665 | u32 flags, | 666 | u32 flags, |
@@ -681,8 +682,8 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
681 | int err = 0; | 682 | int err = 0; |
682 | bool need_job_tracking; | 683 | bool need_job_tracking; |
683 | bool need_deferred_cleanup = false; | 684 | bool need_deferred_cleanup = false; |
684 | struct nvgpu_gpfifo __user *user_gpfifo = args ? | 685 | struct nvgpu_gpfifo_entry __user *user_gpfifo = args ? |
685 | (struct nvgpu_gpfifo __user *)(uintptr_t)args->gpfifo : NULL; | 686 | (struct nvgpu_gpfifo_entry __user *)(uintptr_t)args->gpfifo : NULL; |
686 | 687 | ||
687 | if (nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) | 688 | if (nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) |
688 | return -ENODEV; | 689 | return -ENODEV; |
diff --git a/drivers/gpu/nvgpu/common/linux/channel.h b/drivers/gpu/nvgpu/common/linux/channel.h index 85be581a..6026e259 100644 --- a/drivers/gpu/nvgpu/common/linux/channel.h +++ b/drivers/gpu/nvgpu/common/linux/channel.h | |||
@@ -71,7 +71,7 @@ struct channel_gk20a *gk20a_open_new_channel_with_cb(struct gk20a *g, | |||
71 | bool is_privileged_channel); | 71 | bool is_privileged_channel); |
72 | 72 | ||
73 | int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | 73 | int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, |
74 | struct nvgpu_gpfifo *gpfifo, | 74 | struct nvgpu_gpfifo_entry *gpfifo, |
75 | struct nvgpu_submit_gpfifo_args *args, | 75 | struct nvgpu_submit_gpfifo_args *args, |
76 | u32 num_entries, | 76 | u32 num_entries, |
77 | u32 flags, | 77 | u32 flags, |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index ab1c4a6f..2008c471 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -59,6 +59,19 @@ struct nvgpu_channel_fence { | |||
59 | u32 value; | 59 | u32 value; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | /* | ||
63 | * The binary format of 'struct nvgpu_gpfifo_entry' introduced here | ||
64 | * should match that of 'struct nvgpu_gpfifo' defined in uapi header, since | ||
65 | * this struct is intended to be a mirror copy of the uapi struct. This is | ||
66 | * a rigid requirement because there's no conversion function and there are | ||
67 | * memcpy's present between the user gpfifo (of type nvgpu_gpfifo) and the | ||
68 | * kern gpfifo (of type nvgpu_gpfifo_entry). | ||
69 | */ | ||
70 | struct nvgpu_gpfifo_entry { | ||
71 | u32 entry0; | ||
72 | u32 entry1; | ||
73 | }; | ||
74 | |||
62 | struct nvgpu_gpfifo_args { | 75 | struct nvgpu_gpfifo_args { |
63 | u32 num_entries; | 76 | u32 num_entries; |
64 | u32 num_inflight_jobs; | 77 | u32 num_inflight_jobs; |