amd-drm-fixes-6.6-2023-10-04: amdgpu: - Add missing unique_id for GC 11.0.3 - Fix memory leak in FRU error path - Fix PCIe link reporting on some SMU 11 parts - Fix ACPI _PR3 detection - Fix DISPCLK WDIVIDER handling in OTG code Signed-off-by: Dave Airlie <airlied@redhat.com>
Unified · Split
| @@ -2093,7 +2093,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) · 2092 unmodified lines | |||
| 2093 | adev->flags |= AMD_IS_PX; | 2093 | adev->flags |= AMD_IS_PX; |
| 2094 | 2094 | ||
| 2095 | if (!(adev->flags & AMD_IS_APU)) { | 2095 | if (!(adev->flags & AMD_IS_APU)) { |
| 2096 | parent = pci_upstream_bridge(adev->pdev); | 2096 | parent = pcie_find_root_port(adev->pdev); |
| 2097 | adev->has_pr3 = parent ? pci_pr3_present(parent) : false; | 2097 | adev->has_pr3 = parent ? pci_pr3_present(parent) : false; |
| 2098 | } | 2098 | } |
| 2099 | 2099 | ||
| @@ -170,6 +170,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 169 unmodified lines | |||
| 170 | csum += pia[size - 1]; | 170 | csum += pia[size - 1]; |
| 171 | if (csum) { | 171 | if (csum) { |
| 172 | DRM_ERROR("Bad Product Info Area checksum: 0x%02x", csum); | 172 | DRM_ERROR("Bad Product Info Area checksum: 0x%02x", csum); |
| 173 | kfree(pia); | ||
| 173 | return -EIO; | 174 | return -EIO; |
| 174 | } | 175 | } |
| 175 | 176 | ||
| @@ -157,7 +157,7 @@ void dcn20_update_clocks_update_dentist(struct clk_mgr_internal *clk_mgr, struct · 156 unmodified lines | |||
| 157 | int32_t N; | 157 | int32_t N; |
| 158 | int32_t j; | 158 | int32_t j; |
| 159 | 159 | ||
| 160 | if (!pipe_ctx->stream) | 160 | if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) |
| 161 | continue; | 161 | continue; |
| 162 | /* Virtual encoders don't have this function */ | 162 | /* Virtual encoders don't have this function */ |
| 163 | if (!stream_enc->funcs->get_fifo_cal_average_level) | 163 | if (!stream_enc->funcs->get_fifo_cal_average_level) |
| @@ -188,7 +188,7 @@ void dcn20_update_clocks_update_dentist(struct clk_mgr_internal *clk_mgr, struct · 24 unmodified lines | |||
| 188 | int32_t N; | 188 | int32_t N; |
| 189 | int32_t j; | 189 | int32_t j; |
| 190 | 190 | ||
| 191 | if (!pipe_ctx->stream) | 191 | if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) |
| 192 | continue; | 192 | continue; |
| 193 | /* Virtual encoders don't have this function */ | 193 | /* Virtual encoders don't have this function */ |
| 194 | if (!stream_enc->funcs->get_fifo_cal_average_level) | 194 | if (!stream_enc->funcs->get_fifo_cal_average_level) |
| @@ -355,7 +355,7 @@ static void dcn32_update_clocks_update_dentist( · 354 unmodified lines | |||
| 355 | int32_t N; | 355 | int32_t N; |
| 356 | int32_t j; | 356 | int32_t j; |
| 357 | 357 | ||
| 358 | if (!pipe_ctx->stream) | 358 | if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) |
| 359 | continue; | 359 | continue; |
| 360 | /* Virtual encoders don't have this function */ | 360 | /* Virtual encoders don't have this function */ |
| 361 | if (!stream_enc->funcs->get_fifo_cal_average_level) | 361 | if (!stream_enc->funcs->get_fifo_cal_average_level) |
| @@ -401,7 +401,7 @@ static void dcn32_update_clocks_update_dentist( · 39 unmodified lines | |||
| 401 | int32_t N; | 401 | int32_t N; |
| 402 | int32_t j; | 402 | int32_t j; |
| 403 | 403 | ||
| 404 | if (!pipe_ctx->stream) | 404 | if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) |
| 405 | continue; | 405 | continue; |
| 406 | /* Virtual encoders don't have this function */ | 406 | /* Virtual encoders don't have this function */ |
| 407 | if (!stream_enc->funcs->get_fifo_cal_average_level) | 407 | if (!stream_enc->funcs->get_fifo_cal_average_level) |
| @@ -2040,6 +2040,7 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · 2039 unmodified lines | |||
| 2040 | case IP_VERSION(11, 0, 0): | 2040 | case IP_VERSION(11, 0, 0): |
| 2041 | case IP_VERSION(11, 0, 1): | 2041 | case IP_VERSION(11, 0, 1): |
| 2042 | case IP_VERSION(11, 0, 2): | 2042 | case IP_VERSION(11, 0, 2): |
| 2043 | case IP_VERSION(11, 0, 3): | ||
| 2043 | *states = ATTR_STATE_SUPPORTED; | 2044 | *states = ATTR_STATE_SUPPORTED; |
| 2044 | break; | 2045 | break; |
| 2045 | default: | 2046 | default: |
| @@ -2082,36 +2082,41 @@ static int sienna_cichlid_display_disable_memory_clock_switch(struct smu_context · 2081 unmodified lines | |||
| 2082 | return ret; | 2082 | return ret; |
| 2083 | } | 2083 | } |
| 2084 | 2084 | ||
| 2085 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) | ||
| 2086 | |||
| 2085 | static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu, | 2087 | static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu, |
| 2086 | uint32_t pcie_gen_cap, | 2088 | uint32_t pcie_gen_cap, |
| 2087 | uint32_t pcie_width_cap) | 2089 | uint32_t pcie_width_cap) |
| 2088 | { | 2090 | { |
| 2089 | struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; | 2091 | struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; |
| 2090 | struct smu_11_0_pcie_table *pcie_table = &dpm_context->dpm_tables.pcie_table; | 2092 | struct smu_11_0_pcie_table *pcie_table = &dpm_context->dpm_tables.pcie_table; |
| 2091 | u32 smu_pcie_arg; | 2093 | uint8_t *table_member1, *table_member2; |
| 2094 | uint32_t min_gen_speed, max_gen_speed; | ||
| 2095 | uint32_t min_lane_width, max_lane_width; | ||
| 2096 | uint32_t smu_pcie_arg; | ||
| 2092 | int ret, i; | 2097 | int ret, i; |
| 2093 | 2098 | ||
| 2094 | /* PCIE gen speed and lane width override */ | 2099 | GET_PPTABLE_MEMBER(PcieGenSpeed, &table_member1); |
| 2095 | if (!amdgpu_device_pcie_dynamic_switching_supported()) { | 2100 | GET_PPTABLE_MEMBER(PcieLaneCount, &table_member2); |
| 2096 | if (pcie_table->pcie_gen[NUM_LINK_LEVELS - 1] < pcie_gen_cap) | ||
| 2097 | pcie_gen_cap = pcie_table->pcie_gen[NUM_LINK_LEVELS - 1]; | ||
| 2098 | 2101 | ||
| 2099 | if (pcie_table->pcie_lane[NUM_LINK_LEVELS - 1] < pcie_width_cap) | 2102 | min_gen_speed = MAX(0, table_member1[0]); |
| 2100 | pcie_width_cap = pcie_table->pcie_lane[NUM_LINK_LEVELS - 1]; | 2103 | max_gen_speed = MIN(pcie_gen_cap, table_member1[1]); |
| 2104 | min_gen_speed = min_gen_speed > max_gen_speed ? | ||
| 2105 | max_gen_speed : min_gen_speed; | ||
| 2106 | min_lane_width = MAX(1, table_member2[0]); | ||
| 2107 | max_lane_width = MIN(pcie_width_cap, table_member2[1]); | ||
| 2108 | min_lane_width = min_lane_width > max_lane_width ? | ||
| 2109 | max_lane_width : min_lane_width; | ||
| 2101 | 2110 | ||
| 2102 | /* Force all levels to use the same settings */ | 2111 | if (!amdgpu_device_pcie_dynamic_switching_supported()) { |
| 2103 | for (i = 0; i < NUM_LINK_LEVELS; i++) { | 2112 | pcie_table->pcie_gen[0] = max_gen_speed; |
| 2104 | pcie_table->pcie_gen[i] = pcie_gen_cap; | 2113 | pcie_table->pcie_lane[0] = max_lane_width; |
| 2105 | pcie_table->pcie_lane[i] = pcie_width_cap; | ||
| 2106 | } | ||
| 2107 | } else { | 2114 | } else { |
| 2108 | for (i = 0; i < NUM_LINK_LEVELS; i++) { | 2115 | pcie_table->pcie_gen[0] = min_gen_speed; |
| 2109 | if (pcie_table->pcie_gen[i] > pcie_gen_cap) | 2116 | pcie_table->pcie_lane[0] = min_lane_width; |
| 2110 | pcie_table->pcie_gen[i] = pcie_gen_cap; | ||
| 2111 | if (pcie_table->pcie_lane[i] > pcie_width_cap) | ||
| 2112 | pcie_table->pcie_lane[i] = pcie_width_cap; | ||
| 2113 | } | ||
| 2114 | } | 2117 | } |
| 2118 | pcie_table->pcie_gen[1] = max_gen_speed; | ||
| 2119 | pcie_table->pcie_lane[1] = max_lane_width; | ||
| 2115 | 2120 | ||
| 2116 | for (i = 0; i < NUM_LINK_LEVELS; i++) { | 2121 | for (i = 0; i < NUM_LINK_LEVELS; i++) { |
| 2117 | smu_pcie_arg = (i << 16 | | 2122 | smu_pcie_arg = (i << 16 | |