diff options
-rw-r--r-- | drivers/gpu/nvgpu/Makefile | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/ltc.c | 16 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ltc_gk20a.c | 46 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ltc_gk20a.h | 31 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/ltc_gm20b.c | 12 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/ltc_gp10b.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/ltc.h | 4 |
7 files changed, 29 insertions, 95 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 9c6c59f2..a0cb5d90 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile | |||
@@ -103,7 +103,6 @@ nvgpu-y := \ | |||
103 | gk20a/gr_ctx_gk20a_sim.o \ | 103 | gk20a/gr_ctx_gk20a_sim.o \ |
104 | gk20a/gr_ctx_gk20a.o \ | 104 | gk20a/gr_ctx_gk20a.o \ |
105 | gk20a/gk20a_gating_reglist.o \ | 105 | gk20a/gk20a_gating_reglist.o \ |
106 | gk20a/ltc_gk20a.o \ | ||
107 | gk20a/fb_gk20a.o \ | 106 | gk20a/fb_gk20a.o \ |
108 | gk20a/hal.o \ | 107 | gk20a/hal.o \ |
109 | gk20a/tsg_gk20a.o \ | 108 | gk20a/tsg_gk20a.o \ |
diff --git a/drivers/gpu/nvgpu/common/ltc.c b/drivers/gpu/nvgpu/common/ltc.c index 4fbdbe2e..006e2ed2 100644 --- a/drivers/gpu/nvgpu/common/ltc.c +++ b/drivers/gpu/nvgpu/common/ltc.c | |||
@@ -21,8 +21,10 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <nvgpu/ltc.h> | 23 | #include <nvgpu/ltc.h> |
24 | #include <nvgpu/dma.h> | ||
24 | 25 | ||
25 | #include "gk20a/gk20a.h" | 26 | #include "gk20a/gk20a.h" |
27 | #include "gk20a/gr_gk20a.h" | ||
26 | 28 | ||
27 | int nvgpu_init_ltc_support(struct gk20a *g) | 29 | int nvgpu_init_ltc_support(struct gk20a *g) |
28 | { | 30 | { |
@@ -46,3 +48,17 @@ void nvgpu_ltc_sync_enabled(struct gk20a *g) | |||
46 | } | 48 | } |
47 | nvgpu_spinlock_release(&g->ltc_enabled_lock); | 49 | nvgpu_spinlock_release(&g->ltc_enabled_lock); |
48 | } | 50 | } |
51 | |||
52 | int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size) | ||
53 | { | ||
54 | struct gr_gk20a *gr = &g->gr; | ||
55 | unsigned long flags = 0; | ||
56 | |||
57 | if (!nvgpu_iommuable(g)) | ||
58 | flags = NVGPU_DMA_FORCE_CONTIGUOUS; | ||
59 | |||
60 | return nvgpu_dma_alloc_flags_sys(g, | ||
61 | flags, | ||
62 | compbit_backing_size, | ||
63 | &gr->compbit_store.mem); | ||
64 | } | ||
diff --git a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c deleted file mode 100644 index a915cf0c..00000000 --- a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * GK20A L2 | ||
3 | * | ||
4 | * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the "Software"), | ||
8 | * to deal in the Software without restriction, including without limitation | ||
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
11 | * Software is furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice shall be included in | ||
14 | * all copies or substantial portions of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | */ | ||
24 | |||
25 | #include <nvgpu/dma.h> | ||
26 | |||
27 | #include "gk20a.h" | ||
28 | #include "gr_gk20a.h" | ||
29 | |||
30 | int gk20a_ltc_alloc_phys_cbc(struct gk20a *g, size_t compbit_backing_size) | ||
31 | { | ||
32 | struct gr_gk20a *gr = &g->gr; | ||
33 | |||
34 | return nvgpu_dma_alloc_flags_sys(g, NVGPU_DMA_FORCE_CONTIGUOUS, | ||
35 | compbit_backing_size, | ||
36 | &gr->compbit_store.mem); | ||
37 | } | ||
38 | |||
39 | int gk20a_ltc_alloc_virt_cbc(struct gk20a *g, size_t compbit_backing_size) | ||
40 | { | ||
41 | struct gr_gk20a *gr = &g->gr; | ||
42 | |||
43 | return nvgpu_dma_alloc_flags_sys(g, NVGPU_DMA_NO_KERNEL_MAPPING, | ||
44 | compbit_backing_size, | ||
45 | &gr->compbit_store.mem); | ||
46 | } | ||
diff --git a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h deleted file mode 100644 index 8153ef0b..00000000 --- a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * GK20A L2 | ||
3 | * | ||
4 | * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the "Software"), | ||
8 | * to deal in the Software without restriction, including without limitation | ||
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
11 | * Software is furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice shall be included in | ||
14 | * all copies or substantial portions of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | */ | ||
24 | |||
25 | #ifndef LTC_GK20A_H | ||
26 | #define LTC_GK20A_H | ||
27 | struct gk20a; | ||
28 | |||
29 | int gk20a_ltc_alloc_phys_cbc(struct gk20a *g, size_t compbit_backing_size); | ||
30 | int gk20a_ltc_alloc_virt_cbc(struct gk20a *g, size_t compbit_backing_size); | ||
31 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c index 84759192..6ec9aec5 100644 --- a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c | |||
@@ -24,18 +24,18 @@ | |||
24 | 24 | ||
25 | #include <trace/events/gk20a.h> | 25 | #include <trace/events/gk20a.h> |
26 | 26 | ||
27 | #include "gk20a/gk20a.h" | ||
28 | |||
29 | #include <nvgpu/timers.h> | 27 | #include <nvgpu/timers.h> |
30 | #include <nvgpu/enabled.h> | 28 | #include <nvgpu/enabled.h> |
31 | #include <nvgpu/bug.h> | 29 | #include <nvgpu/bug.h> |
30 | #include <nvgpu/ltc.h> | ||
32 | 31 | ||
33 | #include <nvgpu/hw/gm20b/hw_mc_gm20b.h> | 32 | #include <nvgpu/hw/gm20b/hw_mc_gm20b.h> |
34 | #include <nvgpu/hw/gm20b/hw_ltc_gm20b.h> | 33 | #include <nvgpu/hw/gm20b/hw_ltc_gm20b.h> |
35 | #include <nvgpu/hw/gm20b/hw_top_gm20b.h> | 34 | #include <nvgpu/hw/gm20b/hw_top_gm20b.h> |
36 | #include <nvgpu/hw/gm20b/hw_pri_ringmaster_gm20b.h> | 35 | #include <nvgpu/hw/gm20b/hw_pri_ringmaster_gm20b.h> |
37 | 36 | ||
38 | #include "gk20a/ltc_gk20a.h" | 37 | #include "gk20a/gk20a.h" |
38 | |||
39 | #include "ltc_gm20b.h" | 39 | #include "ltc_gm20b.h" |
40 | 40 | ||
41 | int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | 41 | int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) |
@@ -92,11 +92,7 @@ int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | |||
92 | gk20a_dbg_info("max comptag lines : %d", | 92 | gk20a_dbg_info("max comptag lines : %d", |
93 | max_comptag_lines); | 93 | max_comptag_lines); |
94 | 94 | ||
95 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) | 95 | err = nvgpu_ltc_alloc_cbc(g, compbit_backing_size); |
96 | err = gk20a_ltc_alloc_phys_cbc(g, compbit_backing_size); | ||
97 | else | ||
98 | err = gk20a_ltc_alloc_virt_cbc(g, compbit_backing_size); | ||
99 | |||
100 | if (err) | 96 | if (err) |
101 | return err; | 97 | return err; |
102 | 98 | ||
diff --git a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c index 9d878402..92a899b8 100644 --- a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c | |||
@@ -24,16 +24,16 @@ | |||
24 | 24 | ||
25 | #include <dt-bindings/memory/tegra-swgroup.h> | 25 | #include <dt-bindings/memory/tegra-swgroup.h> |
26 | 26 | ||
27 | #include "gk20a/gk20a.h" | 27 | #include <nvgpu/ltc.h> |
28 | #include "gm20b/ltc_gm20b.h" | ||
29 | |||
30 | #include <nvgpu/log.h> | 28 | #include <nvgpu/log.h> |
31 | #include <nvgpu/enabled.h> | 29 | #include <nvgpu/enabled.h> |
32 | 30 | ||
33 | #include <nvgpu/hw/gp10b/hw_mc_gp10b.h> | 31 | #include <nvgpu/hw/gp10b/hw_mc_gp10b.h> |
34 | #include <nvgpu/hw/gp10b/hw_ltc_gp10b.h> | 32 | #include <nvgpu/hw/gp10b/hw_ltc_gp10b.h> |
35 | 33 | ||
36 | #include "gk20a/ltc_gk20a.h" | 34 | #include "gk20a/gk20a.h" |
35 | #include "gm20b/ltc_gm20b.h" | ||
36 | |||
37 | #include "ltc_gp10b.h" | 37 | #include "ltc_gp10b.h" |
38 | 38 | ||
39 | int gp10b_determine_L2_size_bytes(struct gk20a *g) | 39 | int gp10b_determine_L2_size_bytes(struct gk20a *g) |
@@ -112,11 +112,7 @@ int gp10b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | |||
112 | gk20a_dbg_info("gobs_per_comptagline_per_slice: %d", | 112 | gk20a_dbg_info("gobs_per_comptagline_per_slice: %d", |
113 | gobs_per_comptagline_per_slice); | 113 | gobs_per_comptagline_per_slice); |
114 | 114 | ||
115 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) | 115 | err = nvgpu_ltc_alloc_cbc(g, compbit_backing_size); |
116 | err = gk20a_ltc_alloc_phys_cbc(g, compbit_backing_size); | ||
117 | else | ||
118 | err = gk20a_ltc_alloc_virt_cbc(g, compbit_backing_size); | ||
119 | |||
120 | if (err) | 116 | if (err) |
121 | return err; | 117 | return err; |
122 | 118 | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/ltc.h b/drivers/gpu/nvgpu/include/nvgpu/ltc.h index 223346a3..60aa5424 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/ltc.h +++ b/drivers/gpu/nvgpu/include/nvgpu/ltc.h | |||
@@ -19,12 +19,16 @@ | |||
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | * DEALINGS IN THE SOFTWARE. | 20 | * DEALINGS IN THE SOFTWARE. |
21 | */ | 21 | */ |
22 | |||
22 | #ifndef __NVGPU_LTC_H__ | 23 | #ifndef __NVGPU_LTC_H__ |
23 | #define __NVGPU_LTC_H__ | 24 | #define __NVGPU_LTC_H__ |
24 | 25 | ||
26 | #include <nvgpu/types.h> | ||
27 | |||
25 | struct gk20a; | 28 | struct gk20a; |
26 | 29 | ||
27 | int nvgpu_init_ltc_support(struct gk20a *g); | 30 | int nvgpu_init_ltc_support(struct gk20a *g); |
28 | void nvgpu_ltc_sync_enabled(struct gk20a *g); | 31 | void nvgpu_ltc_sync_enabled(struct gk20a *g); |
32 | int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size); | ||
29 | 33 | ||
30 | #endif | 34 | #endif |