diff options
author | Sunny He <suhe@nvidia.com> | 2017-07-26 14:13:15 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-07-27 19:34:44 -0400 |
commit | 9d37d8b78c2dac7fa480493d1ab67b95290b87f1 (patch) | |
tree | 338d862a37c8639c68a22f9543fa1499f2307762 /drivers/gpu/nvgpu/gk20a | |
parent | 6431ec360bf7b7baf6dd687b1525c40114ede189 (diff) |
gpu: nvgpu: Reorg fecs_trace HAL initialization
Reorganize HAL initialization to remove inheritance and construct
the gpu_ops struct at compile time. This patch only covers the
fecs_trace sub-module of the gpu_ops struct.
Perform HAL function assignments in hal_gxxxx.c through the
population of a chip-specific copy of gpu_ops.
Jira NVGPU-74
Change-Id: I84485ad64997270c6a0fce3c95dc9ceb0094cf6c
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1527419
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c | 13 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 41 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h | 20 |
4 files changed, 33 insertions, 45 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c index f3866d6a..cc05ceff 100644 --- a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c | |||
@@ -170,7 +170,7 @@ static int gk20a_ctxsw_dev_alloc_buffer(struct gk20a_ctxsw_dev *dev, | |||
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | static int gk20a_ctxsw_dev_ring_alloc(struct gk20a *g, | 173 | int gk20a_ctxsw_dev_ring_alloc(struct gk20a *g, |
174 | void **buf, size_t *size) | 174 | void **buf, size_t *size) |
175 | { | 175 | { |
176 | struct nvgpu_ctxsw_ring_header *hdr; | 176 | struct nvgpu_ctxsw_ring_header *hdr; |
@@ -194,7 +194,7 @@ static int gk20a_ctxsw_dev_ring_alloc(struct gk20a *g, | |||
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
197 | static int gk20a_ctxsw_dev_ring_free(struct gk20a *g) | 197 | int gk20a_ctxsw_dev_ring_free(struct gk20a *g) |
198 | { | 198 | { |
199 | struct gk20a_ctxsw_dev *dev = &g->ctxsw_trace->devs[0]; | 199 | struct gk20a_ctxsw_dev *dev = &g->ctxsw_trace->devs[0]; |
200 | 200 | ||
@@ -457,7 +457,7 @@ static struct vm_operations_struct gk20a_ctxsw_dev_vma_ops = { | |||
457 | .close = gk20a_ctxsw_dev_vma_close, | 457 | .close = gk20a_ctxsw_dev_vma_close, |
458 | }; | 458 | }; |
459 | 459 | ||
460 | static int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, | 460 | int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, |
461 | struct vm_area_struct *vma) | 461 | struct vm_area_struct *vma) |
462 | { | 462 | { |
463 | return remap_vmalloc_range(vma, g->ctxsw_trace->devs[0].hdr, 0); | 463 | return remap_vmalloc_range(vma, g->ctxsw_trace->devs[0].hdr, 0); |
@@ -715,10 +715,3 @@ void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg) | |||
715 | #endif | 715 | #endif |
716 | trace_gk20a_channel_reset(~0, tsg->tsgid); | 716 | trace_gk20a_channel_reset(~0, tsg->tsgid); |
717 | } | 717 | } |
718 | |||
719 | void gk20a_ctxsw_trace_init_ops(struct gpu_ops *ops) | ||
720 | { | ||
721 | ops->fecs_trace.alloc_user_buffer = gk20a_ctxsw_dev_ring_alloc; | ||
722 | ops->fecs_trace.free_user_buffer = gk20a_ctxsw_dev_ring_free; | ||
723 | ops->fecs_trace.mmap_user_buffer = gk20a_ctxsw_dev_mmap_buffer; | ||
724 | } | ||
diff --git a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.h b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.h index 5262538a..887fe415 100644 --- a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.h | |||
@@ -35,12 +35,14 @@ long gk20a_ctxsw_dev_ioctl(struct file *filp, | |||
35 | ssize_t gk20a_ctxsw_dev_read(struct file *, char __user *, size_t, loff_t *); | 35 | ssize_t gk20a_ctxsw_dev_read(struct file *, char __user *, size_t, loff_t *); |
36 | unsigned int gk20a_ctxsw_dev_poll(struct file *, struct poll_table_struct *); | 36 | unsigned int gk20a_ctxsw_dev_poll(struct file *, struct poll_table_struct *); |
37 | int gk20a_ctxsw_dev_mmap(struct file *, struct vm_area_struct *); | 37 | int gk20a_ctxsw_dev_mmap(struct file *, struct vm_area_struct *); |
38 | int gk20a_ctxsw_dev_ring_alloc(struct gk20a *g, void **buf, size_t *size); | ||
39 | int gk20a_ctxsw_dev_ring_free(struct gk20a *g); | ||
40 | int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, struct vm_area_struct *vma); | ||
38 | 41 | ||
39 | int gk20a_ctxsw_trace_init(struct gk20a *); | 42 | int gk20a_ctxsw_trace_init(struct gk20a *); |
40 | void gk20a_ctxsw_trace_cleanup(struct gk20a *); | 43 | void gk20a_ctxsw_trace_cleanup(struct gk20a *); |
41 | int gk20a_ctxsw_trace_write(struct gk20a *, struct nvgpu_ctxsw_trace_entry *); | 44 | int gk20a_ctxsw_trace_write(struct gk20a *, struct nvgpu_ctxsw_trace_entry *); |
42 | void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid); | 45 | void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid); |
43 | void gk20a_ctxsw_trace_init_ops(struct gpu_ops *ops); | ||
44 | 46 | ||
45 | void gk20a_ctxsw_trace_channel_reset(struct gk20a *g, struct channel_gk20a *ch); | 47 | void gk20a_ctxsw_trace_channel_reset(struct gk20a *g, struct channel_gk20a *ch); |
46 | void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg); | 48 | void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg); |
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index 0b26f657..84bf20b8 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |||
@@ -327,7 +327,7 @@ static int gk20a_fecs_trace_ring_read(struct gk20a *g, int index) | |||
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | 329 | ||
330 | static int gk20a_fecs_trace_poll(struct gk20a *g) | 330 | int gk20a_fecs_trace_poll(struct gk20a *g) |
331 | { | 331 | { |
332 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 332 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
333 | 333 | ||
@@ -566,7 +566,7 @@ static inline void gk20a_fecs_trace_debugfs_cleanup(struct gk20a *g) | |||
566 | 566 | ||
567 | #endif /* CONFIG_DEBUG_FS */ | 567 | #endif /* CONFIG_DEBUG_FS */ |
568 | 568 | ||
569 | static int gk20a_fecs_trace_init(struct gk20a *g) | 569 | int gk20a_fecs_trace_init(struct gk20a *g) |
570 | { | 570 | { |
571 | struct gk20a_fecs_trace *trace; | 571 | struct gk20a_fecs_trace *trace; |
572 | int err; | 572 | int err; |
@@ -610,7 +610,7 @@ clean: | |||
610 | return err; | 610 | return err; |
611 | } | 611 | } |
612 | 612 | ||
613 | static int gk20a_fecs_trace_bind_channel(struct gk20a *g, | 613 | int gk20a_fecs_trace_bind_channel(struct gk20a *g, |
614 | struct channel_gk20a *ch) | 614 | struct channel_gk20a *ch) |
615 | { | 615 | { |
616 | /* | 616 | /* |
@@ -678,7 +678,7 @@ static int gk20a_fecs_trace_bind_channel(struct gk20a *g, | |||
678 | return 0; | 678 | return 0; |
679 | } | 679 | } |
680 | 680 | ||
681 | static int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a *ch) | 681 | int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a *ch) |
682 | { | 682 | { |
683 | u32 context_ptr = gk20a_fecs_trace_fecs_context_ptr(g, ch); | 683 | u32 context_ptr = gk20a_fecs_trace_fecs_context_ptr(g, ch); |
684 | 684 | ||
@@ -694,7 +694,7 @@ static int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a | |||
694 | return 0; | 694 | return 0; |
695 | } | 695 | } |
696 | 696 | ||
697 | static int gk20a_fecs_trace_reset(struct gk20a *g) | 697 | int gk20a_fecs_trace_reset(struct gk20a *g) |
698 | { | 698 | { |
699 | gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw, ""); | 699 | gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw, ""); |
700 | 700 | ||
@@ -705,7 +705,7 @@ static int gk20a_fecs_trace_reset(struct gk20a *g) | |||
705 | return gk20a_fecs_trace_set_read_index(g, 0); | 705 | return gk20a_fecs_trace_set_read_index(g, 0); |
706 | } | 706 | } |
707 | 707 | ||
708 | static int gk20a_fecs_trace_deinit(struct gk20a *g) | 708 | int gk20a_fecs_trace_deinit(struct gk20a *g) |
709 | { | 709 | { |
710 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 710 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
711 | 711 | ||
@@ -722,7 +722,7 @@ static int gk20a_fecs_trace_deinit(struct gk20a *g) | |||
722 | return 0; | 722 | return 0; |
723 | } | 723 | } |
724 | 724 | ||
725 | static int gk20a_gr_max_entries(struct gk20a *g, | 725 | int gk20a_gr_max_entries(struct gk20a *g, |
726 | struct nvgpu_ctxsw_trace_filter *filter) | 726 | struct nvgpu_ctxsw_trace_filter *filter) |
727 | { | 727 | { |
728 | int n; | 728 | int n; |
@@ -736,7 +736,7 @@ static int gk20a_gr_max_entries(struct gk20a *g, | |||
736 | return n * GK20A_FECS_TRACE_NUM_RECORDS; | 736 | return n * GK20A_FECS_TRACE_NUM_RECORDS; |
737 | } | 737 | } |
738 | 738 | ||
739 | static int gk20a_fecs_trace_enable(struct gk20a *g) | 739 | int gk20a_fecs_trace_enable(struct gk20a *g) |
740 | { | 740 | { |
741 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 741 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
742 | int write; | 742 | int write; |
@@ -765,7 +765,7 @@ static int gk20a_fecs_trace_enable(struct gk20a *g) | |||
765 | return 0; | 765 | return 0; |
766 | } | 766 | } |
767 | 767 | ||
768 | static int gk20a_fecs_trace_disable(struct gk20a *g) | 768 | int gk20a_fecs_trace_disable(struct gk20a *g) |
769 | { | 769 | { |
770 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 770 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
771 | 771 | ||
@@ -775,31 +775,10 @@ static int gk20a_fecs_trace_disable(struct gk20a *g) | |||
775 | return -EPERM; | 775 | return -EPERM; |
776 | } | 776 | } |
777 | 777 | ||
778 | static bool gk20a_fecs_trace_is_enabled(struct gk20a *g) | 778 | bool gk20a_fecs_trace_is_enabled(struct gk20a *g) |
779 | { | 779 | { |
780 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 780 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
781 | 781 | ||
782 | return (trace && nvgpu_thread_is_running(&trace->poll_task)); | 782 | return (trace && nvgpu_thread_is_running(&trace->poll_task)); |
783 | } | 783 | } |
784 | |||
785 | |||
786 | void gk20a_init_fecs_trace_ops(struct gpu_ops *ops) | ||
787 | { | ||
788 | gk20a_ctxsw_trace_init_ops(ops); | ||
789 | ops->fecs_trace.init = gk20a_fecs_trace_init; | ||
790 | ops->fecs_trace.deinit = gk20a_fecs_trace_deinit; | ||
791 | ops->fecs_trace.enable = gk20a_fecs_trace_enable; | ||
792 | ops->fecs_trace.disable = gk20a_fecs_trace_disable; | ||
793 | ops->fecs_trace.is_enabled = gk20a_fecs_trace_is_enabled; | ||
794 | ops->fecs_trace.reset = gk20a_fecs_trace_reset; | ||
795 | ops->fecs_trace.flush = NULL; | ||
796 | ops->fecs_trace.poll = gk20a_fecs_trace_poll; | ||
797 | ops->fecs_trace.bind_channel = gk20a_fecs_trace_bind_channel; | ||
798 | ops->fecs_trace.unbind_channel = gk20a_fecs_trace_unbind_channel; | ||
799 | ops->fecs_trace.max_entries = gk20a_gr_max_entries; | ||
800 | } | ||
801 | #else | ||
802 | void gk20a_init_fecs_trace_ops(struct gpu_ops *ops) | ||
803 | { | ||
804 | } | ||
805 | #endif /* CONFIG_GK20A_CTXSW_TRACE */ | 784 | #endif /* CONFIG_GK20A_CTXSW_TRACE */ |
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h index 4979d6c6..454a33e8 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -14,7 +14,21 @@ | |||
14 | #ifndef __FECS_TRACE_GK20A_H | 14 | #ifndef __FECS_TRACE_GK20A_H |
15 | #define __FECS_TRACE_GK20A_H | 15 | #define __FECS_TRACE_GK20A_H |
16 | 16 | ||
17 | struct gpu_ops; | 17 | struct gk20a; |
18 | void gk20a_init_fecs_trace_ops(struct gpu_ops *ops); | 18 | struct channel_gk20a; |
19 | struct nvgpu_ctxsw_trace_filter; | ||
20 | |||
21 | int gk20a_fecs_trace_poll(struct gk20a *g); | ||
22 | int gk20a_fecs_trace_init(struct gk20a *g); | ||
23 | int gk20a_fecs_trace_bind_channel(struct gk20a *g, | ||
24 | struct channel_gk20a *ch); | ||
25 | int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a *ch); | ||
26 | int gk20a_fecs_trace_reset(struct gk20a *g); | ||
27 | int gk20a_fecs_trace_deinit(struct gk20a *g); | ||
28 | int gk20a_gr_max_entries(struct gk20a *g, | ||
29 | struct nvgpu_ctxsw_trace_filter *filter); | ||
30 | int gk20a_fecs_trace_enable(struct gk20a *g); | ||
31 | int gk20a_fecs_trace_disable(struct gk20a *g); | ||
32 | bool gk20a_fecs_trace_is_enabled(struct gk20a *g); | ||
19 | 33 | ||
20 | #endif /* __FECS_TRACE_GK20A_H */ | 34 | #endif /* __FECS_TRACE_GK20A_H */ |