Merge tag 'drm-fixes-2025-06-14' of https://gitlab.freedesktop.org/drm/kernel

Pull drm fixes from Dave Airlie:
"Quiet week, only two pull requests came my way, xe has a couple of
fixes and then a bunch of fixes across the board, vc4 probably fixes
the biggest problem:

vc4:
- Fix infinite EPROBE_DEFER loop in vc4 probing

amdxdna:
- Fix amdxdna firmware size

meson:
- modesetting fixes

sitronix:
- Kconfig fix for st7171-i2c

dma-buf:
- Fix -EBUSY WARN_ON_ONCE in dma-buf

udmabuf:
- Use dma_sync_sgtable_for_cpu in udmabuf

xe:
- Fix regression disallowing 64K SVM migration
- Use a bounce buffer for WA BB"

* tag 'drm-fixes-2025-06-14' of https://gitlab.freedesktop.org/drm/kernel:
drm/xe/lrc: Use a temporary buffer for WA BB
udmabuf: use sgtable-based scatterlist wrappers
dma-buf: fix compare in WARN_ON_ONCE
drm/sitronix: st7571-i2c: Select VIDEOMODE_HELPERS
drm/meson: fix more rounding issues with 59.94Hz modes
drm/meson: use vclk_freq instead of pixel_freq in debug print
drm/meson: fix debug log statement when setting the HDMI clocks
drm/vc4: fix infinite EPROBE_DEFER loop
drm/xe/svm: Fix regression disallowing 64K SVM migration
accel/amdxdna: Fix incorrect PSP firmware size

+68 -39
+2 -2
drivers/accel/amdxdna/aie2_psp.c
··· 126 126 psp->ddev = ddev; 127 127 memcpy(psp->psp_regs, conf->psp_regs, sizeof(psp->psp_regs)); 128 128 129 - psp->fw_buf_sz = ALIGN(conf->fw_size, PSP_FW_ALIGN) + PSP_FW_ALIGN; 130 - psp->fw_buffer = drmm_kmalloc(ddev, psp->fw_buf_sz, GFP_KERNEL); 129 + psp->fw_buf_sz = ALIGN(conf->fw_size, PSP_FW_ALIGN); 130 + psp->fw_buffer = drmm_kmalloc(ddev, psp->fw_buf_sz + PSP_FW_ALIGN, GFP_KERNEL); 131 131 if (!psp->fw_buffer) { 132 132 drm_err(ddev, "no memory for fw buffer"); 133 133 return NULL;
+1 -1
drivers/dma-buf/dma-buf.c
··· 1118 1118 * Catch exporters making buffers inaccessible even when 1119 1119 * attachments preventing that exist. 1120 1120 */ 1121 - WARN_ON_ONCE(ret == EBUSY); 1121 + WARN_ON_ONCE(ret == -EBUSY); 1122 1122 if (ret) 1123 1123 return ERR_PTR(ret); 1124 1124 }
+2 -3
drivers/dma-buf/udmabuf.c
··· 264 264 ubuf->sg = NULL; 265 265 } 266 266 } else { 267 - dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, 268 - direction); 267 + dma_sync_sgtable_for_cpu(dev, ubuf->sg, direction); 269 268 } 270 269 271 270 return ret; ··· 279 280 if (!ubuf->sg) 280 281 return -EINVAL; 281 282 282 - dma_sync_sg_for_device(dev, ubuf->sg->sgl, ubuf->sg->nents, direction); 283 + dma_sync_sgtable_for_device(dev, ubuf->sg, direction); 283 284 return 0; 284 285 } 285 286
+1 -1
drivers/gpu/drm/meson/meson_encoder_hdmi.c
··· 109 109 venc_freq /= 2; 110 110 111 111 dev_dbg(priv->dev, 112 - "vclk:%lluHz phy=%lluHz venc=%lluHz hdmi=%lluHz enci=%d\n", 112 + "phy:%lluHz vclk=%lluHz venc=%lluHz hdmi=%lluHz enci=%d\n", 113 113 phy_freq, vclk_freq, venc_freq, hdmi_freq, 114 114 priv->venc.hdmi_use_enci); 115 115
+34 -21
drivers/gpu/drm/meson/meson_vclk.c
··· 110 110 #define HDMI_PLL_LOCK BIT(31) 111 111 #define HDMI_PLL_LOCK_G12A (3 << 30) 112 112 113 - #define PIXEL_FREQ_1000_1001(_freq) \ 114 - DIV_ROUND_CLOSEST_ULL((_freq) * 1000ULL, 1001ULL) 115 - #define PHY_FREQ_1000_1001(_freq) \ 116 - (PIXEL_FREQ_1000_1001(DIV_ROUND_DOWN_ULL(_freq, 10ULL)) * 10) 113 + #define FREQ_1000_1001(_freq) DIV_ROUND_CLOSEST_ULL((_freq) * 1000ULL, 1001ULL) 117 114 118 115 /* VID PLL Dividers */ 119 116 enum { ··· 769 772 pll_freq); 770 773 } 771 774 775 + static bool meson_vclk_freqs_are_matching_param(unsigned int idx, 776 + unsigned long long phy_freq, 777 + unsigned long long vclk_freq) 778 + { 779 + DRM_DEBUG_DRIVER("i = %d vclk_freq = %lluHz alt = %lluHz\n", 780 + idx, params[idx].vclk_freq, 781 + FREQ_1000_1001(params[idx].vclk_freq)); 782 + DRM_DEBUG_DRIVER("i = %d phy_freq = %lluHz alt = %lluHz\n", 783 + idx, params[idx].phy_freq, 784 + FREQ_1000_1001(params[idx].phy_freq)); 785 + 786 + /* Match strict frequency */ 787 + if (phy_freq == params[idx].phy_freq && 788 + vclk_freq == params[idx].vclk_freq) 789 + return true; 790 + 791 + /* Match 1000/1001 variant: vclk deviation has to be less than 1kHz 792 + * (drm EDID is defined in 1kHz steps, so everything smaller must be 793 + * rounding error) and the PHY freq deviation has to be less than 794 + * 10kHz (as the TMDS clock is 10 times the pixel clock, so anything 795 + * smaller must be rounding error as well). 796 + */ 797 + if (abs(vclk_freq - FREQ_1000_1001(params[idx].vclk_freq)) < 1000 && 798 + abs(phy_freq - FREQ_1000_1001(params[idx].phy_freq)) < 10000) 799 + return true; 800 + 801 + /* no match */ 802 + return false; 803 + } 804 + 772 805 enum drm_mode_status 773 806 meson_vclk_vic_supported_freq(struct meson_drm *priv, 774 807 unsigned long long phy_freq, ··· 817 790 } 818 791 819 792 for (i = 0 ; params[i].pixel_freq ; ++i) { 820 - DRM_DEBUG_DRIVER("i = %d pixel_freq = %lluHz alt = %lluHz\n", 821 - i, params[i].pixel_freq, 822 - PIXEL_FREQ_1000_1001(params[i].pixel_freq)); 823 - DRM_DEBUG_DRIVER("i = %d phy_freq = %lluHz alt = %lluHz\n", 824 - i, params[i].phy_freq, 825 - PHY_FREQ_1000_1001(params[i].phy_freq)); 826 - /* Match strict frequency */ 827 - if (phy_freq == params[i].phy_freq && 828 - vclk_freq == params[i].vclk_freq) 829 - return MODE_OK; 830 - /* Match 1000/1001 variant */ 831 - if (phy_freq == PHY_FREQ_1000_1001(params[i].phy_freq) && 832 - vclk_freq == PIXEL_FREQ_1000_1001(params[i].vclk_freq)) 793 + if (meson_vclk_freqs_are_matching_param(i, phy_freq, vclk_freq)) 833 794 return MODE_OK; 834 795 } 835 796 ··· 1090 1075 } 1091 1076 1092 1077 for (freq = 0 ; params[freq].pixel_freq ; ++freq) { 1093 - if ((phy_freq == params[freq].phy_freq || 1094 - phy_freq == PHY_FREQ_1000_1001(params[freq].phy_freq)) && 1095 - (vclk_freq == params[freq].vclk_freq || 1096 - vclk_freq == PIXEL_FREQ_1000_1001(params[freq].vclk_freq))) { 1078 + if (meson_vclk_freqs_are_matching_param(freq, phy_freq, 1079 + vclk_freq)) { 1097 1080 if (vclk_freq != params[freq].vclk_freq) 1098 1081 vic_alternate_clock = true; 1099 1082 else
+1
drivers/gpu/drm/sitronix/Kconfig
··· 5 5 select DRM_GEM_SHMEM_HELPER 6 6 select DRM_KMS_HELPER 7 7 select REGMAP_I2C 8 + select VIDEOMODE_HELPERS 8 9 help 9 10 DRM driver for Sitronix ST7571 panels controlled over I2C. 10 11
+6 -6
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 560 560 if (ret) 561 561 return ret; 562 562 563 - ret = drm_connector_hdmi_audio_init(connector, dev->dev, 564 - &vc4_hdmi_audio_funcs, 565 - 8, false, -1); 566 - if (ret) 567 - return ret; 568 - 569 563 drm_connector_helper_add(connector, &vc4_hdmi_connector_helper_funcs); 570 564 571 565 /* ··· 2284 2290 dev_err(dev, "Could not register CPU DAI: %d\n", ret); 2285 2291 return ret; 2286 2292 } 2293 + 2294 + ret = drm_connector_hdmi_audio_init(&vc4_hdmi->connector, dev, 2295 + &vc4_hdmi_audio_funcs, 8, false, 2296 + -1); 2297 + if (ret) 2298 + return ret; 2287 2299 2288 2300 dai_link->cpus = &vc4_hdmi->audio.cpu; 2289 2301 dai_link->codecs = &vc4_hdmi->audio.codec;
+20 -4
drivers/gpu/drm/xe/xe_lrc.c
··· 941 941 * store it in the PPHSWP. 942 942 */ 943 943 #define CONTEXT_ACTIVE 1ULL 944 - static void xe_lrc_setup_utilization(struct xe_lrc *lrc) 944 + static int xe_lrc_setup_utilization(struct xe_lrc *lrc) 945 945 { 946 - u32 *cmd; 946 + u32 *cmd, *buf = NULL; 947 947 948 - cmd = lrc->bb_per_ctx_bo->vmap.vaddr; 948 + if (lrc->bb_per_ctx_bo->vmap.is_iomem) { 949 + buf = kmalloc(lrc->bb_per_ctx_bo->size, GFP_KERNEL); 950 + if (!buf) 951 + return -ENOMEM; 952 + cmd = buf; 953 + } else { 954 + cmd = lrc->bb_per_ctx_bo->vmap.vaddr; 955 + } 949 956 950 957 *cmd++ = MI_STORE_REGISTER_MEM | MI_SRM_USE_GGTT | MI_SRM_ADD_CS_OFFSET; 951 958 *cmd++ = ENGINE_ID(0).addr; ··· 973 966 974 967 *cmd++ = MI_BATCH_BUFFER_END; 975 968 969 + if (buf) { 970 + xe_map_memcpy_to(gt_to_xe(lrc->gt), &lrc->bb_per_ctx_bo->vmap, 0, 971 + buf, (cmd - buf) * sizeof(*cmd)); 972 + kfree(buf); 973 + } 974 + 976 975 xe_lrc_write_ctx_reg(lrc, CTX_BB_PER_CTX_PTR, 977 976 xe_bo_ggtt_addr(lrc->bb_per_ctx_bo) | 1); 978 977 978 + return 0; 979 979 } 980 980 981 981 #define PVC_CTX_ASID (0x2e + 1) ··· 1139 1125 map = __xe_lrc_start_seqno_map(lrc); 1140 1126 xe_map_write32(lrc_to_xe(lrc), &map, lrc->fence_ctx.next_seqno - 1); 1141 1127 1142 - xe_lrc_setup_utilization(lrc); 1128 + err = xe_lrc_setup_utilization(lrc); 1129 + if (err) 1130 + goto err_lrc_finish; 1143 1131 1144 1132 return 0; 1145 1133
+1 -1
drivers/gpu/drm/xe/xe_svm.c
··· 764 764 return false; 765 765 } 766 766 767 - if (range_size <= SZ_64K && !supports_4K_migration(vm->xe)) { 767 + if (range_size < SZ_64K && !supports_4K_migration(vm->xe)) { 768 768 drm_dbg(&vm->xe->drm, "Platform doesn't support SZ_4K range migration\n"); 769 769 return false; 770 770 }