diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2018-08-10 17:09:36 -0400 |
---|---|---|
committer | Bo Yan <byan@nvidia.com> | 2018-08-20 14:00:59 -0400 |
commit | 227c6f7b7a499dd58e0db6859736cfe586ef0897 (patch) | |
tree | d354f8422647021693aefefa5124d865c29ecd32 /drivers/gpu/nvgpu/gm20b | |
parent | 9e69e0cf978b53706f55ffb873e3966b4bb3a7a8 (diff) |
gpu: nvgpu: Move fuse HAL to common
Move implementation of fuse HAL to common/fuse. Also implements new
fuse query functions for FBIO, FBP, TPC floorsweeping and security
fuses.
JIRA NVGPU-957
Change-Id: I55e256a4f1b59d50a721d4942907f70dc57467c4
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1797177
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/fuse_gm20b.c | 91 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/fuse_gm20b.h | 37 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/gr_gm20b.c | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 13 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/pmu_gm20b.c | 5 |
5 files changed, 16 insertions, 137 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/fuse_gm20b.c b/drivers/gpu/nvgpu/gm20b/fuse_gm20b.c deleted file mode 100644 index 95ac8ee3..00000000 --- a/drivers/gpu/nvgpu/gm20b/fuse_gm20b.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * GM20B FUSE | ||
3 | * | ||
4 | * Copyright (c) 2017-2018, 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/types.h> | ||
26 | #include <nvgpu/fuse.h> | ||
27 | #include <nvgpu/enabled.h> | ||
28 | #include <nvgpu/io.h> | ||
29 | |||
30 | #include "gk20a/gk20a.h" | ||
31 | |||
32 | #include "fuse_gm20b.h" | ||
33 | |||
34 | #include <nvgpu/hw/gm20b/hw_fuse_gm20b.h> | ||
35 | |||
36 | int gm20b_fuse_check_priv_security(struct gk20a *g) | ||
37 | { | ||
38 | u32 gcplex_config; | ||
39 | |||
40 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) { | ||
41 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, true); | ||
42 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | ||
43 | nvgpu_log(g, gpu_dbg_info, "priv sec is enabled in fmodel"); | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | if (nvgpu_tegra_fuse_read_gcplex_config_fuse(g, &gcplex_config)) { | ||
48 | nvgpu_err(g, "err reading gcplex config fuse, check fuse clk"); | ||
49 | return -EINVAL; | ||
50 | } | ||
51 | |||
52 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | ||
53 | |||
54 | if (gk20a_readl(g, fuse_opt_priv_sec_en_r())) { | ||
55 | /* | ||
56 | * all falcons have to boot in LS mode and this needs | ||
57 | * wpr_enabled set to 1 and vpr_auto_fetch_disable | ||
58 | * set to 0. In this case gmmu tries to pull wpr | ||
59 | * and vpr settings from tegra mc | ||
60 | */ | ||
61 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, true); | ||
62 | if ((gcplex_config & | ||
63 | GCPLEX_CONFIG_WPR_ENABLED_MASK) && | ||
64 | !(gcplex_config & | ||
65 | GCPLEX_CONFIG_VPR_AUTO_FETCH_DISABLE_MASK)) { | ||
66 | if (gk20a_readl(g, fuse_opt_sec_debug_en_r())) | ||
67 | nvgpu_log(g, gpu_dbg_info, | ||
68 | "gcplex_config = 0x%08x, " | ||
69 | "secure mode: ACR debug", | ||
70 | gcplex_config); | ||
71 | else | ||
72 | nvgpu_log(g, gpu_dbg_info, | ||
73 | "gcplex_config = 0x%08x, " | ||
74 | "secure mode: ACR non debug", | ||
75 | gcplex_config); | ||
76 | } else { | ||
77 | nvgpu_err(g, "gcplex_config = 0x%08x " | ||
78 | "invalid wpr_enabled/vpr_auto_fetch_disable " | ||
79 | "with priv_sec_en", gcplex_config); | ||
80 | /* do not try to boot GPU */ | ||
81 | return -EINVAL; | ||
82 | } | ||
83 | } else { | ||
84 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); | ||
85 | nvgpu_log(g, gpu_dbg_info, | ||
86 | "gcplex_config = 0x%08x, non secure mode", | ||
87 | gcplex_config); | ||
88 | } | ||
89 | |||
90 | return 0; | ||
91 | } | ||
diff --git a/drivers/gpu/nvgpu/gm20b/fuse_gm20b.h b/drivers/gpu/nvgpu/gm20b/fuse_gm20b.h deleted file mode 100644 index 51734b2f..00000000 --- a/drivers/gpu/nvgpu/gm20b/fuse_gm20b.h +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * GM20B FUSE | ||
3 | * | ||
4 | * Copyright (c) 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 _NVGPU_GM20B_FUSE | ||
26 | #define _NVGPU_GM20B_FUSE | ||
27 | |||
28 | #define GCPLEX_CONFIG_VPR_AUTO_FETCH_DISABLE_MASK ((u32)(1 << 0)) | ||
29 | #define GCPLEX_CONFIG_VPR_ENABLED_MASK ((u32)(1 << 1)) | ||
30 | #define GCPLEX_CONFIG_WPR_ENABLED_MASK ((u32)(1 << 2)) | ||
31 | |||
32 | |||
33 | struct gk20a; | ||
34 | |||
35 | int gm20b_fuse_check_priv_security(struct gk20a *g); | ||
36 | |||
37 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c index abc39362..68ae91e8 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <nvgpu/hw/gm20b/hw_fifo_gm20b.h> | 40 | #include <nvgpu/hw/gm20b/hw_fifo_gm20b.h> |
41 | #include <nvgpu/hw/gm20b/hw_top_gm20b.h> | 41 | #include <nvgpu/hw/gm20b/hw_top_gm20b.h> |
42 | #include <nvgpu/hw/gm20b/hw_ctxsw_prog_gm20b.h> | 42 | #include <nvgpu/hw/gm20b/hw_ctxsw_prog_gm20b.h> |
43 | #include <nvgpu/hw/gm20b/hw_fuse_gm20b.h> | ||
44 | #include <nvgpu/hw/gm20b/hw_perf_gm20b.h> | 43 | #include <nvgpu/hw/gm20b/hw_perf_gm20b.h> |
45 | 44 | ||
46 | void gr_gm20b_init_gpc_mmu(struct gk20a *g) | 45 | void gr_gm20b_init_gpc_mmu(struct gk20a *g) |
@@ -549,7 +548,7 @@ u32 gr_gm20b_get_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) | |||
549 | struct gr_gk20a *gr = &g->gr; | 548 | struct gr_gk20a *gr = &g->gr; |
550 | 549 | ||
551 | /* Toggle the bits of NV_FUSE_STATUS_OPT_TPC_GPC */ | 550 | /* Toggle the bits of NV_FUSE_STATUS_OPT_TPC_GPC */ |
552 | val = gk20a_readl(g, fuse_status_opt_tpc_gpc_r(gpc_index)); | 551 | val = g->ops.fuse.fuse_status_opt_tpc_gpc(g, gpc_index); |
553 | 552 | ||
554 | return (~val) & ((0x1 << gr->max_tpc_per_gpc_count) - 1); | 553 | return (~val) & ((0x1 << gr->max_tpc_per_gpc_count) - 1); |
555 | } | 554 | } |
@@ -1076,7 +1075,7 @@ u32 gr_gm20b_get_fbp_en_mask(struct gk20a *g) | |||
1076 | * flip the bits. | 1075 | * flip the bits. |
1077 | * Also set unused bits to zero | 1076 | * Also set unused bits to zero |
1078 | */ | 1077 | */ |
1079 | fbp_en_mask = gk20a_readl(g, fuse_status_opt_fbp_r()); | 1078 | fbp_en_mask = g->ops.fuse.fuse_status_opt_fbp(g); |
1080 | fbp_en_mask = ~fbp_en_mask; | 1079 | fbp_en_mask = ~fbp_en_mask; |
1081 | fbp_en_mask = fbp_en_mask & ((1 << max_fbps_count) - 1); | 1080 | fbp_en_mask = fbp_en_mask & ((1 << max_fbps_count) - 1); |
1082 | 1081 | ||
@@ -1114,7 +1113,7 @@ u32 *gr_gm20b_rop_l2_en_mask(struct gk20a *g) | |||
1114 | 1113 | ||
1115 | /* mask of Rop_L2 for each FBP */ | 1114 | /* mask of Rop_L2 for each FBP */ |
1116 | for_each_set_bit(i, &fbp_en_mask, max_fbps_count) { | 1115 | for_each_set_bit(i, &fbp_en_mask, max_fbps_count) { |
1117 | tmp = gk20a_readl(g, fuse_status_opt_rop_l2_fbp_r(i)); | 1116 | tmp = g->ops.fuse.fuse_status_opt_rop_l2_fbp(g, i); |
1118 | gr->fbp_rop_l2_en_mask[i] = rop_l2_all_en ^ tmp; | 1117 | gr->fbp_rop_l2_en_mask[i] = rop_l2_all_en ^ tmp; |
1119 | } | 1118 | } |
1120 | 1119 | ||
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 431cfc9b..acdf4591 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "common/therm/therm_gm20b.h" | 32 | #include "common/therm/therm_gm20b.h" |
33 | #include "common/therm/therm_gm20b.h" | 33 | #include "common/therm/therm_gm20b.h" |
34 | #include "common/ltc/ltc_gm20b.h" | 34 | #include "common/ltc/ltc_gm20b.h" |
35 | #include "common/fuse/fuse_gm20b.h" | ||
35 | 36 | ||
36 | #include "gk20a/gk20a.h" | 37 | #include "gk20a/gk20a.h" |
37 | #include "gk20a/ce2_gk20a.h" | 38 | #include "gk20a/ce2_gk20a.h" |
@@ -55,7 +56,6 @@ | |||
55 | #include "regops_gm20b.h" | 56 | #include "regops_gm20b.h" |
56 | #include "hal_gm20b.h" | 57 | #include "hal_gm20b.h" |
57 | #include "acr_gm20b.h" | 58 | #include "acr_gm20b.h" |
58 | #include "fuse_gm20b.h" | ||
59 | 59 | ||
60 | #include <nvgpu/debug.h> | 60 | #include <nvgpu/debug.h> |
61 | #include <nvgpu/bug.h> | 61 | #include <nvgpu/bug.h> |
@@ -64,7 +64,6 @@ | |||
64 | #include <nvgpu/error_notifier.h> | 64 | #include <nvgpu/error_notifier.h> |
65 | 65 | ||
66 | #include <nvgpu/hw/gm20b/hw_proj_gm20b.h> | 66 | #include <nvgpu/hw/gm20b/hw_proj_gm20b.h> |
67 | #include <nvgpu/hw/gm20b/hw_fuse_gm20b.h> | ||
68 | #include <nvgpu/hw/gm20b/hw_fifo_gm20b.h> | 67 | #include <nvgpu/hw/gm20b/hw_fifo_gm20b.h> |
69 | #include <nvgpu/hw/gm20b/hw_ram_gm20b.h> | 68 | #include <nvgpu/hw/gm20b/hw_ram_gm20b.h> |
70 | #include <nvgpu/hw/gm20b/hw_top_gm20b.h> | 69 | #include <nvgpu/hw/gm20b/hw_top_gm20b.h> |
@@ -649,6 +648,16 @@ static const struct gpu_ops gm20b_ops = { | |||
649 | }, | 648 | }, |
650 | .fuse = { | 649 | .fuse = { |
651 | .check_priv_security = gm20b_fuse_check_priv_security, | 650 | .check_priv_security = gm20b_fuse_check_priv_security, |
651 | .fuse_status_opt_fbio = gm20b_fuse_status_opt_fbio, | ||
652 | .fuse_status_opt_fbp = gm20b_fuse_status_opt_fbp, | ||
653 | .fuse_status_opt_rop_l2_fbp = gm20b_fuse_status_opt_rop_l2_fbp, | ||
654 | .fuse_status_opt_tpc_gpc = gm20b_fuse_status_opt_tpc_gpc, | ||
655 | .fuse_ctrl_opt_tpc_gpc = gm20b_fuse_ctrl_opt_tpc_gpc, | ||
656 | .fuse_opt_sec_debug_en = gm20b_fuse_opt_sec_debug_en, | ||
657 | .fuse_opt_priv_sec_en = gm20b_fuse_opt_priv_sec_en, | ||
658 | .read_vin_cal_fuse_rev = NULL, | ||
659 | .read_vin_cal_slope_intercept_fuse = NULL, | ||
660 | .read_vin_cal_gain_offset_fuse = NULL, | ||
652 | }, | 661 | }, |
653 | .chip_init_gpu_characteristics = gk20a_init_gpu_characteristics, | 662 | .chip_init_gpu_characteristics = gk20a_init_gpu_characteristics, |
654 | .get_litter_value = gm20b_get_litter_value, | 663 | .get_litter_value = gm20b_get_litter_value, |
diff --git a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c index 731078f7..53bec96f 100644 --- a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c | |||
@@ -36,7 +36,6 @@ | |||
36 | 36 | ||
37 | #include <nvgpu/hw/gm20b/hw_gr_gm20b.h> | 37 | #include <nvgpu/hw/gm20b/hw_gr_gm20b.h> |
38 | #include <nvgpu/hw/gm20b/hw_pwr_gm20b.h> | 38 | #include <nvgpu/hw/gm20b/hw_pwr_gm20b.h> |
39 | #include <nvgpu/hw/gm20b/hw_fuse_gm20b.h> | ||
40 | 39 | ||
41 | #define gm20b_dbg_pmu(g, fmt, arg...) \ | 40 | #define gm20b_dbg_pmu(g, fmt, arg...) \ |
42 | nvgpu_log(g, gpu_dbg_pmu, fmt, ##arg) | 41 | nvgpu_log(g, gpu_dbg_pmu, fmt, ##arg) |
@@ -267,9 +266,9 @@ void pmu_dump_security_fuses_gm20b(struct gk20a *g) | |||
267 | u32 val; | 266 | u32 val; |
268 | 267 | ||
269 | nvgpu_err(g, "FUSE_OPT_SEC_DEBUG_EN_0: 0x%x", | 268 | nvgpu_err(g, "FUSE_OPT_SEC_DEBUG_EN_0: 0x%x", |
270 | gk20a_readl(g, fuse_opt_sec_debug_en_r())); | 269 | g->ops.fuse.fuse_opt_sec_debug_en(g)); |
271 | nvgpu_err(g, "FUSE_OPT_PRIV_SEC_EN_0: 0x%x", | 270 | nvgpu_err(g, "FUSE_OPT_PRIV_SEC_EN_0: 0x%x", |
272 | gk20a_readl(g, fuse_opt_priv_sec_en_r())); | 271 | g->ops.fuse.fuse_opt_priv_sec_en(g)); |
273 | nvgpu_tegra_fuse_read_gcplex_config_fuse(g, &val); | 272 | nvgpu_tegra_fuse_read_gcplex_config_fuse(g, &val); |
274 | nvgpu_err(g, "FUSE_GCPLEX_CONFIG_FUSE_0: 0x%x", val); | 273 | nvgpu_err(g, "FUSE_GCPLEX_CONFIG_FUSE_0: 0x%x", val); |
275 | } | 274 | } |