summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSourab Gupta <sourabg@nvidia.com>2018-04-10 02:35:09 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-04-11 13:16:09 -0400
commit585e33e4082baaf58d3714c42200f3c72bffa218 (patch)
tree0258a738f37e96aab4d11ae8ac3a4d78e3680c4b
parentf3d22faef874901808746d957d2f97e6ca07a977 (diff)
gpu: nvgpu: remove usage of nvgpu_fence
Remove the usage of nvgpu_fence splattered across nvgpu, and replace with a struct defined in common code. The usage is still inside Linux, but this helps the subsequent unification efforts, e.g. to unify the submit path. VQRM-3465 Change-Id: Ic3737450123dfc5e1c40ca5b6b8d8f6b3070aa0d Signed-off-by: Sourab Gupta <sourabg@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1691977 Reviewed-by: Konsta Holtta <kholtta@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/cde.c10
-rw-r--r--drivers/gpu/nvgpu/common/linux/cde.h6
-rw-r--r--drivers/gpu/nvgpu/common/linux/ce2.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/channel.c4
-rw-r--r--drivers/gpu/nvgpu/common/linux/channel.h4
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c12
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h12
8 files changed, 37 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/cde.c b/drivers/gpu/nvgpu/common/linux/cde.c
index e5441ac9..aefef882 100644
--- a/drivers/gpu/nvgpu/common/linux/cde.c
+++ b/drivers/gpu/nvgpu/common/linux/cde.c
@@ -748,7 +748,7 @@ deinit_image:
748} 748}
749 749
750static int gk20a_cde_execute_buffer(struct gk20a_cde_ctx *cde_ctx, 750static int gk20a_cde_execute_buffer(struct gk20a_cde_ctx *cde_ctx,
751 u32 op, struct nvgpu_fence *fence, 751 u32 op, struct nvgpu_channel_fence *fence,
752 u32 flags, struct gk20a_fence **fence_out) 752 u32 flags, struct gk20a_fence **fence_out)
753{ 753{
754 struct nvgpu_os_linux *l = cde_ctx->l; 754 struct nvgpu_os_linux *l = cde_ctx->l;
@@ -975,7 +975,7 @@ int gk20a_cde_convert(struct nvgpu_os_linux *l,
975 struct dma_buf *compbits_scatter_buf, 975 struct dma_buf *compbits_scatter_buf,
976 u64 compbits_byte_offset, 976 u64 compbits_byte_offset,
977 u64 scatterbuffer_byte_offset, 977 u64 scatterbuffer_byte_offset,
978 struct nvgpu_fence *fence, 978 struct nvgpu_channel_fence *fence,
979 u32 __flags, struct gk20a_cde_param *params, 979 u32 __flags, struct gk20a_cde_param *params,
980 int num_params, struct gk20a_fence **fence_out) 980 int num_params, struct gk20a_fence **fence_out)
981__acquires(&l->cde_app->mutex) 981__acquires(&l->cde_app->mutex)
@@ -1482,7 +1482,7 @@ static int gk20a_buffer_convert_gpu_to_cde_v1(
1482 u64 offset, u64 compbits_hoffset, u64 compbits_voffset, 1482 u64 offset, u64 compbits_hoffset, u64 compbits_voffset,
1483 u64 scatterbuffer_offset, 1483 u64 scatterbuffer_offset,
1484 u32 width, u32 height, u32 block_height_log2, 1484 u32 width, u32 height, u32 block_height_log2,
1485 u32 submit_flags, struct nvgpu_fence *fence_in, 1485 u32 submit_flags, struct nvgpu_channel_fence *fence_in,
1486 struct gk20a_buffer_state *state) 1486 struct gk20a_buffer_state *state)
1487{ 1487{
1488 struct gk20a *g = &l->g; 1488 struct gk20a *g = &l->g;
@@ -1624,7 +1624,7 @@ static int gk20a_buffer_convert_gpu_to_cde(
1624 u64 offset, u64 compbits_hoffset, u64 compbits_voffset, 1624 u64 offset, u64 compbits_hoffset, u64 compbits_voffset,
1625 u64 scatterbuffer_offset, 1625 u64 scatterbuffer_offset,
1626 u32 width, u32 height, u32 block_height_log2, 1626 u32 width, u32 height, u32 block_height_log2,
1627 u32 submit_flags, struct nvgpu_fence *fence_in, 1627 u32 submit_flags, struct nvgpu_channel_fence *fence_in,
1628 struct gk20a_buffer_state *state) 1628 struct gk20a_buffer_state *state)
1629{ 1629{
1630 struct gk20a *g = &l->g; 1630 struct gk20a *g = &l->g;
@@ -1656,7 +1656,7 @@ int gk20a_prepare_compressible_read(
1656 u64 compbits_hoffset, u64 compbits_voffset, 1656 u64 compbits_hoffset, u64 compbits_voffset,
1657 u64 scatterbuffer_offset, 1657 u64 scatterbuffer_offset,
1658 u32 width, u32 height, u32 block_height_log2, 1658 u32 width, u32 height, u32 block_height_log2,
1659 u32 submit_flags, struct nvgpu_fence *fence, 1659 u32 submit_flags, struct nvgpu_channel_fence *fence,
1660 u32 *valid_compbits, u32 *zbc_color, 1660 u32 *valid_compbits, u32 *zbc_color,
1661 struct gk20a_fence **fence_out) 1661 struct gk20a_fence **fence_out)
1662{ 1662{
diff --git a/drivers/gpu/nvgpu/common/linux/cde.h b/drivers/gpu/nvgpu/common/linux/cde.h
index 115558dc..9ff142ea 100644
--- a/drivers/gpu/nvgpu/common/linux/cde.h
+++ b/drivers/gpu/nvgpu/common/linux/cde.h
@@ -44,7 +44,7 @@ struct device;
44struct nvgpu_os_linux; 44struct nvgpu_os_linux;
45struct gk20a; 45struct gk20a;
46struct gk20a_fence; 46struct gk20a_fence;
47struct nvgpu_fence; 47struct nvgpu_channel_fence;
48struct channel_gk20a; 48struct channel_gk20a;
49struct vm_gk20a; 49struct vm_gk20a;
50struct nvgpu_gpfifo; 50struct nvgpu_gpfifo;
@@ -306,7 +306,7 @@ int gk20a_cde_convert(struct nvgpu_os_linux *l,
306 struct dma_buf *compbits_buf, 306 struct dma_buf *compbits_buf,
307 u64 compbits_byte_offset, 307 u64 compbits_byte_offset,
308 u64 scatterbuffer_byte_offset, 308 u64 scatterbuffer_byte_offset,
309 struct nvgpu_fence *fence, 309 struct nvgpu_channel_fence *fence,
310 u32 __flags, struct gk20a_cde_param *params, 310 u32 __flags, struct gk20a_cde_param *params,
311 int num_params, struct gk20a_fence **fence_out); 311 int num_params, struct gk20a_fence **fence_out);
312 312
@@ -315,7 +315,7 @@ int gk20a_prepare_compressible_read(
315 u64 compbits_hoffset, u64 compbits_voffset, 315 u64 compbits_hoffset, u64 compbits_voffset,
316 u64 scatterbuffer_offset, 316 u64 scatterbuffer_offset,
317 u32 width, u32 height, u32 block_height_log2, 317 u32 width, u32 height, u32 block_height_log2,
318 u32 submit_flags, struct nvgpu_fence *fence, 318 u32 submit_flags, struct nvgpu_channel_fence *fence,
319 u32 *valid_compbits, u32 *zbc_color, 319 u32 *valid_compbits, u32 *zbc_color,
320 struct gk20a_fence **fence_out); 320 struct gk20a_fence **fence_out);
321int gk20a_mark_compressible_write( 321int gk20a_mark_compressible_write(
diff --git a/drivers/gpu/nvgpu/common/linux/ce2.c b/drivers/gpu/nvgpu/common/linux/ce2.c
index 7cb39382..d1f0ad63 100644
--- a/drivers/gpu/nvgpu/common/linux/ce2.c
+++ b/drivers/gpu/nvgpu/common/linux/ce2.c
@@ -56,7 +56,7 @@ int gk20a_ce_execute_ops(struct gk20a *g,
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 gpfifo;
59 struct nvgpu_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
62 if (!ce_app->initialised ||ce_app->app_state != NVGPU_CE_ACTIVE) 62 if (!ce_app->initialised ||ce_app->app_state != NVGPU_CE_ACTIVE)
diff --git a/drivers/gpu/nvgpu/common/linux/channel.c b/drivers/gpu/nvgpu/common/linux/channel.c
index dc35fbc0..ad127606 100644
--- a/drivers/gpu/nvgpu/common/linux/channel.c
+++ b/drivers/gpu/nvgpu/common/linux/channel.c
@@ -416,7 +416,7 @@ static void trace_write_pushbuffer_range(struct channel_gk20a *c,
416 * Handle the submit synchronization - pre-fences and post-fences. 416 * Handle the submit synchronization - pre-fences and post-fences.
417 */ 417 */
418static int gk20a_submit_prepare_syncs(struct channel_gk20a *c, 418static int gk20a_submit_prepare_syncs(struct channel_gk20a *c,
419 struct nvgpu_fence *fence, 419 struct nvgpu_channel_fence *fence,
420 struct channel_gk20a_job *job, 420 struct channel_gk20a_job *job,
421 struct priv_cmd_entry **wait_cmd, 421 struct priv_cmd_entry **wait_cmd,
422 struct priv_cmd_entry **incr_cmd, 422 struct priv_cmd_entry **incr_cmd,
@@ -663,7 +663,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
663 struct nvgpu_submit_gpfifo_args *args, 663 struct nvgpu_submit_gpfifo_args *args,
664 u32 num_entries, 664 u32 num_entries,
665 u32 flags, 665 u32 flags,
666 struct nvgpu_fence *fence, 666 struct nvgpu_channel_fence *fence,
667 struct gk20a_fence **fence_out, 667 struct gk20a_fence **fence_out,
668 bool force_need_sync_fence, 668 bool force_need_sync_fence,
669 struct fifo_profile_gk20a *profile) 669 struct fifo_profile_gk20a *profile)
diff --git a/drivers/gpu/nvgpu/common/linux/channel.h b/drivers/gpu/nvgpu/common/linux/channel.h
index 35be425a..85be581a 100644
--- a/drivers/gpu/nvgpu/common/linux/channel.h
+++ b/drivers/gpu/nvgpu/common/linux/channel.h
@@ -24,7 +24,7 @@
24struct channel_gk20a; 24struct channel_gk20a;
25struct nvgpu_gpfifo; 25struct nvgpu_gpfifo;
26struct nvgpu_submit_gpfifo_args; 26struct nvgpu_submit_gpfifo_args;
27struct nvgpu_fence; 27struct nvgpu_channel_fence;
28struct gk20a_fence; 28struct gk20a_fence;
29struct fifo_profile_gk20a; 29struct fifo_profile_gk20a;
30struct nvgpu_os_linux; 30struct nvgpu_os_linux;
@@ -75,7 +75,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
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,
78 struct nvgpu_fence *fence, 78 struct nvgpu_channel_fence *fence,
79 struct gk20a_fence **fence_out, 79 struct gk20a_fence **fence_out,
80 bool force_need_sync_fence, 80 bool force_need_sync_fence,
81 struct fifo_profile_gk20a *profile); 81 struct fifo_profile_gk20a *profile);
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
index 9b5a850a..c75c9244 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
@@ -614,6 +614,14 @@ static void nvgpu_get_gpfifo_args(
614 alloc_gpfifo_args->flags); 614 alloc_gpfifo_args->flags);
615} 615}
616 616
617static void nvgpu_get_fence_args(
618 struct nvgpu_fence *fence_args_in,
619 struct nvgpu_channel_fence *fence_args_out)
620{
621 fence_args_out->id = fence_args_in->id;
622 fence_args_out->value = fence_args_in->value;
623}
624
617static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch, 625static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
618 ulong id, u32 offset, 626 ulong id, u32 offset,
619 u32 payload, u32 timeout) 627 u32 payload, u32 timeout)
@@ -760,6 +768,7 @@ static int gk20a_ioctl_channel_submit_gpfifo(
760 struct channel_gk20a *ch, 768 struct channel_gk20a *ch,
761 struct nvgpu_submit_gpfifo_args *args) 769 struct nvgpu_submit_gpfifo_args *args)
762{ 770{
771 struct nvgpu_channel_fence fence;
763 struct gk20a_fence *fence_out; 772 struct gk20a_fence *fence_out;
764 struct fifo_profile_gk20a *profile = NULL; 773 struct fifo_profile_gk20a *profile = NULL;
765 774
@@ -779,8 +788,9 @@ static int gk20a_ioctl_channel_submit_gpfifo(
779 !capable(CAP_SYS_NICE)) 788 !capable(CAP_SYS_NICE))
780 return -EPERM; 789 return -EPERM;
781 790
791 nvgpu_get_fence_args(&args->fence, &fence);
782 ret = gk20a_submit_channel_gpfifo(ch, NULL, args, args->num_entries, 792 ret = gk20a_submit_channel_gpfifo(ch, NULL, args, args->num_entries,
783 args->flags, &args->fence, 793 args->flags, &fence,
784 &fence_out, false, profile); 794 &fence_out, false, profile);
785 795
786 if (ret) 796 if (ret)
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
index c37f45dd..3392b6fa 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
@@ -339,7 +339,7 @@ static int gk20a_ctrl_prepare_compressible_read(
339 339
340#ifdef CONFIG_NVGPU_SUPPORT_CDE 340#ifdef CONFIG_NVGPU_SUPPORT_CDE
341 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); 341 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
342 struct nvgpu_fence fence; 342 struct nvgpu_channel_fence fence;
343 struct gk20a_fence *fence_out = NULL; 343 struct gk20a_fence *fence_out = NULL;
344 int flags = args->submit_flags; 344 int flags = args->submit_flags;
345 345
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
index cd5bf7d7..ab1c4a6f 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -47,6 +47,18 @@ struct fifo_profile_gk20a;
47#define NVGPU_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE (1 << 2) 47#define NVGPU_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE (1 << 2)
48#define NVGPU_GPFIFO_FLAGS_USERMODE_SUPPORT (1 << 3) 48#define NVGPU_GPFIFO_FLAGS_USERMODE_SUPPORT (1 << 3)
49 49
50/*
51 * The binary format of 'struct nvgpu_channel_fence' introduced here
52 * should match that of 'struct nvgpu_fence' defined in uapi header, since
53 * this struct is intended to be a mirror copy of the uapi struct. This is
54 * not a hard requirement though because of nvgpu_get_fence_args conversion
55 * function.
56 */
57struct nvgpu_channel_fence {
58 u32 id;
59 u32 value;
60};
61
50struct nvgpu_gpfifo_args { 62struct nvgpu_gpfifo_args {
51 u32 num_entries; 63 u32 num_entries;
52 u32 num_inflight_jobs; 64 u32 num_inflight_jobs;