diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2018-08-10 11:28:23 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-08-13 17:06:17 -0400 |
commit | e62785190f74cfbf9003a190a768e9077373bf6f (patch) | |
tree | be7bf93828c948d3b9bc84ec31f3f21cec35cf9e /drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c | |
parent | 0706e94c9204becdee6a32391a319cad690d1bc3 (diff) |
gpu: nvgpu: Move priv_ring HAL to common
Move implementation of priv_ring HAL to common/priv_ring. Implement
two new HAL APIs to remove illegal dependencies: enable_priv_ring and
enum_ltc.
As enum_ltc can be implemented only gm20b onwards, bump gk20a
implementation to base on gm20b.
JIRA NVGPU-964
Change-Id: I160c2216132aadbcd98bb4a688aeeb2c520a9bc0
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1797025
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c b/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c deleted file mode 100644 index 0e004a5d..00000000 --- a/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | /* | ||
2 | * GK20A priv ring | ||
3 | * | ||
4 | * Copyright (c) 2011-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 "gk20a.h" | ||
26 | |||
27 | #include <nvgpu/log.h> | ||
28 | #include <nvgpu/timers.h> | ||
29 | #include <nvgpu/enabled.h> | ||
30 | #include <nvgpu/io.h> | ||
31 | #include <nvgpu/utils.h> | ||
32 | |||
33 | #include <nvgpu/hw/gk20a/hw_mc_gk20a.h> | ||
34 | #include <nvgpu/hw/gk20a/hw_pri_ringmaster_gk20a.h> | ||
35 | #include <nvgpu/hw/gk20a/hw_pri_ringstation_sys_gk20a.h> | ||
36 | #include <nvgpu/hw/gk20a/hw_pri_ringstation_gpc_gk20a.h> | ||
37 | #include <nvgpu/hw/gk20a/hw_pri_ringstation_fbp_gk20a.h> | ||
38 | |||
39 | void gk20a_enable_priv_ring(struct gk20a *g) | ||
40 | { | ||
41 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) | ||
42 | return; | ||
43 | |||
44 | nvgpu_log(g, gpu_dbg_info, "enabling priv ring"); | ||
45 | |||
46 | if (g->ops.clock_gating.slcg_priring_load_gating_prod) | ||
47 | g->ops.clock_gating.slcg_priring_load_gating_prod(g, | ||
48 | g->slcg_enabled); | ||
49 | |||
50 | gk20a_writel(g,pri_ringmaster_command_r(), | ||
51 | 0x4); | ||
52 | |||
53 | gk20a_writel(g, pri_ringstation_sys_decode_config_r(), | ||
54 | 0x2); | ||
55 | gk20a_readl(g, pri_ringstation_sys_decode_config_r()); | ||
56 | } | ||
57 | |||
58 | void gk20a_priv_ring_isr(struct gk20a *g) | ||
59 | { | ||
60 | u32 status0, status1; | ||
61 | u32 cmd; | ||
62 | s32 retry = 100; | ||
63 | u32 gpc; | ||
64 | u32 gpc_priv_stride = nvgpu_get_litter_value(g, GPU_LIT_GPC_PRIV_STRIDE); | ||
65 | |||
66 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) | ||
67 | return; | ||
68 | |||
69 | status0 = gk20a_readl(g, pri_ringmaster_intr_status0_r()); | ||
70 | status1 = gk20a_readl(g, pri_ringmaster_intr_status1_r()); | ||
71 | |||
72 | nvgpu_log(g, gpu_dbg_intr, "ringmaster intr status0: 0x%08x," | ||
73 | "status1: 0x%08x", status0, status1); | ||
74 | |||
75 | if (pri_ringmaster_intr_status0_gbl_write_error_sys_v(status0) != 0) { | ||
76 | nvgpu_log(g, gpu_dbg_intr, "SYS write error. ADR %08x WRDAT %08x INFO %08x, CODE %08x", | ||
77 | gk20a_readl(g, pri_ringstation_sys_priv_error_adr_r()), | ||
78 | gk20a_readl(g, pri_ringstation_sys_priv_error_wrdat_r()), | ||
79 | gk20a_readl(g, pri_ringstation_sys_priv_error_info_r()), | ||
80 | gk20a_readl(g, pri_ringstation_sys_priv_error_code_r())); | ||
81 | } | ||
82 | |||
83 | for (gpc = 0; gpc < g->gr.gpc_count; gpc++) { | ||
84 | if (status1 & BIT(gpc)) { | ||
85 | nvgpu_log(g, gpu_dbg_intr, "GPC%u write error. ADR %08x WRDAT %08x INFO %08x, CODE %08x", gpc, | ||
86 | gk20a_readl(g, pri_ringstation_gpc_gpc0_priv_error_adr_r() + gpc * gpc_priv_stride), | ||
87 | gk20a_readl(g, pri_ringstation_gpc_gpc0_priv_error_wrdat_r() + gpc * gpc_priv_stride), | ||
88 | gk20a_readl(g, pri_ringstation_gpc_gpc0_priv_error_info_r() + gpc * gpc_priv_stride), | ||
89 | gk20a_readl(g, pri_ringstation_gpc_gpc0_priv_error_code_r() + gpc * gpc_priv_stride)); | ||
90 | } | ||
91 | } | ||
92 | /* clear interrupt */ | ||
93 | cmd = gk20a_readl(g, pri_ringmaster_command_r()); | ||
94 | cmd = set_field(cmd, pri_ringmaster_command_cmd_m(), | ||
95 | pri_ringmaster_command_cmd_ack_interrupt_f()); | ||
96 | gk20a_writel(g, pri_ringmaster_command_r(), cmd); | ||
97 | /* poll for clear interrupt done */ | ||
98 | cmd = pri_ringmaster_command_cmd_v( | ||
99 | gk20a_readl(g, pri_ringmaster_command_r())); | ||
100 | while (cmd != pri_ringmaster_command_cmd_no_cmd_v() && retry) { | ||
101 | nvgpu_udelay(20); | ||
102 | retry--; | ||
103 | cmd = pri_ringmaster_command_cmd_v( | ||
104 | gk20a_readl(g, pri_ringmaster_command_r())); | ||
105 | } | ||
106 | if (retry == 0 && cmd != pri_ringmaster_command_cmd_no_cmd_v()) | ||
107 | nvgpu_warn(g, "priv ringmaster intr ack too many retries"); | ||
108 | } | ||
109 | |||
110 | void gk20a_priv_set_timeout_settings(struct gk20a *g) | ||
111 | { | ||
112 | /* | ||
113 | * Bug 1340570: increase the clock timeout to avoid potential | ||
114 | * operation failure at high gpcclk rate. Default values are 0x400. | ||
115 | */ | ||
116 | nvgpu_writel(g, pri_ringstation_sys_master_config_r(0x15), 0x800); | ||
117 | nvgpu_writel(g, pri_ringstation_gpc_master_config_r(0xa), 0x800); | ||
118 | nvgpu_writel(g, pri_ringstation_fbp_master_config_r(0x8), 0x800); | ||
119 | } | ||