Skip to content

Commit 6f5a5e8

Browse files
committed
Merge tag 'amd-drm-fixes-6.4-2023-04-26' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-fixes-6.4-2023-04-26: amdgpu: - SR-IOV fixes - DCN 3.2 fixes - DC mclk handling fixes - eDP fixes - SubVP fixes - HDCP regression fix - DSC fixes - DC FP fixes - DCN 3.x fixes - Display flickering fix when switching between vram and gtt - Z8 power saving fix - Fix hang when skipping modeset Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230427033012.7668-1-alexander.deucher@amd.com
2 parents cf03e29 + d893f39 commit 6f5a5e8

31 files changed

Lines changed: 300 additions & 172 deletions

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,8 +2539,6 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
25392539
amdgpu_fru_get_product_info(adev);
25402540

25412541
init_failed:
2542-
if (amdgpu_sriov_vf(adev))
2543-
amdgpu_virt_release_full_gpu(adev, true);
25442542

25452543
return r;
25462544
}
@@ -3859,18 +3857,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
38593857

38603858
r = amdgpu_device_ip_init(adev);
38613859
if (r) {
3862-
/* failed in exclusive mode due to timeout */
3863-
if (amdgpu_sriov_vf(adev) &&
3864-
!amdgpu_sriov_runtime(adev) &&
3865-
amdgpu_virt_mmio_blocked(adev) &&
3866-
!amdgpu_virt_wait_reset(adev)) {
3867-
dev_err(adev->dev, "VF exclusive mode timeout\n");
3868-
/* Don't send request since VF is inactive. */
3869-
adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;
3870-
adev->virt.ops = NULL;
3871-
r = -EAGAIN;
3872-
goto release_ras_con;
3873-
}
38743860
dev_err(adev->dev, "amdgpu_device_ip_init failed\n");
38753861
amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_AMDGPU_INIT_FAIL, 0, 0);
38763862
goto release_ras_con;
@@ -3939,8 +3925,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,
39393925
msecs_to_jiffies(AMDGPU_RESUME_MS));
39403926
}
39413927

3942-
if (amdgpu_sriov_vf(adev))
3928+
if (amdgpu_sriov_vf(adev)) {
3929+
amdgpu_virt_release_full_gpu(adev, true);
39433930
flush_delayed_work(&adev->delayed_init_work);
3931+
}
39443932

39453933
r = sysfs_create_files(&adev->dev->kobj, amdgpu_dev_attributes);
39463934
if (r)
@@ -3980,6 +3968,20 @@ int amdgpu_device_init(struct amdgpu_device *adev,
39803968
return 0;
39813969

39823970
release_ras_con:
3971+
if (amdgpu_sriov_vf(adev))
3972+
amdgpu_virt_release_full_gpu(adev, true);
3973+
3974+
/* failed in exclusive mode due to timeout */
3975+
if (amdgpu_sriov_vf(adev) &&
3976+
!amdgpu_sriov_runtime(adev) &&
3977+
amdgpu_virt_mmio_blocked(adev) &&
3978+
!amdgpu_virt_wait_reset(adev)) {
3979+
dev_err(adev->dev, "VF exclusive mode timeout\n");
3980+
/* Don't send request since VF is inactive. */
3981+
adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;
3982+
adev->virt.ops = NULL;
3983+
r = -EAGAIN;
3984+
}
39833985
amdgpu_release_ras_context(adev);
39843986

39853987
failed:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static int jpeg_v4_0_start_sriov(struct amdgpu_device *adev)
430430
MMSCH_COMMAND__END;
431431

432432
header.version = MMSCH_VERSION;
433-
header.total_size = sizeof(struct mmsch_v4_0_init_header) >> 2;
433+
header.total_size = RREG32_SOC15(VCN, 0, regMMSCH_VF_CTX_SIZE);
434434

435435
header.jpegdec.init_status = 0;
436436
header.jpegdec.table_offset = 0;

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

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,9 +3128,12 @@ void amdgpu_dm_update_connector_after_detect(
31283128
aconnector->edid);
31293129
}
31303130

3131-
aconnector->timing_requested = kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
3132-
if (!aconnector->timing_requested)
3133-
dm_error("%s: failed to create aconnector->requested_timing\n", __func__);
3131+
if (!aconnector->timing_requested) {
3132+
aconnector->timing_requested =
3133+
kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
3134+
if (!aconnector->timing_requested)
3135+
dm_error("failed to create aconnector->requested_timing\n");
3136+
}
31343137

31353138
drm_connector_update_edid_property(connector, aconnector->edid);
31363139
amdgpu_dm_update_freesync_caps(connector, aconnector->edid);
@@ -7898,6 +7901,13 @@ static void amdgpu_dm_commit_cursors(struct drm_atomic_state *state)
78987901
amdgpu_dm_plane_handle_cursor_update(plane, old_plane_state);
78997902
}
79007903

7904+
static inline uint32_t get_mem_type(struct drm_framebuffer *fb)
7905+
{
7906+
struct amdgpu_bo *abo = gem_to_amdgpu_bo(fb->obj[0]);
7907+
7908+
return abo->tbo.resource ? abo->tbo.resource->mem_type : 0;
7909+
}
7910+
79017911
static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
79027912
struct dc_state *dc_state,
79037913
struct drm_device *dev,
@@ -7972,6 +7982,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
79727982
continue;
79737983

79747984
dc_plane = dm_new_plane_state->dc_state;
7985+
if (!dc_plane)
7986+
continue;
79757987

79767988
bundle->surface_updates[planes_count].surface = dc_plane;
79777989
if (new_pcrtc_state->color_mgmt_changed) {
@@ -8038,11 +8050,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
80388050

80398051
/*
80408052
* Only allow immediate flips for fast updates that don't
8041-
* change FB pitch, DCC state, rotation or mirroing.
8053+
* change memory domain, FB pitch, DCC state, rotation or
8054+
* mirroring.
80428055
*/
80438056
bundle->flip_addrs[planes_count].flip_immediate =
80448057
crtc->state->async_flip &&
8045-
acrtc_state->update_type == UPDATE_TYPE_FAST;
8058+
acrtc_state->update_type == UPDATE_TYPE_FAST &&
8059+
get_mem_type(old_plane_state->fb) == get_mem_type(fb);
80468060

80478061
timestamp_ns = ktime_get_ns();
80488062
bundle->flip_addrs[planes_count].flip_timestamp_in_us = div_u64(timestamp_ns, 1000);
@@ -8554,6 +8568,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
85548568
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc);
85558569
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
85568570

8571+
if (!adev->dm.hdcp_workqueue)
8572+
continue;
8573+
85578574
pr_debug("[HDCP_DM] -------------- i : %x ----------\n", i);
85588575

85598576
if (!connector)
@@ -8602,6 +8619,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
86028619
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc);
86038620
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
86048621

8622+
if (!adev->dm.hdcp_workqueue)
8623+
continue;
8624+
86058625
new_crtc_state = NULL;
86068626
old_crtc_state = NULL;
86078627

@@ -9620,8 +9640,9 @@ static int dm_update_plane_state(struct dc *dc,
96209640
return -EINVAL;
96219641
}
96229642

9643+
if (dm_old_plane_state->dc_state)
9644+
dc_plane_state_release(dm_old_plane_state->dc_state);
96239645

9624-
dc_plane_state_release(dm_old_plane_state->dc_state);
96259646
dm_new_plane_state->dc_state = NULL;
96269647

96279648
*lock_and_validation_needed = true;
@@ -10158,6 +10179,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
1015810179
ret = compute_mst_dsc_configs_for_state(state, dm_state->context, vars);
1015910180
if (ret) {
1016010181
DRM_DEBUG_DRIVER("compute_mst_dsc_configs_for_state() failed\n");
10182+
ret = -EINVAL;
1016110183
goto fail;
1016210184
}
1016310185

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,6 @@ static void apply_synaptics_fifo_reset_wa(struct drm_dp_aux *aux)
687687
return;
688688

689689
data[0] |= (1 << 1); // set bit 1 to 1
690-
return;
691690

692691
if (!execute_synaptics_rc_command(aux, false, 0x31, 4, 0x221198, data))
693692
return;

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,17 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
379379
if (aconnector->dc_sink && connector->state) {
380380
struct drm_device *dev = connector->dev;
381381
struct amdgpu_device *adev = drm_to_adev(dev);
382-
struct hdcp_workqueue *hdcp_work = adev->dm.hdcp_workqueue;
383-
struct hdcp_workqueue *hdcp_w = &hdcp_work[aconnector->dc_link->link_index];
384382

385-
connector->state->hdcp_content_type =
386-
hdcp_w->hdcp_content_type[connector->index];
387-
connector->state->content_protection =
388-
hdcp_w->content_protection[connector->index];
383+
if (adev->dm.hdcp_workqueue) {
384+
struct hdcp_workqueue *hdcp_work = adev->dm.hdcp_workqueue;
385+
struct hdcp_workqueue *hdcp_w =
386+
&hdcp_work[aconnector->dc_link->link_index];
387+
388+
connector->state->hdcp_content_type =
389+
hdcp_w->hdcp_content_type[connector->index];
390+
connector->state->content_protection =
391+
hdcp_w->content_protection[connector->index];
392+
}
389393
}
390394

391395
if (aconnector->dc_sink) {
@@ -1406,6 +1410,7 @@ int pre_validate_dsc(struct drm_atomic_state *state,
14061410
ret = pre_compute_mst_dsc_configs_for_state(state, local_dc_state, vars);
14071411
if (ret != 0) {
14081412
DRM_INFO_ONCE("pre_compute_mst_dsc_configs_for_state() failed\n");
1413+
ret = -EINVAL;
14091414
goto clean_exit;
14101415
}
14111416

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ void dc_fpu_begin(const char *function_name, const int line)
8989

9090
if (*pcpu == 1) {
9191
#if defined(CONFIG_X86)
92+
migrate_disable();
9293
kernel_fpu_begin();
9394
#elif defined(CONFIG_PPC64)
9495
if (cpu_has_feature(CPU_FTR_VSX_COMP)) {
@@ -129,6 +130,7 @@ void dc_fpu_end(const char *function_name, const int line)
129130
if (*pcpu <= 0) {
130131
#if defined(CONFIG_X86)
131132
kernel_fpu_end();
133+
migrate_enable();
132134
#elif defined(CONFIG_PPC64)
133135
if (cpu_has_feature(CPU_FTR_VSX_COMP)) {
134136
disable_kernel_vsx();

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,8 @@ void dcn32_clk_mgr_construct(
878878
struct pp_smu_funcs *pp_smu,
879879
struct dccg *dccg)
880880
{
881+
struct clk_log_info log_info = {0};
882+
881883
clk_mgr->base.ctx = ctx;
882884
clk_mgr->base.funcs = &dcn32_funcs;
883885
if (ASICREV_IS_GC_11_0_2(clk_mgr->base.ctx->asic_id.hw_internal_rev)) {
@@ -911,13 +913,16 @@ void dcn32_clk_mgr_construct(
911913
clk_mgr->base.clks.ref_dtbclk_khz = 268750;
912914
}
913915

916+
914917
/* integer part is now VCO frequency in kHz */
915918
clk_mgr->base.dentist_vco_freq_khz = dcn32_get_vco_frequency_from_reg(clk_mgr);
916919

917920
/* in case we don't get a value from the register, use default */
918921
if (clk_mgr->base.dentist_vco_freq_khz == 0)
919922
clk_mgr->base.dentist_vco_freq_khz = 4300000; /* Updated as per HW docs */
920923

924+
dcn32_dump_clk_registers(&clk_mgr->base.boot_snapshot, &clk_mgr->base, &log_info);
925+
921926
if (ctx->dc->debug.disable_dtb_ref_clk_switch &&
922927
clk_mgr->base.clks.ref_dtbclk_khz != clk_mgr->base.boot_snapshot.dtbclk) {
923928
clk_mgr->base.clks.ref_dtbclk_khz = clk_mgr->base.boot_snapshot.dtbclk;

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,9 @@ bool dc_remove_plane_from_context(
17071707
struct dc_stream_status *stream_status = NULL;
17081708
struct resource_pool *pool = dc->res_pool;
17091709

1710+
if (!plane_state)
1711+
return true;
1712+
17101713
for (i = 0; i < context->stream_count; i++)
17111714
if (context->streams[i] == stream) {
17121715
stream_status = &context->stream_status[i];

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ struct dc_link {
14541454

14551455
struct ddc_service *ddc;
14561456

1457+
enum dp_panel_mode panel_mode;
14571458
bool aux_mode;
14581459

14591460
/* Private to DC core */

drivers/gpu/drm/amd/display/dc/dc_stream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ struct test_pattern {
144144
unsigned int cust_pattern_size;
145145
};
146146

147-
#define SUBVP_DRR_MARGIN_US 600 // 600us for DRR margin (SubVP + DRR)
147+
#define SUBVP_DRR_MARGIN_US 100 // 100us for DRR margin (SubVP + DRR)
148148

149149
enum mall_stream_type {
150150
SUBVP_NONE, // subvp not in use

0 commit comments

Comments
 (0)