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/gp10b | |
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/gp10b')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/fuse_gp10b.c | 105 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/fuse_gp10b.h | 34 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 16 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/pmu_gp10b.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/pmu_gp10b.h | 1 |
5 files changed, 13 insertions, 157 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/fuse_gp10b.c b/drivers/gpu/nvgpu/gp10b/fuse_gp10b.c deleted file mode 100644 index a79d5e1c..00000000 --- a/drivers/gpu/nvgpu/gp10b/fuse_gp10b.c +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /* | ||
2 | * GP10B 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 "gm20b/fuse_gm20b.h" | ||
33 | |||
34 | #include "fuse_gp10b.h" | ||
35 | |||
36 | #include <nvgpu/hw/gp10b/hw_fuse_gp10b.h> | ||
37 | |||
38 | int gp10b_fuse_check_priv_security(struct gk20a *g) | ||
39 | { | ||
40 | u32 gcplex_config; | ||
41 | |||
42 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) { | ||
43 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); | ||
44 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | ||
45 | nvgpu_log(g, gpu_dbg_info, "priv sec is disabled in fmodel"); | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | if (nvgpu_tegra_fuse_read_gcplex_config_fuse(g, &gcplex_config)) { | ||
50 | nvgpu_err(g, "err reading gcplex config fuse, check fuse clk"); | ||
51 | return -EINVAL; | ||
52 | } | ||
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 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); | ||
63 | if ((gcplex_config & | ||
64 | GCPLEX_CONFIG_WPR_ENABLED_MASK) && | ||
65 | !(gcplex_config & | ||
66 | GCPLEX_CONFIG_VPR_AUTO_FETCH_DISABLE_MASK)) { | ||
67 | if (gk20a_readl(g, fuse_opt_sec_debug_en_r())) | ||
68 | nvgpu_log(g, gpu_dbg_info, | ||
69 | "gcplex_config = 0x%08x, " | ||
70 | "secure mode: ACR debug", | ||
71 | gcplex_config); | ||
72 | else | ||
73 | nvgpu_log(g, gpu_dbg_info, | ||
74 | "gcplex_config = 0x%08x, " | ||
75 | "secure mode: ACR non debug", | ||
76 | gcplex_config); | ||
77 | |||
78 | } else { | ||
79 | nvgpu_err(g, "gcplex_config = 0x%08x " | ||
80 | "invalid wpr_enabled/vpr_auto_fetch_disable " | ||
81 | "with priv_sec_en", gcplex_config); | ||
82 | /* do not try to boot GPU */ | ||
83 | return -EINVAL; | ||
84 | } | ||
85 | } else { | ||
86 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); | ||
87 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | ||
88 | nvgpu_log(g, gpu_dbg_info, | ||
89 | "gcplex_config = 0x%08x, non secure mode", | ||
90 | gcplex_config); | ||
91 | } | ||
92 | |||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | bool gp10b_fuse_is_opt_ecc_enable(struct gk20a *g) | ||
97 | { | ||
98 | return gk20a_readl(g, fuse_opt_ecc_en_r()) != 0U; | ||
99 | } | ||
100 | |||
101 | bool gp10b_fuse_is_opt_feature_override_disable(struct gk20a *g) | ||
102 | { | ||
103 | return gk20a_readl(g, | ||
104 | fuse_opt_feature_fuses_override_disable_r()) != 0U; | ||
105 | } | ||
diff --git a/drivers/gpu/nvgpu/gp10b/fuse_gp10b.h b/drivers/gpu/nvgpu/gp10b/fuse_gp10b.h deleted file mode 100644 index d9037e22..00000000 --- a/drivers/gpu/nvgpu/gp10b/fuse_gp10b.h +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /* | ||
2 | * GP10B 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 | #ifndef _NVGPU_GP10B_FUSE | ||
26 | #define _NVGPU_GP10B_FUSE | ||
27 | |||
28 | struct gk20a; | ||
29 | |||
30 | int gp10b_fuse_check_priv_security(struct gk20a *g); | ||
31 | bool gp10b_fuse_is_opt_ecc_enable(struct gk20a *g); | ||
32 | bool gp10b_fuse_is_opt_feature_override_disable(struct gk20a *g); | ||
33 | |||
34 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 7df17ed7..efd66b5d 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include "common/therm/therm_gp10b.h" | 36 | #include "common/therm/therm_gp10b.h" |
37 | #include "common/ltc/ltc_gm20b.h" | 37 | #include "common/ltc/ltc_gm20b.h" |
38 | #include "common/ltc/ltc_gp10b.h" | 38 | #include "common/ltc/ltc_gp10b.h" |
39 | #include "common/fuse/fuse_gm20b.h" | ||
40 | #include "common/fuse/fuse_gp10b.h" | ||
39 | 41 | ||
40 | #include "gk20a/gk20a.h" | 42 | #include "gk20a/gk20a.h" |
41 | #include "gk20a/fifo_gk20a.h" | 43 | #include "gk20a/fifo_gk20a.h" |
@@ -70,7 +72,6 @@ | |||
70 | 72 | ||
71 | #include "gp10b.h" | 73 | #include "gp10b.h" |
72 | #include "hal_gp10b.h" | 74 | #include "hal_gp10b.h" |
73 | #include "fuse_gp10b.h" | ||
74 | 75 | ||
75 | #include <nvgpu/debug.h> | 76 | #include <nvgpu/debug.h> |
76 | #include <nvgpu/bug.h> | 77 | #include <nvgpu/bug.h> |
@@ -80,7 +81,6 @@ | |||
80 | #include <nvgpu/error_notifier.h> | 81 | #include <nvgpu/error_notifier.h> |
81 | 82 | ||
82 | #include <nvgpu/hw/gp10b/hw_proj_gp10b.h> | 83 | #include <nvgpu/hw/gp10b/hw_proj_gp10b.h> |
83 | #include <nvgpu/hw/gp10b/hw_fuse_gp10b.h> | ||
84 | #include <nvgpu/hw/gp10b/hw_fifo_gp10b.h> | 84 | #include <nvgpu/hw/gp10b/hw_fifo_gp10b.h> |
85 | #include <nvgpu/hw/gp10b/hw_ram_gp10b.h> | 85 | #include <nvgpu/hw/gp10b/hw_ram_gp10b.h> |
86 | #include <nvgpu/hw/gp10b/hw_top_gp10b.h> | 86 | #include <nvgpu/hw/gp10b/hw_top_gp10b.h> |
@@ -597,7 +597,7 @@ static const struct gpu_ops gp10b_ops = { | |||
597 | .pmu_pg_init_param = gp10b_pg_gr_init, | 597 | .pmu_pg_init_param = gp10b_pg_gr_init, |
598 | .pmu_pg_supported_engines_list = gk20a_pmu_pg_engines_list, | 598 | .pmu_pg_supported_engines_list = gk20a_pmu_pg_engines_list, |
599 | .pmu_pg_engines_feature_list = gk20a_pmu_pg_feature_list, | 599 | .pmu_pg_engines_feature_list = gk20a_pmu_pg_feature_list, |
600 | .dump_secure_fuses = pmu_dump_security_fuses_gp10b, | 600 | .dump_secure_fuses = pmu_dump_security_fuses_gm20b, |
601 | .reset_engine = gk20a_pmu_engine_reset, | 601 | .reset_engine = gk20a_pmu_engine_reset, |
602 | .is_engine_in_reset = gk20a_pmu_is_engine_in_reset, | 602 | .is_engine_in_reset = gk20a_pmu_is_engine_in_reset, |
603 | .get_irqdest = gk20a_pmu_get_irqdest, | 603 | .get_irqdest = gk20a_pmu_get_irqdest, |
@@ -702,6 +702,16 @@ static const struct gpu_ops gp10b_ops = { | |||
702 | .is_opt_ecc_enable = gp10b_fuse_is_opt_ecc_enable, | 702 | .is_opt_ecc_enable = gp10b_fuse_is_opt_ecc_enable, |
703 | .is_opt_feature_override_disable = | 703 | .is_opt_feature_override_disable = |
704 | gp10b_fuse_is_opt_feature_override_disable, | 704 | gp10b_fuse_is_opt_feature_override_disable, |
705 | .fuse_status_opt_fbio = gm20b_fuse_status_opt_fbio, | ||
706 | .fuse_status_opt_fbp = gm20b_fuse_status_opt_fbp, | ||
707 | .fuse_status_opt_rop_l2_fbp = gm20b_fuse_status_opt_rop_l2_fbp, | ||
708 | .fuse_status_opt_tpc_gpc = gm20b_fuse_status_opt_tpc_gpc, | ||
709 | .fuse_ctrl_opt_tpc_gpc = gm20b_fuse_ctrl_opt_tpc_gpc, | ||
710 | .fuse_opt_sec_debug_en = gm20b_fuse_opt_sec_debug_en, | ||
711 | .fuse_opt_priv_sec_en = gm20b_fuse_opt_priv_sec_en, | ||
712 | .read_vin_cal_fuse_rev = NULL, | ||
713 | .read_vin_cal_slope_intercept_fuse = NULL, | ||
714 | .read_vin_cal_gain_offset_fuse = NULL, | ||
705 | }, | 715 | }, |
706 | .chip_init_gpu_characteristics = gp10b_init_gpu_characteristics, | 716 | .chip_init_gpu_characteristics = gp10b_init_gpu_characteristics, |
707 | .get_litter_value = gp10b_get_litter_value, | 717 | .get_litter_value = gp10b_get_litter_value, |
diff --git a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c index 6ecb7957..d6497173 100644 --- a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include "pmu_gp10b.h" | 36 | #include "pmu_gp10b.h" |
37 | 37 | ||
38 | #include <nvgpu/hw/gp10b/hw_pwr_gp10b.h> | 38 | #include <nvgpu/hw/gp10b/hw_pwr_gp10b.h> |
39 | #include <nvgpu/hw/gp10b/hw_fuse_gp10b.h> | ||
40 | 39 | ||
41 | #define gp10b_dbg_pmu(g, fmt, arg...) \ | 40 | #define gp10b_dbg_pmu(g, fmt, arg...) \ |
42 | nvgpu_log(g, gpu_dbg_pmu, fmt, ##arg) | 41 | nvgpu_log(g, gpu_dbg_pmu, fmt, ##arg) |
@@ -375,19 +374,6 @@ bool gp10b_is_priv_load(u32 falcon_id) | |||
375 | return enable_status; | 374 | return enable_status; |
376 | } | 375 | } |
377 | 376 | ||
378 | /*Dump Security related fuses*/ | ||
379 | void pmu_dump_security_fuses_gp10b(struct gk20a *g) | ||
380 | { | ||
381 | u32 val; | ||
382 | |||
383 | nvgpu_err(g, "FUSE_OPT_SEC_DEBUG_EN_0: 0x%x", | ||
384 | gk20a_readl(g, fuse_opt_sec_debug_en_r())); | ||
385 | nvgpu_err(g, "FUSE_OPT_PRIV_SEC_EN_0: 0x%x", | ||
386 | gk20a_readl(g, fuse_opt_priv_sec_en_r())); | ||
387 | nvgpu_tegra_fuse_read_gcplex_config_fuse(g, &val); | ||
388 | nvgpu_err(g, "FUSE_GCPLEX_CONFIG_FUSE_0: 0x%x", val); | ||
389 | } | ||
390 | |||
391 | bool gp10b_is_pmu_supported(struct gk20a *g) | 377 | bool gp10b_is_pmu_supported(struct gk20a *g) |
392 | { | 378 | { |
393 | return true; | 379 | return true; |
diff --git a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.h b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.h index 44e0ec98..87c3ba79 100644 --- a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.h | |||
@@ -35,7 +35,6 @@ int gp10b_init_pmu_setup_hw1(struct gk20a *g); | |||
35 | void gp10b_pmu_elpg_statistics(struct gk20a *g, u32 pg_engine_id, | 35 | void gp10b_pmu_elpg_statistics(struct gk20a *g, u32 pg_engine_id, |
36 | struct pmu_pg_stats_data *pg_stat_data); | 36 | struct pmu_pg_stats_data *pg_stat_data); |
37 | int gp10b_pmu_setup_elpg(struct gk20a *g); | 37 | int gp10b_pmu_setup_elpg(struct gk20a *g); |
38 | void pmu_dump_security_fuses_gp10b(struct gk20a *g); | ||
39 | int gp10b_load_falcon_ucode(struct gk20a *g, u32 falconidmask); | 38 | int gp10b_load_falcon_ucode(struct gk20a *g, u32 falconidmask); |
40 | int gp10b_pg_gr_init(struct gk20a *g, u32 pg_engine_id); | 39 | int gp10b_pg_gr_init(struct gk20a *g, u32 pg_engine_id); |
41 | void gp10b_write_dmatrfbase(struct gk20a *g, u32 addr); | 40 | void gp10b_write_dmatrfbase(struct gk20a *g, u32 addr); |