diff options
author | Mahantesh Kumbar <mkumbar@nvidia.com> | 2017-04-25 02:52:56 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-23 04:14:18 -0400 |
commit | be04b9b1b56d6dd478fe521277c079367c03f39d (patch) | |
tree | 779f867a3511743ca776064e09ee88d59f2d24ce /drivers/gpu/nvgpu/common | |
parent | 5efa7c8d5ef74eba4fa33881eb64176f5a97de11 (diff) |
gpu: nvgpu: falcon reset support
- Added flacon reset dependent interface & HAL
methods to perform falcon reset.
- method to wait for idle
- method to reset falcon
- method to set irq
- method to read status of CPU
- Updated falcon ops pointer to point gk20a
falcon HAL methods
- Added members to know support of falcon
& interrupt.
- Added falcon dependency ops member to support
flacon speicifc methods
JIRA NVGPU-99
JIRA NVGPU-101
Change-Id: I411477e5696a61ee73caebfdab625763b522c255
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1469453
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/falcon/falcon.c | 103 |
1 files changed, 102 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/falcon/falcon.c b/drivers/gpu/nvgpu/common/falcon/falcon.c index bcc24355..9e832985 100644 --- a/drivers/gpu/nvgpu/common/falcon/falcon.c +++ b/drivers/gpu/nvgpu/common/falcon/falcon.c | |||
@@ -16,6 +16,106 @@ | |||
16 | 16 | ||
17 | #include "gk20a/gk20a.h" | 17 | #include "gk20a/gk20a.h" |
18 | 18 | ||
19 | int nvgpu_flcn_wait_idle(struct nvgpu_falcon *flcn) | ||
20 | { | ||
21 | struct gk20a *g = flcn->g; | ||
22 | struct nvgpu_falcon_ops *flcn_ops = &flcn->flcn_ops; | ||
23 | struct nvgpu_timeout timeout; | ||
24 | u32 idle_stat; | ||
25 | |||
26 | if (!flcn_ops->is_falcon_idle) { | ||
27 | nvgpu_warn(g, "Invalid op on falcon 0x%x ", flcn->flcn_id); | ||
28 | return -EINVAL; | ||
29 | } | ||
30 | |||
31 | nvgpu_timeout_init(g, &timeout, 2000, NVGPU_TIMER_RETRY_TIMER); | ||
32 | |||
33 | /* wait for falcon idle */ | ||
34 | do { | ||
35 | idle_stat = flcn_ops->is_falcon_idle(flcn); | ||
36 | |||
37 | if (idle_stat) | ||
38 | break; | ||
39 | |||
40 | if (nvgpu_timeout_expired_msg(&timeout, | ||
41 | "waiting for falcon idle: 0x%08x", idle_stat)) | ||
42 | return -EBUSY; | ||
43 | |||
44 | nvgpu_usleep_range(100, 200); | ||
45 | } while (1); | ||
46 | |||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | int nvgpu_flcn_reset(struct nvgpu_falcon *flcn) | ||
51 | { | ||
52 | int status = -EINVAL; | ||
53 | |||
54 | if (flcn->flcn_ops.reset) | ||
55 | status = flcn->flcn_ops.reset(flcn); | ||
56 | else | ||
57 | nvgpu_warn(flcn->g, "Invalid op on falcon 0x%x ", | ||
58 | flcn->flcn_id); | ||
59 | |||
60 | return status; | ||
61 | } | ||
62 | |||
63 | void nvgpu_flcn_set_irq(struct nvgpu_falcon *flcn, bool enable, | ||
64 | u32 intr_mask, u32 intr_dest) | ||
65 | { | ||
66 | struct nvgpu_falcon_ops *flcn_ops = &flcn->flcn_ops; | ||
67 | |||
68 | if (flcn_ops->set_irq) { | ||
69 | flcn->intr_mask = intr_mask; | ||
70 | flcn->intr_dest = intr_dest; | ||
71 | flcn_ops->set_irq(flcn, enable); | ||
72 | } else | ||
73 | nvgpu_warn(flcn->g, "Invalid op on falcon 0x%x ", | ||
74 | flcn->flcn_id); | ||
75 | } | ||
76 | |||
77 | bool nvgpu_flcn_get_mem_scrubbing_status(struct nvgpu_falcon *flcn) | ||
78 | { | ||
79 | struct nvgpu_falcon_ops *flcn_ops = &flcn->flcn_ops; | ||
80 | bool status = false; | ||
81 | |||
82 | if (flcn_ops->is_falcon_scrubbing_done) | ||
83 | status = flcn_ops->is_falcon_scrubbing_done(flcn); | ||
84 | else | ||
85 | nvgpu_warn(flcn->g, "Invalid op on falcon 0x%x ", | ||
86 | flcn->flcn_id); | ||
87 | |||
88 | return status; | ||
89 | } | ||
90 | |||
91 | bool nvgpu_flcn_get_cpu_halted_status(struct nvgpu_falcon *flcn) | ||
92 | { | ||
93 | struct nvgpu_falcon_ops *flcn_ops = &flcn->flcn_ops; | ||
94 | bool status = false; | ||
95 | |||
96 | if (flcn_ops->is_falcon_cpu_halted) | ||
97 | status = flcn_ops->is_falcon_cpu_halted(flcn); | ||
98 | else | ||
99 | nvgpu_warn(flcn->g, "Invalid op on falcon 0x%x ", | ||
100 | flcn->flcn_id); | ||
101 | |||
102 | return status; | ||
103 | } | ||
104 | |||
105 | bool nvgpu_flcn_get_idle_status(struct nvgpu_falcon *flcn) | ||
106 | { | ||
107 | struct nvgpu_falcon_ops *flcn_ops = &flcn->flcn_ops; | ||
108 | bool status = false; | ||
109 | |||
110 | if (flcn_ops->is_falcon_idle) | ||
111 | status = flcn_ops->is_falcon_idle(flcn); | ||
112 | else | ||
113 | nvgpu_warn(flcn->g, "Invalid op on falcon 0x%x ", | ||
114 | flcn->flcn_id); | ||
115 | |||
116 | return status; | ||
117 | } | ||
118 | |||
19 | void nvgpu_flcn_sw_init(struct gk20a *g, u32 flcn_id) | 119 | void nvgpu_flcn_sw_init(struct gk20a *g, u32 flcn_id) |
20 | { | 120 | { |
21 | struct nvgpu_falcon *flcn = NULL; | 121 | struct nvgpu_falcon *flcn = NULL; |
@@ -25,6 +125,7 @@ void nvgpu_flcn_sw_init(struct gk20a *g, u32 flcn_id) | |||
25 | case FALCON_ID_PMU: | 125 | case FALCON_ID_PMU: |
26 | flcn = &g->pmu_flcn; | 126 | flcn = &g->pmu_flcn; |
27 | flcn->flcn_id = flcn_id; | 127 | flcn->flcn_id = flcn_id; |
128 | g->pmu.flcn = &g->pmu_flcn; | ||
28 | break; | 129 | break; |
29 | case FALCON_ID_SEC2: | 130 | case FALCON_ID_SEC2: |
30 | flcn = &g->sec2_flcn; | 131 | flcn = &g->sec2_flcn; |
@@ -37,7 +138,7 @@ void nvgpu_flcn_sw_init(struct gk20a *g, u32 flcn_id) | |||
37 | case FALCON_ID_GPCCS: | 138 | case FALCON_ID_GPCCS: |
38 | flcn = &g->gpccs_flcn; | 139 | flcn = &g->gpccs_flcn; |
39 | flcn->flcn_id = flcn_id; | 140 | flcn->flcn_id = flcn_id; |
40 | break; | 141 | break; |
41 | default: | 142 | default: |
42 | nvgpu_err(g, "Invalid/Unsupported falcon ID %x", flcn_id); | 143 | nvgpu_err(g, "Invalid/Unsupported falcon ID %x", flcn_id); |
43 | break; | 144 | break; |