Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Fix HPD after gpu reset

[Why]
DC is not using amdgpu_irq_get/put to manage the HPD interrupt refcounts.
So when amdgpu_irq_gpu_reset_resume_helper() reprograms all of the IRQs,
HPD gets disabled.

[How]
Use amdgpu_irq_get/put() for HPD init/fini in DM in order to sync refcounts

Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Roman Li <Roman.Li@amd.com>
Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f3dde2ff7fcaacd77884502e8f572f2328e9c745)
Cc: stable@vger.kernel.org

authored by

Roman Li and committed by
Alex Deucher
4de141b8 b5f7242e

+14
+14
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
··· 894 894 struct drm_device *dev = adev_to_drm(adev); 895 895 struct drm_connector *connector; 896 896 struct drm_connector_list_iter iter; 897 + int i; 897 898 898 899 drm_connector_list_iter_begin(dev, &iter); 899 900 drm_for_each_connector_iter(connector, &iter) { ··· 921 920 } 922 921 } 923 922 drm_connector_list_iter_end(&iter); 923 + 924 + /* Update reference counts for HPDs */ 925 + for (i = DC_IRQ_SOURCE_HPD1; i <= adev->mode_info.num_hpd; i++) { 926 + if (amdgpu_irq_get(adev, &adev->hpd_irq, i - DC_IRQ_SOURCE_HPD1)) 927 + drm_err(dev, "DM_IRQ: Failed get HPD for source=%d)!\n", i); 928 + } 924 929 } 925 930 926 931 /** ··· 942 935 struct drm_device *dev = adev_to_drm(adev); 943 936 struct drm_connector *connector; 944 937 struct drm_connector_list_iter iter; 938 + int i; 945 939 946 940 drm_connector_list_iter_begin(dev, &iter); 947 941 drm_for_each_connector_iter(connector, &iter) { ··· 968 960 } 969 961 } 970 962 drm_connector_list_iter_end(&iter); 963 + 964 + /* Update reference counts for HPDs */ 965 + for (i = DC_IRQ_SOURCE_HPD1; i <= adev->mode_info.num_hpd; i++) { 966 + if (amdgpu_irq_put(adev, &adev->hpd_irq, i - DC_IRQ_SOURCE_HPD1)) 967 + drm_err(dev, "DM_IRQ: Failed put HPD for source=%d!\n", i); 968 + } 971 969 }