aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2015-12-07 17:02:53 -0500
committerAlex Deucher <alexander.deucher@amd.com>2015-12-11 11:13:42 -0500
commit2c1a27840394428d8f44fe5d7509dd20574d0573 (patch)
treee13f5a1fc29091712d613373f81dc86f6507fb47 /drivers/gpu/drm/amd/amdgpu
parentabdfb850ca99a27557564e4fcf4b137e209ebfef (diff)
drm/amdgpu: add more debugging output for driver failures
Add more fine grained debugging output for init/fini/suspend/ resume failures. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c73
1 files changed, 57 insertions, 16 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 84775964b138..54af6ce7901f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1214,12 +1214,14 @@ static int amdgpu_early_init(struct amdgpu_device *adev)
1214 } else { 1214 } else {
1215 if (adev->ip_blocks[i].funcs->early_init) { 1215 if (adev->ip_blocks[i].funcs->early_init) {
1216 r = adev->ip_blocks[i].funcs->early_init((void *)adev); 1216 r = adev->ip_blocks[i].funcs->early_init((void *)adev);
1217 if (r == -ENOENT) 1217 if (r == -ENOENT) {
1218 adev->ip_block_status[i].valid = false; 1218 adev->ip_block_status[i].valid = false;
1219 else if (r) 1219 } else if (r) {
1220 DRM_ERROR("early_init %d failed %d\n", i, r);
1220 return r; 1221 return r;
1221 else 1222 } else {
1222 adev->ip_block_status[i].valid = true; 1223 adev->ip_block_status[i].valid = true;
1224 }
1223 } else { 1225 } else {
1224 adev->ip_block_status[i].valid = true; 1226 adev->ip_block_status[i].valid = true;
1225 } 1227 }
@@ -1237,20 +1239,28 @@ static int amdgpu_init(struct amdgpu_device *adev)
1237 if (!adev->ip_block_status[i].valid) 1239 if (!adev->ip_block_status[i].valid)
1238 continue; 1240 continue;
1239 r = adev->ip_blocks[i].funcs->sw_init((void *)adev); 1241 r = adev->ip_blocks[i].funcs->sw_init((void *)adev);
1240 if (r) 1242 if (r) {
1243 DRM_ERROR("sw_init %d failed %d\n", i, r);
1241 return r; 1244 return r;
1245 }
1242 adev->ip_block_status[i].sw = true; 1246 adev->ip_block_status[i].sw = true;
1243 /* need to do gmc hw init early so we can allocate gpu mem */ 1247 /* need to do gmc hw init early so we can allocate gpu mem */
1244 if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC) { 1248 if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC) {
1245 r = amdgpu_vram_scratch_init(adev); 1249 r = amdgpu_vram_scratch_init(adev);
1246 if (r) 1250 if (r) {
1251 DRM_ERROR("amdgpu_vram_scratch_init failed %d\n", r);
1247 return r; 1252 return r;
1253 }
1248 r = adev->ip_blocks[i].funcs->hw_init((void *)adev); 1254 r = adev->ip_blocks[i].funcs->hw_init((void *)adev);
1249 if (r) 1255 if (r) {
1256 DRM_ERROR("hw_init %d failed %d\n", i, r);
1250 return r; 1257 return r;
1258 }
1251 r = amdgpu_wb_init(adev); 1259 r = amdgpu_wb_init(adev);
1252 if (r) 1260 if (r) {
1261 DRM_ERROR("amdgpu_wb_init failed %d\n", r);
1253 return r; 1262 return r;
1263 }
1254 adev->ip_block_status[i].hw = true; 1264 adev->ip_block_status[i].hw = true;
1255 } 1265 }
1256 } 1266 }
@@ -1262,8 +1272,10 @@ static int amdgpu_init(struct amdgpu_device *adev)
1262 if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC) 1272 if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC)
1263 continue; 1273 continue;
1264 r = adev->ip_blocks[i].funcs->hw_init((void *)adev); 1274 r = adev->ip_blocks[i].funcs->hw_init((void *)adev);
1265 if (r) 1275 if (r) {
1276 DRM_ERROR("hw_init %d failed %d\n", i, r);
1266 return r; 1277 return r;
1278 }
1267 adev->ip_block_status[i].hw = true; 1279 adev->ip_block_status[i].hw = true;
1268 } 1280 }
1269 1281
@@ -1280,12 +1292,16 @@ static int amdgpu_late_init(struct amdgpu_device *adev)
1280 /* enable clockgating to save power */ 1292 /* enable clockgating to save power */
1281 r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, 1293 r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev,
1282 AMD_CG_STATE_GATE); 1294 AMD_CG_STATE_GATE);
1283 if (r) 1295 if (r) {
1296 DRM_ERROR("set_clockgating_state(gate) %d failed %d\n", i, r);
1284 return r; 1297 return r;
1298 }
1285 if (adev->ip_blocks[i].funcs->late_init) { 1299 if (adev->ip_blocks[i].funcs->late_init) {
1286 r = adev->ip_blocks[i].funcs->late_init((void *)adev); 1300 r = adev->ip_blocks[i].funcs->late_init((void *)adev);
1287 if (r) 1301 if (r) {
1302 DRM_ERROR("late_init %d failed %d\n", i, r);
1288 return r; 1303 return r;
1304 }
1289 } 1305 }
1290 } 1306 }
1291 1307
@@ -1306,10 +1322,15 @@ static int amdgpu_fini(struct amdgpu_device *adev)
1306 /* ungate blocks before hw fini so that we can shutdown the blocks safely */ 1322 /* ungate blocks before hw fini so that we can shutdown the blocks safely */
1307 r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, 1323 r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev,
1308 AMD_CG_STATE_UNGATE); 1324 AMD_CG_STATE_UNGATE);
1309 if (r) 1325 if (r) {
1326 DRM_ERROR("set_clockgating_state(ungate) %d failed %d\n", i, r);
1310 return r; 1327 return r;
1328 }
1311 r = adev->ip_blocks[i].funcs->hw_fini((void *)adev); 1329 r = adev->ip_blocks[i].funcs->hw_fini((void *)adev);
1312 /* XXX handle errors */ 1330 /* XXX handle errors */
1331 if (r) {
1332 DRM_DEBUG("hw_fini %d failed %d\n", i, r);
1333 }
1313 adev->ip_block_status[i].hw = false; 1334 adev->ip_block_status[i].hw = false;
1314 } 1335 }
1315 1336
@@ -1318,6 +1339,9 @@ static int amdgpu_fini(struct amdgpu_device *adev)
1318 continue; 1339 continue;
1319 r = adev->ip_blocks[i].funcs->sw_fini((void *)adev); 1340 r = adev->ip_blocks[i].funcs->sw_fini((void *)adev);
1320 /* XXX handle errors */ 1341 /* XXX handle errors */
1342 if (r) {
1343 DRM_DEBUG("sw_fini %d failed %d\n", i, r);
1344 }
1321 adev->ip_block_status[i].sw = false; 1345 adev->ip_block_status[i].sw = false;
1322 adev->ip_block_status[i].valid = false; 1346 adev->ip_block_status[i].valid = false;
1323 } 1347 }
@@ -1335,9 +1359,15 @@ static int amdgpu_suspend(struct amdgpu_device *adev)
1335 /* ungate blocks so that suspend can properly shut them down */ 1359 /* ungate blocks so that suspend can properly shut them down */
1336 r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, 1360 r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev,
1337 AMD_CG_STATE_UNGATE); 1361 AMD_CG_STATE_UNGATE);
1362 if (r) {
1363 DRM_ERROR("set_clockgating_state(ungate) %d failed %d\n", i, r);
1364 }
1338 /* XXX handle errors */ 1365 /* XXX handle errors */
1339 r = adev->ip_blocks[i].funcs->suspend(adev); 1366 r = adev->ip_blocks[i].funcs->suspend(adev);
1340 /* XXX handle errors */ 1367 /* XXX handle errors */
1368 if (r) {
1369 DRM_ERROR("suspend %d failed %d\n", i, r);
1370 }
1341 } 1371 }
1342 1372
1343 return 0; 1373 return 0;
@@ -1351,8 +1381,10 @@ static int amdgpu_resume(struct amdgpu_device *adev)
1351 if (!adev->ip_block_status[i].valid) 1381 if (!adev->ip_block_status[i].valid)
1352 continue; 1382 continue;
1353 r = adev->ip_blocks[i].funcs->resume(adev); 1383 r = adev->ip_blocks[i].funcs->resume(adev);
1354 if (r) 1384 if (r) {
1385 DRM_ERROR("resume %d failed %d\n", i, r);
1355 return r; 1386 return r;
1387 }
1356 } 1388 }
1357 1389
1358 return 0; 1390 return 0;
@@ -1484,8 +1516,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,
1484 return -EINVAL; 1516 return -EINVAL;
1485 } 1517 }
1486 r = amdgpu_atombios_init(adev); 1518 r = amdgpu_atombios_init(adev);
1487 if (r) 1519 if (r) {
1520 dev_err(adev->dev, "amdgpu_atombios_init failed\n");
1488 return r; 1521 return r;
1522 }
1489 1523
1490 /* Post card if necessary */ 1524 /* Post card if necessary */
1491 if (!amdgpu_card_posted(adev)) { 1525 if (!amdgpu_card_posted(adev)) {
@@ -1499,21 +1533,26 @@ int amdgpu_device_init(struct amdgpu_device *adev,
1499 1533
1500 /* Initialize clocks */ 1534 /* Initialize clocks */
1501 r = amdgpu_atombios_get_clock_info(adev); 1535 r = amdgpu_atombios_get_clock_info(adev);
1502 if (r) 1536 if (r) {
1537 dev_err(adev->dev, "amdgpu_atombios_get_clock_info failed\n");
1503 return r; 1538 return r;
1539 }
1504 /* init i2c buses */ 1540 /* init i2c buses */
1505 amdgpu_atombios_i2c_init(adev); 1541 amdgpu_atombios_i2c_init(adev);
1506 1542
1507 /* Fence driver */ 1543 /* Fence driver */
1508 r = amdgpu_fence_driver_init(adev); 1544 r = amdgpu_fence_driver_init(adev);
1509 if (r) 1545 if (r) {
1546 dev_err(adev->dev, "amdgpu_fence_driver_init failed\n");
1510 return r; 1547 return r;
1548 }
1511 1549
1512 /* init the mode config */ 1550 /* init the mode config */
1513 drm_mode_config_init(adev->ddev); 1551 drm_mode_config_init(adev->ddev);
1514 1552
1515 r = amdgpu_init(adev); 1553 r = amdgpu_init(adev);
1516 if (r) { 1554 if (r) {
1555 dev_err(adev->dev, "amdgpu_init failed\n");
1517 amdgpu_fini(adev); 1556 amdgpu_fini(adev);
1518 return r; 1557 return r;
1519 } 1558 }
@@ -1570,8 +1609,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,
1570 * explicit gating rather than handling it automatically. 1609 * explicit gating rather than handling it automatically.
1571 */ 1610 */
1572 r = amdgpu_late_init(adev); 1611 r = amdgpu_late_init(adev);
1573 if (r) 1612 if (r) {
1613 dev_err(adev->dev, "amdgpu_late_init failed\n");
1574 return r; 1614 return r;
1615 }
1575 1616
1576 return 0; 1617 return 0;
1577} 1618}