diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gp106')
-rw-r--r-- | drivers/gpu/nvgpu/gp106/hal_gp106.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/hw_fb_gp106.h | 16 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/hw_fbpa_gp106.h | 61 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/hw_top_gp106.h | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/mm_gp106.c | 39 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/mm_gp106.h | 23 |
6 files changed, 149 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index 1dd16139..7ef72d72 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "gm20b/pmu_gm20b.h" | 39 | #include "gm20b/pmu_gm20b.h" |
40 | #include "gm20b/clk_gm20b.h" | 40 | #include "gm20b/clk_gm20b.h" |
41 | 41 | ||
42 | #include "gp106/mm_gp106.h" | ||
42 | #include "gp106/pmu_gp106.h" | 43 | #include "gp106/pmu_gp106.h" |
43 | #include "gp106/gr_ctx_gp106.h" | 44 | #include "gp106/gr_ctx_gp106.h" |
44 | #include "gp106/gr_gp106.h" | 45 | #include "gp106/gr_gp106.h" |
@@ -194,7 +195,7 @@ int gp106_init_hal(struct gk20a *g) | |||
194 | gp10b_init_fifo(gops); | 195 | gp10b_init_fifo(gops); |
195 | gp10b_init_ce(gops); | 196 | gp10b_init_ce(gops); |
196 | gp106_init_gr_ctx(gops); | 197 | gp106_init_gr_ctx(gops); |
197 | gp10b_init_mm(gops); | 198 | gp106_init_mm(gops); |
198 | gp106_init_pmu_ops(gops); | 199 | gp106_init_pmu_ops(gops); |
199 | gk20a_init_debug_ops(gops); | 200 | gk20a_init_debug_ops(gops); |
200 | gp10b_init_regops(gops); | 201 | gp10b_init_regops(gops); |
diff --git a/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h b/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h index 42d32ab3..1ab876cd 100644 --- a/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h +++ b/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h | |||
@@ -486,4 +486,20 @@ static inline u32 fb_niso_flush_sysmem_addr_r(void) | |||
486 | { | 486 | { |
487 | return 0x00100c10; | 487 | return 0x00100c10; |
488 | } | 488 | } |
489 | static inline u32 fb_mmu_local_memory_range_r(void) | ||
490 | { | ||
491 | return 0x00100ce0; | ||
492 | } | ||
493 | static inline u32 fb_mmu_local_memory_range_lower_scale_v(u32 r) | ||
494 | { | ||
495 | return (r >> 0) & 0xf; | ||
496 | } | ||
497 | static inline u32 fb_mmu_local_memory_range_lower_mag_v(u32 r) | ||
498 | { | ||
499 | return (r >> 4) & 0x3f; | ||
500 | } | ||
501 | static inline u32 fb_mmu_local_memory_range_ecc_mode_v(u32 r) | ||
502 | { | ||
503 | return (r >> 30) & 0x1; | ||
504 | } | ||
489 | #endif | 505 | #endif |
diff --git a/drivers/gpu/nvgpu/gp106/hw_fbpa_gp106.h b/drivers/gpu/nvgpu/gp106/hw_fbpa_gp106.h new file mode 100644 index 00000000..7f02eeb6 --- /dev/null +++ b/drivers/gpu/nvgpu/gp106/hw_fbpa_gp106.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
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, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | /* | ||
17 | * Function naming determines intended use: | ||
18 | * | ||
19 | * <x>_r(void) : Returns the offset for register <x>. | ||
20 | * | ||
21 | * <x>_o(void) : Returns the offset for element <x>. | ||
22 | * | ||
23 | * <x>_w(void) : Returns the word offset for word (4 byte) element <x>. | ||
24 | * | ||
25 | * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits. | ||
26 | * | ||
27 | * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted | ||
28 | * and masked to place it at field <y> of register <x>. This value | ||
29 | * can be |'d with others to produce a full register value for | ||
30 | * register <x>. | ||
31 | * | ||
32 | * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This | ||
33 | * value can be ~'d and then &'d to clear the value of field <y> for | ||
34 | * register <x>. | ||
35 | * | ||
36 | * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted | ||
37 | * to place it at field <y> of register <x>. This value can be |'d | ||
38 | * with others to produce a full register value for <x>. | ||
39 | * | ||
40 | * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register | ||
41 | * <x> value 'r' after being shifted to place its LSB at bit 0. | ||
42 | * This value is suitable for direct comparison with other unshifted | ||
43 | * values appropriate for use in field <y> of register <x>. | ||
44 | * | ||
45 | * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for | ||
46 | * field <y> of register <x>. This value is suitable for direct | ||
47 | * comparison with unshifted values appropriate for use in field <y> | ||
48 | * of register <x>. | ||
49 | */ | ||
50 | #ifndef _hw_fbpa_gp106_h_ | ||
51 | #define _hw_fbpa_gp106_h_ | ||
52 | |||
53 | static inline u32 fbpa_cstatus_r(void) | ||
54 | { | ||
55 | return 0x009a020c; | ||
56 | } | ||
57 | static inline u32 fbpa_cstatus_ramamount_v(u32 r) | ||
58 | { | ||
59 | return (r >> 0) & 0x1ffff; | ||
60 | } | ||
61 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gp106/hw_top_gp106.h b/drivers/gpu/nvgpu/gp106/hw_top_gp106.h index e833c152..85350954 100644 --- a/drivers/gpu/nvgpu/gp106/hw_top_gp106.h +++ b/drivers/gpu/nvgpu/gp106/hw_top_gp106.h | |||
@@ -74,6 +74,14 @@ static inline u32 top_num_fbps_value_v(u32 r) | |||
74 | { | 74 | { |
75 | return (r >> 0) & 0x1f; | 75 | return (r >> 0) & 0x1f; |
76 | } | 76 | } |
77 | static inline u32 top_num_fbpas_r(void) | ||
78 | { | ||
79 | return 0x0002243c; | ||
80 | } | ||
81 | static inline u32 top_num_fbpas_value_v(u32 r) | ||
82 | { | ||
83 | return (r >> 0) & 0x1f; | ||
84 | } | ||
77 | static inline u32 top_ltc_per_fbp_r(void) | 85 | static inline u32 top_ltc_per_fbp_r(void) |
78 | { | 86 | { |
79 | return 0x00022450; | 87 | return 0x00022450; |
diff --git a/drivers/gpu/nvgpu/gp106/mm_gp106.c b/drivers/gpu/nvgpu/gp106/mm_gp106.c new file mode 100644 index 00000000..1a4b6dd1 --- /dev/null +++ b/drivers/gpu/nvgpu/gp106/mm_gp106.c | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * GP106 memory management | ||
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" | ||
17 | #include "gp10b/mm_gp10b.h" | ||
18 | |||
19 | #include "hw_fb_gp106.h" | ||
20 | |||
21 | static size_t gp106_mm_get_vidmem_size(struct gk20a *g) | ||
22 | { | ||
23 | u32 range = gk20a_readl(g, fb_mmu_local_memory_range_r()); | ||
24 | u32 mag = fb_mmu_local_memory_range_lower_mag_v(range); | ||
25 | u32 scale = fb_mmu_local_memory_range_lower_scale_v(range); | ||
26 | u32 ecc = fb_mmu_local_memory_range_ecc_mode_v(range); | ||
27 | size_t bytes = ((size_t)mag << scale) * SZ_1M; | ||
28 | |||
29 | if (ecc) | ||
30 | bytes = bytes / 16 * 15; | ||
31 | |||
32 | return bytes; | ||
33 | } | ||
34 | |||
35 | void gp106_init_mm(struct gpu_ops *gops) | ||
36 | { | ||
37 | gp10b_init_mm(gops); | ||
38 | gops->mm.get_vidmem_size = gp106_mm_get_vidmem_size; | ||
39 | } | ||
diff --git a/drivers/gpu/nvgpu/gp106/mm_gp106.h b/drivers/gpu/nvgpu/gp106/mm_gp106.h new file mode 100644 index 00000000..36a89a11 --- /dev/null +++ b/drivers/gpu/nvgpu/gp106/mm_gp106.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * GP106 memory management | ||
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 | #ifndef MM_GP106_H | ||
17 | #define MM_GP106_H | ||
18 | |||
19 | struct gpu_ops; | ||
20 | |||
21 | void gp106_init_mm(struct gpu_ops *gops); | ||
22 | |||
23 | #endif | ||