[openchrome-devel] drm-openchrome: Branch 'drm-next-5.10' - 13 commits - Documentation/gpu/amdgpu.rst drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Mon Oct 19 17:54:59 UTC 2020


 Documentation/gpu/amdgpu.rst                                |    4 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c                     |    2 
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h                     |    1 
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c                      |   24 +++++++++-
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c                       |   28 ++++++++++--
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h                       |    3 -
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c                       |    2 
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h           |    2 
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |    2 
 drivers/gpu/drm/amd/display/dc/core/dc.c                    |   10 ++--
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c         |    2 
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c                   |    7 +--
 drivers/gpu/drm/i915/display/intel_ddi.c                    |    2 
 drivers/gpu/drm/i915/display/intel_display.c                |   17 ++-----
 14 files changed, 72 insertions(+), 34 deletions(-)

New commits:
commit 22e0ee2460b4b70cde562b7a3818ae94c2786f46
Merge: 225deb00edda 40b99050455b
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Oct 19 09:43:32 2020 -0700

    Merge tag 'drm-next-2020-10-19' of git://anongit.freedesktop.org/drm/drm into drm-next-5.10
    
    drm fixes for 5.10-rc1
    
    i915:
    - Set all unused color plane offsets to ~0xfff again (Ville)
    - Fix TGL DKL PHY DP vswing handling (Ville)
    
    amdgpu:
    - DCN clang warning fix
    - eDP fix
    - BACO fix
    - Kernel documentation fixes
    - SMU7 mclk fix
    - VCN1 hw bug workaround
    
    amdkfd:
    - kvfree vs kfree fix

commit 40b99050455b9a6cb8faf15dcd41888312184720
Merge: c46a40ff13dc 214bba50616f
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Oct 19 09:21:55 2020 +1000

    Merge tag 'drm-intel-next-fixes-2020-10-15' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
    
    - Set all unused color plane offsets to ~0xfff again (Ville)
    - Fix TGL DKL PHY DP vswing handling (Ville)
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    
    From: Rodrigo Vivi <rodrigo.vivi at intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20201015181453.GA2905280@intel.com

commit c46a40ff13dc3e2c4e2a40fd56fd10e8ee1dea4d
Author: Eryk Brol <eryk.brol at amd.com>
Date:   Thu Oct 15 15:40:53 2020 -0400

    drm/amd/display: Fix incorrect dsc force enable logic
    
    [Why]
    Missed removing a '!' which results in incorrect behavior
    
    [How]
    Remove the offending '!'
    
    Signed-off-by: Eryk Brol <eryk.brol at amd.com>
    Reviewed-by: Harry Wentland <harry.wentland at amd.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20201015194053.355335-1-eryk.brol@amd.com

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index db741e47d194..eee19edeeee5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -647,7 +647,7 @@ static void try_disable_dsc(struct drm_atomic_state *state,
 	for (i = 0; i < count; i++) {
 		if (vars[i].dsc_enabled
 				&& vars[i].bpp_x16 == params[i].bw_range.max_target_bpp_x16
-				&& !params[i].clock_force_enable == DSC_CLK_FORCE_DEFAULT) {
+				&& params[i].clock_force_enable == DSC_CLK_FORCE_DEFAULT) {
 			kbps_increase[i] = params[i].bw_range.stream_kbps - params[i].bw_range.max_kbps;
 			tried[i] = false;
 			remaining_to_try += 1;
commit 941947d29eb71d2c0b3218a0f38354e5b0ffbe92
Merge: 640eee067d9a 8f4729e88064
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Oct 19 09:11:32 2020 +1000

    Merge tag 'amd-drm-fixes-5.10-2020-10-14' of git://people.freedesktop.org/~agd5f/linux into drm-next
    
    amd-drm-fixes-5.10-2020-10-14:
    
    amdgpu:
    - eDP fix
    - BACO fix
    - Kernel documentation fixes
    - SMU7 mclk fix
    - VCN1 hw bug workaround
    
    amdkfd:
    - kvfree vs kfree fix
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    From: Alex Deucher <alexdeucher at gmail.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20201014195403.4558-1-alexander.deucher@amd.com

commit 8f4729e880647c419de0bbe3ff21d7efb4e65676
Author: Kent Russell <kent.russell at amd.com>
Date:   Wed Oct 14 07:47:32 2020 -0400

    drm/amdkfd: Use kvfree in destroy_crat_image
    
    Now that we use kvmalloc for the crat_image, we need to use kvfree when
    we destroy this.
    
    Fixes: d0e63b343e575e ("drm/amdkfd: Use kvmalloc instead of kmalloc for VCRAT")
    Reported-by: Morris Zhang <shiwu.zhang at amd.clm>
    Signed-off-by: Kent Russell <kent.russell at amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
index d2981524dba0..5e2254b9e931 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -1426,5 +1426,5 @@ int kfd_create_crat_image_virtual(void **crat_image, size_t *size,
  */
 void kfd_destroy_crat_image(void *crat_image)
 {
-	kfree(crat_image);
+	kvfree(crat_image);
 }
commit 187561dd76531945126b15c9486fec7cfa5f0415
Author: Veerabadhran G <vegopala at amd.com>
Date:   Thu Oct 8 22:30:02 2020 +0530

    drm/amdgpu: vcn and jpeg ring synchronization
    
    Synchronize the ring usage for vcn1 and jpeg1 to workaround a hardware bug.
    
    Signed-off-by: Veerabadhran Gopalakrishnan <veerabadhran.gopalakrishnan at amd.com>
    Acked-by: Christian König <christian.koenig at amd.com>
    Reviewed-by: Christian König <christian.koenig at amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
    Cc: stable at vger.kernel.org

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index 495c3d7bb2b2..f3b7287e84c4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -68,6 +68,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
 
 	INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);
 	mutex_init(&adev->vcn.vcn_pg_lock);
+	mutex_init(&adev->vcn.vcn1_jpeg1_workaround);
 	atomic_set(&adev->vcn.total_submission_cnt, 0);
 	for (i = 0; i < adev->vcn.num_vcn_inst; i++)
 		atomic_set(&adev->vcn.inst[i].dpg_enc_submission_cnt, 0);
@@ -237,6 +238,7 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev)
 	}
 
 	release_firmware(adev->vcn.fw);
+	mutex_destroy(&adev->vcn.vcn1_jpeg1_workaround);
 	mutex_destroy(&adev->vcn.vcn_pg_lock);
 
 	return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
index 7a9b804bc988..17691158f783 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
@@ -220,6 +220,7 @@ struct amdgpu_vcn {
 	struct amdgpu_vcn_inst	 inst[AMDGPU_MAX_VCN_INSTANCES];
 	struct amdgpu_vcn_reg	 internal;
 	struct mutex		 vcn_pg_lock;
+	struct mutex		vcn1_jpeg1_workaround;
 	atomic_t		 total_submission_cnt;
 
 	unsigned	harvest_config;
diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
index bc300283b6ab..c600b61b5f45 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
@@ -33,6 +33,7 @@
 
 static void jpeg_v1_0_set_dec_ring_funcs(struct amdgpu_device *adev);
 static void jpeg_v1_0_set_irq_funcs(struct amdgpu_device *adev);
+static void jpeg_v1_0_ring_begin_use(struct amdgpu_ring *ring);
 
 static void jpeg_v1_0_decode_ring_patch_wreg(struct amdgpu_ring *ring, uint32_t *ptr, uint32_t reg_offset, uint32_t val)
 {
@@ -564,8 +565,8 @@ static const struct amdgpu_ring_funcs jpeg_v1_0_decode_ring_vm_funcs = {
 	.insert_start = jpeg_v1_0_decode_ring_insert_start,
 	.insert_end = jpeg_v1_0_decode_ring_insert_end,
 	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = vcn_v1_0_ring_begin_use,
-	.end_use = amdgpu_vcn_ring_end_use,
+	.begin_use = jpeg_v1_0_ring_begin_use,
+	.end_use = vcn_v1_0_ring_end_use,
 	.emit_wreg = jpeg_v1_0_decode_ring_emit_wreg,
 	.emit_reg_wait = jpeg_v1_0_decode_ring_emit_reg_wait,
 	.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
@@ -586,3 +587,22 @@ static void jpeg_v1_0_set_irq_funcs(struct amdgpu_device *adev)
 {
 	adev->jpeg.inst->irq.funcs = &jpeg_v1_0_irq_funcs;
 }
+
+static void jpeg_v1_0_ring_begin_use(struct amdgpu_ring *ring)
+{
+	struct	amdgpu_device *adev = ring->adev;
+	bool	set_clocks = !cancel_delayed_work_sync(&adev->vcn.idle_work);
+	int		cnt = 0;
+
+	mutex_lock(&adev->vcn.vcn1_jpeg1_workaround);
+
+	if (amdgpu_fence_wait_empty(&adev->vcn.inst->ring_dec))
+		DRM_ERROR("JPEG dec: vcn dec ring may not be empty\n");
+
+	for (cnt = 0; cnt < adev->vcn.num_enc_rings; cnt++) {
+		if (amdgpu_fence_wait_empty(&adev->vcn.inst->ring_enc[cnt]))
+			DRM_ERROR("JPEG dec: vcn enc ring[%d] may not be empty\n", cnt);
+	}
+
+	vcn_v1_0_set_pg_for_begin_use(ring, set_clocks);
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
index 73699eafb51e..86e1ef732ebe 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
@@ -54,6 +54,7 @@ static int vcn_v1_0_pause_dpg_mode(struct amdgpu_device *adev,
 				int inst_idx, struct dpg_pause_state *new_state);
 
 static void vcn_v1_0_idle_work_handler(struct work_struct *work);
+static void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring);
 
 /**
  * vcn_v1_0_early_init - set function pointers
@@ -1804,11 +1805,24 @@ static void vcn_v1_0_idle_work_handler(struct work_struct *work)
 	}
 }
 
-void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring)
+static void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring)
 {
-	struct amdgpu_device *adev = ring->adev;
+	struct	amdgpu_device *adev = ring->adev;
 	bool set_clocks = !cancel_delayed_work_sync(&adev->vcn.idle_work);
 
+	mutex_lock(&adev->vcn.vcn1_jpeg1_workaround);
+
+	if (amdgpu_fence_wait_empty(&ring->adev->jpeg.inst->ring_dec))
+		DRM_ERROR("VCN dec: jpeg dec ring may not be empty\n");
+
+	vcn_v1_0_set_pg_for_begin_use(ring, set_clocks);
+
+}
+
+void vcn_v1_0_set_pg_for_begin_use(struct amdgpu_ring *ring, bool set_clocks)
+{
+	struct amdgpu_device *adev = ring->adev;
+
 	if (set_clocks) {
 		amdgpu_gfx_off_ctrl(adev, false);
 		if (adev->pm.dpm_enabled)
@@ -1844,6 +1858,12 @@ void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring)
 	}
 }
 
+void vcn_v1_0_ring_end_use(struct amdgpu_ring *ring)
+{
+	schedule_delayed_work(&ring->adev->vcn.idle_work, VCN_IDLE_TIMEOUT);
+	mutex_unlock(&ring->adev->vcn.vcn1_jpeg1_workaround);
+}
+
 static const struct amd_ip_funcs vcn_v1_0_ip_funcs = {
 	.name = "vcn_v1_0",
 	.early_init = vcn_v1_0_early_init,
@@ -1891,7 +1911,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_dec_ring_vm_funcs = {
 	.insert_end = vcn_v1_0_dec_ring_insert_end,
 	.pad_ib = amdgpu_ring_generic_pad_ib,
 	.begin_use = vcn_v1_0_ring_begin_use,
-	.end_use = amdgpu_vcn_ring_end_use,
+	.end_use = vcn_v1_0_ring_end_use,
 	.emit_wreg = vcn_v1_0_dec_ring_emit_wreg,
 	.emit_reg_wait = vcn_v1_0_dec_ring_emit_reg_wait,
 	.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
@@ -1923,7 +1943,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_enc_ring_vm_funcs = {
 	.insert_end = vcn_v1_0_enc_ring_insert_end,
 	.pad_ib = amdgpu_ring_generic_pad_ib,
 	.begin_use = vcn_v1_0_ring_begin_use,
-	.end_use = amdgpu_vcn_ring_end_use,
+	.end_use = vcn_v1_0_ring_end_use,
 	.emit_wreg = vcn_v1_0_enc_ring_emit_wreg,
 	.emit_reg_wait = vcn_v1_0_enc_ring_emit_reg_wait,
 	.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h
index f67d7391fc21..1f1cc7f0ece7 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h
@@ -24,7 +24,8 @@
 #ifndef __VCN_V1_0_H__
 #define __VCN_V1_0_H__
 
-void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring);
+void vcn_v1_0_ring_end_use(struct amdgpu_ring *ring);
+void vcn_v1_0_set_pg_for_begin_use(struct amdgpu_ring *ring, bool set_clocks);
 
 extern const struct amdgpu_ip_block_version vcn_v1_0_ip_block;
 
commit 83da6eea3af669ee0b1f1bc05ffd6150af984994
Author: Evan Quan <evan.quan at amd.com>
Date:   Wed Sep 2 16:10:10 2020 +0800

    drm/amd/pm: increase mclk switch threshold to 200 us
    
    To avoid underflow seen on Polaris10 with some 3440x1440
    144Hz displays. As the threshold of 190 us cuts too close
    to minVBlankTime of 192 us.
    
    Signed-off-by: Evan Quan <evan.quan at amd.com>
    Acked-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
    Cc: stable at vger.kernel.org

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
index 3bf8be4d107b..1e8919b0acdb 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
@@ -2883,7 +2883,7 @@ static int smu7_vblank_too_short(struct pp_hwmgr *hwmgr,
 		if (hwmgr->is_kicker)
 			switch_limit_us = data->is_memory_gddr5 ? 450 : 150;
 		else
-			switch_limit_us = data->is_memory_gddr5 ? 190 : 150;
+			switch_limit_us = data->is_memory_gddr5 ? 200 : 150;
 		break;
 	case CHIP_VEGAM:
 		switch_limit_us = 30;
commit 39ec39d77170a3fe9e92dcddf9060634276ee1ee
Author: Mauro Carvalho Chehab <mchehab+huawei at kernel.org>
Date:   Tue Oct 13 13:54:20 2020 +0200

    docs: amdgpu: fix a warning when building the documentation
    
    As reported by Sphinx:
    
            Documentation/gpu/amdgpu.rst:200: WARNING: Inline emphasis start-string without end-string.
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei at kernel.org>
    Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/Documentation/gpu/amdgpu.rst b/Documentation/gpu/amdgpu.rst
index 57047dcb8d19..1f9ea8221f80 100644
--- a/Documentation/gpu/amdgpu.rst
+++ b/Documentation/gpu/amdgpu.rst
@@ -206,8 +206,8 @@ pp_power_profile_mode
 .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
    :doc: pp_power_profile_mode
 
-*_busy_percent
-~~~~~~~~~~~~~~
+\*_busy_percent
+~~~~~~~~~~~~~~~
 
 .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
    :doc: gpu_busy_percent
commit c0e35ed924e47be387205fa4beaf4134b992e0d4
Author: Mauro Carvalho Chehab <mchehab+huawei at kernel.org>
Date:   Tue Oct 13 13:54:27 2020 +0200

    drm/amd/display: kernel-doc: document force_timing_sync
    
    As warned when running "make htmldocs":
    
            ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:345: warning: Function parameter or member 'force_timing_sync' not described in 'amdgpu_display_manager'
    
    This new struct member was not documented at kernel-doc markup.
    
    Fixes: 3d4e52d0cf24 ("drm/amd/display: Add debugfs for forcing stream timing sync")
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei at kernel.org>
    Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index 9c1e003d9c29..34f6369bf51f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -149,6 +149,8 @@ struct amdgpu_dm_backlight_caps {
  * @cached_state: Caches device atomic state for suspend/resume
  * @cached_dc_state: Cached state of content streams
  * @compressor: Frame buffer compression buffer. See &struct dm_comressor_info
+ * @force_timing_sync: set via debugfs. When set, indicates that all connected
+ *		       displays will be forced to synchronize.
  */
 struct amdgpu_display_manager {
 
commit 02a1bea65bb335ebfd3a4d191742de3b6f64a414
Author: Alex Deucher <alexander.deucher at amd.com>
Date:   Mon Oct 12 10:12:28 2020 -0400

    drm/amdgpu/swsmu: init the baco mutex in early_init
    
    GPU reset might get called during init time, before
    sw_init has been called.
    
    Reviewed-by: Kevin Wang <kevin1.wang at amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index e41fd6ea6451..b1e5ec01527b 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -417,6 +417,9 @@ static int smu_early_init(void *handle)
 	smu->pm_enabled = !!amdgpu_dpm;
 	smu->is_apu = false;
 	mutex_init(&smu->mutex);
+	mutex_init(&smu->smu_baco.mutex);
+	smu->smu_baco.state = SMU_BACO_STATE_EXIT;
+	smu->smu_baco.platform_support = false;
 
 	return smu_set_funcs(adev);
 }
@@ -795,10 +798,6 @@ static int smu_sw_init(void *handle)
 	bitmap_zero(smu->smu_feature.enabled, SMU_FEATURE_MAX);
 	bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX);
 
-	mutex_init(&smu->smu_baco.mutex);
-	smu->smu_baco.state = SMU_BACO_STATE_EXIT;
-	smu->smu_baco.platform_support = false;
-
 	mutex_init(&smu->sensor_lock);
 	mutex_init(&smu->metrics_lock);
 	mutex_init(&smu->message_lock);
commit 44264591a8c4da7090a4bfd10e04f4cb8fe60afe
Author: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
Date:   Fri Oct 9 09:36:01 2020 -0400

    drm/amd/display: Fix module load hangs when connected to an eDP
    
    It was recently introduced a change that enables driver to disable
    streams if pixel clock changes. Consequently, the code path executed in
    the disable vbios function expanded to an encoder verification part.
    The encoder loop is nested inside the pipe count loop, and both loops
    share the 'i' variable in control of their flow. This situation may lead
    to an infinite loop because the encoder loop constantly updates the `i`
    variable, making the first loop always positive. As a result, we can see
    a soft hang during the module load (modprobe amdgpu) and a series of
    dmesg log that looks like this:
    
    kernel:[  124.538727] watchdog: BUG: soft lockup - CPU#2 stuck for 22s!
    [modprobe:1000]
    
    RSP: 0018:ffffabbf419bf0e8 EFLAGS: 00000282
    RAX: ffffffffc0809de0 RBX: ffff93b35ccc0000 RCX: ffff93b366c21800
    RDX: 0000000000000000 RSI: 0000000000000141 RDI: ffff93b35ccc0000
    RBP: ffffabbf419bf108 R08: ffffabbf419bf164 R09: 0000000000000001
    R10: 0000000000000003 R11: 0000000000000003 R12: 0000000008677d40
    R13: 0000000000000141 R14: ffff93b35cfc0000 R15: ffff93b35abc0000
    FS:  00007f1400717540(0000) GS:ffff93b37f680000(0000)
         knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00005649b66b0968 CR3: 00000003e0fec000 CR4: 0000000000350ee0
    Call Trace:
     amdgpu_device_rreg+0x17/0x20 [amdgpu]
     amdgpu_cgs_read_register+0x14/0x20 [amdgpu]
     dm_read_reg_func+0x3a/0xb0 [amdgpu]
     get_pixel_clk_frequency_100hz+0x30/0x50 [amdgpu]
     dc_commit_state+0x8f1/0xae0 [amdgpu]
     ? drm_calc_timestamping_constants+0x101/0x160 [drm]
     amdgpu_dm_atomic_commit_tail+0x39d/0x21a0 [amdgpu]
     ? dcn21_validate_bandwidth+0xe5/0x290 [amdgpu]
     ? kfree+0xc3/0x390
     ? dcn21_validate_bandwidth+0xe5/0x290 [amdgpu]
    ...
    RSP: 002b:00007fff26009bd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
    RAX: ffffffffffffffda RBX: 000055a8025bea50 RCX: 00007f140085c89d
    RDX: 0000000000000000 RSI: 000055a8025b8290 RDI: 000000000000000c
    RBP: 0000000000040000 R08: 0000000000000000 R09: 0000000000000000
    R10: 000000000000000c R11: 0000000000000246 R12: 000055a8025b8290
    R13: 0000000000000000 R14: 000055a8025bead0 R15: 000055a8025bea50
    
    This issue was fixed by introducing a second variable for the internal
    loop.
    
    Fixes: 8353d30e747f4e ("drm/amd/display: disable stream if pixel clock changed with link active")
    Reviewed-by: Roman Li <Roman.Li at amd.com>
    Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
    Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 2a725a5fba40..1eb29c362122 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -848,7 +848,7 @@ static void disable_vbios_mode_if_required(
 		struct dc *dc,
 		struct dc_state *context)
 {
-	unsigned int i;
+	unsigned int i, j;
 
 	/* check if timing_changed, disable stream*/
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
@@ -872,10 +872,10 @@ static void disable_vbios_mode_if_required(
 
 			enc_inst = link->link_enc->funcs->get_dig_frontend(link->link_enc);
 			if (enc_inst != ENGINE_ID_UNKNOWN) {
-				for (i = 0; i < dc->res_pool->stream_enc_count; i++) {
-					if (dc->res_pool->stream_enc[i]->id == enc_inst) {
-						tg_inst = dc->res_pool->stream_enc[i]->funcs->dig_source_otg(
-							dc->res_pool->stream_enc[i]);
+				for (j = 0; j < dc->res_pool->stream_enc_count; j++) {
+					if (dc->res_pool->stream_enc[j]->id == enc_inst) {
+						tg_inst = dc->res_pool->stream_enc[j]->funcs->dig_source_otg(
+							dc->res_pool->stream_enc[j]);
 						break;
 					}
 				}
commit 214bba50616f65264dfc30d095daef3ab7500f52
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Thu Oct 8 13:16:06 2020 +0300

    drm/i915: Set all unused color plane offsets to ~0xfff again
    
    When the number of potential color planes grew to 4 we stopped
    setting all unused color plane offsets to ~0xfff. The code
    still tries to do this, but actually does nothing since the
    loop limits are bogus.
    
    skl_check_main_surface() actually depends on this ~0xfff
    behaviour as it will make sure to move the main surface
    offset below the aux surface offset because the hardware
    AUX_DIST must be a non-negative value [1], and for simplicity
    it doesn't bother checking if the AUX plane is actually
    needed or not. So currently it may end up shuffling the
    main surface around based on some stale leftover AUX offset.
    
    The skl+ plane code also just blindly calculates the AUX_DIST
    whether or not the AUX plane is actually needed by the hw or
    not, and that too will now potentially use some stale AUX
    surface offset in the calculation. Would seem nicer to
    guarantee a consistent non-negative AUX_DIST always.
    
    So bring back the original ~0xfff offset behaviour for
    unused color planes. Though it doesn't seem super likely
    that this inconsistency would cause any real issues.
    
    Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
    Cc: Lucas De Marchi <lucas.demarchi at intel.com>
    Cc: Imre Deak <imre.deak at intel.com>
    Cc: Radhakrishna Sripada <radhakrishna.sripada at intel.com>
    Fixes: 2dfbf9d2873a ("drm/i915/tgl: Gen-12 display can decompress surfaces compressed by the media engine")
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20201008101608.8652-1-ville.syrjala@linux.intel.com
    Reviewed-by: Imre Deak <imre.deak at intel.com>
    (cherry picked from commit 79148ce4b25d418327feca8abb2f7392d49f5259)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index d64e46acfbbd..fac4657a286c 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4093,8 +4093,7 @@ static int skl_check_ccs_aux_surface(struct intel_plane_state *plane_state)
 int skl_check_plane_surface(struct intel_plane_state *plane_state)
 {
 	const struct drm_framebuffer *fb = plane_state->hw.fb;
-	int ret;
-	bool needs_aux = false;
+	int ret, i;
 
 	ret = intel_plane_compute_gtt(plane_state);
 	if (ret)
@@ -4108,7 +4107,6 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
 	 * it.
 	 */
 	if (is_ccs_modifier(fb->modifier)) {
-		needs_aux = true;
 		ret = skl_check_ccs_aux_surface(plane_state);
 		if (ret)
 			return ret;
@@ -4116,20 +4114,15 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
 
 	if (intel_format_info_is_yuv_semiplanar(fb->format,
 						fb->modifier)) {
-		needs_aux = true;
 		ret = skl_check_nv12_aux_surface(plane_state);
 		if (ret)
 			return ret;
 	}
 
-	if (!needs_aux) {
-		int i;
-
-		for (i = 1; i < fb->format->num_planes; i++) {
-			plane_state->color_plane[i].offset = ~0xfff;
-			plane_state->color_plane[i].x = 0;
-			plane_state->color_plane[i].y = 0;
-		}
+	for (i = fb->format->num_planes; i < ARRAY_SIZE(plane_state->color_plane); i++) {
+		plane_state->color_plane[i].offset = ~0xfff;
+		plane_state->color_plane[i].x = 0;
+		plane_state->color_plane[i].y = 0;
 	}
 
 	ret = skl_check_main_surface(plane_state);
commit f0b707c125a2e228bcc047cd46040943bef61931
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Thu Oct 1 01:36:42 2020 +0300

    drm/i915: Fix TGL DKL PHY DP vswing handling
    
    The HDMI vs. not-HDMI check got inverted whem the bogus encoder->type
    checks were eliminated. So now we're using 0 as the link rate on DP
    and potentially non-zero on HDMI, which is exactly the opposite of
    what we want. The original bogus check actually worked more correctly
    by accident since if would always evaluate to true. Due to this we
    now always use the RBR/HBR1 vswing table and never ever the HBR2+
    vswing table. That is probably not a good way to get a high quality
    signal at HBR2+ rates. Fix the check so we pick the right table.
    
    Cc: stable at vger.kernel.org
    Cc: Vandita Kulkarni <vandita.kulkarni at intel.com>
    Cc: Uma Shankar <uma.shankar at intel.com>
    Fixes: 94641eb6c696 ("drm/i915/display: Fix the encoder type check")
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200930223642.28565-1-ville.syrjala@linux.intel.com
    Reviewed-by: José Roberto de Souza <jose.souza at intel.com>
    Reviewed-by: Vandita Kulkarni <vandita.kulkarni at intel.com>
    (cherry picked from commit 945b18fb4803b01e822ade6aef6cc0b6e4bd644f)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 4d06178cd76c..cdcb7b1034ae 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -2742,7 +2742,7 @@ tgl_dkl_phy_ddi_vswing_sequence(struct intel_encoder *encoder, int link_clock,
 	u32 n_entries, val, ln, dpcnt_mask, dpcnt_val;
 	int rate = 0;
 
-	if (type == INTEL_OUTPUT_HDMI) {
+	if (type != INTEL_OUTPUT_HDMI) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
 		rate = intel_dp->link_rate;


More information about the openchrome-devel mailing list