summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106/gr_gp106.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2016-03-23 11:41:04 -0400
committerDeepak Nibade <dnibade@nvidia.com>2016-12-27 04:56:16 -0500
commit3d0f9a751784ac9eb27f9f989f3b584ff5dc8f17 (patch)
tree4c1df46e81b17f47ddc8731beb95c7f351de7788 /drivers/gpu/nvgpu/gp106/gr_gp106.c
parent21eda905ea69a0e090f6e29c444a9129c65f0b1f (diff)
gpu: nvgpu: Add support for gp104 and gp106
Add support for chips gp104 and gp106. Change-Id: Ied5f239bdd0ec85245bce1fb6ef51330871d0f05 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1120465 GVS: Gerrit_Virtual_Submit Reviewed-by: Ken Adams <kadams@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp106/gr_gp106.c')
-rw-r--r--drivers/gpu/nvgpu/gp106/gr_gp106.c111
1 files changed, 111 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp106/gr_gp106.c b/drivers/gpu/nvgpu/gp106/gr_gp106.c
new file mode 100644
index 00000000..e4768e0d
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gr_gp106.c
@@ -0,0 +1,111 @@
1/*
2 * GP106 GPU GR
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include "gk20a/gk20a.h" /* FERMI and MAXWELL classes defined here */
17
18#include "gk20a/gr_gk20a.h"
19
20#include "gm20b/gr_gm20b.h" /* for MAXWELL classes */
21#include "gp10b/gr_gp10b.h"
22#include "gr_gp106.h"
23#include "hw_gr_gp106.h"
24
25static bool gr_gp106_is_valid_class(struct gk20a *g, u32 class_num)
26{
27 bool valid = false;
28
29 switch (class_num) {
30 case PASCAL_COMPUTE_A:
31 case PASCAL_COMPUTE_B:
32 case PASCAL_A:
33 case PASCAL_B:
34 case PASCAL_DMA_COPY_A:
35 valid = true;
36 break;
37
38 case MAXWELL_COMPUTE_B:
39 case MAXWELL_B:
40 case FERMI_TWOD_A:
41 case KEPLER_DMA_COPY_A:
42 case MAXWELL_DMA_COPY_A:
43 valid = true;
44 break;
45
46 default:
47 break;
48 }
49 gk20a_dbg_info("class=0x%x valid=%d", class_num, valid);
50 return valid;
51}
52
53static u32 gr_gp106_pagepool_default_size(struct gk20a *g)
54{
55 return gr_scc_pagepool_total_pages_hwmax_value_v();
56}
57
58static int gr_gp106_handle_sw_method(struct gk20a *g, u32 addr,
59 u32 class_num, u32 offset, u32 data)
60{
61 gk20a_dbg_fn("");
62
63 if (class_num == PASCAL_COMPUTE_B) {
64 switch (offset << 2) {
65 case NVC0C0_SET_SHADER_EXCEPTIONS:
66 gk20a_gr_set_shader_exceptions(g, data);
67 break;
68 default:
69 goto fail;
70 }
71 }
72
73 if (class_num == PASCAL_B) {
74 switch (offset << 2) {
75 case NVC097_SET_SHADER_EXCEPTIONS:
76 gk20a_gr_set_shader_exceptions(g, data);
77 break;
78 case NVC097_SET_CIRCULAR_BUFFER_SIZE:
79 g->ops.gr.set_circular_buffer_size(g, data);
80 break;
81 case NVC097_SET_ALPHA_CIRCULAR_BUFFER_SIZE:
82 g->ops.gr.set_alpha_circular_buffer_size(g, data);
83 break;
84 default:
85 goto fail;
86 }
87 }
88 return 0;
89
90fail:
91 return -EINVAL;
92}
93
94static void gr_gp106_cb_size_default(struct gk20a *g)
95{
96 struct gr_gk20a *gr = &g->gr;
97
98 if (!gr->attrib_cb_default_size)
99 gr->attrib_cb_default_size = 0x800;
100 gr->alpha_cb_default_size =
101 gr_gpc0_ppc0_cbm_alpha_cb_size_v_default_v();
102}
103
104void gp106_init_gr(struct gpu_ops *gops)
105{
106 gp10b_init_gr(gops);
107 gops->gr.is_valid_class = gr_gp106_is_valid_class;
108 gops->gr.pagepool_default_size = gr_gp106_pagepool_default_size;
109 gops->gr.handle_sw_method = gr_gp106_handle_sw_method;
110 gops->gr.cb_size_default = gr_gp106_cb_size_default;
111}