Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'amd-drm-next-5.8-2020-05-27' of git://people.freedesktop.org/~agd5f/linux into drm-next

amd-drm-next-5.8-2020-05-27:

amdgpu:
- SRIOV fixes
- RAS fixes
- VCN 2.5 DPG (Dynamic PowerGating) fixes
- FP16 updates for display
- CTF cleanups
- Display fixes
- Fix pcie bw sysfs handling
- Enable resizeable BAR support for gmc 10.x
- GFXOFF fixes for Raven
- PM sysfs handling fixes

amdkfd:
- Fix a race condition
- Warning fixes

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200527231219.3930-1-alexander.deucher@amd.com

+779 -534
+2
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 173 173 extern int amdgpu_emu_mode; 174 174 extern uint amdgpu_smu_memory_pool_size; 175 175 extern uint amdgpu_dc_feature_mask; 176 + extern uint amdgpu_dc_debug_mask; 176 177 extern uint amdgpu_dm_abm_level; 177 178 extern struct amdgpu_mgpu_info mgpu_info; 178 179 extern int amdgpu_ras_enable; ··· 739 738 uint32_t rev_id; 740 739 uint32_t external_rev_id; 741 740 unsigned long flags; 741 + unsigned long apu_flags; 742 742 int usec_timeout; 743 743 const struct amdgpu_asic_funcs *asic_funcs; 744 744 bool shutdown;
+3 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
··· 1302 1302 return -EBUSY; 1303 1303 } 1304 1304 1305 - /* No more MMU notifiers */ 1306 - amdgpu_mn_unregister(mem->bo); 1307 - 1308 1305 /* Make sure restore workers don't access the BO any more */ 1309 1306 bo_list_entry = &mem->validate_list; 1310 1307 mutex_lock(&process_info->lock); 1311 1308 list_del(&bo_list_entry->head); 1312 1309 mutex_unlock(&process_info->lock); 1310 + 1311 + /* No more MMU notifiers */ 1312 + amdgpu_mn_unregister(mem->bo); 1313 1313 1314 1314 ret = reserve_bo_and_cond_vms(mem, NULL, BO_VM_ALL, &ctx); 1315 1315 if (unlikely(ret))
+9 -10
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 1567 1567 chip_name = "vega12"; 1568 1568 break; 1569 1569 case CHIP_RAVEN: 1570 - if (adev->rev_id >= 8) 1570 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 1571 1571 chip_name = "raven2"; 1572 - else if (adev->pdev->device == 0x15d8) 1572 + else if (adev->apu_flags & AMD_APU_IS_PICASSO) 1573 1573 chip_name = "picasso"; 1574 1574 else 1575 1575 chip_name = "raven"; ··· 1617 1617 (const struct gpu_info_firmware_v1_0 *)(adev->firmware.gpu_info_fw->data + 1618 1618 le32_to_cpu(hdr->header.ucode_array_offset_bytes)); 1619 1619 1620 - if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) 1620 + if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) { 1621 + amdgpu_discovery_get_gfx_info(adev); 1621 1622 goto parse_soc_bounding_box; 1623 + } 1622 1624 1623 1625 adev->gfx.config.max_shader_engines = le32_to_cpu(gpu_info_fw->gc_num_se); 1624 1626 adev->gfx.config.max_cu_per_sh = le32_to_cpu(gpu_info_fw->gc_num_cu_per_sh); ··· 1766 1764 return -EINVAL; 1767 1765 } 1768 1766 1769 - r = amdgpu_device_parse_gpu_info_fw(adev); 1770 - if (r) 1771 - return r; 1772 - 1773 - if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) 1774 - amdgpu_discovery_get_gfx_info(adev); 1775 - 1776 1767 amdgpu_amdkfd_device_probe(adev); 1777 1768 1778 1769 if (amdgpu_sriov_vf(adev)) { ··· 1820 1825 } 1821 1826 /* get the vbios after the asic_funcs are set up */ 1822 1827 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON) { 1828 + r = amdgpu_device_parse_gpu_info_fw(adev); 1829 + if (r) 1830 + return r; 1831 + 1823 1832 /* skip vbios handling for new handshake */ 1824 1833 if (amdgpu_sriov_vf(adev) && adev->virt.req_init_data_ver == 1) 1825 1834 continue;
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
··· 523 523 break; 524 524 case CHIP_RAVEN: 525 525 /* enable S/G on PCO and RV2 */ 526 - if (adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) 526 + if ((adev->apu_flags & AMD_APU_IS_RAVEN2) || 527 + (adev->apu_flags & AMD_APU_IS_PICASSO)) 527 528 domain |= AMDGPU_GEM_DOMAIN_GTT; 528 529 break; 529 530 default:
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h
··· 450 450 451 451 /* Used for I2C access to various EEPROMs on relevant ASICs */ 452 452 struct i2c_adapter smu_i2c; 453 + struct list_head pm_attr_list; 453 454 }; 454 455 455 456 #define R600_SSTU_DFLT 0
+8
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 140 140 uint amdgpu_smu_memory_pool_size = 0; 141 141 /* FBC (bit 0) disabled by default*/ 142 142 uint amdgpu_dc_feature_mask = 0; 143 + uint amdgpu_dc_debug_mask = 0; 143 144 int amdgpu_async_gfx_ring = 1; 144 145 int amdgpu_mcbp = 0; 145 146 int amdgpu_discovery = -1; ··· 714 713 */ 715 714 MODULE_PARM_DESC(dcfeaturemask, "all stable DC features enabled (default))"); 716 715 module_param_named(dcfeaturemask, amdgpu_dc_feature_mask, uint, 0444); 716 + 717 + /** 718 + * DOC: dcdebugmask (uint) 719 + * Override display features enabled. See enum DC_DEBUG_MASK in drivers/gpu/drm/amd/include/amd_shared.h. 720 + */ 721 + MODULE_PARM_DESC(dcdebugmask, "all debug options disabled (default))"); 722 + module_param_named(dcdebugmask, amdgpu_dc_debug_mask, uint, 0444); 717 723 718 724 /** 719 725 * DOC: abmlevel (uint)
+67 -145
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
··· 163 163 enum amd_pm_state_type pm; 164 164 int ret; 165 165 166 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 167 - return 0; 168 - 169 166 ret = pm_runtime_get_sync(ddev->dev); 170 167 if (ret < 0) 171 168 return ret; ··· 195 198 struct amdgpu_device *adev = ddev->dev_private; 196 199 enum amd_pm_state_type state; 197 200 int ret; 198 - 199 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 200 - return -EINVAL; 201 201 202 202 if (strncmp("battery", buf, strlen("battery")) == 0) 203 203 state = POWER_STATE_TYPE_BATTERY; ··· 297 303 enum amd_dpm_forced_level level = 0xff; 298 304 int ret; 299 305 300 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 301 - return 0; 302 - 303 306 ret = pm_runtime_get_sync(ddev->dev); 304 307 if (ret < 0) 305 308 return ret; ··· 334 343 enum amd_dpm_forced_level current_level = 0xff; 335 344 int ret = 0; 336 345 337 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 338 - return -EINVAL; 339 - 340 346 if (strncmp("low", buf, strlen("low")) == 0) { 341 347 level = AMD_DPM_FORCED_LEVEL_LOW; 342 348 } else if (strncmp("high", buf, strlen("high")) == 0) { ··· 369 381 pm_runtime_mark_last_busy(ddev->dev); 370 382 pm_runtime_put_autosuspend(ddev->dev); 371 383 return count; 384 + } 385 + 386 + if (adev->asic_type == CHIP_RAVEN) { 387 + if (!(adev->apu_flags & AMD_APU_IS_RAVEN2)) { 388 + if (current_level != AMD_DPM_FORCED_LEVEL_MANUAL && level == AMD_DPM_FORCED_LEVEL_MANUAL) 389 + amdgpu_gfx_off_ctrl(adev, false); 390 + else if (current_level == AMD_DPM_FORCED_LEVEL_MANUAL && level != AMD_DPM_FORCED_LEVEL_MANUAL) 391 + amdgpu_gfx_off_ctrl(adev, true); 392 + } 372 393 } 373 394 374 395 /* profile_exit setting is valid only when current mode is in profile mode */ ··· 472 475 enum amd_pm_state_type pm = 0; 473 476 int i = 0, ret = 0; 474 477 475 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 476 - return 0; 477 - 478 478 ret = pm_runtime_get_sync(ddev->dev); 479 479 if (ret < 0) 480 480 return ret; ··· 508 514 struct drm_device *ddev = dev_get_drvdata(dev); 509 515 struct amdgpu_device *adev = ddev->dev_private; 510 516 511 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 512 - return 0; 513 - 514 517 if (adev->pp_force_state_enabled) 515 518 return amdgpu_get_pp_cur_state(dev, attr, buf); 516 519 else ··· 524 533 enum amd_pm_state_type state = 0; 525 534 unsigned long idx; 526 535 int ret; 527 - 528 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 529 - return -EINVAL; 530 536 531 537 if (strlen(buf) == 1) 532 538 adev->pp_force_state_enabled = false; ··· 580 592 char *table = NULL; 581 593 int size, ret; 582 594 583 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 584 - return 0; 585 - 586 595 ret = pm_runtime_get_sync(ddev->dev); 587 596 if (ret < 0) 588 597 return ret; ··· 618 633 struct drm_device *ddev = dev_get_drvdata(dev); 619 634 struct amdgpu_device *adev = ddev->dev_private; 620 635 int ret = 0; 621 - 622 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 623 - return -EINVAL; 624 636 625 637 ret = pm_runtime_get_sync(ddev->dev); 626 638 if (ret < 0) ··· 721 739 const char delimiter[3] = {' ', '\n', '\0'}; 722 740 uint32_t type; 723 741 724 - if (amdgpu_sriov_vf(adev)) 725 - return -EINVAL; 726 - 727 742 if (count > 127) 728 743 return -EINVAL; 729 744 ··· 810 831 ssize_t size; 811 832 int ret; 812 833 813 - if (amdgpu_sriov_vf(adev)) 814 - return 0; 815 - 816 834 ret = pm_runtime_get_sync(ddev->dev); 817 835 if (ret < 0) 818 836 return ret; ··· 859 883 uint64_t featuremask; 860 884 int ret; 861 885 862 - if (amdgpu_sriov_vf(adev)) 863 - return -EINVAL; 864 - 865 886 ret = kstrtou64(buf, 0, &featuremask); 866 887 if (ret) 867 888 return -EINVAL; ··· 898 925 struct amdgpu_device *adev = ddev->dev_private; 899 926 ssize_t size; 900 927 int ret; 901 - 902 - if (amdgpu_sriov_vf(adev)) 903 - return 0; 904 928 905 929 ret = pm_runtime_get_sync(ddev->dev); 906 930 if (ret < 0) ··· 954 984 struct amdgpu_device *adev = ddev->dev_private; 955 985 ssize_t size; 956 986 int ret; 957 - 958 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 959 - return 0; 960 987 961 988 ret = pm_runtime_get_sync(ddev->dev); 962 989 if (ret < 0) ··· 1018 1051 int ret; 1019 1052 uint32_t mask = 0; 1020 1053 1021 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1022 - return -EINVAL; 1023 - 1024 1054 ret = amdgpu_read_mask(buf, count, &mask); 1025 1055 if (ret) 1026 1056 return ret; ··· 1049 1085 ssize_t size; 1050 1086 int ret; 1051 1087 1052 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1053 - return 0; 1054 - 1055 1088 ret = pm_runtime_get_sync(ddev->dev); 1056 1089 if (ret < 0) 1057 1090 return ret; ··· 1075 1114 struct amdgpu_device *adev = ddev->dev_private; 1076 1115 uint32_t mask = 0; 1077 1116 int ret; 1078 - 1079 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1080 - return -EINVAL; 1081 1117 1082 1118 ret = amdgpu_read_mask(buf, count, &mask); 1083 1119 if (ret) ··· 1107 1149 ssize_t size; 1108 1150 int ret; 1109 1151 1110 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1111 - return 0; 1112 - 1113 1152 ret = pm_runtime_get_sync(ddev->dev); 1114 1153 if (ret < 0) 1115 1154 return ret; ··· 1133 1178 struct amdgpu_device *adev = ddev->dev_private; 1134 1179 int ret; 1135 1180 uint32_t mask = 0; 1136 - 1137 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1138 - return -EINVAL; 1139 1181 1140 1182 ret = amdgpu_read_mask(buf, count, &mask); 1141 1183 if (ret) ··· 1167 1215 ssize_t size; 1168 1216 int ret; 1169 1217 1170 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1171 - return 0; 1172 - 1173 1218 ret = pm_runtime_get_sync(ddev->dev); 1174 1219 if (ret < 0) 1175 1220 return ret; ··· 1193 1244 struct amdgpu_device *adev = ddev->dev_private; 1194 1245 int ret; 1195 1246 uint32_t mask = 0; 1196 - 1197 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1198 - return -EINVAL; 1199 1247 1200 1248 ret = amdgpu_read_mask(buf, count, &mask); 1201 1249 if (ret) ··· 1227 1281 ssize_t size; 1228 1282 int ret; 1229 1283 1230 - if (amdgpu_sriov_vf(adev)) 1231 - return 0; 1232 - 1233 1284 ret = pm_runtime_get_sync(ddev->dev); 1234 1285 if (ret < 0) 1235 1286 return ret; ··· 1253 1310 struct amdgpu_device *adev = ddev->dev_private; 1254 1311 int ret; 1255 1312 uint32_t mask = 0; 1256 - 1257 - if (amdgpu_sriov_vf(adev)) 1258 - return -EINVAL; 1259 1313 1260 1314 ret = amdgpu_read_mask(buf, count, &mask); 1261 1315 if (ret) ··· 1287 1347 ssize_t size; 1288 1348 int ret; 1289 1349 1290 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1291 - return 0; 1292 - 1293 1350 ret = pm_runtime_get_sync(ddev->dev); 1294 1351 if (ret < 0) 1295 1352 return ret; ··· 1313 1376 struct amdgpu_device *adev = ddev->dev_private; 1314 1377 int ret; 1315 1378 uint32_t mask = 0; 1316 - 1317 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1318 - return -EINVAL; 1319 1379 1320 1380 ret = amdgpu_read_mask(buf, count, &mask); 1321 1381 if (ret) ··· 1347 1413 uint32_t value = 0; 1348 1414 int ret; 1349 1415 1350 - if (amdgpu_sriov_vf(adev)) 1351 - return 0; 1352 - 1353 1416 ret = pm_runtime_get_sync(ddev->dev); 1354 1417 if (ret < 0) 1355 1418 return ret; ··· 1371 1440 struct amdgpu_device *adev = ddev->dev_private; 1372 1441 int ret; 1373 1442 long int value; 1374 - 1375 - if (amdgpu_sriov_vf(adev)) 1376 - return -EINVAL; 1377 1443 1378 1444 ret = kstrtol(buf, 0, &value); 1379 1445 ··· 1410 1482 uint32_t value = 0; 1411 1483 int ret; 1412 1484 1413 - if (amdgpu_sriov_vf(adev)) 1414 - return 0; 1415 - 1416 1485 ret = pm_runtime_get_sync(ddev->dev); 1417 1486 if (ret < 0) 1418 1487 return ret; ··· 1434 1509 struct amdgpu_device *adev = ddev->dev_private; 1435 1510 int ret; 1436 1511 long int value; 1437 - 1438 - if (amdgpu_sriov_vf(adev)) 1439 - return 0; 1440 1512 1441 1513 ret = kstrtol(buf, 0, &value); 1442 1514 ··· 1493 1571 ssize_t size; 1494 1572 int ret; 1495 1573 1496 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1497 - return 0; 1498 - 1499 1574 ret = pm_runtime_get_sync(ddev->dev); 1500 1575 if (ret < 0) 1501 1576 return ret; ··· 1532 1613 tmp[1] = '\0'; 1533 1614 ret = kstrtol(tmp, 0, &profile_mode); 1534 1615 if (ret) 1535 - return -EINVAL; 1536 - 1537 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1538 1616 return -EINVAL; 1539 1617 1540 1618 if (profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) { ··· 1587 1671 struct amdgpu_device *adev = ddev->dev_private; 1588 1672 int r, value, size = sizeof(value); 1589 1673 1590 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1591 - return 0; 1592 - 1593 1674 r = pm_runtime_get_sync(ddev->dev); 1594 1675 if (r < 0) 1595 1676 return r; ··· 1619 1706 struct drm_device *ddev = dev_get_drvdata(dev); 1620 1707 struct amdgpu_device *adev = ddev->dev_private; 1621 1708 int r, value, size = sizeof(value); 1622 - 1623 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1624 - return 0; 1625 1709 1626 1710 r = pm_runtime_get_sync(ddev->dev); 1627 1711 if (r < 0) ··· 1655 1745 { 1656 1746 struct drm_device *ddev = dev_get_drvdata(dev); 1657 1747 struct amdgpu_device *adev = ddev->dev_private; 1658 - uint64_t count0, count1; 1748 + uint64_t count0 = 0, count1 = 0; 1659 1749 int ret; 1660 1750 1661 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1662 - return 0; 1751 + if (adev->flags & AMD_IS_APU) 1752 + return -ENODATA; 1753 + 1754 + if (!adev->asic_funcs->get_pcie_usage) 1755 + return -ENODATA; 1663 1756 1664 1757 ret = pm_runtime_get_sync(ddev->dev); 1665 1758 if (ret < 0) ··· 1693 1780 { 1694 1781 struct drm_device *ddev = dev_get_drvdata(dev); 1695 1782 struct amdgpu_device *adev = ddev->dev_private; 1696 - 1697 - if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) 1698 - return 0; 1699 1783 1700 1784 if (adev->unique_id) 1701 1785 return snprintf(buf, PAGE_SIZE, "%016llx\n", adev->unique_id); ··· 1725 1815 }; 1726 1816 1727 1817 static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_attr *attr, 1728 - uint32_t mask) 1818 + uint32_t mask, enum amdgpu_device_attr_states *states) 1729 1819 { 1730 1820 struct device_attribute *dev_attr = &attr->dev_attr; 1731 1821 const char *attr_name = dev_attr->attr.name; ··· 1733 1823 enum amd_asic_type asic_type = adev->asic_type; 1734 1824 1735 1825 if (!(attr->flags & mask)) { 1736 - attr->states = ATTR_STATE_UNSUPPORTED; 1826 + *states = ATTR_STATE_UNSUPPORTED; 1737 1827 return 0; 1738 1828 } 1739 1829 1740 1830 #define DEVICE_ATTR_IS(_name) (!strcmp(attr_name, #_name)) 1741 1831 1742 1832 if (DEVICE_ATTR_IS(pp_dpm_socclk)) { 1743 - if (asic_type <= CHIP_VEGA10) 1744 - attr->states = ATTR_STATE_UNSUPPORTED; 1833 + if (asic_type < CHIP_VEGA10) 1834 + *states = ATTR_STATE_UNSUPPORTED; 1745 1835 } else if (DEVICE_ATTR_IS(pp_dpm_dcefclk)) { 1746 - if (asic_type <= CHIP_VEGA10 || asic_type == CHIP_ARCTURUS) 1747 - attr->states = ATTR_STATE_UNSUPPORTED; 1836 + if (asic_type < CHIP_VEGA10 || asic_type == CHIP_ARCTURUS) 1837 + *states = ATTR_STATE_UNSUPPORTED; 1748 1838 } else if (DEVICE_ATTR_IS(pp_dpm_fclk)) { 1749 1839 if (asic_type < CHIP_VEGA20) 1750 - attr->states = ATTR_STATE_UNSUPPORTED; 1840 + *states = ATTR_STATE_UNSUPPORTED; 1751 1841 } else if (DEVICE_ATTR_IS(pp_dpm_pcie)) { 1752 1842 if (asic_type == CHIP_ARCTURUS) 1753 - attr->states = ATTR_STATE_UNSUPPORTED; 1843 + *states = ATTR_STATE_UNSUPPORTED; 1754 1844 } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { 1755 - attr->states = ATTR_STATE_UNSUPPORTED; 1845 + *states = ATTR_STATE_UNSUPPORTED; 1756 1846 if ((is_support_sw_smu(adev) && adev->smu.od_enabled) || 1757 1847 (!is_support_sw_smu(adev) && hwmgr->od_enabled)) 1758 - attr->states = ATTR_STATE_UNSUPPORTED; 1848 + *states = ATTR_STATE_SUPPORTED; 1759 1849 } else if (DEVICE_ATTR_IS(mem_busy_percent)) { 1760 1850 if (adev->flags & AMD_IS_APU || asic_type == CHIP_VEGA10) 1761 - attr->states = ATTR_STATE_UNSUPPORTED; 1851 + *states = ATTR_STATE_UNSUPPORTED; 1762 1852 } else if (DEVICE_ATTR_IS(pcie_bw)) { 1763 1853 /* PCIe Perf counters won't work on APU nodes */ 1764 1854 if (adev->flags & AMD_IS_APU) 1765 - attr->states = ATTR_STATE_UNSUPPORTED; 1855 + *states = ATTR_STATE_UNSUPPORTED; 1766 1856 } else if (DEVICE_ATTR_IS(unique_id)) { 1767 1857 if (!adev->unique_id) 1768 - attr->states = ATTR_STATE_UNSUPPORTED; 1858 + *states = ATTR_STATE_UNSUPPORTED; 1769 1859 } else if (DEVICE_ATTR_IS(pp_features)) { 1770 - if (adev->flags & AMD_IS_APU || asic_type <= CHIP_VEGA10) 1771 - attr->states = ATTR_STATE_UNSUPPORTED; 1860 + if (adev->flags & AMD_IS_APU || asic_type < CHIP_VEGA10) 1861 + *states = ATTR_STATE_UNSUPPORTED; 1772 1862 } 1773 1863 1774 1864 if (asic_type == CHIP_ARCTURUS) { ··· 1789 1879 1790 1880 static int amdgpu_device_attr_create(struct amdgpu_device *adev, 1791 1881 struct amdgpu_device_attr *attr, 1792 - uint32_t mask) 1882 + uint32_t mask, struct list_head *attr_list) 1793 1883 { 1794 1884 int ret = 0; 1795 1885 struct device_attribute *dev_attr = &attr->dev_attr; 1796 1886 const char *name = dev_attr->attr.name; 1887 + enum amdgpu_device_attr_states attr_states = ATTR_STATE_SUPPORTED; 1888 + struct amdgpu_device_attr_entry *attr_entry; 1889 + 1797 1890 int (*attr_update)(struct amdgpu_device *adev, struct amdgpu_device_attr *attr, 1798 - uint32_t mask) = default_attr_update; 1891 + uint32_t mask, enum amdgpu_device_attr_states *states) = default_attr_update; 1799 1892 1800 1893 BUG_ON(!attr); 1801 1894 1802 1895 attr_update = attr->attr_update ? attr_update : default_attr_update; 1803 1896 1804 - ret = attr_update(adev, attr, mask); 1897 + ret = attr_update(adev, attr, mask, &attr_states); 1805 1898 if (ret) { 1806 1899 dev_err(adev->dev, "failed to update device file %s, ret = %d\n", 1807 1900 name, ret); 1808 1901 return ret; 1809 1902 } 1810 1903 1811 - /* the attr->states maybe changed after call attr->attr_update function */ 1812 - if (attr->states == ATTR_STATE_UNSUPPORTED) 1904 + if (attr_states == ATTR_STATE_UNSUPPORTED) 1813 1905 return 0; 1814 1906 1815 1907 ret = device_create_file(adev->dev, dev_attr); ··· 1820 1908 name, ret); 1821 1909 } 1822 1910 1823 - attr->states = ATTR_STATE_SUPPORTED; 1911 + attr_entry = kmalloc(sizeof(*attr_entry), GFP_KERNEL); 1912 + if (!attr_entry) 1913 + return -ENOMEM; 1914 + 1915 + attr_entry->attr = attr; 1916 + INIT_LIST_HEAD(&attr_entry->entry); 1917 + 1918 + list_add_tail(&attr_entry->entry, attr_list); 1824 1919 1825 1920 return ret; 1826 1921 } ··· 1836 1917 { 1837 1918 struct device_attribute *dev_attr = &attr->dev_attr; 1838 1919 1839 - if (attr->states == ATTR_STATE_UNSUPPORTED) 1840 - return; 1841 - 1842 1920 device_remove_file(adev->dev, dev_attr); 1843 - 1844 - attr->states = ATTR_STATE_UNSUPPORTED; 1845 1921 } 1922 + 1923 + static void amdgpu_device_attr_remove_groups(struct amdgpu_device *adev, 1924 + struct list_head *attr_list); 1846 1925 1847 1926 static int amdgpu_device_attr_create_groups(struct amdgpu_device *adev, 1848 1927 struct amdgpu_device_attr *attrs, 1849 1928 uint32_t counts, 1850 - uint32_t mask) 1929 + uint32_t mask, 1930 + struct list_head *attr_list) 1851 1931 { 1852 1932 int ret = 0; 1853 1933 uint32_t i = 0; 1854 1934 1855 1935 for (i = 0; i < counts; i++) { 1856 - ret = amdgpu_device_attr_create(adev, &attrs[i], mask); 1936 + ret = amdgpu_device_attr_create(adev, &attrs[i], mask, attr_list); 1857 1937 if (ret) 1858 1938 goto failed; 1859 1939 } ··· 1860 1942 return 0; 1861 1943 1862 1944 failed: 1863 - for (; i > 0; i--) { 1864 - amdgpu_device_attr_remove(adev, &attrs[i]); 1865 - } 1945 + amdgpu_device_attr_remove_groups(adev, attr_list); 1866 1946 1867 1947 return ret; 1868 1948 } 1869 1949 1870 1950 static void amdgpu_device_attr_remove_groups(struct amdgpu_device *adev, 1871 - struct amdgpu_device_attr *attrs, 1872 - uint32_t counts) 1951 + struct list_head *attr_list) 1873 1952 { 1874 - uint32_t i = 0; 1953 + struct amdgpu_device_attr_entry *entry, *entry_tmp; 1875 1954 1876 - for (i = 0; i < counts; i++) 1877 - amdgpu_device_attr_remove(adev, &attrs[i]); 1955 + if (list_empty(attr_list)) 1956 + return ; 1957 + 1958 + list_for_each_entry_safe(entry, entry_tmp, attr_list, entry) { 1959 + amdgpu_device_attr_remove(adev, entry->attr); 1960 + list_del(&entry->entry); 1961 + kfree(entry); 1962 + } 1878 1963 } 1879 1964 1880 1965 static ssize_t amdgpu_hwmon_show_temp(struct device *dev, ··· 3288 3367 if (adev->pm.dpm_enabled == 0) 3289 3368 return 0; 3290 3369 3370 + INIT_LIST_HEAD(&adev->pm.pm_attr_list); 3371 + 3291 3372 adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev, 3292 3373 DRIVER_NAME, adev, 3293 3374 hwmon_groups); ··· 3316 3393 ret = amdgpu_device_attr_create_groups(adev, 3317 3394 amdgpu_device_attrs, 3318 3395 ARRAY_SIZE(amdgpu_device_attrs), 3319 - mask); 3396 + mask, 3397 + &adev->pm.pm_attr_list); 3320 3398 if (ret) 3321 3399 return ret; 3322 3400 ··· 3334 3410 if (adev->pm.int_hwmon_dev) 3335 3411 hwmon_device_unregister(adev->pm.int_hwmon_dev); 3336 3412 3337 - amdgpu_device_attr_remove_groups(adev, 3338 - amdgpu_device_attrs, 3339 - ARRAY_SIZE(amdgpu_device_attrs)); 3413 + amdgpu_device_attr_remove_groups(adev, &adev->pm.pm_attr_list); 3340 3414 } 3341 3415 3342 3416 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
+8 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h
··· 47 47 struct amdgpu_device_attr { 48 48 struct device_attribute dev_attr; 49 49 enum amdgpu_device_attr_flags flags; 50 - enum amdgpu_device_attr_states states; 51 - int (*attr_update)(struct amdgpu_device *adev, 52 - struct amdgpu_device_attr* attr, 53 - uint32_t mask); 50 + int (*attr_update)(struct amdgpu_device *adev, struct amdgpu_device_attr *attr, 51 + uint32_t mask, enum amdgpu_device_attr_states *states); 52 + 53 + }; 54 + 55 + struct amdgpu_device_attr_entry { 56 + struct list_head entry; 57 + struct amdgpu_device_attr *attr; 54 58 }; 55 59 56 60 #define to_amdgpu_device_attr(_dev_attr) \ ··· 63 59 #define __AMDGPU_DEVICE_ATTR(_name, _mode, _show, _store, _flags, ...) \ 64 60 { .dev_attr = __ATTR(_name, _mode, _show, _store), \ 65 61 .flags = _flags, \ 66 - .states = ATTR_STATE_SUPPORTED, \ 67 62 ##__VA_ARGS__, } 68 63 69 64 #define AMDGPU_DEVICE_ATTR(_name, _mode, _flags, ...) \
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 1552 1552 struct amdgpu_device* adev = psp->adev; 1553 1553 struct amdgpu_firmware_info *ucode = 1554 1554 &adev->firmware.ucode[AMDGPU_UCODE_ID_SMC]; 1555 + struct amdgpu_ras *ras = psp->ras.ras; 1555 1556 1556 1557 if (!ucode->fw || amdgpu_sriov_vf(psp->adev)) 1557 1558 return 0; 1558 1559 1559 1560 1560 - if (adev->in_gpu_reset) { 1561 + if (adev->in_gpu_reset && ras && ras->supported) { 1561 1562 ret = amdgpu_dpm_set_mp1_state(adev, PP_MP1_STATE_UNLOAD); 1562 1563 if (ret) { 1563 1564 DRM_WARN("Failed to set MP1 state prepare for reload\n");
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
··· 70 70 71 71 switch (adev->asic_type) { 72 72 case CHIP_RAVEN: 73 - if (adev->rev_id >= 8) 73 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 74 74 fw_name = FIRMWARE_RAVEN2; 75 - else if (adev->pdev->device == 0x15d8) 75 + else if (adev->apu_flags & AMD_APU_IS_PICASSO) 76 76 fw_name = FIRMWARE_PICASSO; 77 77 else 78 78 fw_name = FIRMWARE_RAVEN;
+9 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 3000 3000 !amdgpu_gmc_vram_full_visible(&adev->gmc)), 3001 3001 "CPU update of VM recommended only for large BAR system\n"); 3002 3002 3003 - if (vm->use_cpu_for_update) 3003 + if (vm->use_cpu_for_update) { 3004 + /* Sync with last SDMA update/clear before switching to CPU */ 3005 + r = amdgpu_bo_sync_wait(vm->root.base.bo, 3006 + AMDGPU_FENCE_OWNER_UNDEFINED, true); 3007 + if (r) 3008 + goto free_idr; 3009 + 3004 3010 vm->update_funcs = &amdgpu_vm_cpu_funcs; 3005 - else 3011 + } else { 3006 3012 vm->update_funcs = &amdgpu_vm_sdma_funcs; 3013 + } 3007 3014 dma_fence_put(vm->last_update); 3008 3015 vm->last_update = NULL; 3009 3016 vm->is_compute_context = true;
+16 -7
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
··· 325 325 static void amdgpu_xgmi_sysfs_rem_dev_info(struct amdgpu_device *adev, 326 326 struct amdgpu_hive_info *hive) 327 327 { 328 + char node[10]; 329 + memset(node, 0, sizeof(node)); 330 + 328 331 device_remove_file(adev->dev, &dev_attr_xgmi_device_id); 329 - sysfs_remove_link(&adev->dev->kobj, adev->ddev->unique); 330 - sysfs_remove_link(hive->kobj, adev->ddev->unique); 332 + device_remove_file(adev->dev, &dev_attr_xgmi_error); 333 + 334 + if (adev != hive->adev) 335 + sysfs_remove_link(&adev->dev->kobj,"xgmi_hive_info"); 336 + 337 + sprintf(node, "node%d", hive->number_devices); 338 + sysfs_remove_link(hive->kobj, node); 339 + 331 340 } 332 341 333 342 ··· 592 583 if (!hive) 593 584 return -EINVAL; 594 585 595 - if (!(hive->number_devices--)) { 586 + task_barrier_rem_task(&hive->tb); 587 + amdgpu_xgmi_sysfs_rem_dev_info(adev, hive); 588 + mutex_unlock(&hive->hive_lock); 589 + 590 + if(!(--hive->number_devices)){ 596 591 amdgpu_xgmi_sysfs_destroy(adev, hive); 597 592 mutex_destroy(&hive->hive_lock); 598 593 mutex_destroy(&hive->reset_lock); 599 - } else { 600 - task_barrier_rem_task(&hive->tb); 601 - amdgpu_xgmi_sysfs_rem_dev_info(adev, hive); 602 - mutex_unlock(&hive->hive_lock); 603 594 } 604 595 605 596 return psp_xgmi_terminate(&adev->psp);
+8 -8
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
··· 959 959 case CHIP_RAVEN: 960 960 soc15_program_register_sequence(adev, golden_settings_gc_9_1, 961 961 ARRAY_SIZE(golden_settings_gc_9_1)); 962 - if (adev->rev_id >= 8) 962 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 963 963 soc15_program_register_sequence(adev, 964 964 golden_settings_gc_9_1_rv2, 965 965 ARRAY_SIZE(golden_settings_gc_9_1_rv2)); ··· 1274 1274 case CHIP_VEGA20: 1275 1275 break; 1276 1276 case CHIP_RAVEN: 1277 - if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) && 1277 + if (!((adev->apu_flags & AMD_APU_IS_RAVEN2) || 1278 + (adev->apu_flags & AMD_APU_IS_PICASSO)) && 1278 1279 ((!is_raven_kicker(adev) && 1279 1280 adev->gfx.rlc_fw_version < 531) || 1280 1281 (adev->gfx.rlc_feature_version < 1) || ··· 1618 1617 chip_name = "vega20"; 1619 1618 break; 1620 1619 case CHIP_RAVEN: 1621 - if (adev->rev_id >= 8) 1620 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 1622 1621 chip_name = "raven2"; 1623 - else if (adev->pdev->device == 0x15d8) 1622 + else if (adev->apu_flags & AMD_APU_IS_PICASSO) 1624 1623 chip_name = "picasso"; 1625 1624 else 1626 1625 chip_name = "raven"; ··· 2120 2119 adev->gfx.config.sc_prim_fifo_size_backend = 0x100; 2121 2120 adev->gfx.config.sc_hiz_tile_fifo_size = 0x30; 2122 2121 adev->gfx.config.sc_earlyz_tile_fifo_size = 0x4C0; 2123 - if (adev->rev_id >= 8) 2122 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 2124 2123 gb_addr_config = RAVEN2_GB_ADDR_CONFIG_GOLDEN; 2125 2124 else 2126 2125 gb_addr_config = RAVEN_GB_ADDR_CONFIG_GOLDEN; ··· 2969 2968 */ 2970 2969 if (adev->gfx.rlc.is_rlc_v2_1) { 2971 2970 if (adev->asic_type == CHIP_VEGA12 || 2972 - (adev->asic_type == CHIP_RAVEN && 2973 - adev->rev_id >= 8)) 2971 + (adev->apu_flags & AMD_APU_IS_RAVEN2)) 2974 2972 gfx_v9_1_init_rlc_save_restore_list(adev); 2975 2973 gfx_v9_0_enable_save_restore_machine(adev); 2976 2974 } ··· 6881 6881 adev->gds.gds_compute_max_wave_id = 0x27f; 6882 6882 break; 6883 6883 case CHIP_RAVEN: 6884 - if (adev->rev_id >= 0x8) 6884 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 6885 6885 adev->gds.gds_compute_max_wave_id = 0x77; /* raven2 */ 6886 6886 else 6887 6887 adev->gds.gds_compute_max_wave_id = 0x15f; /* raven1 */
+1 -1
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c
··· 80 80 WREG32_SOC15_RLC(GC, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR, 81 81 min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18); 82 82 83 - if (adev->asic_type == CHIP_RAVEN && adev->rev_id >= 0x8) 83 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 84 84 /* 85 85 * Raven2 has a HW issue that it is unable to use the 86 86 * vram which is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR.
+10 -4
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
··· 686 686 */ 687 687 static int gmc_v10_0_mc_init(struct amdgpu_device *adev) 688 688 { 689 - /* Could aper size report 0 ? */ 690 - adev->gmc.aper_base = pci_resource_start(adev->pdev, 0); 691 - adev->gmc.aper_size = pci_resource_len(adev->pdev, 0); 689 + int r; 692 690 693 691 /* size in MB on si */ 694 692 adev->gmc.mc_vram_size = 695 693 adev->nbio.funcs->get_memsize(adev) * 1024ULL * 1024ULL; 696 694 adev->gmc.real_vram_size = adev->gmc.mc_vram_size; 697 - adev->gmc.visible_vram_size = adev->gmc.aper_size; 695 + 696 + if (!(adev->flags & AMD_IS_APU)) { 697 + r = amdgpu_device_resize_fb_bar(adev); 698 + if (r) 699 + return r; 700 + } 701 + adev->gmc.aper_base = pci_resource_start(adev->pdev, 0); 702 + adev->gmc.aper_size = pci_resource_len(adev->pdev, 0); 698 703 699 704 /* In case the PCI BAR is larger than the actual amount of vram */ 705 + adev->gmc.visible_vram_size = adev->gmc.aper_size; 700 706 if (adev->gmc.visible_vram_size > adev->gmc.real_vram_size) 701 707 adev->gmc.visible_vram_size = adev->gmc.real_vram_size; 702 708
+2 -3
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
··· 441 441 return ((vmhub == AMDGPU_MMHUB_0 || 442 442 vmhub == AMDGPU_MMHUB_1) && 443 443 (!amdgpu_sriov_vf(adev)) && 444 - (!(adev->asic_type == CHIP_RAVEN && 445 - adev->rev_id < 0x8 && 446 - adev->pdev->device == 0x15d8))); 444 + (!(!(adev->apu_flags & AMD_APU_IS_RAVEN2) && 445 + (adev->apu_flags & AMD_APU_IS_PICASSO)))); 447 446 } 448 447 449 448 static bool gmc_v9_0_get_atc_vmid_pasid_mapping_info(struct amdgpu_device *adev,
-1
drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
··· 268 268 data = RREG32_SOC15(JPEG, inst, mmJPEG_CGC_GATE); 269 269 data &= ~(JPEG_CGC_GATE__JPEG_DEC_MASK 270 270 | JPEG_CGC_GATE__JPEG2_DEC_MASK 271 - | JPEG_CGC_GATE__JPEG_ENC_MASK 272 271 | JPEG_CGC_GATE__JMCIF_MASK 273 272 | JPEG_CGC_GATE__JRBBM_MASK); 274 273 WREG32_SOC15(JPEG, inst, mmJPEG_CGC_GATE, data);
+1 -1
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
··· 96 96 WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR, 97 97 min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18); 98 98 99 - if (adev->asic_type == CHIP_RAVEN && adev->rev_id >= 0x8) 99 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 100 100 /* 101 101 * Raven2 has a HW issue that it is unable to use the vram which 102 102 * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the
-8
drivers/gpu/drm/amd/amdgpu/nv.c
··· 548 548 return true; 549 549 } 550 550 551 - static void nv_get_pcie_usage(struct amdgpu_device *adev, 552 - uint64_t *count0, 553 - uint64_t *count1) 554 - { 555 - /*TODO*/ 556 - } 557 - 558 551 static bool nv_need_reset_on_init(struct amdgpu_device *adev) 559 552 { 560 553 #if 0 ··· 622 629 .invalidate_hdp = &nv_invalidate_hdp, 623 630 .init_doorbell_index = &nv_init_doorbell_index, 624 631 .need_full_reset = &nv_need_full_reset, 625 - .get_pcie_usage = &nv_get_pcie_usage, 626 632 .need_reset_on_init = &nv_need_reset_on_init, 627 633 .get_pcie_replay_count = &nv_get_pcie_replay_count, 628 634 .supports_baco = &nv_asic_supports_baco,
+2 -2
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
··· 55 55 56 56 switch (adev->asic_type) { 57 57 case CHIP_RAVEN: 58 - if (adev->rev_id >= 0x8) 58 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 59 59 chip_name = "raven2"; 60 - else if (adev->pdev->device == 0x15d8) 60 + else if (adev->apu_flags & AMD_APU_IS_PICASSO) 61 61 chip_name = "picasso"; 62 62 else 63 63 chip_name = "raven";
+3 -3
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
··· 486 486 soc15_program_register_sequence(adev, 487 487 golden_settings_sdma_4_1, 488 488 ARRAY_SIZE(golden_settings_sdma_4_1)); 489 - if (adev->rev_id >= 8) 489 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 490 490 soc15_program_register_sequence(adev, 491 491 golden_settings_sdma_rv2, 492 492 ARRAY_SIZE(golden_settings_sdma_rv2)); ··· 575 575 chip_name = "vega20"; 576 576 break; 577 577 case CHIP_RAVEN: 578 - if (adev->rev_id >= 8) 578 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 579 579 chip_name = "raven2"; 580 - else if (adev->pdev->device == 0x15d8) 580 + else if (adev->apu_flags & AMD_APU_IS_PICASSO) 581 581 chip_name = "picasso"; 582 582 else 583 583 chip_name = "raven";
+13 -4
drivers/gpu/drm/amd/amdgpu/soc15.c
··· 564 564 static int soc15_asic_reset(struct amdgpu_device *adev) 565 565 { 566 566 /* original raven doesn't have full asic reset */ 567 - if (adev->pdev->device == 0x15dd && adev->rev_id < 0x8) 567 + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && 568 + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) 568 569 return 0; 569 570 570 571 switch (soc15_asic_reset_method(adev)) { ··· 1130 1129 break; 1131 1130 case CHIP_RAVEN: 1132 1131 adev->asic_funcs = &soc15_asic_funcs; 1132 + if (adev->pdev->device == 0x15dd) 1133 + adev->apu_flags |= AMD_APU_IS_RAVEN; 1134 + if (adev->pdev->device == 0x15d8) 1135 + adev->apu_flags |= AMD_APU_IS_PICASSO; 1133 1136 if (adev->rev_id >= 0x8) 1137 + adev->apu_flags |= AMD_APU_IS_RAVEN2; 1138 + 1139 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) 1134 1140 adev->external_rev_id = adev->rev_id + 0x79; 1135 - else if (adev->pdev->device == 0x15d8) 1141 + else if (adev->apu_flags & AMD_APU_IS_PICASSO) 1136 1142 adev->external_rev_id = adev->rev_id + 0x41; 1137 1143 else if (adev->rev_id == 1) 1138 1144 adev->external_rev_id = adev->rev_id + 0x20; 1139 1145 else 1140 1146 adev->external_rev_id = adev->rev_id + 0x01; 1141 1147 1142 - if (adev->rev_id >= 0x8) { 1148 + if (adev->apu_flags & AMD_APU_IS_RAVEN2) { 1143 1149 adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | 1144 1150 AMD_CG_SUPPORT_GFX_MGLS | 1145 1151 AMD_CG_SUPPORT_GFX_CP_LS | ··· 1164 1156 AMD_CG_SUPPORT_VCN_MGCG; 1165 1157 1166 1158 adev->pg_flags = AMD_PG_SUPPORT_SDMA | AMD_PG_SUPPORT_VCN; 1167 - } else if (adev->pdev->device == 0x15d8) { 1159 + } else if (adev->apu_flags & AMD_APU_IS_PICASSO) { 1168 1160 adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | 1169 1161 AMD_CG_SUPPORT_GFX_MGLS | 1170 1162 AMD_CG_SUPPORT_GFX_CP_LS | ··· 1230 1222 break; 1231 1223 case CHIP_RENOIR: 1232 1224 adev->asic_funcs = &soc15_asic_funcs; 1225 + adev->apu_flags |= AMD_APU_IS_RENOIR; 1233 1226 adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | 1234 1227 AMD_CG_SUPPORT_GFX_MGLS | 1235 1228 AMD_CG_SUPPORT_GFX_3D_CGCG |
-9
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
··· 1453 1453 WREG32_SOC15(VCN, inst_idx, mmUVD_RB_WPTR2, lower_32_bits(ring->wptr)); 1454 1454 fw_shared->multi_queue.encode_lowlatency_queue_mode &= ~FW_QUEUE_RING_RESET; 1455 1455 1456 - fw_shared->multi_queue.decode_queue_mode |= FW_QUEUE_RING_RESET; 1457 - WREG32_SOC15(VCN, inst_idx, mmUVD_RBC_RB_WPTR, 1458 - RREG32_SOC15(VCN, inst_idx, mmUVD_SCRATCH2) & 0x7FFFFFFF); 1459 - fw_shared->multi_queue.decode_queue_mode &= ~FW_QUEUE_RING_RESET; 1460 - 1461 1456 /* Unstall DPG */ 1462 1457 WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS), 1463 1458 0, ~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK); ··· 1513 1518 static void vcn_v2_5_dec_ring_set_wptr(struct amdgpu_ring *ring) 1514 1519 { 1515 1520 struct amdgpu_device *adev = ring->adev; 1516 - 1517 - if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) 1518 - WREG32_SOC15(VCN, ring->me, mmUVD_SCRATCH2, 1519 - lower_32_bits(ring->wptr) | 0x80000000); 1520 1521 1521 1522 if (ring->use_doorbell) { 1522 1523 adev->wb.wb[ring->wptr_offs] = lower_32_bits(ring->wptr);
+2 -2
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c
··· 37 37 vmid = SOC15_VMID_FROM_IH_ENTRY(ih_ring_entry); 38 38 if (vmid < dev->vm_info.first_vmid_kfd || 39 39 vmid > dev->vm_info.last_vmid_kfd) 40 - return 0; 40 + return false; 41 41 42 42 source_id = SOC15_SOURCE_ID_FROM_IH_ENTRY(ih_ring_entry); 43 43 client_id = SOC15_CLIENT_ID_FROM_IH_ENTRY(ih_ring_entry); ··· 69 69 70 70 /* If there is no valid PASID, it's likely a bug */ 71 71 if (WARN_ONCE(pasid == 0, "Bug: No PASID in KFD interrupt")) 72 - return 0; 72 + return false; 73 73 74 74 /* Interrupt types we care about: various signals and faults. 75 75 * They will be forwarded to a work queue (see below).
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
··· 192 192 193 193 dev_warn_ratelimited(kfd_device, 194 194 "Invalid PPR device %x:%x.%x pasid 0x%x address 0x%lX flags 0x%X", 195 - PCI_BUS_NUM(pdev->devfn), 195 + pdev->bus->number, 196 196 PCI_SLOT(pdev->devfn), 197 197 PCI_FUNC(pdev->devfn), 198 198 pasid,
+268 -49
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 918 918 goto error; 919 919 } 920 920 921 + if (amdgpu_dc_debug_mask & DC_DISABLE_PIPE_SPLIT) { 922 + adev->dm.dc->debug.force_single_disp_pipe_split = false; 923 + adev->dm.dc->debug.pipe_split_policy = MPC_SPLIT_AVOID; 924 + } 925 + 926 + if (adev->asic_type != CHIP_CARRIZO && adev->asic_type != CHIP_STONEY) 927 + adev->dm.dc->debug.disable_stutter = amdgpu_pp_feature_mask & PP_STUTTER_MODE ? false : true; 928 + 929 + if (amdgpu_dc_debug_mask & DC_DISABLE_STUTTER) 930 + adev->dm.dc->debug.disable_stutter = true; 931 + 932 + if (amdgpu_dc_debug_mask & DC_DISABLE_DSC) 933 + adev->dm.dc->debug.disable_dsc = true; 934 + 935 + if (amdgpu_dc_debug_mask & DC_DISABLE_CLOCK_GATING) 936 + adev->dm.dc->debug.disable_clock_gate = true; 937 + 921 938 r = dm_dmub_hw_init(adev); 922 939 if (r) { 923 940 DRM_ERROR("DMUB interface failed to initialize: status=%d\n", r); ··· 1538 1521 return 0; 1539 1522 } 1540 1523 1524 + 1525 + static int dm_enable_vblank(struct drm_crtc *crtc); 1526 + static void dm_disable_vblank(struct drm_crtc *crtc); 1527 + 1528 + static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev, 1529 + struct dc_state *state, bool enable) 1530 + { 1531 + enum dc_irq_source irq_source; 1532 + struct amdgpu_crtc *acrtc; 1533 + int rc = -EBUSY; 1534 + int i = 0; 1535 + 1536 + for (i = 0; i < state->stream_count; i++) { 1537 + acrtc = get_crtc_by_otg_inst( 1538 + adev, state->stream_status[i].primary_otg_inst); 1539 + 1540 + if (acrtc && state->stream_status[i].plane_count != 0) { 1541 + irq_source = IRQ_TYPE_PFLIP + acrtc->otg_inst; 1542 + rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY; 1543 + DRM_DEBUG("crtc %d - vupdate irq %sabling: r=%d\n", 1544 + acrtc->crtc_id, enable ? "en" : "dis", rc); 1545 + if (rc) 1546 + DRM_WARN("Failed to %s pflip interrupts\n", 1547 + enable ? "enable" : "disable"); 1548 + 1549 + if (enable) { 1550 + rc = dm_enable_vblank(&acrtc->base); 1551 + if (rc) 1552 + DRM_WARN("Failed to enable vblank interrupts\n"); 1553 + } else { 1554 + dm_disable_vblank(&acrtc->base); 1555 + } 1556 + 1557 + } 1558 + } 1559 + 1560 + } 1561 + 1562 + enum dc_status amdgpu_dm_commit_zero_streams(struct dc *dc) 1563 + { 1564 + struct dc_state *context = NULL; 1565 + enum dc_status res = DC_ERROR_UNEXPECTED; 1566 + int i; 1567 + struct dc_stream_state *del_streams[MAX_PIPES]; 1568 + int del_streams_count = 0; 1569 + 1570 + memset(del_streams, 0, sizeof(del_streams)); 1571 + 1572 + context = dc_create_state(dc); 1573 + if (context == NULL) 1574 + goto context_alloc_fail; 1575 + 1576 + dc_resource_state_copy_construct_current(dc, context); 1577 + 1578 + /* First remove from context all streams */ 1579 + for (i = 0; i < context->stream_count; i++) { 1580 + struct dc_stream_state *stream = context->streams[i]; 1581 + 1582 + del_streams[del_streams_count++] = stream; 1583 + } 1584 + 1585 + /* Remove all planes for removed streams and then remove the streams */ 1586 + for (i = 0; i < del_streams_count; i++) { 1587 + if (!dc_rem_all_planes_for_stream(dc, del_streams[i], context)) { 1588 + res = DC_FAIL_DETACH_SURFACES; 1589 + goto fail; 1590 + } 1591 + 1592 + res = dc_remove_stream_from_ctx(dc, context, del_streams[i]); 1593 + if (res != DC_OK) 1594 + goto fail; 1595 + } 1596 + 1597 + 1598 + res = dc_validate_global_state(dc, context, false); 1599 + 1600 + if (res != DC_OK) { 1601 + DRM_ERROR("%s:resource validation failed, dc_status:%d\n", __func__, res); 1602 + goto fail; 1603 + } 1604 + 1605 + res = dc_commit_state(dc, context); 1606 + 1607 + fail: 1608 + dc_release_state(context); 1609 + 1610 + context_alloc_fail: 1611 + return res; 1612 + } 1613 + 1541 1614 static int dm_suspend(void *handle) 1542 1615 { 1543 1616 struct amdgpu_device *adev = handle; 1544 1617 struct amdgpu_display_manager *dm = &adev->dm; 1618 + int ret = 0; 1619 + 1620 + if (adev->in_gpu_reset) { 1621 + mutex_lock(&dm->dc_lock); 1622 + dm->cached_dc_state = dc_copy_state(dm->dc->current_state); 1623 + 1624 + dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false); 1625 + 1626 + amdgpu_dm_commit_zero_streams(dm->dc); 1627 + 1628 + amdgpu_dm_irq_suspend(adev); 1629 + 1630 + return ret; 1631 + } 1545 1632 1546 1633 WARN_ON(adev->dm.cached_state); 1547 1634 adev->dm.cached_state = drm_atomic_helper_suspend(adev->ddev); ··· 1761 1640 1762 1641 } 1763 1642 1643 + static void dm_gpureset_commit_state(struct dc_state *dc_state, 1644 + struct amdgpu_display_manager *dm) 1645 + { 1646 + struct { 1647 + struct dc_surface_update surface_updates[MAX_SURFACES]; 1648 + struct dc_plane_info plane_infos[MAX_SURFACES]; 1649 + struct dc_scaling_info scaling_infos[MAX_SURFACES]; 1650 + struct dc_flip_addrs flip_addrs[MAX_SURFACES]; 1651 + struct dc_stream_update stream_update; 1652 + } * bundle; 1653 + int k, m; 1654 + 1655 + bundle = kzalloc(sizeof(*bundle), GFP_KERNEL); 1656 + 1657 + if (!bundle) { 1658 + dm_error("Failed to allocate update bundle\n"); 1659 + goto cleanup; 1660 + } 1661 + 1662 + for (k = 0; k < dc_state->stream_count; k++) { 1663 + bundle->stream_update.stream = dc_state->streams[k]; 1664 + 1665 + for (m = 0; m < dc_state->stream_status->plane_count; m++) { 1666 + bundle->surface_updates[m].surface = 1667 + dc_state->stream_status->plane_states[m]; 1668 + bundle->surface_updates[m].surface->force_full_update = 1669 + true; 1670 + } 1671 + dc_commit_updates_for_stream( 1672 + dm->dc, bundle->surface_updates, 1673 + dc_state->stream_status->plane_count, 1674 + dc_state->streams[k], &bundle->stream_update, dc_state); 1675 + } 1676 + 1677 + cleanup: 1678 + kfree(bundle); 1679 + 1680 + return; 1681 + } 1682 + 1764 1683 static int dm_resume(void *handle) 1765 1684 { 1766 1685 struct amdgpu_device *adev = handle; ··· 1817 1656 struct dm_plane_state *dm_new_plane_state; 1818 1657 struct dm_atomic_state *dm_state = to_dm_atomic_state(dm->atomic_obj.state); 1819 1658 enum dc_connection_type new_connection_type = dc_connection_none; 1820 - int i, r; 1659 + struct dc_state *dc_state; 1660 + int i, r, j; 1821 1661 1662 + if (adev->in_gpu_reset) { 1663 + dc_state = dm->cached_dc_state; 1664 + 1665 + r = dm_dmub_hw_init(adev); 1666 + if (r) 1667 + DRM_ERROR("DMUB interface failed to initialize: status=%d\n", r); 1668 + 1669 + dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0); 1670 + dc_resume(dm->dc); 1671 + 1672 + amdgpu_dm_irq_resume_early(adev); 1673 + 1674 + for (i = 0; i < dc_state->stream_count; i++) { 1675 + dc_state->streams[i]->mode_changed = true; 1676 + for (j = 0; j < dc_state->stream_status->plane_count; j++) { 1677 + dc_state->stream_status->plane_states[j]->update_flags.raw 1678 + = 0xffffffff; 1679 + } 1680 + } 1681 + 1682 + WARN_ON(!dc_commit_state(dm->dc, dc_state)); 1683 + 1684 + dm_gpureset_commit_state(dm->cached_dc_state, dm); 1685 + 1686 + dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, true); 1687 + 1688 + dc_release_state(dm->cached_dc_state); 1689 + dm->cached_dc_state = NULL; 1690 + 1691 + amdgpu_dm_irq_resume_late(adev); 1692 + 1693 + mutex_unlock(&dm->dc_lock); 1694 + 1695 + return 0; 1696 + } 1822 1697 /* Recreate dc_state - DC invalidates it when setting power state to S3. */ 1823 1698 dc_release_state(dm_state->context); 1824 1699 dm_state->context = dc_create_state(dm->dc); ··· 3219 3022 goto fail; 3220 3023 } 3221 3024 3222 - if (adev->asic_type != CHIP_CARRIZO && adev->asic_type != CHIP_STONEY) 3223 - dm->dc->debug.disable_stutter = amdgpu_pp_feature_mask & PP_STUTTER_MODE ? false : true; 3224 - 3225 3025 /* No userspace support. */ 3226 3026 dm->dc->debug.disable_tri_buf = true; 3227 3027 ··· 3845 3651 case DRM_FORMAT_ARGB16161616F: 3846 3652 plane_info->format = SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F; 3847 3653 break; 3654 + case DRM_FORMAT_XBGR16161616F: 3655 + case DRM_FORMAT_ABGR16161616F: 3656 + plane_info->format = SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F; 3657 + break; 3848 3658 default: 3849 3659 DRM_ERROR( 3850 3660 "Unsupported screen format %s\n", ··· 4020 3822 4021 3823 static enum dc_color_depth 4022 3824 convert_color_depth_from_display_info(const struct drm_connector *connector, 4023 - const struct drm_connector_state *state, 4024 - bool is_y420) 3825 + bool is_y420, int requested_bpc) 4025 3826 { 4026 3827 uint8_t bpc; 4027 3828 ··· 4040 3843 bpc = bpc ? bpc : 8; 4041 3844 } 4042 3845 4043 - if (!state) 4044 - state = connector->state; 4045 - 4046 - if (state) { 3846 + if (requested_bpc > 0) { 4047 3847 /* 4048 3848 * Cap display bpc based on the user requested value. 4049 3849 * ··· 4049 3855 * or if this was called outside of atomic check, so it 4050 3856 * can't be used directly. 4051 3857 */ 4052 - bpc = min(bpc, state->max_requested_bpc); 3858 + bpc = min_t(u8, bpc, requested_bpc); 4053 3859 4054 3860 /* Round down to the nearest even number. */ 4055 3861 bpc = bpc - (bpc & 1); ··· 4171 3977 const struct drm_display_mode *mode_in, 4172 3978 const struct drm_connector *connector, 4173 3979 const struct drm_connector_state *connector_state, 4174 - const struct dc_stream_state *old_stream) 3980 + const struct dc_stream_state *old_stream, 3981 + int requested_bpc) 4175 3982 { 4176 3983 struct dc_crtc_timing *timing_out = &stream->timing; 4177 3984 const struct drm_display_info *info = &connector->display_info; ··· 4202 4007 4203 4008 timing_out->timing_3d_format = TIMING_3D_FORMAT_NONE; 4204 4009 timing_out->display_color_depth = convert_color_depth_from_display_info( 4205 - connector, connector_state, 4206 - (timing_out->pixel_encoding == PIXEL_ENCODING_YCBCR420)); 4010 + connector, 4011 + (timing_out->pixel_encoding == PIXEL_ENCODING_YCBCR420), 4012 + requested_bpc); 4207 4013 timing_out->scan_type = SCANNING_TYPE_NODATA; 4208 4014 timing_out->hdmi_vic = 0; 4209 4015 ··· 4410 4214 create_stream_for_sink(struct amdgpu_dm_connector *aconnector, 4411 4215 const struct drm_display_mode *drm_mode, 4412 4216 const struct dm_connector_state *dm_state, 4413 - const struct dc_stream_state *old_stream) 4217 + const struct dc_stream_state *old_stream, 4218 + int requested_bpc) 4414 4219 { 4415 4220 struct drm_display_mode *preferred_mode = NULL; 4416 4221 struct drm_connector *drm_connector; ··· 4496 4299 */ 4497 4300 if (!scale || mode_refresh != preferred_refresh) 4498 4301 fill_stream_properties_from_drm_display_mode(stream, 4499 - &mode, &aconnector->base, con_state, NULL); 4302 + &mode, &aconnector->base, con_state, NULL, requested_bpc); 4500 4303 else 4501 4304 fill_stream_properties_from_drm_display_mode(stream, 4502 - &mode, &aconnector->base, con_state, old_stream); 4305 + &mode, &aconnector->base, con_state, old_stream, requested_bpc); 4503 4306 4504 4307 stream->timing.flags.DSC = 0; 4505 4308 ··· 5018 4821 create_eml_sink(aconnector); 5019 4822 } 5020 4823 4824 + static struct dc_stream_state * 4825 + create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector, 4826 + const struct drm_display_mode *drm_mode, 4827 + const struct dm_connector_state *dm_state, 4828 + const struct dc_stream_state *old_stream) 4829 + { 4830 + struct drm_connector *connector = &aconnector->base; 4831 + struct amdgpu_device *adev = connector->dev->dev_private; 4832 + struct dc_stream_state *stream; 4833 + int requested_bpc = connector->state ? connector->state->max_requested_bpc : 8; 4834 + enum dc_status dc_result = DC_OK; 4835 + 4836 + do { 4837 + stream = create_stream_for_sink(aconnector, drm_mode, 4838 + dm_state, old_stream, 4839 + requested_bpc); 4840 + if (stream == NULL) { 4841 + DRM_ERROR("Failed to create stream for sink!\n"); 4842 + break; 4843 + } 4844 + 4845 + dc_result = dc_validate_stream(adev->dm.dc, stream); 4846 + 4847 + if (dc_result != DC_OK) { 4848 + DRM_DEBUG_KMS("Mode %dx%d (clk %d) failed DC validation with error %d\n", 4849 + drm_mode->hdisplay, 4850 + drm_mode->vdisplay, 4851 + drm_mode->clock, 4852 + dc_result); 4853 + 4854 + dc_stream_release(stream); 4855 + stream = NULL; 4856 + requested_bpc -= 2; /* lower bpc to retry validation */ 4857 + } 4858 + 4859 + } while (stream == NULL && requested_bpc >= 6); 4860 + 4861 + return stream; 4862 + } 4863 + 5021 4864 enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connector, 5022 4865 struct drm_display_mode *mode) 5023 4866 { 5024 4867 int result = MODE_ERROR; 5025 4868 struct dc_sink *dc_sink; 5026 - struct amdgpu_device *adev = connector->dev->dev_private; 5027 4869 /* TODO: Unhardcode stream count */ 5028 4870 struct dc_stream_state *stream; 5029 4871 struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); 5030 - enum dc_status dc_result = DC_OK; 5031 4872 5032 4873 if ((mode->flags & DRM_MODE_FLAG_INTERLACE) || 5033 4874 (mode->flags & DRM_MODE_FLAG_DBLSCAN)) ··· 5086 4851 goto fail; 5087 4852 } 5088 4853 5089 - stream = create_stream_for_sink(aconnector, mode, NULL, NULL); 5090 - if (stream == NULL) { 5091 - DRM_ERROR("Failed to create stream for sink!\n"); 5092 - goto fail; 5093 - } 5094 - 5095 - dc_result = dc_validate_stream(adev->dm.dc, stream); 5096 - 5097 - if (dc_result == DC_OK) 4854 + stream = create_validate_stream_for_sink(aconnector, mode, NULL, NULL); 4855 + if (stream) { 4856 + dc_stream_release(stream); 5098 4857 result = MODE_OK; 5099 - else 5100 - DRM_DEBUG_KMS("Mode %dx%d (clk %d) failed DC validation with error %d\n", 5101 - mode->hdisplay, 5102 - mode->vdisplay, 5103 - mode->clock, 5104 - dc_result); 5105 - 5106 - dc_stream_release(stream); 4858 + } 5107 4859 5108 4860 fail: 5109 4861 /* TODO: error handling*/ ··· 5413 5191 return 0; 5414 5192 5415 5193 if (!state->duplicated) { 5194 + int max_bpc = conn_state->max_requested_bpc; 5416 5195 is_y420 = drm_mode_is_420_also(&connector->display_info, adjusted_mode) && 5417 5196 aconnector->force_yuv420_output; 5418 - color_depth = convert_color_depth_from_display_info(connector, conn_state, 5419 - is_y420); 5197 + color_depth = convert_color_depth_from_display_info(connector, 5198 + is_y420, 5199 + max_bpc); 5420 5200 bpp = convert_dc_color_depth_into_bpc(color_depth) * 3; 5421 5201 clock = adjusted_mode->clock; 5422 5202 dm_new_connector_state->pbn = drm_dp_calc_pbn_mode(clock, bpp, false); ··· 5790 5566 if (plane_cap && plane_cap->pixel_format_support.fp16) { 5791 5567 formats[num_formats++] = DRM_FORMAT_XRGB16161616F; 5792 5568 formats[num_formats++] = DRM_FORMAT_ARGB16161616F; 5569 + formats[num_formats++] = DRM_FORMAT_XBGR16161616F; 5570 + formats[num_formats++] = DRM_FORMAT_ABGR16161616F; 5793 5571 } 5794 5572 break; 5795 5573 ··· 7848 7622 if (!drm_atomic_crtc_needs_modeset(new_crtc_state)) 7849 7623 goto skip_modeset; 7850 7624 7851 - new_stream = create_stream_for_sink(aconnector, 7852 - &new_crtc_state->mode, 7853 - dm_new_conn_state, 7854 - dm_old_crtc_state->stream); 7625 + new_stream = create_validate_stream_for_sink(aconnector, 7626 + &new_crtc_state->mode, 7627 + dm_new_conn_state, 7628 + dm_old_crtc_state->stream); 7855 7629 7856 7630 /* 7857 7631 * we can have no stream on ACTION_SET if a display ··· 8133 7907 (new_plane_state->crtc_h > new_acrtc->max_cursor_height)) { 8134 7908 DRM_DEBUG_ATOMIC("Bad cursor size %d x %d\n", 8135 7909 new_plane_state->crtc_w, new_plane_state->crtc_h); 8136 - return -EINVAL; 8137 - } 8138 - 8139 - if (new_plane_state->crtc_x <= -new_acrtc->max_cursor_width || 8140 - new_plane_state->crtc_y <= -new_acrtc->max_cursor_height) { 8141 - DRM_DEBUG_ATOMIC("Bad cursor position %d, %d\n", 8142 - new_plane_state->crtc_x, new_plane_state->crtc_y); 8143 7910 return -EINVAL; 8144 7911 } 8145 7912
+1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
··· 315 315 #endif 316 316 317 317 struct drm_atomic_state *cached_state; 318 + struct dc_state *cached_dc_state; 318 319 319 320 struct dm_comressor_info compressor; 320 321
+20 -1
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c
··· 690 690 struct dc_debug_options *dbg, 691 691 struct dc_state *context) 692 692 { 693 + int i; 694 + 695 + for (i = 0; i < MAX_PIPES; i++) { 696 + struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; 697 + 698 + /** 699 + * Workaround for avoiding pipe-split in cases where we'd split 700 + * planes that are too small, resulting in splits that aren't 701 + * valid for the scaler. 702 + */ 703 + if (pipe->plane_state && 704 + (pipe->plane_state->dst_rect.width <= 16 || 705 + pipe->plane_state->dst_rect.height <= 16 || 706 + pipe->plane_state->src_rect.width <= 16 || 707 + pipe->plane_state->src_rect.height <= 16)) { 708 + hack_disable_optional_pipe_split(v); 709 + return; 710 + } 711 + } 712 + 693 713 if (dbg->pipe_split_policy == MPC_SPLIT_AVOID) 694 714 hack_disable_optional_pipe_split(v); 695 715 ··· 721 701 dbg->force_single_disp_pipe_split) 722 702 hack_force_pipe_split(v, context->streams[0]->timing.pix_clk_100hz); 723 703 } 724 - 725 704 726 705 unsigned int get_highest_allowed_voltage_level(uint32_t hw_internal_rev, uint32_t pci_revision_id) 727 706 {
+8
drivers/gpu/drm/amd/display/dc/core/dc_link.c
··· 3245 3245 dp_set_dsc_enable(pipe_ctx, true); 3246 3246 3247 3247 } 3248 + 3249 + if (pipe_ctx->stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) { 3250 + core_link_set_avmute(pipe_ctx, false); 3251 + } 3248 3252 } 3249 3253 3250 3254 void core_link_disable_stream(struct pipe_ctx *pipe_ctx) ··· 3260 3256 if (!IS_DIAG_DC(dc->ctx->dce_environment) && 3261 3257 dc_is_virtual_signal(pipe_ctx->stream->signal)) 3262 3258 return; 3259 + 3260 + if (pipe_ctx->stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) { 3261 + core_link_set_avmute(pipe_ctx, true); 3262 + } 3263 3263 3264 3264 #if defined(CONFIG_DRM_AMD_DC_HDCP) 3265 3265 update_psp_stream_config(pipe_ctx, true);
+22 -6
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 532 532 *flip_horz_scan_dir = !*flip_horz_scan_dir; 533 533 } 534 534 535 + int get_num_mpc_splits(struct pipe_ctx *pipe) 536 + { 537 + int mpc_split_count = 0; 538 + struct pipe_ctx *other_pipe = pipe->bottom_pipe; 539 + 540 + while (other_pipe && other_pipe->plane_state == pipe->plane_state) { 541 + mpc_split_count++; 542 + other_pipe = other_pipe->bottom_pipe; 543 + } 544 + other_pipe = pipe->top_pipe; 545 + while (other_pipe && other_pipe->plane_state == pipe->plane_state) { 546 + mpc_split_count++; 547 + other_pipe = other_pipe->top_pipe; 548 + } 549 + 550 + return mpc_split_count; 551 + } 552 + 535 553 int get_num_odm_splits(struct pipe_ctx *pipe) 536 554 { 537 555 int odm_split_count = 0; ··· 574 556 /*Check for mpc split*/ 575 557 struct pipe_ctx *split_pipe = pipe_ctx->top_pipe; 576 558 559 + *split_count = get_num_mpc_splits(pipe_ctx); 577 560 while (split_pipe && split_pipe->plane_state == pipe_ctx->plane_state) { 578 561 (*split_idx)++; 579 - (*split_count)++; 580 562 split_pipe = split_pipe->top_pipe; 581 - } 582 - split_pipe = pipe_ctx->bottom_pipe; 583 - while (split_pipe && split_pipe->plane_state == pipe_ctx->plane_state) { 584 - (*split_count)++; 585 - split_pipe = split_pipe->bottom_pipe; 586 563 } 587 564 } else { 588 565 /*Get odm split index*/ ··· 2677 2664 2678 2665 if (false == pipe_ctx_old->stream->link->link_state_valid && 2679 2666 false == pipe_ctx_old->stream->dpms_off) 2667 + return true; 2668 + 2669 + if (pipe_ctx_old->stream_res.dsc != pipe_ctx->stream_res.dsc) 2680 2670 return true; 2681 2671 2682 2672 return false;
+1 -1
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
··· 411 411 .pixel_format_support = { 412 412 .argb8888 = true, 413 413 .nv12 = false, 414 - .fp16 = false 414 + .fp16 = true 415 415 }, 416 416 417 417 .max_upscale_factor = {
+1 -1
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
··· 516 516 .pixel_format_support = { 517 517 .argb8888 = true, 518 518 .nv12 = false, 519 - .fp16 = false 519 + .fp16 = true 520 520 }, 521 521 522 522 .max_upscale_factor = {
-1
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
··· 93 93 void hubbub1_allow_self_refresh_control(struct hubbub *hubbub, bool allow) 94 94 { 95 95 struct dcn10_hubbub *hubbub1 = TO_DCN10_HUBBUB(hubbub); 96 - 97 96 /* 98 97 * DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_ENABLE = 1 means do not allow stutter 99 98 * DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_ENABLE = 0 means allow stutter
+72 -2
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
··· 737 737 if (dc->res_pool->hubbub->funcs->allow_self_refresh_control) 738 738 if (allow_self_fresh_force_enable == false && 739 739 dc->res_pool->hubbub->funcs->is_allow_self_refresh_enabled(dc->res_pool->hubbub)) 740 - dc->res_pool->hubbub->funcs->allow_self_refresh_control(dc->res_pool->hubbub, true); 740 + dc->res_pool->hubbub->funcs->allow_self_refresh_control(dc->res_pool->hubbub, 741 + !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter); 741 742 742 743 } 743 744 ··· 1683 1682 hws->funcs.verify_allow_pstate_change_high(dc); 1684 1683 } 1685 1684 1685 + /** 1686 + * delay_cursor_until_vupdate() - Delay cursor update if too close to VUPDATE. 1687 + * 1688 + * Software keepout workaround to prevent cursor update locking from stalling 1689 + * out cursor updates indefinitely or from old values from being retained in 1690 + * the case where the viewport changes in the same frame as the cursor. 1691 + * 1692 + * The idea is to calculate the remaining time from VPOS to VUPDATE. If it's 1693 + * too close to VUPDATE, then stall out until VUPDATE finishes. 1694 + * 1695 + * TODO: Optimize cursor programming to be once per frame before VUPDATE 1696 + * to avoid the need for this workaround. 1697 + */ 1698 + static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx) 1699 + { 1700 + struct dc_stream_state *stream = pipe_ctx->stream; 1701 + struct crtc_position position; 1702 + uint32_t vupdate_start, vupdate_end; 1703 + unsigned int lines_to_vupdate, us_to_vupdate, vpos; 1704 + unsigned int us_per_line, us_vupdate; 1705 + 1706 + if (!dc->hwss.calc_vupdate_position || !dc->hwss.get_position) 1707 + return; 1708 + 1709 + if (!pipe_ctx->stream_res.stream_enc || !pipe_ctx->stream_res.tg) 1710 + return; 1711 + 1712 + dc->hwss.calc_vupdate_position(dc, pipe_ctx, &vupdate_start, 1713 + &vupdate_end); 1714 + 1715 + dc->hwss.get_position(&pipe_ctx, 1, &position); 1716 + vpos = position.vertical_count; 1717 + 1718 + /* Avoid wraparound calculation issues */ 1719 + vupdate_start += stream->timing.v_total; 1720 + vupdate_end += stream->timing.v_total; 1721 + vpos += stream->timing.v_total; 1722 + 1723 + if (vpos <= vupdate_start) { 1724 + /* VPOS is in VACTIVE or back porch. */ 1725 + lines_to_vupdate = vupdate_start - vpos; 1726 + } else if (vpos > vupdate_end) { 1727 + /* VPOS is in the front porch. */ 1728 + return; 1729 + } else { 1730 + /* VPOS is in VUPDATE. */ 1731 + lines_to_vupdate = 0; 1732 + } 1733 + 1734 + /* Calculate time until VUPDATE in microseconds. */ 1735 + us_per_line = 1736 + stream->timing.h_total * 10000u / stream->timing.pix_clk_100hz; 1737 + us_to_vupdate = lines_to_vupdate * us_per_line; 1738 + 1739 + /* 70 us is a conservative estimate of cursor update time*/ 1740 + if (us_to_vupdate > 70) 1741 + return; 1742 + 1743 + /* Stall out until the cursor update completes. */ 1744 + if (vupdate_end < vupdate_start) 1745 + vupdate_end += stream->timing.v_total; 1746 + us_vupdate = (vupdate_end - vupdate_start + 1) * us_per_line; 1747 + udelay(us_to_vupdate + us_vupdate); 1748 + } 1749 + 1686 1750 void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock) 1687 1751 { 1688 1752 /* cursor lock is per MPCC tree, so only need to lock one pipe per stream */ 1689 1753 if (!pipe || pipe->top_pipe) 1690 1754 return; 1755 + 1756 + /* Prevent cursor lock from stalling out cursor updates. */ 1757 + if (lock) 1758 + delay_cursor_until_vupdate(dc, pipe); 1691 1759 1692 1760 dc->res_pool->mpc->funcs->cursor_lock(dc->res_pool->mpc, 1693 1761 pipe->stream_res.opp->inst, lock); ··· 3371 3301 return vertical_line_start; 3372 3302 } 3373 3303 3374 - static void dcn10_calc_vupdate_position( 3304 + void dcn10_calc_vupdate_position( 3375 3305 struct dc *dc, 3376 3306 struct pipe_ctx *pipe_ctx, 3377 3307 uint32_t *start_line,
+5
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h
··· 34 34 void dcn10_hw_sequencer_construct(struct dc *dc); 35 35 36 36 int dcn10_get_vupdate_offset_from_vsync(struct pipe_ctx *pipe_ctx); 37 + void dcn10_calc_vupdate_position( 38 + struct dc *dc, 39 + struct pipe_ctx *pipe_ctx, 40 + uint32_t *start_line, 41 + uint32_t *end_line); 37 42 void dcn10_setup_vupdate_interrupt(struct dc *dc, struct pipe_ctx *pipe_ctx); 38 43 enum dc_status dcn10_enable_stream_timing( 39 44 struct pipe_ctx *pipe_ctx,
+1
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c
··· 72 72 .set_clock = dcn10_set_clock, 73 73 .get_clock = dcn10_get_clock, 74 74 .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync, 75 + .calc_vupdate_position = dcn10_calc_vupdate_position, 75 76 .set_backlight_level = dce110_set_backlight_level, 76 77 .set_abm_immediate_disable = dce110_set_abm_immediate_disable, 77 78 };
+1
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.h
··· 80 80 const struct dcn_hubbub_mask *masks; 81 81 unsigned int debug_test_index_pstate; 82 82 struct dcn_watermark_set watermarks; 83 + int num_vmid; 83 84 struct dcn20_vmid vmid[16]; 84 85 unsigned int detile_buf_size; 85 86 };
+1
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c
··· 83 83 .init_vm_ctx = dcn20_init_vm_ctx, 84 84 .set_flip_control_gsl = dcn20_set_flip_control_gsl, 85 85 .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync, 86 + .calc_vupdate_position = dcn10_calc_vupdate_position, 86 87 .set_backlight_level = dce110_set_backlight_level, 87 88 .set_abm_immediate_disable = dce110_set_abm_immediate_disable, 88 89 };
+97 -90
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
··· 1663 1663 } 1664 1664 1665 1665 1666 - static void acquire_dsc(struct resource_context *res_ctx, 1667 - const struct resource_pool *pool, 1666 + void dcn20_acquire_dsc(const struct dc *dc, 1667 + struct resource_context *res_ctx, 1668 1668 struct display_stream_compressor **dsc, 1669 1669 int pipe_idx) 1670 1670 { 1671 1671 int i; 1672 + const struct resource_pool *pool = dc->res_pool; 1673 + struct display_stream_compressor *dsc_old = dc->current_state->res_ctx.pipe_ctx[pipe_idx].stream_res.dsc; 1672 1674 1673 - ASSERT(*dsc == NULL); 1675 + ASSERT(*dsc == NULL); /* If this ASSERT fails, dsc was not released properly */ 1674 1676 *dsc = NULL; 1675 1677 1678 + /* Always do 1-to-1 mapping when number of DSCs is same as number of pipes */ 1676 1679 if (pool->res_cap->num_dsc == pool->res_cap->num_opp) { 1677 1680 *dsc = pool->dscs[pipe_idx]; 1678 1681 res_ctx->is_dsc_acquired[pipe_idx] = true; 1679 1682 return; 1683 + } 1684 + 1685 + /* Return old DSC to avoid the need for re-programming */ 1686 + if (dsc_old && !res_ctx->is_dsc_acquired[dsc_old->inst]) { 1687 + *dsc = dsc_old; 1688 + res_ctx->is_dsc_acquired[dsc_old->inst] = true; 1689 + return ; 1680 1690 } 1681 1691 1682 1692 /* Find first free DSC */ ··· 1720 1710 { 1721 1711 enum dc_status result = DC_OK; 1722 1712 int i; 1723 - const struct resource_pool *pool = dc->res_pool; 1724 1713 1725 1714 /* Get a DSC if required and available */ 1726 1715 for (i = 0; i < dc->res_pool->pipe_count; i++) { ··· 1731 1722 if (pipe_ctx->stream_res.dsc) 1732 1723 continue; 1733 1724 1734 - acquire_dsc(&dc_ctx->res_ctx, pool, &pipe_ctx->stream_res.dsc, i); 1725 + dcn20_acquire_dsc(dc, &dc_ctx->res_ctx, &pipe_ctx->stream_res.dsc, i); 1735 1726 1736 1727 /* The number of DSCs can be less than the number of pipes */ 1737 1728 if (!pipe_ctx->stream_res.dsc) { ··· 1859 1850 } 1860 1851 1861 1852 bool dcn20_split_stream_for_odm( 1853 + const struct dc *dc, 1862 1854 struct resource_context *res_ctx, 1863 - const struct resource_pool *pool, 1864 1855 struct pipe_ctx *prev_odm_pipe, 1865 1856 struct pipe_ctx *next_odm_pipe) 1866 1857 { 1867 1858 int pipe_idx = next_odm_pipe->pipe_idx; 1859 + const struct resource_pool *pool = dc->res_pool; 1868 1860 1869 1861 *next_odm_pipe = *prev_odm_pipe; 1870 1862 ··· 1923 1913 } 1924 1914 next_odm_pipe->stream_res.opp = pool->opps[next_odm_pipe->pipe_idx]; 1925 1915 if (next_odm_pipe->stream->timing.flags.DSC == 1) { 1926 - acquire_dsc(res_ctx, pool, &next_odm_pipe->stream_res.dsc, next_odm_pipe->pipe_idx); 1916 + dcn20_acquire_dsc(dc, res_ctx, &next_odm_pipe->stream_res.dsc, next_odm_pipe->pipe_idx); 1927 1917 ASSERT(next_odm_pipe->stream_res.dsc); 1928 1918 if (next_odm_pipe->stream_res.dsc == NULL) 1929 1919 return false; ··· 2586 2576 } 2587 2577 } 2588 2578 2589 - int dcn20_find_previous_split_count(struct pipe_ctx *pipe) 2590 - { 2591 - int previous_split = 1; 2592 - struct pipe_ctx *current_pipe = pipe; 2593 - 2594 - while (current_pipe->bottom_pipe) { 2595 - if (current_pipe->plane_state != current_pipe->bottom_pipe->plane_state) 2596 - break; 2597 - previous_split++; 2598 - current_pipe = current_pipe->bottom_pipe; 2599 - } 2600 - current_pipe = pipe; 2601 - while (current_pipe->top_pipe) { 2602 - if (current_pipe->plane_state != current_pipe->top_pipe->plane_state) 2603 - break; 2604 - previous_split++; 2605 - current_pipe = current_pipe->top_pipe; 2606 - } 2607 - return previous_split; 2608 - } 2609 - 2610 2579 int dcn20_validate_apply_pipe_split_flags( 2611 2580 struct dc *dc, 2612 2581 struct dc_state *context, ··· 2597 2608 int plane_count = 0; 2598 2609 bool force_split = false; 2599 2610 bool avoid_split = dc->debug.pipe_split_policy == MPC_SPLIT_AVOID; 2611 + struct vba_vars_st *v = &context->bw_ctx.dml.vba; 2612 + int max_mpc_comb = v->maxMpcComb; 2600 2613 2601 2614 if (context->stream_count > 1) { 2602 2615 if (dc->debug.pipe_split_policy == MPC_SPLIT_AVOID_MULT_DISP) ··· 2606 2615 } else if (dc->debug.force_single_disp_pipe_split) 2607 2616 force_split = true; 2608 2617 2609 - /* TODO: fix dc bugs and remove this split threshold thing */ 2610 2618 for (i = 0; i < dc->res_pool->pipe_count; i++) { 2611 2619 struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; 2612 2620 2621 + /** 2622 + * Workaround for avoiding pipe-split in cases where we'd split 2623 + * planes that are too small, resulting in splits that aren't 2624 + * valid for the scaler. 2625 + */ 2626 + if (pipe->plane_state && 2627 + (pipe->plane_state->dst_rect.width <= 16 || 2628 + pipe->plane_state->dst_rect.height <= 16 || 2629 + pipe->plane_state->src_rect.width <= 16 || 2630 + pipe->plane_state->src_rect.height <= 16)) 2631 + avoid_split = true; 2632 + 2633 + /* TODO: fix dc bugs and remove this split threshold thing */ 2613 2634 if (pipe->stream && !pipe->prev_odm_pipe && 2614 2635 (!pipe->top_pipe || pipe->top_pipe->plane_state != pipe->plane_state)) 2615 2636 ++plane_count; ··· 2631 2628 2632 2629 /* Avoid split loop looks for lowest voltage level that allows most unsplit pipes possible */ 2633 2630 if (avoid_split) { 2634 - int max_mpc_comb = context->bw_ctx.dml.vba.maxMpcComb; 2635 - 2636 2631 for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) { 2637 2632 if (!context->res_ctx.pipe_ctx[i].stream) 2638 2633 continue; 2639 2634 2640 2635 for (vlevel_split = vlevel; vlevel <= context->bw_ctx.dml.soc.num_states; vlevel++) 2641 - if (context->bw_ctx.dml.vba.NoOfDPP[vlevel][0][pipe_idx] == 1 && 2642 - context->bw_ctx.dml.vba.ModeSupport[vlevel][0]) 2636 + if (v->NoOfDPP[vlevel][0][pipe_idx] == 1 && 2637 + v->ModeSupport[vlevel][0]) 2643 2638 break; 2644 2639 /* Impossible to not split this pipe */ 2645 2640 if (vlevel > context->bw_ctx.dml.soc.num_states) ··· 2646 2645 max_mpc_comb = 0; 2647 2646 pipe_idx++; 2648 2647 } 2649 - context->bw_ctx.dml.vba.maxMpcComb = max_mpc_comb; 2648 + v->maxMpcComb = max_mpc_comb; 2650 2649 } 2651 2650 2652 2651 /* Split loop sets which pipe should be split based on dml outputs and dc flags */ 2653 2652 for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) { 2654 2653 struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; 2655 - int pipe_plane = context->bw_ctx.dml.vba.pipe_plane[pipe_idx]; 2654 + int pipe_plane = v->pipe_plane[pipe_idx]; 2655 + bool split4mpc = context->stream_count == 1 && plane_count == 1 2656 + && dc->config.enable_4to1MPC && dc->res_pool->pipe_count >= 4; 2656 2657 2657 2658 if (!context->res_ctx.pipe_ctx[i].stream) 2658 2659 continue; 2659 2660 2660 - if (force_split 2661 - || context->bw_ctx.dml.vba.NoOfDPP[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_plane] > 1) { 2662 - if (context->stream_count == 1 && plane_count == 1 2663 - && dc->config.enable_4to1MPC && dc->res_pool->pipe_count >= 4) 2661 + if (force_split || v->NoOfDPP[vlevel][max_mpc_comb][pipe_plane] > 1) { 2662 + if (split4mpc) 2664 2663 split[i] = 4; 2665 2664 else 2666 2665 split[i] = 2; ··· 2676 2675 split[i] = 2; 2677 2676 if (dc->debug.force_odm_combine & (1 << pipe->stream_res.tg->inst)) { 2678 2677 split[i] = 2; 2679 - context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_plane] = dm_odm_combine_mode_2to1; 2678 + v->ODMCombineEnablePerState[vlevel][pipe_plane] = dm_odm_combine_mode_2to1; 2680 2679 } 2681 - context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_plane] = 2682 - context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_plane]; 2680 + v->ODMCombineEnabled[pipe_plane] = 2681 + v->ODMCombineEnablePerState[vlevel][pipe_plane]; 2683 2682 2684 - if (pipe->prev_odm_pipe && context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_plane] != dm_odm_combine_mode_disabled) { 2685 - /*Already split odm pipe tree, don't try to split again*/ 2686 - split[i] = 0; 2687 - split[pipe->prev_odm_pipe->pipe_idx] = 0; 2688 - } else if (pipe->top_pipe && pipe->plane_state == pipe->top_pipe->plane_state 2689 - && context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_plane] == dm_odm_combine_mode_disabled) { 2690 - /*If 2 way split but can support 4 way split, then split each pipe again*/ 2691 - if (context->stream_count == 1 && plane_count == 1 2692 - && dc->config.enable_4to1MPC && dc->res_pool->pipe_count >= 4) { 2693 - split[i] = 2; 2694 - } else { 2683 + if (v->ODMCombineEnabled[pipe_plane] == dm_odm_combine_mode_disabled) { 2684 + if (get_num_mpc_splits(pipe) == 1) { 2685 + /*If need split for mpc but 2 way split already*/ 2686 + if (split[i] == 4) 2687 + split[i] = 2; /* 2 -> 4 MPC */ 2688 + else if (split[i] == 2) 2689 + split[i] = 0; /* 2 -> 2 MPC */ 2690 + else if (pipe->top_pipe && pipe->top_pipe->plane_state == pipe->plane_state) 2691 + merge[i] = true; /* 2 -> 1 MPC */ 2692 + } else if (get_num_mpc_splits(pipe) == 3) { 2693 + /*If need split for mpc but 4 way split already*/ 2694 + if (split[i] == 2 && ((pipe->top_pipe && !pipe->top_pipe->top_pipe) 2695 + || !pipe->bottom_pipe)) { 2696 + merge[i] = true; /* 4 -> 2 MPC */ 2697 + } else if (split[i] == 0 && pipe->top_pipe && 2698 + pipe->top_pipe->plane_state == pipe->plane_state) 2699 + merge[i] = true; /* 4 -> 1 MPC */ 2695 2700 split[i] = 0; 2696 - split[pipe->top_pipe->pipe_idx] = 0; 2697 - } 2698 - } else if (pipe->prev_odm_pipe || (dcn20_find_previous_split_count(pipe) == 2 && pipe->top_pipe)) { 2699 - if (split[i] == 0) { 2700 - /*Exiting mpc/odm combine*/ 2701 - merge[i] = true; 2702 - } else { 2703 - /*Transition from mpc combine to odm combine or vice versa*/ 2704 - ASSERT(0); /*should not actually happen yet*/ 2705 - split[i] = 2; 2706 - merge[i] = true; 2701 + } else if (get_num_odm_splits(pipe)) { 2702 + /* ODM -> MPC transition */ 2703 + ASSERT(0); /* NOT expected yet */ 2707 2704 if (pipe->prev_odm_pipe) { 2708 - split[pipe->prev_odm_pipe->pipe_idx] = 2; 2709 - merge[pipe->prev_odm_pipe->pipe_idx] = true; 2710 - } else { 2711 - split[pipe->top_pipe->pipe_idx] = 2; 2712 - merge[pipe->top_pipe->pipe_idx] = true; 2705 + split[i] = 0; 2706 + merge[i] = true; 2713 2707 } 2714 2708 } 2715 - } else if (dcn20_find_previous_split_count(pipe) == 3) { 2716 - if (split[i] == 0 && !pipe->top_pipe) { 2717 - merge[pipe->bottom_pipe->pipe_idx] = true; 2718 - merge[pipe->bottom_pipe->bottom_pipe->pipe_idx] = true; 2719 - } else if (split[i] == 2 && !pipe->top_pipe) { 2720 - merge[pipe->bottom_pipe->bottom_pipe->pipe_idx] = true; 2709 + } else { 2710 + if (get_num_odm_splits(pipe) == 1) { 2711 + /*If need split for odm but 2 way split already*/ 2712 + if (split[i] == 4) 2713 + split[i] = 2; /* 2 -> 4 ODM */ 2714 + else if (split[i] == 2) 2715 + split[i] = 0; /* 2 -> 2 ODM */ 2716 + else if (pipe->prev_odm_pipe) { 2717 + ASSERT(0); /* NOT expected yet */ 2718 + merge[i] = true; /* exit ODM */ 2719 + } 2720 + } else if (get_num_odm_splits(pipe) == 3) { 2721 + /*If need split for odm but 4 way split already*/ 2722 + if (split[i] == 2 && ((pipe->prev_odm_pipe && !pipe->prev_odm_pipe->prev_odm_pipe) 2723 + || !pipe->next_odm_pipe)) { 2724 + ASSERT(0); /* NOT expected yet */ 2725 + merge[i] = true; /* 4 -> 2 ODM */ 2726 + } else if (split[i] == 0 && pipe->prev_odm_pipe) { 2727 + ASSERT(0); /* NOT expected yet */ 2728 + merge[i] = true; /* exit ODM */ 2729 + } 2721 2730 split[i] = 0; 2722 - } 2723 - } else if (dcn20_find_previous_split_count(pipe) == 4) { 2724 - if (split[i] == 0 && !pipe->top_pipe) { 2725 - merge[pipe->bottom_pipe->pipe_idx] = true; 2726 - merge[pipe->bottom_pipe->bottom_pipe->pipe_idx] = true; 2727 - merge[pipe->bottom_pipe->bottom_pipe->bottom_pipe->pipe_idx] = true; 2728 - } else if (split[i] == 2 && !pipe->top_pipe) { 2729 - merge[pipe->bottom_pipe->bottom_pipe->pipe_idx] = true; 2730 - merge[pipe->bottom_pipe->bottom_pipe->bottom_pipe->pipe_idx] = true; 2731 - split[i] = 0; 2731 + } else if (get_num_mpc_splits(pipe)) { 2732 + /* MPC -> ODM transition */ 2733 + ASSERT(0); /* NOT expected yet */ 2734 + if (pipe->top_pipe && pipe->top_pipe->plane_state == pipe->plane_state) { 2735 + split[i] = 0; 2736 + merge[i] = true; 2737 + } 2732 2738 } 2733 2739 } 2734 2740 2735 2741 /* Adjust dppclk when split is forced, do not bother with dispclk */ 2736 - if (split[i] != 0 2737 - && context->bw_ctx.dml.vba.NoOfDPP[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx] == 1) 2738 - context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx] /= 2; 2742 + if (split[i] != 0 && v->NoOfDPP[vlevel][max_mpc_comb][pipe_idx] == 1) 2743 + v->RequiredDPPCLK[vlevel][max_mpc_comb][pipe_idx] /= 2; 2739 2744 pipe_idx++; 2740 2745 } 2741 2746 ··· 2799 2792 hsplit_pipe = dcn20_find_secondary_pipe(dc, &context->res_ctx, dc->res_pool, pipe); 2800 2793 ASSERT(hsplit_pipe); 2801 2794 if (!dcn20_split_stream_for_odm( 2802 - &context->res_ctx, dc->res_pool, 2795 + dc, &context->res_ctx, 2803 2796 pipe, hsplit_pipe)) 2804 2797 goto validate_fail; 2805 2798 pipe_split_from[hsplit_pipe->pipe_idx] = pipe_idx; ··· 2828 2821 } 2829 2822 if (context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_idx]) { 2830 2823 if (!dcn20_split_stream_for_odm( 2831 - &context->res_ctx, dc->res_pool, 2824 + dc, &context->res_ctx, 2832 2825 pipe, hsplit_pipe)) 2833 2826 goto validate_fail; 2834 2827 dcn20_build_mapped_resource(dc, context, pipe->stream);
+5 -2
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h
··· 119 119 display_e2e_pipe_params_st *pipes, 120 120 int pipe_cnt); 121 121 bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, bool fast_validate); 122 - int dcn20_find_previous_split_count(struct pipe_ctx *pipe); 123 122 int dcn20_validate_apply_pipe_split_flags( 124 123 struct dc *dc, 125 124 struct dc_state *context, ··· 135 136 struct pipe_ctx *primary_pipe, 136 137 struct pipe_ctx *secondary_pipe); 137 138 bool dcn20_split_stream_for_odm( 139 + const struct dc *dc, 138 140 struct resource_context *res_ctx, 139 - const struct resource_pool *pool, 140 141 struct pipe_ctx *prev_odm_pipe, 141 142 struct pipe_ctx *next_odm_pipe); 143 + void dcn20_acquire_dsc(const struct dc *dc, 144 + struct resource_context *res_ctx, 145 + struct display_stream_compressor **dsc, 146 + int pipe_idx); 142 147 struct pipe_ctx *dcn20_find_secondary_pipe(struct dc *dc, 143 148 struct resource_context *res_ctx, 144 149 const struct resource_pool *pool,
+1 -6
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c
··· 49 49 #define FN(reg_name, field_name) \ 50 50 hubbub1->shifts->field_name, hubbub1->masks->field_name 51 51 52 - #ifdef NUM_VMID 53 - #undef NUM_VMID 54 - #endif 55 - #define NUM_VMID 16 56 - 57 52 static uint32_t convert_and_clamp( 58 53 uint32_t wm_ns, 59 54 uint32_t refclk_mhz, ··· 133 138 134 139 dcn21_dchvm_init(hubbub); 135 140 136 - return NUM_VMID; 141 + return hubbub1->num_vmid; 137 142 } 138 143 139 144 bool hubbub21_program_urgent_watermarks(
+1
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c
··· 86 86 .optimize_pwr_state = dcn21_optimize_pwr_state, 87 87 .exit_optimized_pwr_state = dcn21_exit_optimized_pwr_state, 88 88 .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync, 89 + .calc_vupdate_position = dcn10_calc_vupdate_position, 89 90 .power_down = dce110_power_down, 90 91 .set_backlight_level = dce110_set_backlight_level, 91 92 .set_abm_immediate_disable = dce110_set_abm_immediate_disable,
+2 -1
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
··· 805 805 .num_pll = 5, // maybe 3 because the last two used for USB-c 806 806 .num_dwb = 1, 807 807 .num_ddc = 5, 808 - .num_vmid = 1, 808 + .num_vmid = 16, 809 809 .num_dsc = 3, 810 810 }; 811 811 ··· 1295 1295 vmid->shifts = &vmid_shifts; 1296 1296 vmid->masks = &vmid_masks; 1297 1297 } 1298 + hubbub->num_vmid = res_cap_rn.num_vmid; 1298 1299 1299 1300 return &hubbub->base; 1300 1301 }
-2
drivers/gpu/drm/amd/display/dc/dml/Makefile
··· 63 63 endif 64 64 CFLAGS_$(AMDDALPATH)/dc/dml/dml1_display_rq_dlg_calc.o := $(dml_ccflags) 65 65 CFLAGS_$(AMDDALPATH)/dc/dml/display_rq_dlg_helpers.o := $(dml_ccflags) 66 - CFLAGS_$(AMDDALPATH)/dc/dml/dml_common_defs.o := $(dml_ccflags) 67 66 68 67 DML = display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \ 69 - dml_common_defs.o 70 68 71 69 ifdef CONFIG_DRM_AMD_DC_DCN 72 70 DML += display_mode_vba.o dcn20/display_rq_dlg_calc_20.o dcn20/display_mode_vba_20.o
-1
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.h
··· 26 26 #ifndef __DML20_DISPLAY_RQ_DLG_CALC_H__ 27 27 #define __DML20_DISPLAY_RQ_DLG_CALC_H__ 28 28 29 - #include "../dml_common_defs.h" 30 29 #include "../display_rq_dlg_helpers.h" 31 30 32 31 struct display_mode_lib;
-1
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.h
··· 26 26 #ifndef __DML20V2_DISPLAY_RQ_DLG_CALC_H__ 27 27 #define __DML20V2_DISPLAY_RQ_DLG_CALC_H__ 28 28 29 - #include "../dml_common_defs.h" 30 29 #include "../display_rq_dlg_helpers.h" 31 30 32 31 struct display_mode_lib;
+1 -1
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.h
··· 26 26 #ifndef __DML21_DISPLAY_RQ_DLG_CALC_H__ 27 27 #define __DML21_DISPLAY_RQ_DLG_CALC_H__ 28 28 29 - #include "../dml_common_defs.h" 29 + #include "dm_services.h" 30 30 #include "../display_rq_dlg_helpers.h" 31 31 32 32 struct display_mode_lib;
+4 -2
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.h
··· 25 25 #ifndef __DISPLAY_MODE_LIB_H__ 26 26 #define __DISPLAY_MODE_LIB_H__ 27 27 28 - 29 - #include "dml_common_defs.h" 28 + #include "dm_services.h" 29 + #include "dc_features.h" 30 + #include "display_mode_structs.h" 31 + #include "display_mode_enums.h" 30 32 #include "display_mode_vba.h" 31 33 32 34 enum dml_project {
-2
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h
··· 27 27 #ifndef __DML2_DISPLAY_MODE_VBA_H__ 28 28 #define __DML2_DISPLAY_MODE_VBA_H__ 29 29 30 - #include "dml_common_defs.h" 31 - 32 30 struct display_mode_lib; 33 31 34 32 void ModeSupportAndSystemConfiguration(struct display_mode_lib *mode_lib);
-1
drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_helpers.h
··· 26 26 #ifndef __DISPLAY_RQ_DLG_HELPERS_H__ 27 27 #define __DISPLAY_RQ_DLG_HELPERS_H__ 28 28 29 - #include "dml_common_defs.h" 30 29 #include "display_mode_lib.h" 31 30 32 31 /* Function: Printer functions
-2
drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.h
··· 26 26 #ifndef __DISPLAY_RQ_DLG_CALC_H__ 27 27 #define __DISPLAY_RQ_DLG_CALC_H__ 28 28 29 - #include "dml_common_defs.h" 30 - 31 29 struct display_mode_lib; 32 30 33 31 #include "display_rq_dlg_helpers.h"
-43
drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c
··· 1 - /* 2 - * Copyright 2017 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - * Authors: AMD 23 - * 24 - */ 25 - 26 - #include "dml_common_defs.h" 27 - #include "dcn_calc_math.h" 28 - 29 - #include "dml_inline_defs.h" 30 - 31 - double dml_round(double a) 32 - { 33 - double round_pt = 0.5; 34 - double ceil = dml_ceil(a, 1); 35 - double floor = dml_floor(a, 1); 36 - 37 - if (a - floor >= round_pt) 38 - return ceil; 39 - else 40 - return floor; 41 - } 42 - 43 -
-37
drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h
··· 1 - /* 2 - * Copyright 2017 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - * Authors: AMD 23 - * 24 - */ 25 - 26 - #ifndef __DC_COMMON_DEFS_H__ 27 - #define __DC_COMMON_DEFS_H__ 28 - 29 - #include "dm_services.h" 30 - #include "dc_features.h" 31 - #include "display_mode_structs.h" 32 - #include "display_mode_enums.h" 33 - 34 - 35 - double dml_round(double a); 36 - 37 - #endif /* __DC_COMMON_DEFS_H__ */
+13 -2
drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
··· 26 26 #ifndef __DML_INLINE_DEFS_H__ 27 27 #define __DML_INLINE_DEFS_H__ 28 28 29 - #include "dml_common_defs.h" 30 29 #include "dcn_calc_math.h" 31 30 #include "dml_logger.h" 32 31 ··· 74 75 return (double) dcn_bw_floor2(a, granularity); 75 76 } 76 77 78 + static inline double dml_round(double a) 79 + { 80 + double round_pt = 0.5; 81 + double ceil = dml_ceil(a, 1); 82 + double floor = dml_floor(a, 1); 83 + 84 + if (a - floor >= round_pt) 85 + return ceil; 86 + else 87 + return floor; 88 + } 89 + 77 90 static inline int dml_log2(double x) 78 91 { 79 92 return dml_round((double)dcn_bw_log(x, 2)); ··· 123 112 124 113 static inline unsigned int dml_round_to_multiple(unsigned int num, 125 114 unsigned int multiple, 126 - bool up) 115 + unsigned char up) 127 116 { 128 117 unsigned int remainder; 129 118
+5
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
··· 96 96 void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes, 97 97 struct crtc_position *position); 98 98 int (*get_vupdate_offset_from_vsync)(struct pipe_ctx *pipe_ctx); 99 + void (*calc_vupdate_position)( 100 + struct dc *dc, 101 + struct pipe_ctx *pipe_ctx, 102 + uint32_t *start_line, 103 + uint32_t *end_line); 99 104 void (*enable_per_frame_crtc_position_reset)(struct dc *dc, 100 105 int group_size, struct pipe_ctx *grouped_pipes[]); 101 106 void (*enable_timing_synchronization)(struct dc *dc,
+2
drivers/gpu/drm/amd/display/dc/inc/resource.h
··· 177 177 void get_audio_check(struct audio_info *aud_modes, 178 178 struct audio_check *aud_chk); 179 179 180 + int get_num_mpc_splits(struct pipe_ctx *pipe); 181 + 180 182 int get_num_odm_splits(struct pipe_ctx *pipe); 181 183 182 184 #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */
+5 -2
drivers/gpu/drm/amd/display/modules/vmid/vmid.c
··· 112 112 evict_vmids(core_vmid); 113 113 114 114 vmid = get_next_available_vmid(core_vmid); 115 - add_ptb_to_table(core_vmid, vmid, ptb); 115 + if (vmid != -1) { 116 + add_ptb_to_table(core_vmid, vmid, ptb); 116 117 117 - dc_setup_vm_context(core_vmid->dc, &va_config, vmid); 118 + dc_setup_vm_context(core_vmid->dc, &va_config, vmid); 119 + } else 120 + ASSERT(0); 118 121 } 119 122 120 123 return vmid;
+14
drivers/gpu/drm/amd/include/amd_shared.h
··· 40 40 AMD_EXP_HW_SUPPORT = 0x00080000UL, 41 41 }; 42 42 43 + enum amd_apu_flags { 44 + AMD_APU_IS_RAVEN = 0x00000001UL, 45 + AMD_APU_IS_RAVEN2 = 0x00000002UL, 46 + AMD_APU_IS_PICASSO = 0x00000004UL, 47 + AMD_APU_IS_RENOIR = 0x00000008UL, 48 + }; 49 + 43 50 enum amd_ip_block_type { 44 51 AMD_IP_BLOCK_TYPE_COMMON, 45 52 AMD_IP_BLOCK_TYPE_GMC, ··· 155 148 DC_MULTI_MON_PP_MCLK_SWITCH_MASK = 0x2, 156 149 DC_DISABLE_FRACTIONAL_PWM_MASK = 0x4, 157 150 DC_PSR_MASK = 0x8, 151 + }; 152 + 153 + enum DC_DEBUG_MASK { 154 + DC_DISABLE_PIPE_SPLIT = 0x1, 155 + DC_DISABLE_STUTTER = 0x2, 156 + DC_DISABLE_DSC = 0x4, 157 + DC_DISABLE_CLOCK_GATING = 0x8 158 158 }; 159 159 160 160 enum amd_dpm_forced_level;
+6
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
··· 623 623 struct smu_dpm_context *smu_dpm = &smu->smu_dpm; 624 624 struct arcturus_dpm_table *dpm_table = NULL; 625 625 626 + if (amdgpu_ras_intr_triggered()) 627 + return snprintf(buf, PAGE_SIZE, "unavailable\n"); 628 + 626 629 dpm_table = smu_dpm->dpm_context; 627 630 628 631 switch (type) { ··· 1000 997 struct smu_table_context *table_context = &smu->smu_table; 1001 998 PPTable_t *pptable = table_context->driver_pptable; 1002 999 int ret = 0; 1000 + 1001 + if (amdgpu_ras_intr_triggered()) 1002 + return 0; 1003 1003 1004 1004 if (!data || !size) 1005 1005 return -EINVAL;
+3 -6
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
··· 410 410 struct smu10_voltage_dependency_table **pptable, 411 411 uint32_t num_entry, const DpmClock_t *pclk_dependency_table) 412 412 { 413 - uint32_t table_size, i; 413 + uint32_t i; 414 414 struct smu10_voltage_dependency_table *ptable; 415 415 416 - table_size = sizeof(uint32_t) + sizeof(struct smu10_voltage_dependency_table) * num_entry; 417 - ptable = kzalloc(table_size, GFP_KERNEL); 418 - 416 + ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL); 419 417 if (NULL == ptable) 420 418 return -ENOMEM; 421 419 ··· 1302 1304 static bool smu10_is_raven1_refresh(struct pp_hwmgr *hwmgr) 1303 1305 { 1304 1306 struct amdgpu_device *adev = hwmgr->adev; 1305 - if ((adev->asic_type == CHIP_RAVEN) && 1306 - (adev->rev_id != 0x15d8) && 1307 + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && 1307 1308 (hwmgr->smu_version >= 0x41e2b)) 1308 1309 return true; 1309 1310 else
+1 -1
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.h
··· 192 192 193 193 struct smu10_voltage_dependency_table { 194 194 uint32_t count; 195 - struct smu10_clock_voltage_dependency_record entries[1]; 195 + struct smu10_clock_voltage_dependency_record entries[]; 196 196 }; 197 197 198 198 struct smu10_clock_voltage_information {
+10 -28
drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
··· 597 597 598 598 if (client_id == AMDGPU_IRQ_CLIENTID_LEGACY) { 599 599 if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_LOW_TO_HIGH) { 600 - pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n", 601 - PCI_BUS_NUM(adev->pdev->devfn), 602 - PCI_SLOT(adev->pdev->devfn), 603 - PCI_FUNC(adev->pdev->devfn)); 600 + dev_emerg(adev->dev, "ERROR: GPU over temperature range(SW CTF) detected!\n"); 604 601 /* 605 602 * SW CTF just occurred. 606 603 * Try to do a graceful shutdown to prevent further damage. 607 604 */ 608 - dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n"); 605 + dev_emerg(adev->dev, "ERROR: System is going to shutdown due to GPU SW CTF!\n"); 609 606 orderly_poweroff(true); 610 607 } else if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_HIGH_TO_LOW) 611 - pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n", 612 - PCI_BUS_NUM(adev->pdev->devfn), 613 - PCI_SLOT(adev->pdev->devfn), 614 - PCI_FUNC(adev->pdev->devfn)); 608 + dev_emerg(adev->dev, "ERROR: GPU under temperature range detected!\n"); 615 609 else if (src_id == VISLANDS30_IV_SRCID_GPIO_19) { 616 - pr_warn("GPU Critical Temperature Fault detected on PCIe %d:%d.%d!\n", 617 - PCI_BUS_NUM(adev->pdev->devfn), 618 - PCI_SLOT(adev->pdev->devfn), 619 - PCI_FUNC(adev->pdev->devfn)); 610 + dev_emerg(adev->dev, "ERROR: GPU HW Critical Temperature Fault(aka CTF) detected!\n"); 620 611 /* 621 612 * HW CTF just occurred. Shutdown to prevent further damage. 622 613 */ 623 - dev_emerg(adev->dev, "System is going to shutdown due to HW CTF!\n"); 614 + dev_emerg(adev->dev, "ERROR: System is going to shutdown due to GPU HW CTF!\n"); 624 615 orderly_poweroff(true); 625 616 } 626 617 } else if (client_id == SOC15_IH_CLIENTID_THM) { 627 618 if (src_id == 0) { 628 - pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n", 629 - PCI_BUS_NUM(adev->pdev->devfn), 630 - PCI_SLOT(adev->pdev->devfn), 631 - PCI_FUNC(adev->pdev->devfn)); 619 + dev_emerg(adev->dev, "ERROR: GPU over temperature range(SW CTF) detected!\n"); 632 620 /* 633 621 * SW CTF just occurred. 634 622 * Try to do a graceful shutdown to prevent further damage. 635 623 */ 636 - dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n"); 624 + dev_emerg(adev->dev, "ERROR: System is going to shutdown due to GPU SW CTF!\n"); 637 625 orderly_poweroff(true); 638 626 } else 639 - pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n", 640 - PCI_BUS_NUM(adev->pdev->devfn), 641 - PCI_SLOT(adev->pdev->devfn), 642 - PCI_FUNC(adev->pdev->devfn)); 627 + dev_emerg(adev->dev, "ERROR: GPU under temperature range detected!\n"); 643 628 } else if (client_id == SOC15_IH_CLIENTID_ROM_SMUIO) { 644 - pr_warn("GPU Critical Temperature Fault detected on PCIe %d:%d.%d!\n", 645 - PCI_BUS_NUM(adev->pdev->devfn), 646 - PCI_SLOT(adev->pdev->devfn), 647 - PCI_FUNC(adev->pdev->devfn)); 629 + dev_emerg(adev->dev, "ERROR: GPU HW Critical Temperature Fault(aka CTF) detected!\n"); 648 630 /* 649 631 * HW CTF just occurred. Shutdown to prevent further damage. 650 632 */ 651 - dev_emerg(adev->dev, "System is going to shutdown due to HW CTF!\n"); 633 + dev_emerg(adev->dev, "ERROR: System is going to shutdown due to GPU HW CTF!\n"); 652 634 orderly_poweroff(true); 653 635 } 654 636
+7 -19
drivers/gpu/drm/amd/powerplay/smu_v11_0.c
··· 1565 1565 if (client_id == SOC15_IH_CLIENTID_THM) { 1566 1566 switch (src_id) { 1567 1567 case THM_11_0__SRCID__THM_DIG_THERM_L2H: 1568 - pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n", 1569 - PCI_BUS_NUM(adev->pdev->devfn), 1570 - PCI_SLOT(adev->pdev->devfn), 1571 - PCI_FUNC(adev->pdev->devfn)); 1568 + dev_emerg(adev->dev, "ERROR: GPU over temperature range(SW CTF) detected!\n"); 1572 1569 /* 1573 1570 * SW CTF just occurred. 1574 1571 * Try to do a graceful shutdown to prevent further damage. 1575 1572 */ 1576 - dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n"); 1573 + dev_emerg(adev->dev, "ERROR: System is going to shutdown due to GPU SW CTF!\n"); 1577 1574 orderly_poweroff(true); 1578 1575 break; 1579 1576 case THM_11_0__SRCID__THM_DIG_THERM_H2L: 1580 - pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n", 1581 - PCI_BUS_NUM(adev->pdev->devfn), 1582 - PCI_SLOT(adev->pdev->devfn), 1583 - PCI_FUNC(adev->pdev->devfn)); 1577 + dev_emerg(adev->dev, "ERROR: GPU under temperature range detected\n"); 1584 1578 break; 1585 1579 default: 1586 - pr_warn("GPU under temperature range unknown src id (%d), detected on PCIe %d:%d.%d!\n", 1587 - src_id, 1588 - PCI_BUS_NUM(adev->pdev->devfn), 1589 - PCI_SLOT(adev->pdev->devfn), 1590 - PCI_FUNC(adev->pdev->devfn)); 1580 + dev_emerg(adev->dev, "ERROR: GPU under temperature range unknown src id (%d)\n", 1581 + src_id); 1591 1582 break; 1592 1583 } 1593 1584 } else if (client_id == SOC15_IH_CLIENTID_ROM_SMUIO) { 1594 - pr_warn("GPU Critical Temperature Fault detected on PCIe %d:%d.%d!\n", 1595 - PCI_BUS_NUM(adev->pdev->devfn), 1596 - PCI_SLOT(adev->pdev->devfn), 1597 - PCI_FUNC(adev->pdev->devfn)); 1585 + dev_emerg(adev->dev, "ERROR: GPU HW Critical Temperature Fault(aka CTF) detected!\n"); 1598 1586 /* 1599 1587 * HW CTF just occurred. Shutdown to prevent further damage. 1600 1588 */ 1601 - dev_emerg(adev->dev, "System is going to shutdown due to HW CTF!\n"); 1589 + dev_emerg(adev->dev, "ERROR: System is going to shutdown due to GPU HW CTF!\n"); 1602 1590 orderly_poweroff(true); 1603 1591 } else if (client_id == SOC15_IH_CLIENTID_MP1) { 1604 1592 if (src_id == 0xfe) {
+2 -1
drivers/gpu/drm/amd/powerplay/smumgr/smu10_smumgr.c
··· 226 226 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetSmuVersion, &hwmgr->smu_version); 227 227 adev->pm.fw_version = hwmgr->smu_version >> 8; 228 228 229 - if (adev->rev_id < 0x8 && adev->pdev->device != 0x15d8 && 229 + if (!(adev->apu_flags & AMD_APU_IS_RAVEN2) && 230 + (adev->apu_flags & AMD_APU_IS_RAVEN) && 230 231 adev->pm.fw_version < 0x1e45) 231 232 adev->pm.pp_feature &= ~PP_GFXOFF_MASK; 232 233