aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-01-24 11:37:19 -0500
committerAlex Deucher <alexander.deucher@amd.com>2013-01-31 16:24:57 -0500
commit123bc1832c33218dfa677a88c2c54bc1a48a9e72 (patch)
tree5ad2423f6e4752d7db0120b8ecb4af6a83a00df2
parentf770d78ac159a96071e3c4e4ab97c262e79506d3 (diff)
drm/radeon: use the reset mask to determine if rings are hung
fetch the reset mask and check if the relevant ring flags are set to determine whether the ring is hung or not. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c65
-rw-r--r--drivers/gpu/drm/radeon/ni.c36
-rw-r--r--drivers/gpu/drm/radeon/r600.c31
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c40
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h9
-rw-r--r--drivers/gpu/drm/radeon/si.c72
6 files changed, 173 insertions, 80 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index f77e33262274..045955d5f337 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2308,25 +2308,6 @@ int evergreen_mc_init(struct radeon_device *rdev)
2308 return 0; 2308 return 0;
2309} 2309}
2310 2310
2311bool evergreen_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
2312{
2313 u32 srbm_status;
2314 u32 grbm_status;
2315 u32 grbm_status_se0, grbm_status_se1;
2316
2317 srbm_status = RREG32(SRBM_STATUS);
2318 grbm_status = RREG32(GRBM_STATUS);
2319 grbm_status_se0 = RREG32(GRBM_STATUS_SE0);
2320 grbm_status_se1 = RREG32(GRBM_STATUS_SE1);
2321 if (!(grbm_status & GUI_ACTIVE)) {
2322 radeon_ring_lockup_update(ring);
2323 return false;
2324 }
2325 /* force CP activities */
2326 radeon_ring_force_activity(rdev, ring);
2327 return radeon_ring_test_lockup(rdev, ring);
2328}
2329
2330void evergreen_print_gpu_status_regs(struct radeon_device *rdev) 2311void evergreen_print_gpu_status_regs(struct radeon_device *rdev)
2331{ 2312{
2332 dev_info(rdev->dev, " GRBM_STATUS = 0x%08X\n", 2313 dev_info(rdev->dev, " GRBM_STATUS = 0x%08X\n",
@@ -2578,6 +2559,52 @@ int evergreen_asic_reset(struct radeon_device *rdev)
2578 return 0; 2559 return 0;
2579} 2560}
2580 2561
2562/**
2563 * evergreen_gfx_is_lockup - Check if the GFX engine is locked up
2564 *
2565 * @rdev: radeon_device pointer
2566 * @ring: radeon_ring structure holding ring information
2567 *
2568 * Check if the GFX engine is locked up.
2569 * Returns true if the engine appears to be locked up, false if not.
2570 */
2571bool evergreen_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
2572{
2573 u32 reset_mask = evergreen_gpu_check_soft_reset(rdev);
2574
2575 if (!(reset_mask & (RADEON_RESET_GFX |
2576 RADEON_RESET_COMPUTE |
2577 RADEON_RESET_CP))) {
2578 radeon_ring_lockup_update(ring);
2579 return false;
2580 }
2581 /* force CP activities */
2582 radeon_ring_force_activity(rdev, ring);
2583 return radeon_ring_test_lockup(rdev, ring);
2584}
2585
2586/**
2587 * evergreen_dma_is_lockup - Check if the DMA engine is locked up
2588 *
2589 * @rdev: radeon_device pointer
2590 * @ring: radeon_ring structure holding ring information
2591 *
2592 * Check if the async DMA engine is locked up.
2593 * Returns true if the engine appears to be locked up, false if not.
2594 */
2595bool evergreen_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
2596{
2597 u32 reset_mask = evergreen_gpu_check_soft_reset(rdev);
2598
2599 if (!(reset_mask & RADEON_RESET_DMA)) {
2600 radeon_ring_lockup_update(ring);
2601 return false;
2602 }
2603 /* force ring activities */
2604 radeon_ring_force_activity(rdev, ring);
2605 return radeon_ring_test_lockup(rdev, ring);
2606}
2607
2581/* Interrupts */ 2608/* Interrupts */
2582 2609
2583u32 evergreen_get_vblank_counter(struct radeon_device *rdev, int crtc) 2610u32 evergreen_get_vblank_counter(struct radeon_device *rdev, int crtc)
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 4784c4e5056f..b6e80550ed90 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1534,23 +1534,49 @@ int cayman_asic_reset(struct radeon_device *rdev)
1534} 1534}
1535 1535
1536/** 1536/**
1537 * cayman_gfx_is_lockup - Check if the GFX engine is locked up
1538 *
1539 * @rdev: radeon_device pointer
1540 * @ring: radeon_ring structure holding ring information
1541 *
1542 * Check if the GFX engine is locked up.
1543 * Returns true if the engine appears to be locked up, false if not.
1544 */
1545bool cayman_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
1546{
1547 u32 reset_mask = cayman_gpu_check_soft_reset(rdev);
1548
1549 if (!(reset_mask & (RADEON_RESET_GFX |
1550 RADEON_RESET_COMPUTE |
1551 RADEON_RESET_CP))) {
1552 radeon_ring_lockup_update(ring);
1553 return false;
1554 }
1555 /* force CP activities */
1556 radeon_ring_force_activity(rdev, ring);
1557 return radeon_ring_test_lockup(rdev, ring);
1558}
1559
1560/**
1537 * cayman_dma_is_lockup - Check if the DMA engine is locked up 1561 * cayman_dma_is_lockup - Check if the DMA engine is locked up
1538 * 1562 *
1539 * @rdev: radeon_device pointer 1563 * @rdev: radeon_device pointer
1540 * @ring: radeon_ring structure holding ring information 1564 * @ring: radeon_ring structure holding ring information
1541 * 1565 *
1542 * Check if the async DMA engine is locked up (cayman-SI). 1566 * Check if the async DMA engine is locked up.
1543 * Returns true if the engine appears to be locked up, false if not. 1567 * Returns true if the engine appears to be locked up, false if not.
1544 */ 1568 */
1545bool cayman_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) 1569bool cayman_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
1546{ 1570{
1547 u32 dma_status_reg; 1571 u32 reset_mask = cayman_gpu_check_soft_reset(rdev);
1572 u32 mask;
1548 1573
1549 if (ring->idx == R600_RING_TYPE_DMA_INDEX) 1574 if (ring->idx == R600_RING_TYPE_DMA_INDEX)
1550 dma_status_reg = RREG32(DMA_STATUS_REG + DMA0_REGISTER_OFFSET); 1575 mask = RADEON_RESET_DMA;
1551 else 1576 else
1552 dma_status_reg = RREG32(DMA_STATUS_REG + DMA1_REGISTER_OFFSET); 1577 mask = RADEON_RESET_DMA1;
1553 if (dma_status_reg & DMA_IDLE) { 1578
1579 if (!(reset_mask & mask)) {
1554 radeon_ring_lockup_update(ring); 1580 radeon_ring_lockup_update(ring);
1555 return false; 1581 return false;
1556 } 1582 }
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index abb143c0bdca..3f292765aea8 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1537,16 +1537,22 @@ int r600_asic_reset(struct radeon_device *rdev)
1537 return 0; 1537 return 0;
1538} 1538}
1539 1539
1540bool r600_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) 1540/**
1541 * r600_gfx_is_lockup - Check if the GFX engine is locked up
1542 *
1543 * @rdev: radeon_device pointer
1544 * @ring: radeon_ring structure holding ring information
1545 *
1546 * Check if the GFX engine is locked up.
1547 * Returns true if the engine appears to be locked up, false if not.
1548 */
1549bool r600_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
1541{ 1550{
1542 u32 srbm_status; 1551 u32 reset_mask = r600_gpu_check_soft_reset(rdev);
1543 u32 grbm_status; 1552
1544 u32 grbm_status2; 1553 if (!(reset_mask & (RADEON_RESET_GFX |
1545 1554 RADEON_RESET_COMPUTE |
1546 srbm_status = RREG32(R_000E50_SRBM_STATUS); 1555 RADEON_RESET_CP))) {
1547 grbm_status = RREG32(R_008010_GRBM_STATUS);
1548 grbm_status2 = RREG32(R_008014_GRBM_STATUS2);
1549 if (!G_008010_GUI_ACTIVE(grbm_status)) {
1550 radeon_ring_lockup_update(ring); 1556 radeon_ring_lockup_update(ring);
1551 return false; 1557 return false;
1552 } 1558 }
@@ -1561,15 +1567,14 @@ bool r600_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
1561 * @rdev: radeon_device pointer 1567 * @rdev: radeon_device pointer
1562 * @ring: radeon_ring structure holding ring information 1568 * @ring: radeon_ring structure holding ring information
1563 * 1569 *
1564 * Check if the async DMA engine is locked up (r6xx-evergreen). 1570 * Check if the async DMA engine is locked up.
1565 * Returns true if the engine appears to be locked up, false if not. 1571 * Returns true if the engine appears to be locked up, false if not.
1566 */ 1572 */
1567bool r600_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) 1573bool r600_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
1568{ 1574{
1569 u32 dma_status_reg; 1575 u32 reset_mask = r600_gpu_check_soft_reset(rdev);
1570 1576
1571 dma_status_reg = RREG32(DMA_STATUS_REG); 1577 if (!(reset_mask & RADEON_RESET_DMA)) {
1572 if (dma_status_reg & DMA_IDLE) {
1573 radeon_ring_lockup_update(ring); 1578 radeon_ring_lockup_update(ring);
1574 return false; 1579 return false;
1575 } 1580 }
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 0b202c07fe50..82b5ef043b0e 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -946,7 +946,7 @@ static struct radeon_asic r600_asic = {
946 .cs_parse = &r600_cs_parse, 946 .cs_parse = &r600_cs_parse,
947 .ring_test = &r600_ring_test, 947 .ring_test = &r600_ring_test,
948 .ib_test = &r600_ib_test, 948 .ib_test = &r600_ib_test,
949 .is_lockup = &r600_gpu_is_lockup, 949 .is_lockup = &r600_gfx_is_lockup,
950 }, 950 },
951 [R600_RING_TYPE_DMA_INDEX] = { 951 [R600_RING_TYPE_DMA_INDEX] = {
952 .ib_execute = &r600_dma_ring_ib_execute, 952 .ib_execute = &r600_dma_ring_ib_execute,
@@ -1030,7 +1030,7 @@ static struct radeon_asic rs780_asic = {
1030 .cs_parse = &r600_cs_parse, 1030 .cs_parse = &r600_cs_parse,
1031 .ring_test = &r600_ring_test, 1031 .ring_test = &r600_ring_test,
1032 .ib_test = &r600_ib_test, 1032 .ib_test = &r600_ib_test,
1033 .is_lockup = &r600_gpu_is_lockup, 1033 .is_lockup = &r600_gfx_is_lockup,
1034 }, 1034 },
1035 [R600_RING_TYPE_DMA_INDEX] = { 1035 [R600_RING_TYPE_DMA_INDEX] = {
1036 .ib_execute = &r600_dma_ring_ib_execute, 1036 .ib_execute = &r600_dma_ring_ib_execute,
@@ -1114,7 +1114,7 @@ static struct radeon_asic rv770_asic = {
1114 .cs_parse = &r600_cs_parse, 1114 .cs_parse = &r600_cs_parse,
1115 .ring_test = &r600_ring_test, 1115 .ring_test = &r600_ring_test,
1116 .ib_test = &r600_ib_test, 1116 .ib_test = &r600_ib_test,
1117 .is_lockup = &r600_gpu_is_lockup, 1117 .is_lockup = &r600_gfx_is_lockup,
1118 }, 1118 },
1119 [R600_RING_TYPE_DMA_INDEX] = { 1119 [R600_RING_TYPE_DMA_INDEX] = {
1120 .ib_execute = &r600_dma_ring_ib_execute, 1120 .ib_execute = &r600_dma_ring_ib_execute,
@@ -1198,7 +1198,7 @@ static struct radeon_asic evergreen_asic = {
1198 .cs_parse = &evergreen_cs_parse, 1198 .cs_parse = &evergreen_cs_parse,
1199 .ring_test = &r600_ring_test, 1199 .ring_test = &r600_ring_test,
1200 .ib_test = &r600_ib_test, 1200 .ib_test = &r600_ib_test,
1201 .is_lockup = &evergreen_gpu_is_lockup, 1201 .is_lockup = &evergreen_gfx_is_lockup,
1202 }, 1202 },
1203 [R600_RING_TYPE_DMA_INDEX] = { 1203 [R600_RING_TYPE_DMA_INDEX] = {
1204 .ib_execute = &evergreen_dma_ring_ib_execute, 1204 .ib_execute = &evergreen_dma_ring_ib_execute,
@@ -1207,7 +1207,7 @@ static struct radeon_asic evergreen_asic = {
1207 .cs_parse = &evergreen_dma_cs_parse, 1207 .cs_parse = &evergreen_dma_cs_parse,
1208 .ring_test = &r600_dma_ring_test, 1208 .ring_test = &r600_dma_ring_test,
1209 .ib_test = &r600_dma_ib_test, 1209 .ib_test = &r600_dma_ib_test,
1210 .is_lockup = &r600_dma_is_lockup, 1210 .is_lockup = &evergreen_dma_is_lockup,
1211 } 1211 }
1212 }, 1212 },
1213 .irq = { 1213 .irq = {
@@ -1282,7 +1282,7 @@ static struct radeon_asic sumo_asic = {
1282 .cs_parse = &evergreen_cs_parse, 1282 .cs_parse = &evergreen_cs_parse,
1283 .ring_test = &r600_ring_test, 1283 .ring_test = &r600_ring_test,
1284 .ib_test = &r600_ib_test, 1284 .ib_test = &r600_ib_test,
1285 .is_lockup = &evergreen_gpu_is_lockup, 1285 .is_lockup = &evergreen_gfx_is_lockup,
1286 }, 1286 },
1287 [R600_RING_TYPE_DMA_INDEX] = { 1287 [R600_RING_TYPE_DMA_INDEX] = {
1288 .ib_execute = &evergreen_dma_ring_ib_execute, 1288 .ib_execute = &evergreen_dma_ring_ib_execute,
@@ -1291,7 +1291,7 @@ static struct radeon_asic sumo_asic = {
1291 .cs_parse = &evergreen_dma_cs_parse, 1291 .cs_parse = &evergreen_dma_cs_parse,
1292 .ring_test = &r600_dma_ring_test, 1292 .ring_test = &r600_dma_ring_test,
1293 .ib_test = &r600_dma_ib_test, 1293 .ib_test = &r600_dma_ib_test,
1294 .is_lockup = &r600_dma_is_lockup, 1294 .is_lockup = &evergreen_dma_is_lockup,
1295 } 1295 }
1296 }, 1296 },
1297 .irq = { 1297 .irq = {
@@ -1366,7 +1366,7 @@ static struct radeon_asic btc_asic = {
1366 .cs_parse = &evergreen_cs_parse, 1366 .cs_parse = &evergreen_cs_parse,
1367 .ring_test = &r600_ring_test, 1367 .ring_test = &r600_ring_test,
1368 .ib_test = &r600_ib_test, 1368 .ib_test = &r600_ib_test,
1369 .is_lockup = &evergreen_gpu_is_lockup, 1369 .is_lockup = &evergreen_gfx_is_lockup,
1370 }, 1370 },
1371 [R600_RING_TYPE_DMA_INDEX] = { 1371 [R600_RING_TYPE_DMA_INDEX] = {
1372 .ib_execute = &evergreen_dma_ring_ib_execute, 1372 .ib_execute = &evergreen_dma_ring_ib_execute,
@@ -1375,7 +1375,7 @@ static struct radeon_asic btc_asic = {
1375 .cs_parse = &evergreen_dma_cs_parse, 1375 .cs_parse = &evergreen_dma_cs_parse,
1376 .ring_test = &r600_dma_ring_test, 1376 .ring_test = &r600_dma_ring_test,
1377 .ib_test = &r600_dma_ib_test, 1377 .ib_test = &r600_dma_ib_test,
1378 .is_lockup = &r600_dma_is_lockup, 1378 .is_lockup = &evergreen_dma_is_lockup,
1379 } 1379 }
1380 }, 1380 },
1381 .irq = { 1381 .irq = {
@@ -1457,7 +1457,7 @@ static struct radeon_asic cayman_asic = {
1457 .cs_parse = &evergreen_cs_parse, 1457 .cs_parse = &evergreen_cs_parse,
1458 .ring_test = &r600_ring_test, 1458 .ring_test = &r600_ring_test,
1459 .ib_test = &r600_ib_test, 1459 .ib_test = &r600_ib_test,
1460 .is_lockup = &evergreen_gpu_is_lockup, 1460 .is_lockup = &cayman_gfx_is_lockup,
1461 .vm_flush = &cayman_vm_flush, 1461 .vm_flush = &cayman_vm_flush,
1462 }, 1462 },
1463 [CAYMAN_RING_TYPE_CP1_INDEX] = { 1463 [CAYMAN_RING_TYPE_CP1_INDEX] = {
@@ -1468,7 +1468,7 @@ static struct radeon_asic cayman_asic = {
1468 .cs_parse = &evergreen_cs_parse, 1468 .cs_parse = &evergreen_cs_parse,
1469 .ring_test = &r600_ring_test, 1469 .ring_test = &r600_ring_test,
1470 .ib_test = &r600_ib_test, 1470 .ib_test = &r600_ib_test,
1471 .is_lockup = &evergreen_gpu_is_lockup, 1471 .is_lockup = &cayman_gfx_is_lockup,
1472 .vm_flush = &cayman_vm_flush, 1472 .vm_flush = &cayman_vm_flush,
1473 }, 1473 },
1474 [CAYMAN_RING_TYPE_CP2_INDEX] = { 1474 [CAYMAN_RING_TYPE_CP2_INDEX] = {
@@ -1479,7 +1479,7 @@ static struct radeon_asic cayman_asic = {
1479 .cs_parse = &evergreen_cs_parse, 1479 .cs_parse = &evergreen_cs_parse,
1480 .ring_test = &r600_ring_test, 1480 .ring_test = &r600_ring_test,
1481 .ib_test = &r600_ib_test, 1481 .ib_test = &r600_ib_test,
1482 .is_lockup = &evergreen_gpu_is_lockup, 1482 .is_lockup = &cayman_gfx_is_lockup,
1483 .vm_flush = &cayman_vm_flush, 1483 .vm_flush = &cayman_vm_flush,
1484 }, 1484 },
1485 [R600_RING_TYPE_DMA_INDEX] = { 1485 [R600_RING_TYPE_DMA_INDEX] = {
@@ -1584,7 +1584,7 @@ static struct radeon_asic trinity_asic = {
1584 .cs_parse = &evergreen_cs_parse, 1584 .cs_parse = &evergreen_cs_parse,
1585 .ring_test = &r600_ring_test, 1585 .ring_test = &r600_ring_test,
1586 .ib_test = &r600_ib_test, 1586 .ib_test = &r600_ib_test,
1587 .is_lockup = &evergreen_gpu_is_lockup, 1587 .is_lockup = &cayman_gfx_is_lockup,
1588 .vm_flush = &cayman_vm_flush, 1588 .vm_flush = &cayman_vm_flush,
1589 }, 1589 },
1590 [CAYMAN_RING_TYPE_CP1_INDEX] = { 1590 [CAYMAN_RING_TYPE_CP1_INDEX] = {
@@ -1595,7 +1595,7 @@ static struct radeon_asic trinity_asic = {
1595 .cs_parse = &evergreen_cs_parse, 1595 .cs_parse = &evergreen_cs_parse,
1596 .ring_test = &r600_ring_test, 1596 .ring_test = &r600_ring_test,
1597 .ib_test = &r600_ib_test, 1597 .ib_test = &r600_ib_test,
1598 .is_lockup = &evergreen_gpu_is_lockup, 1598 .is_lockup = &cayman_gfx_is_lockup,
1599 .vm_flush = &cayman_vm_flush, 1599 .vm_flush = &cayman_vm_flush,
1600 }, 1600 },
1601 [CAYMAN_RING_TYPE_CP2_INDEX] = { 1601 [CAYMAN_RING_TYPE_CP2_INDEX] = {
@@ -1606,7 +1606,7 @@ static struct radeon_asic trinity_asic = {
1606 .cs_parse = &evergreen_cs_parse, 1606 .cs_parse = &evergreen_cs_parse,
1607 .ring_test = &r600_ring_test, 1607 .ring_test = &r600_ring_test,
1608 .ib_test = &r600_ib_test, 1608 .ib_test = &r600_ib_test,
1609 .is_lockup = &evergreen_gpu_is_lockup, 1609 .is_lockup = &cayman_gfx_is_lockup,
1610 .vm_flush = &cayman_vm_flush, 1610 .vm_flush = &cayman_vm_flush,
1611 }, 1611 },
1612 [R600_RING_TYPE_DMA_INDEX] = { 1612 [R600_RING_TYPE_DMA_INDEX] = {
@@ -1711,7 +1711,7 @@ static struct radeon_asic si_asic = {
1711 .cs_parse = NULL, 1711 .cs_parse = NULL,
1712 .ring_test = &r600_ring_test, 1712 .ring_test = &r600_ring_test,
1713 .ib_test = &r600_ib_test, 1713 .ib_test = &r600_ib_test,
1714 .is_lockup = &si_gpu_is_lockup, 1714 .is_lockup = &si_gfx_is_lockup,
1715 .vm_flush = &si_vm_flush, 1715 .vm_flush = &si_vm_flush,
1716 }, 1716 },
1717 [CAYMAN_RING_TYPE_CP1_INDEX] = { 1717 [CAYMAN_RING_TYPE_CP1_INDEX] = {
@@ -1722,7 +1722,7 @@ static struct radeon_asic si_asic = {
1722 .cs_parse = NULL, 1722 .cs_parse = NULL,
1723 .ring_test = &r600_ring_test, 1723 .ring_test = &r600_ring_test,
1724 .ib_test = &r600_ib_test, 1724 .ib_test = &r600_ib_test,
1725 .is_lockup = &si_gpu_is_lockup, 1725 .is_lockup = &si_gfx_is_lockup,
1726 .vm_flush = &si_vm_flush, 1726 .vm_flush = &si_vm_flush,
1727 }, 1727 },
1728 [CAYMAN_RING_TYPE_CP2_INDEX] = { 1728 [CAYMAN_RING_TYPE_CP2_INDEX] = {
@@ -1733,7 +1733,7 @@ static struct radeon_asic si_asic = {
1733 .cs_parse = NULL, 1733 .cs_parse = NULL,
1734 .ring_test = &r600_ring_test, 1734 .ring_test = &r600_ring_test,
1735 .ib_test = &r600_ib_test, 1735 .ib_test = &r600_ib_test,
1736 .is_lockup = &si_gpu_is_lockup, 1736 .is_lockup = &si_gfx_is_lockup,
1737 .vm_flush = &si_vm_flush, 1737 .vm_flush = &si_vm_flush,
1738 }, 1738 },
1739 [R600_RING_TYPE_DMA_INDEX] = { 1739 [R600_RING_TYPE_DMA_INDEX] = {
@@ -1744,7 +1744,7 @@ static struct radeon_asic si_asic = {
1744 .cs_parse = NULL, 1744 .cs_parse = NULL,
1745 .ring_test = &r600_dma_ring_test, 1745 .ring_test = &r600_dma_ring_test,
1746 .ib_test = &r600_dma_ib_test, 1746 .ib_test = &r600_dma_ib_test,
1747 .is_lockup = &cayman_dma_is_lockup, 1747 .is_lockup = &si_dma_is_lockup,
1748 .vm_flush = &si_dma_vm_flush, 1748 .vm_flush = &si_dma_vm_flush,
1749 }, 1749 },
1750 [CAYMAN_RING_TYPE_DMA1_INDEX] = { 1750 [CAYMAN_RING_TYPE_DMA1_INDEX] = {
@@ -1755,7 +1755,7 @@ static struct radeon_asic si_asic = {
1755 .cs_parse = NULL, 1755 .cs_parse = NULL,
1756 .ring_test = &r600_dma_ring_test, 1756 .ring_test = &r600_dma_ring_test,
1757 .ib_test = &r600_dma_ib_test, 1757 .ib_test = &r600_dma_ib_test,
1758 .is_lockup = &cayman_dma_is_lockup, 1758 .is_lockup = &si_dma_is_lockup,
1759 .vm_flush = &si_dma_vm_flush, 1759 .vm_flush = &si_dma_vm_flush,
1760 } 1760 }
1761 }, 1761 },
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 15d70e613076..e429e2574cae 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -319,7 +319,7 @@ void r600_dma_semaphore_ring_emit(struct radeon_device *rdev,
319 bool emit_wait); 319 bool emit_wait);
320void r600_dma_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); 320void r600_dma_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
321bool r600_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring); 321bool r600_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring);
322bool r600_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp); 322bool r600_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
323int r600_asic_reset(struct radeon_device *rdev); 323int r600_asic_reset(struct radeon_device *rdev);
324int r600_set_surface_reg(struct radeon_device *rdev, int reg, 324int r600_set_surface_reg(struct radeon_device *rdev, int reg,
325 uint32_t tiling_flags, uint32_t pitch, 325 uint32_t tiling_flags, uint32_t pitch,
@@ -422,7 +422,8 @@ int evergreen_init(struct radeon_device *rdev);
422void evergreen_fini(struct radeon_device *rdev); 422void evergreen_fini(struct radeon_device *rdev);
423int evergreen_suspend(struct radeon_device *rdev); 423int evergreen_suspend(struct radeon_device *rdev);
424int evergreen_resume(struct radeon_device *rdev); 424int evergreen_resume(struct radeon_device *rdev);
425bool evergreen_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp); 425bool evergreen_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
426bool evergreen_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
426int evergreen_asic_reset(struct radeon_device *rdev); 427int evergreen_asic_reset(struct radeon_device *rdev);
427void evergreen_bandwidth_update(struct radeon_device *rdev); 428void evergreen_bandwidth_update(struct radeon_device *rdev);
428void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); 429void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
@@ -480,6 +481,7 @@ int evergreen_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib);
480int evergreen_dma_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib); 481int evergreen_dma_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib);
481void cayman_dma_ring_ib_execute(struct radeon_device *rdev, 482void cayman_dma_ring_ib_execute(struct radeon_device *rdev,
482 struct radeon_ib *ib); 483 struct radeon_ib *ib);
484bool cayman_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring);
483bool cayman_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring); 485bool cayman_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring);
484void cayman_dma_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm); 486void cayman_dma_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm);
485 487
@@ -496,7 +498,8 @@ int si_init(struct radeon_device *rdev);
496void si_fini(struct radeon_device *rdev); 498void si_fini(struct radeon_device *rdev);
497int si_suspend(struct radeon_device *rdev); 499int si_suspend(struct radeon_device *rdev);
498int si_resume(struct radeon_device *rdev); 500int si_resume(struct radeon_device *rdev);
499bool si_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp); 501bool si_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
502bool si_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
500int si_asic_reset(struct radeon_device *rdev); 503int si_asic_reset(struct radeon_device *rdev);
501void si_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); 504void si_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
502int si_irq_set(struct radeon_device *rdev); 505int si_irq_set(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 89b564ec3d34..cd83bc5bd235 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2108,26 +2108,6 @@ static int si_cp_resume(struct radeon_device *rdev)
2108 return 0; 2108 return 0;
2109} 2109}
2110 2110
2111bool si_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
2112{
2113 u32 srbm_status;
2114 u32 grbm_status, grbm_status2;
2115 u32 grbm_status_se0, grbm_status_se1;
2116
2117 srbm_status = RREG32(SRBM_STATUS);
2118 grbm_status = RREG32(GRBM_STATUS);
2119 grbm_status2 = RREG32(GRBM_STATUS2);
2120 grbm_status_se0 = RREG32(GRBM_STATUS_SE0);
2121 grbm_status_se1 = RREG32(GRBM_STATUS_SE1);
2122 if (!(grbm_status & GUI_ACTIVE)) {
2123 radeon_ring_lockup_update(ring);
2124 return false;
2125 }
2126 /* force CP activities */
2127 radeon_ring_force_activity(rdev, ring);
2128 return radeon_ring_test_lockup(rdev, ring);
2129}
2130
2131static u32 si_gpu_check_soft_reset(struct radeon_device *rdev) 2111static u32 si_gpu_check_soft_reset(struct radeon_device *rdev)
2132{ 2112{
2133 u32 reset_mask = 0; 2113 u32 reset_mask = 0;
@@ -2347,6 +2327,58 @@ int si_asic_reset(struct radeon_device *rdev)
2347 return 0; 2327 return 0;
2348} 2328}
2349 2329
2330/**
2331 * si_gfx_is_lockup - Check if the GFX engine is locked up
2332 *
2333 * @rdev: radeon_device pointer
2334 * @ring: radeon_ring structure holding ring information
2335 *
2336 * Check if the GFX engine is locked up.
2337 * Returns true if the engine appears to be locked up, false if not.
2338 */
2339bool si_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
2340{
2341 u32 reset_mask = si_gpu_check_soft_reset(rdev);
2342
2343 if (!(reset_mask & (RADEON_RESET_GFX |
2344 RADEON_RESET_COMPUTE |
2345 RADEON_RESET_CP))) {
2346 radeon_ring_lockup_update(ring);
2347 return false;
2348 }
2349 /* force CP activities */
2350 radeon_ring_force_activity(rdev, ring);
2351 return radeon_ring_test_lockup(rdev, ring);
2352}
2353
2354/**
2355 * si_dma_is_lockup - Check if the DMA engine is locked up
2356 *
2357 * @rdev: radeon_device pointer
2358 * @ring: radeon_ring structure holding ring information
2359 *
2360 * Check if the async DMA engine is locked up.
2361 * Returns true if the engine appears to be locked up, false if not.
2362 */
2363bool si_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
2364{
2365 u32 reset_mask = si_gpu_check_soft_reset(rdev);
2366 u32 mask;
2367
2368 if (ring->idx == R600_RING_TYPE_DMA_INDEX)
2369 mask = RADEON_RESET_DMA;
2370 else
2371 mask = RADEON_RESET_DMA1;
2372
2373 if (!(reset_mask & mask)) {
2374 radeon_ring_lockup_update(ring);
2375 return false;
2376 }
2377 /* force ring activities */
2378 radeon_ring_force_activity(rdev, ring);
2379 return radeon_ring_test_lockup(rdev, ring);
2380}
2381
2350/* MC */ 2382/* MC */
2351static void si_mc_program(struct radeon_device *rdev) 2383static void si_mc_program(struct radeon_device *rdev)
2352{ 2384{