diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_graph.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_graph.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index cbf5ae2f67d4..8b669d0af610 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
@@ -402,3 +402,55 @@ struct nouveau_pgraph_object_class nv50_graph_grclass[] = { | |||
402 | { 0x8597, false, NULL }, /* tesla (nva3, nva5, nva8) */ | 402 | { 0x8597, false, NULL }, /* tesla (nva3, nva5, nva8) */ |
403 | {} | 403 | {} |
404 | }; | 404 | }; |
405 | |||
406 | void | ||
407 | nv50_graph_tlb_flush(struct drm_device *dev) | ||
408 | { | ||
409 | nv50_vm_flush(dev, 0); | ||
410 | } | ||
411 | |||
412 | void | ||
413 | nv86_graph_tlb_flush(struct drm_device *dev) | ||
414 | { | ||
415 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
416 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | ||
417 | bool idle, timeout = false; | ||
418 | unsigned long flags; | ||
419 | u64 start; | ||
420 | u32 tmp; | ||
421 | |||
422 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | ||
423 | nv_mask(dev, 0x400500, 0x00000001, 0x00000000); | ||
424 | |||
425 | start = ptimer->read(dev); | ||
426 | do { | ||
427 | idle = true; | ||
428 | |||
429 | for (tmp = nv_rd32(dev, 0x400380); tmp && idle; tmp >>= 3) { | ||
430 | if ((tmp & 7) == 1) | ||
431 | idle = false; | ||
432 | } | ||
433 | |||
434 | for (tmp = nv_rd32(dev, 0x400384); tmp && idle; tmp >>= 3) { | ||
435 | if ((tmp & 7) == 1) | ||
436 | idle = false; | ||
437 | } | ||
438 | |||
439 | for (tmp = nv_rd32(dev, 0x400388); tmp && idle; tmp >>= 3) { | ||
440 | if ((tmp & 7) == 1) | ||
441 | idle = false; | ||
442 | } | ||
443 | } while (!idle && !(timeout = ptimer->read(dev) - start > 2000000000)); | ||
444 | |||
445 | if (timeout) { | ||
446 | NV_ERROR(dev, "PGRAPH TLB flush idle timeout fail: " | ||
447 | "0x%08x 0x%08x 0x%08x 0x%08x\n", | ||
448 | nv_rd32(dev, 0x400700), nv_rd32(dev, 0x400380), | ||
449 | nv_rd32(dev, 0x400384), nv_rd32(dev, 0x400388)); | ||
450 | } | ||
451 | |||
452 | nv50_vm_flush(dev, 0); | ||
453 | |||
454 | nv_mask(dev, 0x400500, 0x00000001, 0x00000001); | ||
455 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | ||
456 | } | ||