amd-drm-fixes-6.5-2023-07-12: amdgpu: - SMU i2c locking fix - Fix a possible deadlock in process restoration for ROCm apps - Disable PCIe lane/speed switching on Intel platforms (the platforms don't support it) Signed-off-by: Dave Airlie <airlied@redhat.com>
Unified · Split
| @@ -1296,6 +1296,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 1295 unmodified lines | |||
| 1296 | void amdgpu_device_pci_config_reset(struct amdgpu_device *adev); | 1296 | void amdgpu_device_pci_config_reset(struct amdgpu_device *adev); |
| 1297 | int amdgpu_device_pci_reset(struct amdgpu_device *adev); | 1297 | int amdgpu_device_pci_reset(struct amdgpu_device *adev); |
| 1298 | bool amdgpu_device_need_post(struct amdgpu_device *adev); | 1298 | bool amdgpu_device_need_post(struct amdgpu_device *adev); |
| 1299 | bool amdgpu_device_pcie_dynamic_switching_supported(void); | ||
| 1299 | bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev); | 1300 | bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev); |
| 1300 | bool amdgpu_device_aspm_support_quirk(void); | 1301 | bool amdgpu_device_aspm_support_quirk(void); |
| 1301 | 1302 | ||
| @@ -2881,6 +2881,9 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef) · 2880 unmodified lines | |||
| 2881 | if (!attachment->is_mapped) | 2881 | if (!attachment->is_mapped) |
| 2882 | continue; | 2882 | continue; |
| 2883 | 2883 | ||
| 2884 | if (attachment->bo_va->base.bo->tbo.pin_count) | ||
| 2885 | continue; | ||
| 2886 | |||
| 2884 | kfd_mem_dmaunmap_attachment(mem, attachment); | 2887 | kfd_mem_dmaunmap_attachment(mem, attachment); |
| 2885 | ret = update_gpuvm_pte(mem, attachment, &sync_obj); | 2888 | ret = update_gpuvm_pte(mem, attachment, &sync_obj); |
| 2886 | if (ret) { | 2889 | if (ret) { |
| @@ -1458,6 +1458,25 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev) · 1457 unmodified lines | |||
| 1458 | return true; | 1458 | return true; |
| 1459 | } | 1459 | } |
| 1460 | 1460 | ||
| 1461 | /* | ||
| 1462 | * Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic | ||
| 1463 | * speed switching. Until we have confirmation from Intel that a specific host | ||
| 1464 | * supports it, it's safer that we keep it disabled for all. | ||
| 1465 | * | ||
| 1466 | * https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/ | ||
| 1467 | * https://gitlab.freedesktop.org/drm/amd/-/issues/2663 | ||
| 1468 | */ | ||
| 1469 | bool amdgpu_device_pcie_dynamic_switching_supported(void) | ||
| 1470 | { | ||
| 1471 | #if IS_ENABLED(CONFIG_X86) | ||
| 1472 | struct cpuinfo_x86 *c = &cpu_data(0); | ||
| 1473 | |||
| 1474 | if (c->x86_vendor == X86_VENDOR_INTEL) | ||
| 1475 | return false; | ||
| 1476 | #endif | ||
| 1477 | return true; | ||
| 1478 | } | ||
| 1479 | |||
| 1461 | /** | 1480 | /** |
| 1462 | * amdgpu_device_should_use_aspm - check if the device should program ASPM | 1481 | * amdgpu_device_should_use_aspm - check if the device should program ASPM |
| 1463 | * | 1482 | * |
| @@ -295,5 +295,9 @@ int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu, · 294 unmodified lines | |||
| 295 | uint32_t *size, | 295 | uint32_t *size, |
| 296 | uint32_t pptable_id); | 296 | uint32_t pptable_id); |
| 297 | 297 | ||
| 298 | int smu_v13_0_update_pcie_parameters(struct smu_context *smu, | ||
| 299 | uint32_t pcie_gen_cap, | ||
| 300 | uint32_t pcie_width_cap); | ||
| 301 | |||
| 298 | #endif | 302 | #endif |
| 299 | #endif | 303 | #endif |
| @@ -2113,7 +2113,6 @@ static int arcturus_i2c_xfer(struct i2c_adapter *i2c_adap, · 2112 unmodified lines | |||
| 2113 | } | 2113 | } |
| 2114 | mutex_lock(&adev->pm.mutex); | 2114 | mutex_lock(&adev->pm.mutex); |
| 2115 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); | 2115 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); |
| 2116 | mutex_unlock(&adev->pm.mutex); | ||
| 2117 | if (r) | 2116 | if (r) |
| 2118 | goto fail; | 2117 | goto fail; |
| 2119 | 2118 | ||
| @@ -2130,6 +2129,7 @@ static int arcturus_i2c_xfer(struct i2c_adapter *i2c_adap, · 10 unmodified lines | |||
| 2130 | } | 2129 | } |
| 2131 | r = num_msgs; | 2130 | r = num_msgs; |
| 2132 | fail: | 2131 | fail: |
| 2132 | mutex_unlock(&adev->pm.mutex); | ||
| 2133 | kfree(req); | 2133 | kfree(req); |
| 2134 | return r; | 2134 | return r; |
| 2135 | } | 2135 | } |
| @@ -3021,7 +3021,6 @@ static int navi10_i2c_xfer(struct i2c_adapter *i2c_adap, · 3020 unmodified lines | |||
| 3021 | } | 3021 | } |
| 3022 | mutex_lock(&adev->pm.mutex); | 3022 | mutex_lock(&adev->pm.mutex); |
| 3023 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); | 3023 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); |
| 3024 | mutex_unlock(&adev->pm.mutex); | ||
| 3025 | if (r) | 3024 | if (r) |
| 3026 | goto fail; | 3025 | goto fail; |
| 3027 | 3026 | ||
| @@ -3038,6 +3037,7 @@ static int navi10_i2c_xfer(struct i2c_adapter *i2c_adap, · 10 unmodified lines | |||
| 3038 | } | 3037 | } |
| 3039 | r = num_msgs; | 3038 | r = num_msgs; |
| 3040 | fail: | 3039 | fail: |
| 3040 | mutex_unlock(&adev->pm.mutex); | ||
| 3041 | kfree(req); | 3041 | kfree(req); |
| 3042 | return r; | 3042 | return r; |
| 3043 | } | 3043 | } |
| @@ -2077,89 +2077,36 @@ static int sienna_cichlid_display_disable_memory_clock_switch(struct smu_context · 2076 unmodified lines | |||
| 2077 | return ret; | 2077 | return ret; |
| 2078 | } | 2078 | } |
| 2079 | 2079 | ||
| 2080 | static void sienna_cichlid_get_override_pcie_settings(struct smu_context *smu, | ||
| 2081 | uint32_t *gen_speed_override, | ||
| 2082 | uint32_t *lane_width_override) | ||
| 2083 | { | ||
| 2084 | struct amdgpu_device *adev = smu->adev; | ||
| 2085 | |||
| 2086 | *gen_speed_override = 0xff; | ||
| 2087 | *lane_width_override = 0xff; | ||
| 2088 | |||
| 2089 | switch (adev->pdev->device) { | ||
| 2090 | case 0x73A0: | ||
| 2091 | case 0x73A1: | ||
| 2092 | case 0x73A2: | ||
| 2093 | case 0x73A3: | ||
| 2094 | case 0x73AB: | ||
| 2095 | case 0x73AE: | ||
| 2096 | /* Bit 7:0: PCIE lane width, 1 to 7 corresponds is x1 to x32 */ | ||
| 2097 | *lane_width_override = 6; | ||
| 2098 | break; | ||
| 2099 | case 0x73E0: | ||
| 2100 | case 0x73E1: | ||
| 2101 | case 0x73E3: | ||
| 2102 | *lane_width_override = 4; | ||
| 2103 | break; | ||
| 2104 | case 0x7420: | ||
| 2105 | case 0x7421: | ||
| 2106 | case 0x7422: | ||
| 2107 | case 0x7423: | ||
| 2108 | case 0x7424: | ||
| 2109 | *lane_width_override = 3; | ||
| 2110 | break; | ||
| 2111 | default: | ||
| 2112 | break; | ||
| 2113 | } | ||
| 2114 | } | ||
| 2115 | |||
| 2116 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) | ||
| 2117 | |||
| 2118 | static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu, | 2080 | static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu, |
| 2119 | uint32_t pcie_gen_cap, | 2081 | uint32_t pcie_gen_cap, |
| 2120 | uint32_t pcie_width_cap) | 2082 | uint32_t pcie_width_cap) |
| 2121 | { | 2083 | { |
| 2122 | struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; | 2084 | struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; |
| 2123 | struct smu_11_0_pcie_table *pcie_table = &dpm_context->dpm_tables.pcie_table; | 2085 | struct smu_11_0_pcie_table *pcie_table = &dpm_context->dpm_tables.pcie_table; |
| 2124 | uint32_t gen_speed_override, lane_width_override; | 2086 | u32 smu_pcie_arg; |
| 2125 | uint8_t *table_member1, *table_member2; | ||
| 2126 | uint32_t min_gen_speed, max_gen_speed; | ||
| 2127 | uint32_t min_lane_width, max_lane_width; | ||
| 2128 | uint32_t smu_pcie_arg; | ||
| 2129 | int ret, i; | 2087 | int ret, i; |
| 2130 | 2088 | ||
| 2131 | GET_PPTABLE_MEMBER(PcieGenSpeed, &table_member1); | 2089 | /* PCIE gen speed and lane width override */ |
| 2132 | GET_PPTABLE_MEMBER(PcieLaneCount, &table_member2); | 2090 | if (!amdgpu_device_pcie_dynamic_switching_supported()) { |
| 2133 | 2091 | if (pcie_table->pcie_gen[NUM_LINK_LEVELS - 1] < pcie_gen_cap) | |
| 2134 | sienna_cichlid_get_override_pcie_settings(smu, | 2092 | pcie_gen_cap = pcie_table->pcie_gen[NUM_LINK_LEVELS - 1]; |
| 2135 | &gen_speed_override, | ||
| 2136 | &lane_width_override); | ||
| 2137 | 2093 | ||
| 2138 | /* PCIE gen speed override */ | 2094 | if (pcie_table->pcie_lane[NUM_LINK_LEVELS - 1] < pcie_width_cap) |
| 2139 | if (gen_speed_override != 0xff) { | 2095 | pcie_width_cap = pcie_table->pcie_lane[NUM_LINK_LEVELS - 1]; |
| 2140 | min_gen_speed = MIN(pcie_gen_cap, gen_speed_override); | ||
| 2141 | max_gen_speed = MIN(pcie_gen_cap, gen_speed_override); | ||
| 2142 | } else { | ||
| 2143 | min_gen_speed = MAX(0, table_member1[0]); | ||
| 2144 | max_gen_speed = MIN(pcie_gen_cap, table_member1[1]); | ||
| 2145 | min_gen_speed = min_gen_speed > max_gen_speed ? | ||
| 2146 | max_gen_speed : min_gen_speed; | ||
| 2147 | } | ||
| 2148 | pcie_table->pcie_gen[0] = min_gen_speed; | ||
| 2149 | pcie_table->pcie_gen[1] = max_gen_speed; | ||
| 2150 | 2096 | ||
| 2151 | /* PCIE lane width override */ | 2097 | /* Force all levels to use the same settings */ |
| 2152 | if (lane_width_override != 0xff) { | 2098 | for (i = 0; i < NUM_LINK_LEVELS; i++) { |
| 2153 | min_lane_width = MIN(pcie_width_cap, lane_width_override); | 2099 | pcie_table->pcie_gen[i] = pcie_gen_cap; |
| 2154 | max_lane_width = MIN(pcie_width_cap, lane_width_override); | 2100 | pcie_table->pcie_lane[i] = pcie_width_cap; |
| 2101 | } | ||
| 2155 | } else { | 2102 | } else { |
| 2156 | min_lane_width = MAX(1, table_member2[0]); | 2103 | for (i = 0; i < NUM_LINK_LEVELS; i++) { |
| 2157 | max_lane_width = MIN(pcie_width_cap, table_member2[1]); | 2104 | if (pcie_table->pcie_gen[i] > pcie_gen_cap) |
| 2158 | min_lane_width = min_lane_width > max_lane_width ? | 2105 | pcie_table->pcie_gen[i] = pcie_gen_cap; |
| 2159 | max_lane_width : min_lane_width; | 2106 | if (pcie_table->pcie_lane[i] > pcie_width_cap) |
| 2107 | pcie_table->pcie_lane[i] = pcie_width_cap; | ||
| 2108 | } | ||
| 2160 | } | 2109 | } |
| 2161 | pcie_table->pcie_lane[0] = min_lane_width; | ||
| 2162 | pcie_table->pcie_lane[1] = max_lane_width; | ||
| 2163 | 2110 | ||
| 2164 | for (i = 0; i < NUM_LINK_LEVELS; i++) { | 2111 | for (i = 0; i < NUM_LINK_LEVELS; i++) { |
| 2165 | smu_pcie_arg = (i << 16 | | 2112 | smu_pcie_arg = (i << 16 | |
| @@ -3842,7 +3789,6 @@ static int sienna_cichlid_i2c_xfer(struct i2c_adapter *i2c_adap, · 1676 unmodified lines | |||
| 3842 | } | 3789 | } |
| 3843 | mutex_lock(&adev->pm.mutex); | 3790 | mutex_lock(&adev->pm.mutex); |
| 3844 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); | 3791 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); |
| 3845 | mutex_unlock(&adev->pm.mutex); | ||
| 3846 | if (r) | 3792 | if (r) |
| 3847 | goto fail; | 3793 | goto fail; |
| 3848 | 3794 | ||
| @@ -3859,6 +3805,7 @@ static int sienna_cichlid_i2c_xfer(struct i2c_adapter *i2c_adap, · 10 unmodified lines | |||
| 3859 | } | 3805 | } |
| 3860 | r = num_msgs; | 3806 | r = num_msgs; |
| 3861 | fail: | 3807 | fail: |
| 3808 | mutex_unlock(&adev->pm.mutex); | ||
| 3862 | kfree(req); | 3809 | kfree(req); |
| 3863 | return r; | 3810 | return r; |
| 3864 | } | 3811 | } |
| @@ -1525,7 +1525,6 @@ static int aldebaran_i2c_xfer(struct i2c_adapter *i2c_adap, · 1524 unmodified lines | |||
| 1525 | } | 1525 | } |
| 1526 | mutex_lock(&adev->pm.mutex); | 1526 | mutex_lock(&adev->pm.mutex); |
| 1527 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); | 1527 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); |
| 1528 | mutex_unlock(&adev->pm.mutex); | ||
| 1529 | if (r) | 1528 | if (r) |
| 1530 | goto fail; | 1529 | goto fail; |
| 1531 | 1530 | ||
| @@ -1542,6 +1541,7 @@ static int aldebaran_i2c_xfer(struct i2c_adapter *i2c_adap, · 10 unmodified lines | |||
| 1542 | } | 1541 | } |
| 1543 | r = num_msgs; | 1542 | r = num_msgs; |
| 1544 | fail: | 1543 | fail: |
| 1544 | mutex_unlock(&adev->pm.mutex); | ||
| 1545 | kfree(req); | 1545 | kfree(req); |
| 1546 | return r; | 1546 | return r; |
| 1547 | } | 1547 | } |
| @@ -2424,3 +2424,51 @@ int smu_v13_0_mode1_reset(struct smu_context *smu) · 2423 unmodified lines | |||
| 2424 | 2424 | ||
| 2425 | return ret; | 2425 | return ret; |
| 2426 | } | 2426 | } |
| 2427 | |||
| 2428 | int smu_v13_0_update_pcie_parameters(struct smu_context *smu, | ||
| 2429 | uint32_t pcie_gen_cap, | ||
| 2430 | uint32_t pcie_width_cap) | ||
| 2431 | { | ||
| 2432 | struct smu_13_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; | ||
| 2433 | struct smu_13_0_pcie_table *pcie_table = | ||
| 2434 | &dpm_context->dpm_tables.pcie_table; | ||
| 2435 | int num_of_levels = pcie_table->num_of_link_levels; | ||
| 2436 | uint32_t smu_pcie_arg; | ||
| 2437 | int ret, i; | ||
| 2438 | |||
| 2439 | if (!amdgpu_device_pcie_dynamic_switching_supported()) { | ||
| 2440 | if (pcie_table->pcie_gen[num_of_levels - 1] < pcie_gen_cap) | ||
| 2441 | pcie_gen_cap = pcie_table->pcie_gen[num_of_levels - 1]; | ||
| 2442 | |||
| 2443 | if (pcie_table->pcie_lane[num_of_levels - 1] < pcie_width_cap) | ||
| 2444 | pcie_width_cap = pcie_table->pcie_lane[num_of_levels - 1]; | ||
| 2445 | |||
| 2446 | /* Force all levels to use the same settings */ | ||
| 2447 | for (i = 0; i < num_of_levels; i++) { | ||
| 2448 | pcie_table->pcie_gen[i] = pcie_gen_cap; | ||
| 2449 | pcie_table->pcie_lane[i] = pcie_width_cap; | ||
| 2450 | } | ||
| 2451 | } else { | ||
| 2452 | for (i = 0; i < num_of_levels; i++) { | ||
| 2453 | if (pcie_table->pcie_gen[i] > pcie_gen_cap) | ||
| 2454 | pcie_table->pcie_gen[i] = pcie_gen_cap; | ||
| 2455 | if (pcie_table->pcie_lane[i] > pcie_width_cap) | ||
| 2456 | pcie_table->pcie_lane[i] = pcie_width_cap; | ||
| 2457 | } | ||
| 2458 | } | ||
| 2459 | |||
| 2460 | for (i = 0; i < num_of_levels; i++) { | ||
| 2461 | smu_pcie_arg = i << 16; | ||
| 2462 | smu_pcie_arg |= pcie_table->pcie_gen[i] << 8; | ||
| 2463 | smu_pcie_arg |= pcie_table->pcie_lane[i]; | ||
| 2464 | |||
| 2465 | ret = smu_cmn_send_smc_msg_with_param(smu, | ||
| 2466 | SMU_MSG_OverridePcieParameters, | ||
| 2467 | smu_pcie_arg, | ||
| 2468 | NULL); | ||
| 2469 | if (ret) | ||
| 2470 | return ret; | ||
| 2471 | } | ||
| 2472 | |||
| 2473 | return 0; | ||
| 2474 | } | ||
| @@ -1645,37 +1645,6 @@ static int smu_v13_0_0_force_clk_levels(struct smu_context *smu, · 1644 unmodified lines | |||
| 1645 | return ret; | 1645 | return ret; |
| 1646 | } | 1646 | } |
| 1647 | 1647 | ||
| 1648 | static int smu_v13_0_0_update_pcie_parameters(struct smu_context *smu, | ||
| 1649 | uint32_t pcie_gen_cap, | ||
| 1650 | uint32_t pcie_width_cap) | ||
| 1651 | { | ||
| 1652 | struct smu_13_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; | ||
| 1653 | struct smu_13_0_pcie_table *pcie_table = | ||
| 1654 | &dpm_context->dpm_tables.pcie_table; | ||
| 1655 | uint32_t smu_pcie_arg; | ||
| 1656 | int ret, i; | ||
| 1657 | |||
| 1658 | for (i = 0; i < pcie_table->num_of_link_levels; i++) { | ||
| 1659 | if (pcie_table->pcie_gen[i] > pcie_gen_cap) | ||
| 1660 | pcie_table->pcie_gen[i] = pcie_gen_cap; | ||
| 1661 | if (pcie_table->pcie_lane[i] > pcie_width_cap) | ||
| 1662 | pcie_table->pcie_lane[i] = pcie_width_cap; | ||
| 1663 | |||
| 1664 | smu_pcie_arg = i << 16; | ||
| 1665 | smu_pcie_arg |= pcie_table->pcie_gen[i] << 8; | ||
| 1666 | smu_pcie_arg |= pcie_table->pcie_lane[i]; | ||
| 1667 | |||
| 1668 | ret = smu_cmn_send_smc_msg_with_param(smu, | ||
| 1669 | SMU_MSG_OverridePcieParameters, | ||
| 1670 | smu_pcie_arg, | ||
| 1671 | NULL); | ||
| 1672 | if (ret) | ||
| 1673 | return ret; | ||
| 1674 | } | ||
| 1675 | |||
| 1676 | return 0; | ||
| 1677 | } | ||
| 1678 | |||
| 1679 | static const struct smu_temperature_range smu13_thermal_policy[] = { | 1648 | static const struct smu_temperature_range smu13_thermal_policy[] = { |
| 1680 | {-273150, 99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000}, | 1649 | {-273150, 99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000}, |
| 1681 | { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000}, | 1650 | { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000}, |
| @@ -2320,7 +2289,6 @@ static int smu_v13_0_0_i2c_xfer(struct i2c_adapter *i2c_adap, · 638 unmodified lines | |||
| 2320 | } | 2289 | } |
| 2321 | mutex_lock(&adev->pm.mutex); | 2290 | mutex_lock(&adev->pm.mutex); |
| 2322 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); | 2291 | r = smu_cmn_update_table(smu, SMU_TABLE_I2C_COMMANDS, 0, req, true); |
| 2323 | mutex_unlock(&adev->pm.mutex); | ||
| 2324 | if (r) | 2292 | if (r) |
| 2325 | goto fail; | 2293 | goto fail; |
| 2326 | 2294 | ||
| @@ -2337,6 +2305,7 @@ static int smu_v13_0_0_i2c_xfer(struct i2c_adapter *i2c_adap, · 10 unmodified lines | |||
| 2337 | } | 2305 | } |
| 2338 | r = num_msgs; | 2306 | r = num_msgs; |
| 2339 | fail: | 2307 | fail: |
| 2308 | mutex_unlock(&adev->pm.mutex); | ||
| 2340 | kfree(req); | 2309 | kfree(req); |
| 2341 | return r; | 2310 | return r; |
| 2342 | } | 2311 | } |
| @@ -2654,7 +2623,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = { · 311 unmodified lines | |||
| 2654 | .feature_is_enabled = smu_cmn_feature_is_enabled, | 2623 | .feature_is_enabled = smu_cmn_feature_is_enabled, |
| 2655 | .print_clk_levels = smu_v13_0_0_print_clk_levels, | 2624 | .print_clk_levels = smu_v13_0_0_print_clk_levels, |
| 2656 | .force_clk_levels = smu_v13_0_0_force_clk_levels, | 2625 | .force_clk_levels = smu_v13_0_0_force_clk_levels, |
| 2657 | .update_pcie_parameters = smu_v13_0_0_update_pcie_parameters, | 2626 | .update_pcie_parameters = smu_v13_0_update_pcie_parameters, |
| 2658 | .get_thermal_temperature_range = smu_v13_0_0_get_thermal_temperature_range, | 2627 | .get_thermal_temperature_range = smu_v13_0_0_get_thermal_temperature_range, |
| 2659 | .register_irq_handler = smu_v13_0_register_irq_handler, | 2628 | .register_irq_handler = smu_v13_0_register_irq_handler, |
| 2660 | .enable_thermal_alert = smu_v13_0_enable_thermal_alert, | 2629 | .enable_thermal_alert = smu_v13_0_enable_thermal_alert, |
| @@ -1763,7 +1763,6 @@ static int smu_v13_0_6_i2c_xfer(struct i2c_adapter *i2c_adap, · 1762 unmodified lines | |||
| 1763 | } | 1763 | } |
| 1764 | mutex_lock(&adev->pm.mutex); | 1764 | mutex_lock(&adev->pm.mutex); |
| 1765 | r = smu_v13_0_6_request_i2c_xfer(smu, req); | 1765 | r = smu_v13_0_6_request_i2c_xfer(smu, req); |
| 1766 | mutex_unlock(&adev->pm.mutex); | ||
| 1767 | if (r) | 1766 | if (r) |
| 1768 | goto fail; | 1767 | goto fail; |
| 1769 | 1768 | ||
| @@ -1780,6 +1779,7 @@ static int smu_v13_0_6_i2c_xfer(struct i2c_adapter *i2c_adap, · 10 unmodified lines | |||
| 1780 | } | 1779 | } |
| 1781 | r = num_msgs; | 1780 | r = num_msgs; |
| 1782 | fail: | 1781 | fail: |
| 1782 | mutex_unlock(&adev->pm.mutex); | ||
| 1783 | kfree(req); | 1783 | kfree(req); |
| 1784 | return r; | 1784 | return r; |
| 1785 | } | 1785 | } |
| @@ -1635,37 +1635,6 @@ static int smu_v13_0_7_force_clk_levels(struct smu_context *smu, · 1634 unmodified lines | |||
| 1635 | return ret; | 1635 | return ret; |
| 1636 | } | 1636 | } |
| 1637 | 1637 | ||
| 1638 | static int smu_v13_0_7_update_pcie_parameters(struct smu_context *smu, | ||
| 1639 | uint32_t pcie_gen_cap, | ||
| 1640 | uint32_t pcie_width_cap) | ||
| 1641 | { | ||
| 1642 | struct smu_13_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; | ||
| 1643 | struct smu_13_0_pcie_table *pcie_table = | ||
| 1644 | &dpm_context->dpm_tables.pcie_table; | ||
| 1645 | uint32_t smu_pcie_arg; | ||
| 1646 | int ret, i; | ||
| 1647 | |||
| 1648 | for (i = 0; i < pcie_table->num_of_link_levels; i++) { | ||
| 1649 | if (pcie_table->pcie_gen[i] > pcie_gen_cap) | ||
| 1650 | pcie_table->pcie_gen[i] = pcie_gen_cap; | ||
| 1651 | if (pcie_table->pcie_lane[i] > pcie_width_cap) | ||
| 1652 | pcie_table->pcie_lane[i] = pcie_width_cap; | ||
| 1653 | |||
| 1654 | smu_pcie_arg = i << 16; | ||
| 1655 | smu_pcie_arg |= pcie_table->pcie_gen[i] << 8; | ||
| 1656 | smu_pcie_arg |= pcie_table->pcie_lane[i]; | ||
| 1657 | |||
| 1658 | ret = smu_cmn_send_smc_msg_with_param(smu, | ||
| 1659 | SMU_MSG_OverridePcieParameters, | ||
| 1660 | smu_pcie_arg, | ||
| 1661 | NULL); | ||
| 1662 | if (ret) | ||
| 1663 | return ret; | ||
| 1664 | } | ||
| 1665 | |||
| 1666 | return 0; | ||
| 1667 | } | ||
| 1668 | |||
| 1669 | static const struct smu_temperature_range smu13_thermal_policy[] = | 1638 | static const struct smu_temperature_range smu13_thermal_policy[] = |
| 1670 | { | 1639 | { |
| 1671 | {-273150, 99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000}, | 1640 | {-273150, 99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000}, |
| @@ -2234,7 +2203,7 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = { · 562 unmodified lines | |||
| 2234 | .feature_is_enabled = smu_cmn_feature_is_enabled, | 2203 | .feature_is_enabled = smu_cmn_feature_is_enabled, |
| 2235 | .print_clk_levels = smu_v13_0_7_print_clk_levels, | 2204 | .print_clk_levels = smu_v13_0_7_print_clk_levels, |
| 2236 | .force_clk_levels = smu_v13_0_7_force_clk_levels, | 2205 | .force_clk_levels = smu_v13_0_7_force_clk_levels, |
| 2237 | .update_pcie_parameters = smu_v13_0_7_update_pcie_parameters, | 2206 | .update_pcie_parameters = smu_v13_0_update_pcie_parameters, |
| 2238 | .get_thermal_temperature_range = smu_v13_0_7_get_thermal_temperature_range, | 2207 | .get_thermal_temperature_range = smu_v13_0_7_get_thermal_temperature_range, |
| 2239 | .register_irq_handler = smu_v13_0_register_irq_handler, | 2208 | .register_irq_handler = smu_v13_0_register_irq_handler, |
| 2240 | .enable_thermal_alert = smu_v13_0_enable_thermal_alert, | 2209 | .enable_thermal_alert = smu_v13_0_enable_thermal_alert, |