diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 64 |
1 files changed, 20 insertions, 44 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index ef9e3a37..bddcf86e 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | |||
@@ -155,7 +155,7 @@ static void gk20a_channel_syncpt_update(void *priv, int nr_completed) | |||
155 | } | 155 | } |
156 | 156 | ||
157 | static int __gk20a_channel_syncpt_incr(struct gk20a_channel_sync *s, | 157 | static int __gk20a_channel_syncpt_incr(struct gk20a_channel_sync *s, |
158 | bool gfx_class, bool wfi_cmd, | 158 | bool wfi_cmd, |
159 | bool register_irq, | 159 | bool register_irq, |
160 | struct priv_cmd_entry **entry, | 160 | struct priv_cmd_entry **entry, |
161 | struct gk20a_fence **fence) | 161 | struct gk20a_fence **fence) |
@@ -182,39 +182,24 @@ static int __gk20a_channel_syncpt_incr(struct gk20a_channel_sync *s, | |||
182 | 182 | ||
183 | /* WAR for hw bug 1491360: syncpt needs to be incremented twice */ | 183 | /* WAR for hw bug 1491360: syncpt needs to be incremented twice */ |
184 | 184 | ||
185 | if (gfx_class) { | 185 | if (wfi_cmd) { |
186 | WARN_ON(wfi_cmd); /* No sense to use gfx class + wfi. */ | 186 | /* wfi */ |
187 | /* setobject KEPLER_C */ | 187 | incr_cmd->ptr[j++] = 0x2001001E; |
188 | incr_cmd->ptr[j++] = 0x20010000; | 188 | /* handle, ignored */ |
189 | incr_cmd->ptr[j++] = KEPLER_C; | 189 | incr_cmd->ptr[j++] = 0x00000000; |
190 | /* syncpt incr */ | ||
191 | incr_cmd->ptr[j++] = 0x200100B2; | ||
192 | incr_cmd->ptr[j++] = sp->id | | ||
193 | (0x1 << 20) | (0x1 << 16); | ||
194 | /* syncpt incr */ | ||
195 | incr_cmd->ptr[j++] = 0x200100B2; | ||
196 | incr_cmd->ptr[j++] = sp->id | | ||
197 | (0x1 << 20) | (0x1 << 16); | ||
198 | } else { | ||
199 | if (wfi_cmd) { | ||
200 | /* wfi */ | ||
201 | incr_cmd->ptr[j++] = 0x2001001E; | ||
202 | /* handle, ignored */ | ||
203 | incr_cmd->ptr[j++] = 0x00000000; | ||
204 | } | ||
205 | /* syncpoint_a */ | ||
206 | incr_cmd->ptr[j++] = 0x2001001C; | ||
207 | /* payload, ignored */ | ||
208 | incr_cmd->ptr[j++] = 0; | ||
209 | /* syncpoint_b */ | ||
210 | incr_cmd->ptr[j++] = 0x2001001D; | ||
211 | /* syncpt_id, incr */ | ||
212 | incr_cmd->ptr[j++] = (sp->id << 8) | 0x1; | ||
213 | /* syncpoint_b */ | ||
214 | incr_cmd->ptr[j++] = 0x2001001D; | ||
215 | /* syncpt_id, incr */ | ||
216 | incr_cmd->ptr[j++] = (sp->id << 8) | 0x1; | ||
217 | } | 190 | } |
191 | /* syncpoint_a */ | ||
192 | incr_cmd->ptr[j++] = 0x2001001C; | ||
193 | /* payload, ignored */ | ||
194 | incr_cmd->ptr[j++] = 0; | ||
195 | /* syncpoint_b */ | ||
196 | incr_cmd->ptr[j++] = 0x2001001D; | ||
197 | /* syncpt_id, incr */ | ||
198 | incr_cmd->ptr[j++] = (sp->id << 8) | 0x1; | ||
199 | /* syncpoint_b */ | ||
200 | incr_cmd->ptr[j++] = 0x2001001D; | ||
201 | /* syncpt_id, incr */ | ||
202 | incr_cmd->ptr[j++] = (sp->id << 8) | 0x1; | ||
218 | WARN_ON(j != incr_cmd_size); | 203 | WARN_ON(j != incr_cmd_size); |
219 | 204 | ||
220 | thresh = nvhost_syncpt_incr_max_ext(sp->host1x_pdev, sp->id, 2); | 205 | thresh = nvhost_syncpt_incr_max_ext(sp->host1x_pdev, sp->id, 2); |
@@ -241,7 +226,6 @@ int gk20a_channel_syncpt_incr_wfi(struct gk20a_channel_sync *s, | |||
241 | struct gk20a_fence **fence) | 226 | struct gk20a_fence **fence) |
242 | { | 227 | { |
243 | return __gk20a_channel_syncpt_incr(s, | 228 | return __gk20a_channel_syncpt_incr(s, |
244 | false /* use host class */, | ||
245 | true /* wfi */, | 229 | true /* wfi */, |
246 | false /* no irq handler */, | 230 | false /* no irq handler */, |
247 | entry, fence); | 231 | entry, fence); |
@@ -251,12 +235,9 @@ int gk20a_channel_syncpt_incr(struct gk20a_channel_sync *s, | |||
251 | struct priv_cmd_entry **entry, | 235 | struct priv_cmd_entry **entry, |
252 | struct gk20a_fence **fence) | 236 | struct gk20a_fence **fence) |
253 | { | 237 | { |
254 | struct gk20a_channel_syncpt *sp = | ||
255 | container_of(s, struct gk20a_channel_syncpt, ops); | ||
256 | /* Don't put wfi cmd to this one since we're not returning | 238 | /* Don't put wfi cmd to this one since we're not returning |
257 | * a fence to user space. */ | 239 | * a fence to user space. */ |
258 | return __gk20a_channel_syncpt_incr(s, | 240 | return __gk20a_channel_syncpt_incr(s, |
259 | sp->c->obj_class == KEPLER_C /* may use gfx class */, | ||
260 | false /* no wfi */, | 241 | false /* no wfi */, |
261 | true /* register irq */, | 242 | true /* register irq */, |
262 | entry, fence); | 243 | entry, fence); |
@@ -268,15 +249,10 @@ int gk20a_channel_syncpt_incr_user(struct gk20a_channel_sync *s, | |||
268 | struct gk20a_fence **fence, | 249 | struct gk20a_fence **fence, |
269 | bool wfi) | 250 | bool wfi) |
270 | { | 251 | { |
271 | struct gk20a_channel_syncpt *sp = | 252 | /* Need to do 'wfi + host incr' since we return the fence |
272 | container_of(s, struct gk20a_channel_syncpt, ops); | ||
273 | /* Need to do 'host incr + wfi' or 'gfx incr' since we return the fence | ||
274 | * to user space. */ | 253 | * to user space. */ |
275 | return __gk20a_channel_syncpt_incr(s, | 254 | return __gk20a_channel_syncpt_incr(s, |
276 | wfi && | 255 | wfi, |
277 | sp->c->obj_class == KEPLER_C /* use gfx class? */, | ||
278 | wfi && | ||
279 | sp->c->obj_class != KEPLER_C /* wfi if host class */, | ||
280 | true /* register irq */, | 256 | true /* register irq */, |
281 | entry, fence); | 257 | entry, fence); |
282 | } | 258 | } |