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 | 2093 | adev->flags |= AMD_IS_PX; |
| 2094 | 2094 | |
| 2095 | 2095 | if (!(adev->flags & AMD_IS_APU)) { |
| 2096 | − parent = pci_upstream_bridge(adev->pdev); | |
| 2096 | + parent = pcie_find_root_port(adev->pdev); | |
| 2097 | 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 | 170 | csum += pia[size - 1]; |
| 171 | 171 | if (csum) { |
| 172 | 172 | DRM_ERROR("Bad Product Info Area checksum: 0x%02x", csum); |
| 173 | + kfree(pia); | |
| 173 | 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 | 157 | int32_t N; |
| 158 | 158 | int32_t j; |
| 159 | 159 | |
| 160 | − if (!pipe_ctx->stream) | |
| 160 | + if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) | |
| 161 | 161 | continue; |
| 162 | 162 | /* Virtual encoders don't have this function */ |
| 163 | 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 | 188 | int32_t N; |
| 189 | 189 | int32_t j; |
| 190 | 190 | |
| 191 | − if (!pipe_ctx->stream) | |
| 191 | + if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) | |
| 192 | 192 | continue; |
| 193 | 193 | /* Virtual encoders don't have this function */ |
| 194 | 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 | 355 | int32_t N; |
| 356 | 356 | int32_t j; |
| 357 | 357 | |
| 358 | − if (!pipe_ctx->stream) | |
| 358 | + if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) | |
| 359 | 359 | continue; |
| 360 | 360 | /* Virtual encoders don't have this function */ |
| 361 | 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 | 401 | int32_t N; |
| 402 | 402 | int32_t j; |
| 403 | 403 | |
| 404 | − if (!pipe_ctx->stream) | |
| 404 | + if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) | |
| 405 | 405 | continue; |
| 406 | 406 | /* Virtual encoders don't have this function */ |
| 407 | 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 | 2040 | case IP_VERSION(11, 0, 0): |
| 2041 | 2041 | case IP_VERSION(11, 0, 1): |
| 2042 | 2042 | case IP_VERSION(11, 0, 2): |
| 2043 | + case IP_VERSION(11, 0, 3): | |
| 2043 | 2044 | *states = ATTR_STATE_SUPPORTED; |
| 2044 | 2045 | break; |
| 2045 | 2046 | default: |
| @@ -2082,36 +2082,41 @@ static int sienna_cichlid_display_disable_memory_clock_switch(struct smu_context · 2081 unmodified lines | ||
| 2082 | 2082 | return ret; |
| 2083 | 2083 | } |
| 2084 | 2084 | |
| 2085 | +#define MAX(a, b) ((a) > (b) ? (a) : (b)) | |
| 2086 | + | |
| 2085 | 2087 | static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu, |
| 2086 | 2088 | uint32_t pcie_gen_cap, |
| 2087 | 2089 | uint32_t pcie_width_cap) |
| 2088 | 2090 | { |
| 2089 | 2091 | struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; |
| 2090 | 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 | 2097 | int ret, i; |
| 2093 | 2098 | |
| 2094 | − /* PCIE gen speed and lane width override */ | |
| 2095 | − if (!amdgpu_device_pcie_dynamic_switching_supported()) { | |
| 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]; | |
| 2099 | + GET_PPTABLE_MEMBER(PcieGenSpeed, &table_member1); | |
| 2100 | + GET_PPTABLE_MEMBER(PcieLaneCount, &table_member2); | |
| 2098 | 2101 | |
| 2099 | − if (pcie_table->pcie_lane[NUM_LINK_LEVELS - 1] < pcie_width_cap) | |
| 2100 | − pcie_width_cap = pcie_table->pcie_lane[NUM_LINK_LEVELS - 1]; | |
| 2102 | + min_gen_speed = MAX(0, table_member1[0]); | |
| 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 */ | |
| 2103 | − for (i = 0; i < NUM_LINK_LEVELS; i++) { | |
| 2104 | − pcie_table->pcie_gen[i] = pcie_gen_cap; | |
| 2105 | − pcie_table->pcie_lane[i] = pcie_width_cap; | |
| 2106 | − } | |
| 2111 | + if (!amdgpu_device_pcie_dynamic_switching_supported()) { | |
| 2112 | + pcie_table->pcie_gen[0] = max_gen_speed; | |
| 2113 | + pcie_table->pcie_lane[0] = max_lane_width; | |
| 2107 | 2114 | } else { |
| 2108 | − for (i = 0; i < NUM_LINK_LEVELS; i++) { | |
| 2109 | − if (pcie_table->pcie_gen[i] > pcie_gen_cap) | |
| 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 | − } | |
| 2115 | + pcie_table->pcie_gen[0] = min_gen_speed; | |
| 2116 | + pcie_table->pcie_lane[0] = min_lane_width; | |
| 2114 | 2117 | } |
| 2118 | + pcie_table->pcie_gen[1] = max_gen_speed; | |
| 2119 | + pcie_table->pcie_lane[1] = max_lane_width; | |
| 2115 | 2120 | |
| 2116 | 2121 | for (i = 0; i < NUM_LINK_LEVELS; i++) { |
| 2117 | 2122 | smu_pcie_arg = (i << 16 | |