Merge tag 'drm-fixes-2026-01-30' of https://gitlab.freedesktop.org/drm/kernel

Pull drm fixes from Dave Airlie:
"Seems to be a bit quieter this week, mostly xe and amdgpu, with msm
and imx fixes and one WARN_ON from user blocked. Nothing of note
outstanding either.

uapi:
- Fix a WARN_ON() when passing an invalid handle to
drm_gem_change_handle_ioctl()

msm:
- GPU:
- Fix bogus hwcg register update for a690

xe:
- Skip address copy for sync-only execs
- Fix a WA
- Derive mem_copy cap from graphics version
- Fix is_bound() pci_dev lifetime
- xe nvm cleanup fixes

amdgpu:
- SMU 13 fixes
- SMU 14 fixes
- GPUVM fault filter fix
- Powergating fix
- HDMI debounce fix
- Xclk fix for soc21 APUs
- Fix COND_EXEC handling for GC 11
- GC 10-12 KGQ init fixes
- GC 11-12 KGQ reset fixes

imx/tve:
- drop ddc device reference when unloading"

* tag 'drm-fixes-2026-01-30' of https://gitlab.freedesktop.org/drm/kernel: (21 commits)
drm/xe/nvm: Fix double-free on aux add failure
drm/xe/nvm: Manage nvm aux cleanup with devres
drm/amdgpu/gfx12: adjust KGQ reset sequence
drm/amdgpu/gfx11: adjust KGQ reset sequence
drm/amdgpu/gfx12: fix wptr reset in KGQ init
drm/amdgpu/gfx11: fix wptr reset in KGQ init
drm/amdgpu/gfx10: fix wptr reset in KGQ init
drm/xe/configfs: Fix is_bound() pci_dev lifetime
drm/amdgpu: Fix cond_exec handling in amdgpu_ib_schedule()
drm/amdgpu/soc21: fix xclk for APUs
drm/amd/display: Clear HDMI HPD pending work only if it is enabled
drm/imx/tve: fix probe device leak
drm/amd/pm: fix race in power state check before mutex lock
drm/amdgpu: fix NULL pointer dereference in amdgpu_gmc_filter_faults_remove
drm/amd/pm: fix smu v14 soft clock frequency setting issue
drm/amd/pm: fix smu v13 soft clock frequency setting issue
drm/xe: derive mem copy capability from graphics version
drm/xe/xelp: Fix Wa_18022495364
drm/xe: Skip address copy for sync-only execs
drm: Do not allow userspace to trigger kernel warnings in drm_gem_change_handle_ioctl()
...

+117 -86
+6 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
··· 498 498 499 499 if (adev->irq.retry_cam_enabled) 500 500 return; 501 + else if (adev->irq.ih1.ring_size) 502 + ih = &adev->irq.ih1; 503 + else if (adev->irq.ih_soft.enabled) 504 + ih = &adev->irq.ih_soft; 505 + else 506 + return; 501 507 502 - ih = &adev->irq.ih1; 503 508 /* Get the WPTR of the last entry in IH ring */ 504 509 last_wptr = amdgpu_ih_get_wptr(adev, ih); 505 510 /* Order wptr with ring data. */
+3 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
··· 235 235 236 236 amdgpu_ring_ib_begin(ring); 237 237 238 - if (ring->funcs->emit_gfx_shadow) 238 + if (ring->funcs->emit_gfx_shadow && adev->gfx.cp_gfx_shadow) 239 239 amdgpu_ring_emit_gfx_shadow(ring, shadow_va, csa_va, gds_va, 240 240 init_shadow, vmid); 241 241 ··· 291 291 fence_flags | AMDGPU_FENCE_FLAG_64BIT); 292 292 } 293 293 294 - if (ring->funcs->emit_gfx_shadow && ring->funcs->init_cond_exec) { 294 + if (ring->funcs->emit_gfx_shadow && ring->funcs->init_cond_exec && 295 + adev->gfx.cp_gfx_shadow) { 295 296 amdgpu_ring_emit_gfx_shadow(ring, 0, 0, 0, false, 0); 296 297 amdgpu_ring_init_cond_exec(ring, ring->cond_exe_gpu_addr); 297 298 }
+1 -1
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
··· 6879 6879 memcpy_toio(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd)); 6880 6880 /* reset the ring */ 6881 6881 ring->wptr = 0; 6882 - *ring->wptr_cpu_addr = 0; 6882 + atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0); 6883 6883 amdgpu_ring_clear_ring(ring); 6884 6884 } 6885 6885
+14 -11
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
··· 4201 4201 memcpy_toio(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd)); 4202 4202 /* reset the ring */ 4203 4203 ring->wptr = 0; 4204 - *ring->wptr_cpu_addr = 0; 4204 + atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0); 4205 4205 amdgpu_ring_clear_ring(ring); 4206 4206 } 4207 4207 ··· 6823 6823 struct amdgpu_fence *timedout_fence) 6824 6824 { 6825 6825 struct amdgpu_device *adev = ring->adev; 6826 + bool use_mmio = false; 6826 6827 int r; 6827 6828 6828 6829 amdgpu_ring_reset_helper_begin(ring, timedout_fence); 6829 6830 6830 - r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, false); 6831 + r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, use_mmio); 6831 6832 if (r) { 6832 6833 6833 6834 dev_warn(adev->dev, "reset via MES failed and try pipe reset %d\n", r); ··· 6837 6836 return r; 6838 6837 } 6839 6838 6840 - r = gfx_v11_0_kgq_init_queue(ring, true); 6841 - if (r) { 6842 - dev_err(adev->dev, "failed to init kgq\n"); 6843 - return r; 6844 - } 6839 + if (use_mmio) { 6840 + r = gfx_v11_0_kgq_init_queue(ring, true); 6841 + if (r) { 6842 + dev_err(adev->dev, "failed to init kgq\n"); 6843 + return r; 6844 + } 6845 6845 6846 - r = amdgpu_mes_map_legacy_queue(adev, ring); 6847 - if (r) { 6848 - dev_err(adev->dev, "failed to remap kgq\n"); 6849 - return r; 6846 + r = amdgpu_mes_map_legacy_queue(adev, ring); 6847 + if (r) { 6848 + dev_err(adev->dev, "failed to remap kgq\n"); 6849 + return r; 6850 + } 6850 6851 } 6851 6852 6852 6853 return amdgpu_ring_reset_helper_end(ring, timedout_fence);
+14 -11
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
··· 3079 3079 memcpy_toio(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd)); 3080 3080 /* reset the ring */ 3081 3081 ring->wptr = 0; 3082 - *ring->wptr_cpu_addr = 0; 3082 + atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0); 3083 3083 amdgpu_ring_clear_ring(ring); 3084 3084 } 3085 3085 ··· 5297 5297 struct amdgpu_fence *timedout_fence) 5298 5298 { 5299 5299 struct amdgpu_device *adev = ring->adev; 5300 + bool use_mmio = false; 5300 5301 int r; 5301 5302 5302 5303 amdgpu_ring_reset_helper_begin(ring, timedout_fence); 5303 5304 5304 - r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, false); 5305 + r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, use_mmio); 5305 5306 if (r) { 5306 5307 dev_warn(adev->dev, "reset via MES failed and try pipe reset %d\n", r); 5307 5308 r = gfx_v12_reset_gfx_pipe(ring); ··· 5310 5309 return r; 5311 5310 } 5312 5311 5313 - r = gfx_v12_0_kgq_init_queue(ring, true); 5314 - if (r) { 5315 - dev_err(adev->dev, "failed to init kgq\n"); 5316 - return r; 5317 - } 5312 + if (use_mmio) { 5313 + r = gfx_v12_0_kgq_init_queue(ring, true); 5314 + if (r) { 5315 + dev_err(adev->dev, "failed to init kgq\n"); 5316 + return r; 5317 + } 5318 5318 5319 - r = amdgpu_mes_map_legacy_queue(adev, ring); 5320 - if (r) { 5321 - dev_err(adev->dev, "failed to remap kgq\n"); 5322 - return r; 5319 + r = amdgpu_mes_map_legacy_queue(adev, ring); 5320 + if (r) { 5321 + dev_err(adev->dev, "failed to remap kgq\n"); 5322 + return r; 5323 + } 5323 5324 } 5324 5325 5325 5326 return amdgpu_ring_reset_helper_end(ring, timedout_fence);
+7 -1
drivers/gpu/drm/amd/amdgpu/soc21.c
··· 225 225 226 226 static u32 soc21_get_xclk(struct amdgpu_device *adev) 227 227 { 228 - return adev->clock.spll.reference_freq; 228 + u32 reference_clock = adev->clock.spll.reference_freq; 229 + 230 + /* reference clock is actually 99.81 Mhz rather than 100 Mhz */ 231 + if ((adev->flags & AMD_IS_APU) && reference_clock == 10000) 232 + return 9981; 233 + 234 + return reference_clock; 229 235 } 230 236 231 237
+6 -4
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 7754 7754 drm_dp_mst_topology_mgr_destroy(&aconnector->mst_mgr); 7755 7755 7756 7756 /* Cancel and flush any pending HDMI HPD debounce work */ 7757 - cancel_delayed_work_sync(&aconnector->hdmi_hpd_debounce_work); 7758 - if (aconnector->hdmi_prev_sink) { 7759 - dc_sink_release(aconnector->hdmi_prev_sink); 7760 - aconnector->hdmi_prev_sink = NULL; 7757 + if (aconnector->hdmi_hpd_debounce_delay_ms) { 7758 + cancel_delayed_work_sync(&aconnector->hdmi_hpd_debounce_work); 7759 + if (aconnector->hdmi_prev_sink) { 7760 + dc_sink_release(aconnector->hdmi_prev_sink); 7761 + aconnector->hdmi_prev_sink = NULL; 7762 + } 7761 7763 } 7762 7764 7763 7765 if (aconnector->bl_idx != -1) {
+4 -3
drivers/gpu/drm/amd/pm/amdgpu_dpm.c
··· 80 80 enum ip_power_state pwr_state = gate ? POWER_STATE_OFF : POWER_STATE_ON; 81 81 bool is_vcn = block_type == AMD_IP_BLOCK_TYPE_VCN; 82 82 83 + mutex_lock(&adev->pm.mutex); 84 + 83 85 if (atomic_read(&adev->pm.pwr_state[block_type]) == pwr_state && 84 86 (!is_vcn || adev->vcn.num_vcn_inst == 1)) { 85 87 dev_dbg(adev->dev, "IP block%d already in the target %s state!", 86 88 block_type, gate ? "gate" : "ungate"); 87 - return 0; 89 + goto out_unlock; 88 90 } 89 - 90 - mutex_lock(&adev->pm.mutex); 91 91 92 92 switch (block_type) { 93 93 case AMD_IP_BLOCK_TYPE_UVD: ··· 115 115 if (!ret) 116 116 atomic_set(&adev->pm.pwr_state[block_type], pwr_state); 117 117 118 + out_unlock: 118 119 mutex_unlock(&adev->pm.mutex); 119 120 120 121 return ret;
+1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
··· 56 56 #define SMUQ10_TO_UINT(x) ((x) >> 10) 57 57 #define SMUQ10_FRAC(x) ((x) & 0x3ff) 58 58 #define SMUQ10_ROUND(x) ((SMUQ10_TO_UINT(x)) + ((SMUQ10_FRAC(x)) >= 0x200)) 59 + #define SMU_V13_SOFT_FREQ_ROUND(x) ((x) + 1) 59 60 60 61 extern const int pmfw_decoded_link_speed[5]; 61 62 extern const int pmfw_decoded_link_width[7];
+1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v14_0.h
··· 57 57 58 58 #define DECODE_GEN_SPEED(gen_speed_idx) (decoded_link_speed[gen_speed_idx]) 59 59 #define DECODE_LANE_WIDTH(lane_width_idx) (decoded_link_width[lane_width_idx]) 60 + #define SMU_V14_SOFT_FREQ_ROUND(x) ((x) + 1) 60 61 61 62 struct smu_14_0_max_sustainable_clocks { 62 63 uint32_t display_clock;
+1
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
··· 1555 1555 return clk_id; 1556 1556 1557 1557 if (max > 0) { 1558 + max = SMU_V13_SOFT_FREQ_ROUND(max); 1558 1559 if (automatic) 1559 1560 param = (uint32_t)((clk_id << 16) | 0xffff); 1560 1561 else
+1
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
··· 1178 1178 return clk_id; 1179 1179 1180 1180 if (max > 0) { 1181 + max = SMU_V14_SOFT_FREQ_ROUND(max); 1181 1182 if (automatic) 1182 1183 param = (uint32_t)((clk_id << 16) | 0xffff); 1183 1184 else
+12 -6
drivers/gpu/drm/drm_gem.c
··· 960 960 { 961 961 struct drm_gem_change_handle *args = data; 962 962 struct drm_gem_object *obj; 963 - int ret; 963 + int handle, ret; 964 964 965 965 if (!drm_core_check_feature(dev, DRIVER_GEM)) 966 966 return -EOPNOTSUPP; 967 + 968 + /* idr_alloc() limitation. */ 969 + if (args->new_handle > INT_MAX) 970 + return -EINVAL; 971 + handle = args->new_handle; 967 972 968 973 obj = drm_gem_object_lookup(file_priv, args->handle); 969 974 if (!obj) 970 975 return -ENOENT; 971 976 972 - if (args->handle == args->new_handle) { 977 + if (args->handle == handle) { 973 978 ret = 0; 974 979 goto out; 975 980 } ··· 982 977 mutex_lock(&file_priv->prime.lock); 983 978 984 979 spin_lock(&file_priv->table_lock); 985 - ret = idr_alloc(&file_priv->object_idr, obj, 986 - args->new_handle, args->new_handle + 1, GFP_NOWAIT); 980 + ret = idr_alloc(&file_priv->object_idr, obj, handle, handle + 1, 981 + GFP_NOWAIT); 987 982 spin_unlock(&file_priv->table_lock); 988 983 989 984 if (ret < 0) 990 985 goto out_unlock; 991 986 992 987 if (obj->dma_buf) { 993 - ret = drm_prime_add_buf_handle(&file_priv->prime, obj->dma_buf, args->new_handle); 988 + ret = drm_prime_add_buf_handle(&file_priv->prime, obj->dma_buf, 989 + handle); 994 990 if (ret < 0) { 995 991 spin_lock(&file_priv->table_lock); 996 - idr_remove(&file_priv->object_idr, args->new_handle); 992 + idr_remove(&file_priv->object_idr, handle); 997 993 spin_unlock(&file_priv->table_lock); 998 994 goto out_unlock; 999 995 }
+13
drivers/gpu/drm/imx/ipuv3/imx-tve.c
··· 528 528 .bind = imx_tve_bind, 529 529 }; 530 530 531 + static void imx_tve_put_device(void *_dev) 532 + { 533 + struct device *dev = _dev; 534 + 535 + put_device(dev); 536 + } 537 + 531 538 static int imx_tve_probe(struct platform_device *pdev) 532 539 { 533 540 struct device *dev = &pdev->dev; ··· 556 549 if (ddc_node) { 557 550 tve->ddc = of_find_i2c_adapter_by_node(ddc_node); 558 551 of_node_put(ddc_node); 552 + if (tve->ddc) { 553 + ret = devm_add_action_or_reset(dev, imx_tve_put_device, 554 + &tve->ddc->dev); 555 + if (ret) 556 + return ret; 557 + } 559 558 } 560 559 561 560 tve->mode = of_get_tve_mode(np);
-2
drivers/gpu/drm/msm/adreno/a6xx_catalog.c
··· 501 501 {REG_A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222}, 502 502 {REG_A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111}, 503 503 {REG_A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555}, 504 - {REG_A6XX_GPU_GMU_AO_GMU_CGC_DELAY_CNTL, 0x10111}, 505 - {REG_A6XX_GPU_GMU_AO_GMU_CGC_HYST_CNTL, 0x5555}, 506 504 {} 507 505 }; 508 506
+1 -2
drivers/gpu/drm/xe/xe_configfs.c
··· 347 347 return false; 348 348 349 349 ret = pci_get_drvdata(pdev); 350 - pci_dev_put(pdev); 351 - 352 350 if (ret) 353 351 pci_dbg(pdev, "Already bound to driver\n"); 354 352 353 + pci_dev_put(pdev); 355 354 return ret; 356 355 } 357 356
-2
drivers/gpu/drm/xe/xe_device.c
··· 984 984 { 985 985 xe_display_unregister(xe); 986 986 987 - xe_nvm_fini(xe); 988 - 989 987 drm_dev_unplug(&xe->drm); 990 988 991 989 xe_bo_pci_dev_remove_all(xe);
+3 -3
drivers/gpu/drm/xe/xe_exec.c
··· 190 190 goto err_syncs; 191 191 } 192 192 193 - if (xe_exec_queue_is_parallel(q)) { 194 - err = copy_from_user(addresses, addresses_user, sizeof(u64) * 195 - q->width); 193 + if (args->num_batch_buffer && xe_exec_queue_is_parallel(q)) { 194 + err = copy_from_user(addresses, addresses_user, 195 + sizeof(u64) * q->width); 196 196 if (err) { 197 197 err = -EFAULT; 198 198 goto err_syncs;
+1 -1
drivers/gpu/drm/xe/xe_lrc.c
··· 1185 1185 return -ENOSPC; 1186 1186 1187 1187 *cmd++ = MI_LOAD_REGISTER_IMM | MI_LRI_NUM_REGS(1); 1188 - *cmd++ = CS_DEBUG_MODE1(0).addr; 1188 + *cmd++ = CS_DEBUG_MODE2(0).addr; 1189 1189 *cmd++ = _MASKED_BIT_ENABLE(INSTRUCTION_STATE_CACHE_INVALIDATE); 1190 1190 1191 1191 return cmd - batch;
+27 -28
drivers/gpu/drm/xe/xe_nvm.c
··· 83 83 return writable_override; 84 84 } 85 85 86 + static void xe_nvm_fini(void *arg) 87 + { 88 + struct xe_device *xe = arg; 89 + struct intel_dg_nvm_dev *nvm = xe->nvm; 90 + 91 + if (!xe->info.has_gsc_nvm) 92 + return; 93 + 94 + /* No access to internal NVM from VFs */ 95 + if (IS_SRIOV_VF(xe)) 96 + return; 97 + 98 + /* Nvm pointer should not be NULL here */ 99 + if (WARN_ON(!nvm)) 100 + return; 101 + 102 + auxiliary_device_delete(&nvm->aux_dev); 103 + auxiliary_device_uninit(&nvm->aux_dev); 104 + xe->nvm = NULL; 105 + } 106 + 86 107 int xe_nvm_init(struct xe_device *xe) 87 108 { 88 109 struct pci_dev *pdev = to_pci_dev(xe->drm.dev); ··· 153 132 ret = auxiliary_device_init(aux_dev); 154 133 if (ret) { 155 134 drm_err(&xe->drm, "xe-nvm aux init failed %d\n", ret); 156 - goto err; 135 + kfree(nvm); 136 + xe->nvm = NULL; 137 + return ret; 157 138 } 158 139 159 140 ret = auxiliary_device_add(aux_dev); 160 141 if (ret) { 161 142 drm_err(&xe->drm, "xe-nvm aux add failed %d\n", ret); 162 143 auxiliary_device_uninit(aux_dev); 163 - goto err; 144 + xe->nvm = NULL; 145 + return ret; 164 146 } 165 - return 0; 166 - 167 - err: 168 - kfree(nvm); 169 - xe->nvm = NULL; 170 - return ret; 171 - } 172 - 173 - void xe_nvm_fini(struct xe_device *xe) 174 - { 175 - struct intel_dg_nvm_dev *nvm = xe->nvm; 176 - 177 - if (!xe->info.has_gsc_nvm) 178 - return; 179 - 180 - /* No access to internal NVM from VFs */ 181 - if (IS_SRIOV_VF(xe)) 182 - return; 183 - 184 - /* Nvm pointer should not be NULL here */ 185 - if (WARN_ON(!nvm)) 186 - return; 187 - 188 - auxiliary_device_delete(&nvm->aux_dev); 189 - auxiliary_device_uninit(&nvm->aux_dev); 190 - xe->nvm = NULL; 147 + return devm_add_action_or_reset(xe->drm.dev, xe_nvm_fini, xe); 191 148 }
-2
drivers/gpu/drm/xe/xe_nvm.h
··· 10 10 11 11 int xe_nvm_init(struct xe_device *xe); 12 12 13 - void xe_nvm_fini(struct xe_device *xe); 14 - 15 13 #endif
+1 -5
drivers/gpu/drm/xe/xe_pci.c
··· 342 342 .has_display = true, 343 343 .has_flat_ccs = 1, 344 344 .has_pxp = true, 345 - .has_mem_copy_instr = true, 346 345 .max_gt_per_tile = 2, 347 346 .needs_scratch = true, 348 347 .va_bits = 48, ··· 362 363 .has_heci_cscfi = 1, 363 364 .has_late_bind = true, 364 365 .has_sriov = true, 365 - .has_mem_copy_instr = true, 366 366 .max_gt_per_tile = 2, 367 367 .needs_scratch = true, 368 368 .subplatforms = (const struct xe_subplatform_desc[]) { ··· 378 380 .has_display = true, 379 381 .has_flat_ccs = 1, 380 382 .has_sriov = true, 381 - .has_mem_copy_instr = true, 382 383 .max_gt_per_tile = 2, 383 384 .needs_scratch = true, 384 385 .needs_shared_vf_gt_wq = true, ··· 390 393 .dma_mask_size = 46, 391 394 .has_display = true, 392 395 .has_flat_ccs = 1, 393 - .has_mem_copy_instr = true, 394 396 .max_gt_per_tile = 2, 395 397 .require_force_probe = true, 396 398 .va_bits = 48, ··· 671 675 xe->info.has_pxp = desc->has_pxp; 672 676 xe->info.has_sriov = xe_configfs_primary_gt_allowed(to_pci_dev(xe->drm.dev)) && 673 677 desc->has_sriov; 674 - xe->info.has_mem_copy_instr = desc->has_mem_copy_instr; 675 678 xe->info.skip_guc_pc = desc->skip_guc_pc; 676 679 xe->info.skip_mtcfg = desc->skip_mtcfg; 677 680 xe->info.skip_pcode = desc->skip_pcode; ··· 859 864 xe->info.has_range_tlb_inval = graphics_desc->has_range_tlb_inval; 860 865 xe->info.has_usm = graphics_desc->has_usm; 861 866 xe->info.has_64bit_timestamp = graphics_desc->has_64bit_timestamp; 867 + xe->info.has_mem_copy_instr = GRAPHICS_VER(xe) >= 20; 862 868 863 869 xe_info_probe_tile_count(xe); 864 870
-1
drivers/gpu/drm/xe/xe_pci_types.h
··· 46 46 u8 has_late_bind:1; 47 47 u8 has_llc:1; 48 48 u8 has_mbx_power_limits:1; 49 - u8 has_mem_copy_instr:1; 50 49 u8 has_pxp:1; 51 50 u8 has_sriov:1; 52 51 u8 needs_scratch:1;