Skip to content

Commit 3a3c5ab

Browse files
committed
Merge tag 'drm-fixes-2021-06-04-1' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Two big regression reverts in here, one for fbdev and one i915. Otherwise it's mostly amdgpu display fixes, and tegra fixes. fb: - revert broken fb_defio patch amdgpu: - Display fixes - FRU EEPROM error handling fix - RAS fix - PSP fix - Releasing pinned BO fix i915: - Revert conversion to io_mapping_map_user() which lead to BUG_ON() - Fix check for error valued returns in a selftest tegra: - SOR power domain race condition fix - build warning fix - runtime pm ref leak fix - modifier fix" * tag 'drm-fixes-2021-06-04-1' of git://anongit.freedesktop.org/drm/drm: amd/display: convert DRM_DEBUG_ATOMIC to drm_dbg_atomic drm/amdgpu: make sure we unpin the UVD BO drm/amd/amdgpu:save psp ring wptr to avoid attack drm/amd/display: Fix potential memory leak in DMUB hw_init drm/amdgpu: Don't query CE and UE errors drm/amd/display: Fix overlay validation by considering cursors drm/amdgpu: refine amdgpu_fru_get_product_info drm/amdgpu: add judgement for dc support drm/amd/display: Fix GPU scaling regression by FS video support drm/amd/display: Allow bandwidth validation for 0 streams. Revert "i915: use io_mapping_map_user" drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest() Revert "fb_defio: Remove custom address_space_operations" drm/tegra: Correct DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT drm/tegra: sor: Fix AUX device reference leak drm/tegra: Get ref for DP AUX channel, not its ddc adapter drm/tegra: Fix shift overflow in tegra_shared_plane_atomic_update drm/tegra: sor: Fully initialize SOR before registration gpu: host1x: Split up client initalization and registration drm/tegra: sor: Do not leak runtime PM reference
2 parents f88cd3f + 37e2f2e commit 3a3c5ab

File tree

22 files changed

+240
-99
lines changed

22 files changed

+240
-99
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,
337337
{
338338
struct amdgpu_ctx *ctx;
339339
struct amdgpu_ctx_mgr *mgr;
340-
unsigned long ras_counter;
341340

342341
if (!fpriv)
343342
return -EINVAL;
@@ -362,21 +361,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,
362361
if (atomic_read(&ctx->guilty))
363362
out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_GUILTY;
364363

365-
/*query ue count*/
366-
ras_counter = amdgpu_ras_query_error_count(adev, false);
367-
/*ras counter is monotonic increasing*/
368-
if (ras_counter != ctx->ras_counter_ue) {
369-
out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_RAS_UE;
370-
ctx->ras_counter_ue = ras_counter;
371-
}
372-
373-
/*query ce count*/
374-
ras_counter = amdgpu_ras_query_error_count(adev, true);
375-
if (ras_counter != ctx->ras_counter_ce) {
376-
out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_RAS_CE;
377-
ctx->ras_counter_ce = ras_counter;
378-
}
379-
380364
mutex_unlock(&mgr->lock);
381365
return 0;
382366
}

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3118,7 +3118,9 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
31183118
*/
31193119
bool amdgpu_device_has_dc_support(struct amdgpu_device *adev)
31203120
{
3121-
if (amdgpu_sriov_vf(adev) || adev->enable_virtual_display)
3121+
if (amdgpu_sriov_vf(adev) ||
3122+
adev->enable_virtual_display ||
3123+
(adev->harvest_ip_mask & AMD_HARVEST_IP_DMU_MASK))
31223124
return false;
31233125

31243126
return amdgpu_device_asic_has_dc_support(adev->asic_type);

drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,16 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr,
101101
int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
102102
{
103103
unsigned char buff[34];
104-
int addrptr = 0, size = 0;
104+
int addrptr, size;
105+
int len;
105106

106107
if (!is_fru_eeprom_supported(adev))
107108
return 0;
108109

109110
/* If algo exists, it means that the i2c_adapter's initialized */
110111
if (!adev->pm.smu_i2c.algo) {
111112
DRM_WARN("Cannot access FRU, EEPROM accessor not initialized");
112-
return 0;
113+
return -ENODEV;
113114
}
114115

115116
/* There's a lot of repetition here. This is due to the FRU having
@@ -128,7 +129,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
128129
size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
129130
if (size < 1) {
130131
DRM_ERROR("Failed to read FRU Manufacturer, ret:%d", size);
131-
return size;
132+
return -EINVAL;
132133
}
133134

134135
/* Increment the addrptr by the size of the field, and 1 due to the
@@ -138,62 +139,65 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
138139
size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
139140
if (size < 1) {
140141
DRM_ERROR("Failed to read FRU product name, ret:%d", size);
141-
return size;
142+
return -EINVAL;
142143
}
143144

145+
len = size;
144146
/* Product name should only be 32 characters. Any more,
145147
* and something could be wrong. Cap it at 32 to be safe
146148
*/
147-
if (size > 32) {
149+
if (len >= sizeof(adev->product_name)) {
148150
DRM_WARN("FRU Product Number is larger than 32 characters. This is likely a mistake");
149-
size = 32;
151+
len = sizeof(adev->product_name) - 1;
150152
}
151153
/* Start at 2 due to buff using fields 0 and 1 for the address */
152-
memcpy(adev->product_name, &buff[2], size);
153-
adev->product_name[size] = '\0';
154+
memcpy(adev->product_name, &buff[2], len);
155+
adev->product_name[len] = '\0';
154156

155157
addrptr += size + 1;
156158
size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
157159
if (size < 1) {
158160
DRM_ERROR("Failed to read FRU product number, ret:%d", size);
159-
return size;
161+
return -EINVAL;
160162
}
161163

164+
len = size;
162165
/* Product number should only be 16 characters. Any more,
163166
* and something could be wrong. Cap it at 16 to be safe
164167
*/
165-
if (size > 16) {
168+
if (len >= sizeof(adev->product_number)) {
166169
DRM_WARN("FRU Product Number is larger than 16 characters. This is likely a mistake");
167-
size = 16;
170+
len = sizeof(adev->product_number) - 1;
168171
}
169-
memcpy(adev->product_number, &buff[2], size);
170-
adev->product_number[size] = '\0';
172+
memcpy(adev->product_number, &buff[2], len);
173+
adev->product_number[len] = '\0';
171174

172175
addrptr += size + 1;
173176
size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
174177

175178
if (size < 1) {
176179
DRM_ERROR("Failed to read FRU product version, ret:%d", size);
177-
return size;
180+
return -EINVAL;
178181
}
179182

180183
addrptr += size + 1;
181184
size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
182185

183186
if (size < 1) {
184187
DRM_ERROR("Failed to read FRU serial number, ret:%d", size);
185-
return size;
188+
return -EINVAL;
186189
}
187190

191+
len = size;
188192
/* Serial number should only be 16 characters. Any more,
189193
* and something could be wrong. Cap it at 16 to be safe
190194
*/
191-
if (size > 16) {
195+
if (len >= sizeof(adev->serial)) {
192196
DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a mistake");
193-
size = 16;
197+
len = sizeof(adev->serial) - 1;
194198
}
195-
memcpy(adev->serial, &buff[2], size);
196-
adev->serial[size] = '\0';
199+
memcpy(adev->serial, &buff[2], len);
200+
adev->serial[len] = '\0';
197201

198202
return 0;
199203
}

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ struct psp_ring
7676
uint64_t ring_mem_mc_addr;
7777
void *ring_mem_handle;
7878
uint32_t ring_size;
79+
uint32_t ring_wptr;
7980
};
8081

8182
/* More registers may will be supported */

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ static uint32_t psp_v11_0_ring_get_wptr(struct psp_context *psp)
720720
struct amdgpu_device *adev = psp->adev;
721721

722722
if (amdgpu_sriov_vf(adev))
723-
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102);
723+
data = psp->km_ring.ring_wptr;
724724
else
725725
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
726726

@@ -734,6 +734,7 @@ static void psp_v11_0_ring_set_wptr(struct psp_context *psp, uint32_t value)
734734
if (amdgpu_sriov_vf(adev)) {
735735
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, value);
736736
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, GFX_CTRL_CMD_ID_CONSUME_CMD);
737+
psp->km_ring.ring_wptr = value;
737738
} else
738739
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67, value);
739740
}

drivers/gpu/drm/amd/amdgpu/psp_v3_1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ static uint32_t psp_v3_1_ring_get_wptr(struct psp_context *psp)
379379
struct amdgpu_device *adev = psp->adev;
380380

381381
if (amdgpu_sriov_vf(adev))
382-
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102);
382+
data = psp->km_ring.ring_wptr;
383383
else
384384
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
385385
return data;
@@ -394,6 +394,7 @@ static void psp_v3_1_ring_set_wptr(struct psp_context *psp, uint32_t value)
394394
/* send interrupt to PSP for SRIOV ring write pointer update */
395395
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
396396
GFX_CTRL_CMD_ID_CONSUME_CMD);
397+
psp->km_ring.ring_wptr = value;
397398
} else
398399
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67, value);
399400
}

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
357357

358358
error:
359359
dma_fence_put(fence);
360+
amdgpu_bo_unpin(bo);
360361
amdgpu_bo_unreserve(bo);
361362
amdgpu_bo_unref(&bo);
362363
return r;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,8 @@ static int dm_dmub_hw_init(struct amdgpu_device *adev)
925925
abm->dmcu_is_running = dmcu->funcs->is_dmcu_initialized(dmcu);
926926
}
927927

928-
adev->dm.dc->ctx->dmub_srv = dc_dmub_srv_create(adev->dm.dc, dmub_srv);
928+
if (!adev->dm.dc->ctx->dmub_srv)
929+
adev->dm.dc->ctx->dmub_srv = dc_dmub_srv_create(adev->dm.dc, dmub_srv);
929930
if (!adev->dm.dc->ctx->dmub_srv) {
930931
DRM_ERROR("Couldn't allocate DC DMUB server!\n");
931932
return -ENOMEM;
@@ -1954,7 +1955,6 @@ static int dm_suspend(void *handle)
19541955

19551956
amdgpu_dm_irq_suspend(adev);
19561957

1957-
19581958
dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
19591959

19601960
return 0;
@@ -5500,7 +5500,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
55005500
struct drm_display_mode saved_mode;
55015501
struct drm_display_mode *freesync_mode = NULL;
55025502
bool native_mode_found = false;
5503-
bool recalculate_timing = dm_state ? (dm_state->scaling != RMX_OFF) : false;
5503+
bool recalculate_timing = false;
5504+
bool scale = dm_state ? (dm_state->scaling != RMX_OFF) : false;
55045505
int mode_refresh;
55055506
int preferred_refresh = 0;
55065507
#if defined(CONFIG_DRM_AMD_DC_DCN)
@@ -5563,19 +5564,18 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
55635564
*/
55645565
DRM_DEBUG_DRIVER("No preferred mode found\n");
55655566
} else {
5566-
recalculate_timing |= amdgpu_freesync_vid_mode &&
5567+
recalculate_timing = amdgpu_freesync_vid_mode &&
55675568
is_freesync_video_mode(&mode, aconnector);
55685569
if (recalculate_timing) {
55695570
freesync_mode = get_highest_refresh_rate_mode(aconnector, false);
55705571
saved_mode = mode;
55715572
mode = *freesync_mode;
55725573
} else {
55735574
decide_crtc_timing_for_drm_display_mode(
5574-
&mode, preferred_mode,
5575-
dm_state ? (dm_state->scaling != RMX_OFF) : false);
5576-
}
5575+
&mode, preferred_mode, scale);
55775576

5578-
preferred_refresh = drm_mode_vrefresh(preferred_mode);
5577+
preferred_refresh = drm_mode_vrefresh(preferred_mode);
5578+
}
55795579
}
55805580

55815581
if (recalculate_timing)
@@ -5587,7 +5587,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
55875587
* If scaling is enabled and refresh rate didn't change
55885588
* we copy the vic and polarities of the old timings
55895589
*/
5590-
if (!recalculate_timing || mode_refresh != preferred_refresh)
5590+
if (!scale || mode_refresh != preferred_refresh)
55915591
fill_stream_properties_from_drm_display_mode(
55925592
stream, &mode, &aconnector->base, con_state, NULL,
55935593
requested_bpc);
@@ -9854,7 +9854,7 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,
98549854

98559855
if (cursor_scale_w != primary_scale_w ||
98569856
cursor_scale_h != primary_scale_h) {
9857-
DRM_DEBUG_ATOMIC("Cursor plane scaling doesn't match primary plane\n");
9857+
drm_dbg_atomic(crtc->dev, "Cursor plane scaling doesn't match primary plane\n");
98589858
return -EINVAL;
98599859
}
98609860

@@ -9891,7 +9891,7 @@ static int validate_overlay(struct drm_atomic_state *state)
98919891
int i;
98929892
struct drm_plane *plane;
98939893
struct drm_plane_state *old_plane_state, *new_plane_state;
9894-
struct drm_plane_state *primary_state, *overlay_state = NULL;
9894+
struct drm_plane_state *primary_state, *cursor_state, *overlay_state = NULL;
98959895

98969896
/* Check if primary plane is contained inside overlay */
98979897
for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) {
@@ -9921,6 +9921,14 @@ static int validate_overlay(struct drm_atomic_state *state)
99219921
if (!primary_state->crtc)
99229922
return 0;
99239923

9924+
/* check if cursor plane is enabled */
9925+
cursor_state = drm_atomic_get_plane_state(state, overlay_state->crtc->cursor);
9926+
if (IS_ERR(cursor_state))
9927+
return PTR_ERR(cursor_state);
9928+
9929+
if (drm_atomic_plane_disabling(plane->state, cursor_state))
9930+
return 0;
9931+
99249932
/* Perform the bounds check to ensure the overlay plane covers the primary */
99259933
if (primary_state->crtc_x < overlay_state->crtc_x ||
99269934
primary_state->crtc_y < overlay_state->crtc_y ||

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3236,7 +3236,7 @@ static noinline bool dcn20_validate_bandwidth_fp(struct dc *dc,
32363236
voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false);
32373237
dummy_pstate_supported = context->bw_ctx.bw.dcn.clk.p_state_change_support;
32383238

3239-
if (voltage_supported && dummy_pstate_supported) {
3239+
if (voltage_supported && (dummy_pstate_supported || !(context->stream_count))) {
32403240
context->bw_ctx.bw.dcn.clk.p_state_change_support = false;
32413241
goto restore_dml_state;
32423242
}

drivers/gpu/drm/i915/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ config DRM_I915
2020
select INPUT if ACPI
2121
select ACPI_VIDEO if ACPI
2222
select ACPI_BUTTON if ACPI
23-
select IO_MAPPING
2423
select SYNC_FILE
2524
select IOSF_MBI
2625
select CRC32

0 commit comments

Comments
 (0)