diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2014-10-27 05:06:59 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:11:54 -0400 |
commit | 2d5ff668cbc6a932df2c9cf79627d1d340e5c2c0 (patch) | |
tree | 1d9bc4b774a9c2cea339891eaef3af5b87ee354d /drivers/gpu/nvgpu/vgpu | |
parent | 23a182aaa61d120c965f1bce09609cc14d4e14eb (diff) |
gpu: nvgpu: GR and LTC HAL to use const structs
Convert GR and LTC HALs to use const structs, and initialize them
with macros.
Bug 1567274
Change-Id: Ia3f24a5eccb27578d9cba69755f636818d11275c
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/590371
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/gr_vgpu.c | 27 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/ltc_vgpu.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/vgpu.c | 3 |
3 files changed, 24 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c index 6f8baa4b..3e0f9dc3 100644 --- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include "vgpu/vgpu.h" | 16 | #include "vgpu/vgpu.h" |
17 | #include "gk20a/hw_gr_gk20a.h" | 17 | #include "gk20a/hw_gr_gk20a.h" |
18 | #include "gr_ops.h" | ||
18 | 19 | ||
19 | static int vgpu_gr_commit_inst(struct channel_gk20a *c, u64 gpu_va) | 20 | static int vgpu_gr_commit_inst(struct channel_gk20a *c, u64 gpu_va) |
20 | { | 21 | { |
@@ -104,7 +105,7 @@ static int vgpu_gr_alloc_global_ctx_buffers(struct gk20a *g) | |||
104 | 105 | ||
105 | gk20a_dbg_fn(""); | 106 | gk20a_dbg_fn(""); |
106 | 107 | ||
107 | attr_buffer_size = g->ops.gr.calc_global_ctx_buffer_size(g); | 108 | attr_buffer_size = g->ops.gr->calc_global_ctx_buffer_size(g); |
108 | 109 | ||
109 | gk20a_dbg_info("cb_buffer_size : %d", cb_buffer_size); | 110 | gk20a_dbg_info("cb_buffer_size : %d", cb_buffer_size); |
110 | gr->global_ctx_buffer[CIRCULAR].size = cb_buffer_size; | 111 | gr->global_ctx_buffer[CIRCULAR].size = cb_buffer_size; |
@@ -397,7 +398,7 @@ static int vgpu_gr_alloc_obj_ctx(struct channel_gk20a *c, | |||
397 | return -EINVAL; | 398 | return -EINVAL; |
398 | } | 399 | } |
399 | 400 | ||
400 | if (!g->ops.gr.is_valid_class(g, args->class_num)) { | 401 | if (!g->ops.gr->is_valid_class(g, args->class_num)) { |
401 | gk20a_err(dev_from_gk20a(g), | 402 | gk20a_err(dev_from_gk20a(g), |
402 | "invalid obj class 0x%x", args->class_num); | 403 | "invalid obj class 0x%x", args->class_num); |
403 | err = -EINVAL; | 404 | err = -EINVAL; |
@@ -524,9 +525,9 @@ static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) | |||
524 | &gr->max_tpc_count)) | 525 | &gr->max_tpc_count)) |
525 | return -ENOMEM; | 526 | return -ENOMEM; |
526 | 527 | ||
527 | g->ops.gr.bundle_cb_defaults(g); | 528 | g->ops.gr->bundle_cb_defaults(g); |
528 | g->ops.gr.cb_size_default(g); | 529 | g->ops.gr->cb_size_default(g); |
529 | g->ops.gr.calc_global_ctx_buffer_size(g); | 530 | g->ops.gr->calc_global_ctx_buffer_size(g); |
530 | return 0; | 531 | return 0; |
531 | } | 532 | } |
532 | 533 | ||
@@ -612,7 +613,7 @@ static int vgpu_gr_init_gr_setup_sw(struct gk20a *g) | |||
612 | if (err) | 613 | if (err) |
613 | goto clean_up; | 614 | goto clean_up; |
614 | 615 | ||
615 | err = g->ops.ltc.init_comptags(g, gr); | 616 | err = g->ops.ltc->init_comptags(g, gr); |
616 | if (err) | 617 | if (err) |
617 | goto clean_up; | 618 | goto clean_up; |
618 | 619 | ||
@@ -677,11 +678,15 @@ int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info) | |||
677 | return 0; | 678 | return 0; |
678 | } | 679 | } |
679 | 680 | ||
681 | static struct gpu_gr_ops vgpu_gr_ops = { | ||
682 | .free_channel_ctx = vgpu_gr_free_channel_ctx, | ||
683 | .alloc_obj_ctx = vgpu_gr_alloc_obj_ctx, | ||
684 | .free_obj_ctx = vgpu_gr_free_obj_ctx, | ||
685 | .bind_ctxsw_zcull = vgpu_gr_bind_ctxsw_zcull, | ||
686 | .get_zcull_info = vgpu_gr_get_zcull_info, | ||
687 | }; | ||
688 | |||
680 | void vgpu_init_gr_ops(struct gpu_ops *gops) | 689 | void vgpu_init_gr_ops(struct gpu_ops *gops) |
681 | { | 690 | { |
682 | gops->gr.free_channel_ctx = vgpu_gr_free_channel_ctx; | 691 | gops->gr = &vgpu_gr_ops; |
683 | gops->gr.alloc_obj_ctx = vgpu_gr_alloc_obj_ctx; | ||
684 | gops->gr.free_obj_ctx = vgpu_gr_free_obj_ctx; | ||
685 | gops->gr.bind_ctxsw_zcull = vgpu_gr_bind_ctxsw_zcull; | ||
686 | gops->gr.get_zcull_info = vgpu_gr_get_zcull_info; | ||
687 | } | 692 | } |
diff --git a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c index ddff23b7..0a7d19c4 100644 --- a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c | |||
@@ -48,8 +48,12 @@ static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | static const struct gpu_ltc_ops vgpu_ltc_ops = { | ||
52 | .determine_L2_size_bytes = vgpu_determine_L2_size_bytes, | ||
53 | .init_comptags = vgpu_ltc_init_comptags, | ||
54 | }; | ||
55 | |||
51 | void vgpu_init_ltc_ops(struct gpu_ops *gops) | 56 | void vgpu_init_ltc_ops(struct gpu_ops *gops) |
52 | { | 57 | { |
53 | gops->ltc.determine_L2_size_bytes = vgpu_determine_L2_size_bytes; | 58 | gops->ltc = &vgpu_ltc_ops; |
54 | gops->ltc.init_comptags = vgpu_ltc_init_comptags; | ||
55 | } | 59 | } |
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index 84fd6d18..11fa73c5 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "gk20a/debug_gk20a.h" | 21 | #include "gk20a/debug_gk20a.h" |
22 | #include "gk20a/hal_gk20a.h" | 22 | #include "gk20a/hal_gk20a.h" |
23 | #include "gk20a/hw_mc_gk20a.h" | 23 | #include "gk20a/hw_mc_gk20a.h" |
24 | #include "nvgpu_gpuid.h" | ||
24 | 25 | ||
25 | static inline int vgpu_comm_init(struct platform_device *pdev) | 26 | static inline int vgpu_comm_init(struct platform_device *pdev) |
26 | { | 27 | { |
@@ -239,7 +240,7 @@ static int vgpu_init_hal(struct gk20a *g) | |||
239 | u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl; | 240 | u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl; |
240 | 241 | ||
241 | switch (ver) { | 242 | switch (ver) { |
242 | case GK20A_GPUID_GK20A: | 243 | case NVGPU_GPUID_GK20A: |
243 | gk20a_dbg_info("gk20a detected"); | 244 | gk20a_dbg_info("gk20a detected"); |
244 | /* init gk20a ops then override with virt extensions */ | 245 | /* init gk20a ops then override with virt extensions */ |
245 | gk20a_init_hal(&g->ops); | 246 | gk20a_init_hal(&g->ops); |