diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/si.c')
-rw-r--r-- | drivers/gpu/drm/radeon/si.c | 176 |
1 files changed, 87 insertions, 89 deletions
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 0b0279291a73..c053f8193771 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -1762,13 +1762,34 @@ void si_fence_ring_emit(struct radeon_device *rdev, | |||
1762 | */ | 1762 | */ |
1763 | void si_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) | 1763 | void si_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) |
1764 | { | 1764 | { |
1765 | struct radeon_ring *ring = &rdev->ring[ib->fence->ring]; | 1765 | struct radeon_ring *ring = &rdev->ring[ib->ring]; |
1766 | u32 header; | 1766 | u32 header; |
1767 | 1767 | ||
1768 | if (ib->is_const_ib) | 1768 | if (ib->is_const_ib) { |
1769 | /* set switch buffer packet before const IB */ | ||
1770 | radeon_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | ||
1771 | radeon_ring_write(ring, 0); | ||
1772 | |||
1769 | header = PACKET3(PACKET3_INDIRECT_BUFFER_CONST, 2); | 1773 | header = PACKET3(PACKET3_INDIRECT_BUFFER_CONST, 2); |
1770 | else | 1774 | } else { |
1775 | u32 next_rptr; | ||
1776 | if (ring->rptr_save_reg) { | ||
1777 | next_rptr = ring->wptr + 3 + 4 + 8; | ||
1778 | radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); | ||
1779 | radeon_ring_write(ring, ((ring->rptr_save_reg - | ||
1780 | PACKET3_SET_CONFIG_REG_START) >> 2)); | ||
1781 | radeon_ring_write(ring, next_rptr); | ||
1782 | } else if (rdev->wb.enabled) { | ||
1783 | next_rptr = ring->wptr + 5 + 4 + 8; | ||
1784 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | ||
1785 | radeon_ring_write(ring, (1 << 8)); | ||
1786 | radeon_ring_write(ring, ring->next_rptr_gpu_addr & 0xfffffffc); | ||
1787 | radeon_ring_write(ring, upper_32_bits(ring->next_rptr_gpu_addr) & 0xffffffff); | ||
1788 | radeon_ring_write(ring, next_rptr); | ||
1789 | } | ||
1790 | |||
1771 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); | 1791 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); |
1792 | } | ||
1772 | 1793 | ||
1773 | radeon_ring_write(ring, header); | 1794 | radeon_ring_write(ring, header); |
1774 | radeon_ring_write(ring, | 1795 | radeon_ring_write(ring, |
@@ -1779,18 +1800,20 @@ void si_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) | |||
1779 | radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF); | 1800 | radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF); |
1780 | radeon_ring_write(ring, ib->length_dw | (ib->vm_id << 24)); | 1801 | radeon_ring_write(ring, ib->length_dw | (ib->vm_id << 24)); |
1781 | 1802 | ||
1782 | /* flush read cache over gart for this vmid */ | 1803 | if (!ib->is_const_ib) { |
1783 | radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); | 1804 | /* flush read cache over gart for this vmid */ |
1784 | radeon_ring_write(ring, (CP_COHER_CNTL2 - PACKET3_SET_CONFIG_REG_START) >> 2); | 1805 | radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); |
1785 | radeon_ring_write(ring, ib->vm_id); | 1806 | radeon_ring_write(ring, (CP_COHER_CNTL2 - PACKET3_SET_CONFIG_REG_START) >> 2); |
1786 | radeon_ring_write(ring, PACKET3(PACKET3_SURFACE_SYNC, 3)); | 1807 | radeon_ring_write(ring, ib->vm_id); |
1787 | radeon_ring_write(ring, PACKET3_TCL1_ACTION_ENA | | 1808 | radeon_ring_write(ring, PACKET3(PACKET3_SURFACE_SYNC, 3)); |
1788 | PACKET3_TC_ACTION_ENA | | 1809 | radeon_ring_write(ring, PACKET3_TCL1_ACTION_ENA | |
1789 | PACKET3_SH_KCACHE_ACTION_ENA | | 1810 | PACKET3_TC_ACTION_ENA | |
1790 | PACKET3_SH_ICACHE_ACTION_ENA); | 1811 | PACKET3_SH_KCACHE_ACTION_ENA | |
1791 | radeon_ring_write(ring, 0xFFFFFFFF); | 1812 | PACKET3_SH_ICACHE_ACTION_ENA); |
1792 | radeon_ring_write(ring, 0); | 1813 | radeon_ring_write(ring, 0xFFFFFFFF); |
1793 | radeon_ring_write(ring, 10); /* poll interval */ | 1814 | radeon_ring_write(ring, 0); |
1815 | radeon_ring_write(ring, 10); /* poll interval */ | ||
1816 | } | ||
1794 | } | 1817 | } |
1795 | 1818 | ||
1796 | /* | 1819 | /* |
@@ -1917,10 +1940,20 @@ static int si_cp_start(struct radeon_device *rdev) | |||
1917 | 1940 | ||
1918 | static void si_cp_fini(struct radeon_device *rdev) | 1941 | static void si_cp_fini(struct radeon_device *rdev) |
1919 | { | 1942 | { |
1943 | struct radeon_ring *ring; | ||
1920 | si_cp_enable(rdev, false); | 1944 | si_cp_enable(rdev, false); |
1921 | radeon_ring_fini(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]); | 1945 | |
1922 | radeon_ring_fini(rdev, &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]); | 1946 | ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; |
1923 | radeon_ring_fini(rdev, &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]); | 1947 | radeon_ring_fini(rdev, ring); |
1948 | radeon_scratch_free(rdev, ring->rptr_save_reg); | ||
1949 | |||
1950 | ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]; | ||
1951 | radeon_ring_fini(rdev, ring); | ||
1952 | radeon_scratch_free(rdev, ring->rptr_save_reg); | ||
1953 | |||
1954 | ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]; | ||
1955 | radeon_ring_fini(rdev, ring); | ||
1956 | radeon_scratch_free(rdev, ring->rptr_save_reg); | ||
1924 | } | 1957 | } |
1925 | 1958 | ||
1926 | static int si_cp_resume(struct radeon_device *rdev) | 1959 | static int si_cp_resume(struct radeon_device *rdev) |
@@ -2702,7 +2735,7 @@ int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib) | |||
2702 | if (ib->is_const_ib) | 2735 | if (ib->is_const_ib) |
2703 | ret = si_vm_packet3_ce_check(rdev, ib->ptr, &pkt); | 2736 | ret = si_vm_packet3_ce_check(rdev, ib->ptr, &pkt); |
2704 | else { | 2737 | else { |
2705 | switch (ib->fence->ring) { | 2738 | switch (ib->ring) { |
2706 | case RADEON_RING_TYPE_GFX_INDEX: | 2739 | case RADEON_RING_TYPE_GFX_INDEX: |
2707 | ret = si_vm_packet3_gfx_check(rdev, ib->ptr, &pkt); | 2740 | ret = si_vm_packet3_gfx_check(rdev, ib->ptr, &pkt); |
2708 | break; | 2741 | break; |
@@ -2711,7 +2744,7 @@ int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib) | |||
2711 | ret = si_vm_packet3_compute_check(rdev, ib->ptr, &pkt); | 2744 | ret = si_vm_packet3_compute_check(rdev, ib->ptr, &pkt); |
2712 | break; | 2745 | break; |
2713 | default: | 2746 | default: |
2714 | dev_err(rdev->dev, "Non-PM4 ring %d !\n", ib->fence->ring); | 2747 | dev_err(rdev->dev, "Non-PM4 ring %d !\n", ib->ring); |
2715 | ret = -EINVAL; | 2748 | ret = -EINVAL; |
2716 | break; | 2749 | break; |
2717 | } | 2750 | } |
@@ -2942,7 +2975,6 @@ static void si_disable_interrupts(struct radeon_device *rdev) | |||
2942 | WREG32(IH_RB_RPTR, 0); | 2975 | WREG32(IH_RB_RPTR, 0); |
2943 | WREG32(IH_RB_WPTR, 0); | 2976 | WREG32(IH_RB_WPTR, 0); |
2944 | rdev->ih.enabled = false; | 2977 | rdev->ih.enabled = false; |
2945 | rdev->ih.wptr = 0; | ||
2946 | rdev->ih.rptr = 0; | 2978 | rdev->ih.rptr = 0; |
2947 | } | 2979 | } |
2948 | 2980 | ||
@@ -3093,45 +3125,45 @@ int si_irq_set(struct radeon_device *rdev) | |||
3093 | hpd6 = RREG32(DC_HPD6_INT_CONTROL) & ~DC_HPDx_INT_EN; | 3125 | hpd6 = RREG32(DC_HPD6_INT_CONTROL) & ~DC_HPDx_INT_EN; |
3094 | 3126 | ||
3095 | /* enable CP interrupts on all rings */ | 3127 | /* enable CP interrupts on all rings */ |
3096 | if (rdev->irq.sw_int[RADEON_RING_TYPE_GFX_INDEX]) { | 3128 | if (atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) { |
3097 | DRM_DEBUG("si_irq_set: sw int gfx\n"); | 3129 | DRM_DEBUG("si_irq_set: sw int gfx\n"); |
3098 | cp_int_cntl |= TIME_STAMP_INT_ENABLE; | 3130 | cp_int_cntl |= TIME_STAMP_INT_ENABLE; |
3099 | } | 3131 | } |
3100 | if (rdev->irq.sw_int[CAYMAN_RING_TYPE_CP1_INDEX]) { | 3132 | if (atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP1_INDEX])) { |
3101 | DRM_DEBUG("si_irq_set: sw int cp1\n"); | 3133 | DRM_DEBUG("si_irq_set: sw int cp1\n"); |
3102 | cp_int_cntl1 |= TIME_STAMP_INT_ENABLE; | 3134 | cp_int_cntl1 |= TIME_STAMP_INT_ENABLE; |
3103 | } | 3135 | } |
3104 | if (rdev->irq.sw_int[CAYMAN_RING_TYPE_CP2_INDEX]) { | 3136 | if (atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP2_INDEX])) { |
3105 | DRM_DEBUG("si_irq_set: sw int cp2\n"); | 3137 | DRM_DEBUG("si_irq_set: sw int cp2\n"); |
3106 | cp_int_cntl2 |= TIME_STAMP_INT_ENABLE; | 3138 | cp_int_cntl2 |= TIME_STAMP_INT_ENABLE; |
3107 | } | 3139 | } |
3108 | if (rdev->irq.crtc_vblank_int[0] || | 3140 | if (rdev->irq.crtc_vblank_int[0] || |
3109 | rdev->irq.pflip[0]) { | 3141 | atomic_read(&rdev->irq.pflip[0])) { |
3110 | DRM_DEBUG("si_irq_set: vblank 0\n"); | 3142 | DRM_DEBUG("si_irq_set: vblank 0\n"); |
3111 | crtc1 |= VBLANK_INT_MASK; | 3143 | crtc1 |= VBLANK_INT_MASK; |
3112 | } | 3144 | } |
3113 | if (rdev->irq.crtc_vblank_int[1] || | 3145 | if (rdev->irq.crtc_vblank_int[1] || |
3114 | rdev->irq.pflip[1]) { | 3146 | atomic_read(&rdev->irq.pflip[1])) { |
3115 | DRM_DEBUG("si_irq_set: vblank 1\n"); | 3147 | DRM_DEBUG("si_irq_set: vblank 1\n"); |
3116 | crtc2 |= VBLANK_INT_MASK; | 3148 | crtc2 |= VBLANK_INT_MASK; |
3117 | } | 3149 | } |
3118 | if (rdev->irq.crtc_vblank_int[2] || | 3150 | if (rdev->irq.crtc_vblank_int[2] || |
3119 | rdev->irq.pflip[2]) { | 3151 | atomic_read(&rdev->irq.pflip[2])) { |
3120 | DRM_DEBUG("si_irq_set: vblank 2\n"); | 3152 | DRM_DEBUG("si_irq_set: vblank 2\n"); |
3121 | crtc3 |= VBLANK_INT_MASK; | 3153 | crtc3 |= VBLANK_INT_MASK; |
3122 | } | 3154 | } |
3123 | if (rdev->irq.crtc_vblank_int[3] || | 3155 | if (rdev->irq.crtc_vblank_int[3] || |
3124 | rdev->irq.pflip[3]) { | 3156 | atomic_read(&rdev->irq.pflip[3])) { |
3125 | DRM_DEBUG("si_irq_set: vblank 3\n"); | 3157 | DRM_DEBUG("si_irq_set: vblank 3\n"); |
3126 | crtc4 |= VBLANK_INT_MASK; | 3158 | crtc4 |= VBLANK_INT_MASK; |
3127 | } | 3159 | } |
3128 | if (rdev->irq.crtc_vblank_int[4] || | 3160 | if (rdev->irq.crtc_vblank_int[4] || |
3129 | rdev->irq.pflip[4]) { | 3161 | atomic_read(&rdev->irq.pflip[4])) { |
3130 | DRM_DEBUG("si_irq_set: vblank 4\n"); | 3162 | DRM_DEBUG("si_irq_set: vblank 4\n"); |
3131 | crtc5 |= VBLANK_INT_MASK; | 3163 | crtc5 |= VBLANK_INT_MASK; |
3132 | } | 3164 | } |
3133 | if (rdev->irq.crtc_vblank_int[5] || | 3165 | if (rdev->irq.crtc_vblank_int[5] || |
3134 | rdev->irq.pflip[5]) { | 3166 | atomic_read(&rdev->irq.pflip[5])) { |
3135 | DRM_DEBUG("si_irq_set: vblank 5\n"); | 3167 | DRM_DEBUG("si_irq_set: vblank 5\n"); |
3136 | crtc6 |= VBLANK_INT_MASK; | 3168 | crtc6 |= VBLANK_INT_MASK; |
3137 | } | 3169 | } |
@@ -3359,29 +3391,27 @@ int si_irq_process(struct radeon_device *rdev) | |||
3359 | u32 rptr; | 3391 | u32 rptr; |
3360 | u32 src_id, src_data, ring_id; | 3392 | u32 src_id, src_data, ring_id; |
3361 | u32 ring_index; | 3393 | u32 ring_index; |
3362 | unsigned long flags; | ||
3363 | bool queue_hotplug = false; | 3394 | bool queue_hotplug = false; |
3364 | 3395 | ||
3365 | if (!rdev->ih.enabled || rdev->shutdown) | 3396 | if (!rdev->ih.enabled || rdev->shutdown) |
3366 | return IRQ_NONE; | 3397 | return IRQ_NONE; |
3367 | 3398 | ||
3368 | wptr = si_get_ih_wptr(rdev); | 3399 | wptr = si_get_ih_wptr(rdev); |
3400 | |||
3401 | restart_ih: | ||
3402 | /* is somebody else already processing irqs? */ | ||
3403 | if (atomic_xchg(&rdev->ih.lock, 1)) | ||
3404 | return IRQ_NONE; | ||
3405 | |||
3369 | rptr = rdev->ih.rptr; | 3406 | rptr = rdev->ih.rptr; |
3370 | DRM_DEBUG("si_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | 3407 | DRM_DEBUG("si_irq_process start: rptr %d, wptr %d\n", rptr, wptr); |
3371 | 3408 | ||
3372 | spin_lock_irqsave(&rdev->ih.lock, flags); | ||
3373 | if (rptr == wptr) { | ||
3374 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | ||
3375 | return IRQ_NONE; | ||
3376 | } | ||
3377 | restart_ih: | ||
3378 | /* Order reading of wptr vs. reading of IH ring data */ | 3409 | /* Order reading of wptr vs. reading of IH ring data */ |
3379 | rmb(); | 3410 | rmb(); |
3380 | 3411 | ||
3381 | /* display interrupts */ | 3412 | /* display interrupts */ |
3382 | si_irq_ack(rdev); | 3413 | si_irq_ack(rdev); |
3383 | 3414 | ||
3384 | rdev->ih.wptr = wptr; | ||
3385 | while (rptr != wptr) { | 3415 | while (rptr != wptr) { |
3386 | /* wptr/rptr are in bytes! */ | 3416 | /* wptr/rptr are in bytes! */ |
3387 | ring_index = rptr / 4; | 3417 | ring_index = rptr / 4; |
@@ -3399,7 +3429,7 @@ restart_ih: | |||
3399 | rdev->pm.vblank_sync = true; | 3429 | rdev->pm.vblank_sync = true; |
3400 | wake_up(&rdev->irq.vblank_queue); | 3430 | wake_up(&rdev->irq.vblank_queue); |
3401 | } | 3431 | } |
3402 | if (rdev->irq.pflip[0]) | 3432 | if (atomic_read(&rdev->irq.pflip[0])) |
3403 | radeon_crtc_handle_flip(rdev, 0); | 3433 | radeon_crtc_handle_flip(rdev, 0); |
3404 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; | 3434 | rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT; |
3405 | DRM_DEBUG("IH: D1 vblank\n"); | 3435 | DRM_DEBUG("IH: D1 vblank\n"); |
@@ -3425,7 +3455,7 @@ restart_ih: | |||
3425 | rdev->pm.vblank_sync = true; | 3455 | rdev->pm.vblank_sync = true; |
3426 | wake_up(&rdev->irq.vblank_queue); | 3456 | wake_up(&rdev->irq.vblank_queue); |
3427 | } | 3457 | } |
3428 | if (rdev->irq.pflip[1]) | 3458 | if (atomic_read(&rdev->irq.pflip[1])) |
3429 | radeon_crtc_handle_flip(rdev, 1); | 3459 | radeon_crtc_handle_flip(rdev, 1); |
3430 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; | 3460 | rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT; |
3431 | DRM_DEBUG("IH: D2 vblank\n"); | 3461 | DRM_DEBUG("IH: D2 vblank\n"); |
@@ -3451,7 +3481,7 @@ restart_ih: | |||
3451 | rdev->pm.vblank_sync = true; | 3481 | rdev->pm.vblank_sync = true; |
3452 | wake_up(&rdev->irq.vblank_queue); | 3482 | wake_up(&rdev->irq.vblank_queue); |
3453 | } | 3483 | } |
3454 | if (rdev->irq.pflip[2]) | 3484 | if (atomic_read(&rdev->irq.pflip[2])) |
3455 | radeon_crtc_handle_flip(rdev, 2); | 3485 | radeon_crtc_handle_flip(rdev, 2); |
3456 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; | 3486 | rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT; |
3457 | DRM_DEBUG("IH: D3 vblank\n"); | 3487 | DRM_DEBUG("IH: D3 vblank\n"); |
@@ -3477,7 +3507,7 @@ restart_ih: | |||
3477 | rdev->pm.vblank_sync = true; | 3507 | rdev->pm.vblank_sync = true; |
3478 | wake_up(&rdev->irq.vblank_queue); | 3508 | wake_up(&rdev->irq.vblank_queue); |
3479 | } | 3509 | } |
3480 | if (rdev->irq.pflip[3]) | 3510 | if (atomic_read(&rdev->irq.pflip[3])) |
3481 | radeon_crtc_handle_flip(rdev, 3); | 3511 | radeon_crtc_handle_flip(rdev, 3); |
3482 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; | 3512 | rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT; |
3483 | DRM_DEBUG("IH: D4 vblank\n"); | 3513 | DRM_DEBUG("IH: D4 vblank\n"); |
@@ -3503,7 +3533,7 @@ restart_ih: | |||
3503 | rdev->pm.vblank_sync = true; | 3533 | rdev->pm.vblank_sync = true; |
3504 | wake_up(&rdev->irq.vblank_queue); | 3534 | wake_up(&rdev->irq.vblank_queue); |
3505 | } | 3535 | } |
3506 | if (rdev->irq.pflip[4]) | 3536 | if (atomic_read(&rdev->irq.pflip[4])) |
3507 | radeon_crtc_handle_flip(rdev, 4); | 3537 | radeon_crtc_handle_flip(rdev, 4); |
3508 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; | 3538 | rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT; |
3509 | DRM_DEBUG("IH: D5 vblank\n"); | 3539 | DRM_DEBUG("IH: D5 vblank\n"); |
@@ -3529,7 +3559,7 @@ restart_ih: | |||
3529 | rdev->pm.vblank_sync = true; | 3559 | rdev->pm.vblank_sync = true; |
3530 | wake_up(&rdev->irq.vblank_queue); | 3560 | wake_up(&rdev->irq.vblank_queue); |
3531 | } | 3561 | } |
3532 | if (rdev->irq.pflip[5]) | 3562 | if (atomic_read(&rdev->irq.pflip[5])) |
3533 | radeon_crtc_handle_flip(rdev, 5); | 3563 | radeon_crtc_handle_flip(rdev, 5); |
3534 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; | 3564 | rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT; |
3535 | DRM_DEBUG("IH: D6 vblank\n"); | 3565 | DRM_DEBUG("IH: D6 vblank\n"); |
@@ -3620,7 +3650,6 @@ restart_ih: | |||
3620 | break; | 3650 | break; |
3621 | case 233: /* GUI IDLE */ | 3651 | case 233: /* GUI IDLE */ |
3622 | DRM_DEBUG("IH: GUI idle\n"); | 3652 | DRM_DEBUG("IH: GUI idle\n"); |
3623 | rdev->pm.gui_idle = true; | ||
3624 | wake_up(&rdev->irq.idle_queue); | 3653 | wake_up(&rdev->irq.idle_queue); |
3625 | break; | 3654 | break; |
3626 | default: | 3655 | default: |
@@ -3632,15 +3661,17 @@ restart_ih: | |||
3632 | rptr += 16; | 3661 | rptr += 16; |
3633 | rptr &= rdev->ih.ptr_mask; | 3662 | rptr &= rdev->ih.ptr_mask; |
3634 | } | 3663 | } |
3635 | /* make sure wptr hasn't changed while processing */ | ||
3636 | wptr = si_get_ih_wptr(rdev); | ||
3637 | if (wptr != rdev->ih.wptr) | ||
3638 | goto restart_ih; | ||
3639 | if (queue_hotplug) | 3664 | if (queue_hotplug) |
3640 | schedule_work(&rdev->hotplug_work); | 3665 | schedule_work(&rdev->hotplug_work); |
3641 | rdev->ih.rptr = rptr; | 3666 | rdev->ih.rptr = rptr; |
3642 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | 3667 | WREG32(IH_RB_RPTR, rdev->ih.rptr); |
3643 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | 3668 | atomic_set(&rdev->ih.lock, 0); |
3669 | |||
3670 | /* make sure wptr hasn't changed while processing */ | ||
3671 | wptr = si_get_ih_wptr(rdev); | ||
3672 | if (wptr != rptr) | ||
3673 | goto restart_ih; | ||
3674 | |||
3644 | return IRQ_HANDLED; | 3675 | return IRQ_HANDLED; |
3645 | } | 3676 | } |
3646 | 3677 | ||
@@ -3752,35 +3783,18 @@ static int si_startup(struct radeon_device *rdev) | |||
3752 | if (r) | 3783 | if (r) |
3753 | return r; | 3784 | return r; |
3754 | 3785 | ||
3755 | r = radeon_ib_pool_start(rdev); | 3786 | r = radeon_ib_pool_init(rdev); |
3756 | if (r) | ||
3757 | return r; | ||
3758 | |||
3759 | r = radeon_ib_test(rdev, RADEON_RING_TYPE_GFX_INDEX, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]); | ||
3760 | if (r) { | ||
3761 | DRM_ERROR("radeon: failed testing IB (%d) on CP ring 0\n", r); | ||
3762 | rdev->accel_working = false; | ||
3763 | return r; | ||
3764 | } | ||
3765 | |||
3766 | r = radeon_ib_test(rdev, CAYMAN_RING_TYPE_CP1_INDEX, &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]); | ||
3767 | if (r) { | 3787 | if (r) { |
3768 | DRM_ERROR("radeon: failed testing IB (%d) on CP ring 1\n", r); | 3788 | dev_err(rdev->dev, "IB initialization failed (%d).\n", r); |
3769 | rdev->accel_working = false; | ||
3770 | return r; | 3789 | return r; |
3771 | } | 3790 | } |
3772 | 3791 | ||
3773 | r = radeon_ib_test(rdev, CAYMAN_RING_TYPE_CP2_INDEX, &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]); | 3792 | r = radeon_vm_manager_init(rdev); |
3774 | if (r) { | 3793 | if (r) { |
3775 | DRM_ERROR("radeon: failed testing IB (%d) on CP ring 2\n", r); | 3794 | dev_err(rdev->dev, "vm manager initialization failed (%d).\n", r); |
3776 | rdev->accel_working = false; | ||
3777 | return r; | 3795 | return r; |
3778 | } | 3796 | } |
3779 | 3797 | ||
3780 | r = radeon_vm_manager_start(rdev); | ||
3781 | if (r) | ||
3782 | return r; | ||
3783 | |||
3784 | return 0; | 3798 | return 0; |
3785 | } | 3799 | } |
3786 | 3800 | ||
@@ -3809,12 +3823,6 @@ int si_resume(struct radeon_device *rdev) | |||
3809 | 3823 | ||
3810 | int si_suspend(struct radeon_device *rdev) | 3824 | int si_suspend(struct radeon_device *rdev) |
3811 | { | 3825 | { |
3812 | /* FIXME: we should wait for ring to be empty */ | ||
3813 | radeon_ib_pool_suspend(rdev); | ||
3814 | radeon_vm_manager_suspend(rdev); | ||
3815 | #if 0 | ||
3816 | r600_blit_suspend(rdev); | ||
3817 | #endif | ||
3818 | si_cp_enable(rdev, false); | 3826 | si_cp_enable(rdev, false); |
3819 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false; | 3827 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false; |
3820 | rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX].ready = false; | 3828 | rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX].ready = false; |
@@ -3903,17 +3911,7 @@ int si_init(struct radeon_device *rdev) | |||
3903 | if (r) | 3911 | if (r) |
3904 | return r; | 3912 | return r; |
3905 | 3913 | ||
3906 | r = radeon_ib_pool_init(rdev); | ||
3907 | rdev->accel_working = true; | 3914 | rdev->accel_working = true; |
3908 | if (r) { | ||
3909 | dev_err(rdev->dev, "IB initialization failed (%d).\n", r); | ||
3910 | rdev->accel_working = false; | ||
3911 | } | ||
3912 | r = radeon_vm_manager_init(rdev); | ||
3913 | if (r) { | ||
3914 | dev_err(rdev->dev, "vm manager initialization failed (%d).\n", r); | ||
3915 | } | ||
3916 | |||
3917 | r = si_startup(rdev); | 3915 | r = si_startup(rdev); |
3918 | if (r) { | 3916 | if (r) { |
3919 | dev_err(rdev->dev, "disabling GPU acceleration\n"); | 3917 | dev_err(rdev->dev, "disabling GPU acceleration\n"); |
@@ -3921,7 +3919,7 @@ int si_init(struct radeon_device *rdev) | |||
3921 | si_irq_fini(rdev); | 3919 | si_irq_fini(rdev); |
3922 | si_rlc_fini(rdev); | 3920 | si_rlc_fini(rdev); |
3923 | radeon_wb_fini(rdev); | 3921 | radeon_wb_fini(rdev); |
3924 | r100_ib_fini(rdev); | 3922 | radeon_ib_pool_fini(rdev); |
3925 | radeon_vm_manager_fini(rdev); | 3923 | radeon_vm_manager_fini(rdev); |
3926 | radeon_irq_kms_fini(rdev); | 3924 | radeon_irq_kms_fini(rdev); |
3927 | si_pcie_gart_fini(rdev); | 3925 | si_pcie_gart_fini(rdev); |
@@ -3950,7 +3948,7 @@ void si_fini(struct radeon_device *rdev) | |||
3950 | si_rlc_fini(rdev); | 3948 | si_rlc_fini(rdev); |
3951 | radeon_wb_fini(rdev); | 3949 | radeon_wb_fini(rdev); |
3952 | radeon_vm_manager_fini(rdev); | 3950 | radeon_vm_manager_fini(rdev); |
3953 | r100_ib_fini(rdev); | 3951 | radeon_ib_pool_fini(rdev); |
3954 | radeon_irq_kms_fini(rdev); | 3952 | radeon_irq_kms_fini(rdev); |
3955 | si_pcie_gart_fini(rdev); | 3953 | si_pcie_gart_fini(rdev); |
3956 | r600_vram_scratch_fini(rdev); | 3954 | r600_vram_scratch_fini(rdev); |