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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull drm fixes from Simona Vetter:
"Cross-subsystem Changes:
- agp/amd64 binding dmesg noise regression fix

Core Changes:
- fix race in gem_handle_create_tail
- fixup handle_count fb refcount regression from -rc5, popular with
reports ...
- call rust dtor for drm_device release

Driver Changes:
- nouveau: magic 50ms suspend fix, acpi leak fix
- tegra: dma api error in nvdec
- pvr: fix device reset
- habanalbs maintainer update
- intel display: fix some dsi mipi sequences
- xe fixes: SRIOV fixes, small GuC fixes, disable indirect ring due
to issues, compression fix for fragmented BO, doc update

* tag 'drm-fixes-2025-07-12' of https://gitlab.freedesktop.org/drm/kernel: (22 commits)
drm/xe/guc: Default log level to non-verbose
drm/xe/bmg: Don't use WA 16023588340 and 22019338487 on VF
drm/xe/guc: Recommend GuC v70.46.2 for BMG, LNL, DG2
drm/xe/pm: Correct comment of xe_pm_set_vram_threshold()
drm/xe: Release runtime pm for error path of xe_devcoredump_read()
drm/xe/pm: Restore display pm if there is error after display suspend
drm/i915/bios: Apply vlv_fixup_mipi_sequences() to v2 mipi-sequences too
drm/gem: Fix race in drm_gem_handle_create_tail()
drm/framebuffer: Acquire internal references on GEM handles
agp/amd64: Check AGP Capability before binding to unsupported devices
drm/xe/bmg: fix compressed VRAM handling
Revert "drm/xe/xe2: Enable Indirect Ring State support for Xe2"
drm/xe: Allocate PF queue size on pow2 boundary
drm/xe/pf: Clear all LMTT pages on alloc
drm/nouveau/gsp: fix potential leak of memory used during acpi init
rust: drm: remove unnecessary imports
MAINTAINERS: Change habanalabs maintainer
drm/imagination: Fix kernel crash when hard resetting the GPU
drm/tegra: nvdec: Fix dma_alloc_coherent error check
rust: drm: device: drop_in_place() the drm::Device in release()
...

+187 -89
+1 -1
MAINTAINERS
··· 10506 10506 F: block/partitions/efi.* 10507 10507 10508 10508 HABANALABS PCI DRIVER 10509 - M: Ofir Bitton <obitton@habana.ai> 10509 + M: Yaron Avizrat <yaron.avizrat@intel.com> 10510 10510 L: dri-devel@lists.freedesktop.org 10511 10511 S: Supported 10512 10512 C: irc://irc.oftc.net/dri-devel
+8 -8
drivers/char/agp/amd64-agp.c
··· 720 720 721 721 MODULE_DEVICE_TABLE(pci, agp_amd64_pci_table); 722 722 723 - static const struct pci_device_id agp_amd64_pci_promisc_table[] = { 724 - { PCI_DEVICE_CLASS(0, 0) }, 725 - { } 726 - }; 727 - 728 723 static DEFINE_SIMPLE_DEV_PM_OPS(agp_amd64_pm_ops, NULL, agp_amd64_resume); 729 724 730 725 static struct pci_driver agp_amd64_pci_driver = { ··· 734 739 /* Not static due to IOMMU code calling it early. */ 735 740 int __init agp_amd64_init(void) 736 741 { 742 + struct pci_dev *pdev = NULL; 737 743 int err = 0; 738 744 739 745 if (agp_off) ··· 763 767 } 764 768 765 769 /* Look for any AGP bridge */ 766 - agp_amd64_pci_driver.id_table = agp_amd64_pci_promisc_table; 767 - err = driver_attach(&agp_amd64_pci_driver.driver); 768 - if (err == 0 && agp_bridges_found == 0) { 770 + for_each_pci_dev(pdev) 771 + if (pci_find_capability(pdev, PCI_CAP_ID_AGP)) 772 + pci_add_dynid(&agp_amd64_pci_driver, 773 + pdev->vendor, pdev->device, 774 + pdev->subsystem_vendor, 775 + pdev->subsystem_device, 0, 0, 0); 776 + if (agp_bridges_found == 0) { 769 777 pci_unregister_driver(&agp_amd64_pci_driver); 770 778 err = -ENODEV; 771 779 }
+29 -2
drivers/gpu/drm/drm_framebuffer.c
··· 862 862 int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, 863 863 const struct drm_framebuffer_funcs *funcs) 864 864 { 865 + unsigned int i; 865 866 int ret; 867 + bool exists; 866 868 867 869 if (WARN_ON_ONCE(fb->dev != dev || !fb->format)) 868 870 return -EINVAL; 871 + 872 + for (i = 0; i < fb->format->num_planes; i++) { 873 + if (drm_WARN_ON_ONCE(dev, fb->internal_flags & DRM_FRAMEBUFFER_HAS_HANDLE_REF(i))) 874 + fb->internal_flags &= ~DRM_FRAMEBUFFER_HAS_HANDLE_REF(i); 875 + if (fb->obj[i]) { 876 + exists = drm_gem_object_handle_get_if_exists_unlocked(fb->obj[i]); 877 + if (exists) 878 + fb->internal_flags |= DRM_FRAMEBUFFER_HAS_HANDLE_REF(i); 879 + } 880 + } 869 881 870 882 INIT_LIST_HEAD(&fb->filp_head); 871 883 ··· 887 875 ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB, 888 876 false, drm_framebuffer_free); 889 877 if (ret) 890 - goto out; 878 + goto err; 891 879 892 880 mutex_lock(&dev->mode_config.fb_lock); 893 881 dev->mode_config.num_fb++; ··· 895 883 mutex_unlock(&dev->mode_config.fb_lock); 896 884 897 885 drm_mode_object_register(dev, &fb->base); 898 - out: 886 + 887 + return 0; 888 + 889 + err: 890 + for (i = 0; i < fb->format->num_planes; i++) { 891 + if (fb->internal_flags & DRM_FRAMEBUFFER_HAS_HANDLE_REF(i)) { 892 + drm_gem_object_handle_put_unlocked(fb->obj[i]); 893 + fb->internal_flags &= ~DRM_FRAMEBUFFER_HAS_HANDLE_REF(i); 894 + } 895 + } 899 896 return ret; 900 897 } 901 898 EXPORT_SYMBOL(drm_framebuffer_init); ··· 981 960 void drm_framebuffer_cleanup(struct drm_framebuffer *fb) 982 961 { 983 962 struct drm_device *dev = fb->dev; 963 + unsigned int i; 964 + 965 + for (i = 0; i < fb->format->num_planes; i++) { 966 + if (fb->internal_flags & DRM_FRAMEBUFFER_HAS_HANDLE_REF(i)) 967 + drm_gem_object_handle_put_unlocked(fb->obj[i]); 968 + } 984 969 985 970 mutex_lock(&dev->mode_config.fb_lock); 986 971 list_del(&fb->head);
+33 -15
drivers/gpu/drm/drm_gem.c
··· 223 223 } 224 224 225 225 /** 226 - * drm_gem_object_handle_get_unlocked - acquire reference on user-space handles 226 + * drm_gem_object_handle_get_if_exists_unlocked - acquire reference on user-space handle, if any 227 227 * @obj: GEM object 228 228 * 229 - * Acquires a reference on the GEM buffer object's handle. Required 230 - * to keep the GEM object alive. Call drm_gem_object_handle_put_unlocked() 231 - * to release the reference. 229 + * Acquires a reference on the GEM buffer object's handle. Required to keep 230 + * the GEM object alive. Call drm_gem_object_handle_put_if_exists_unlocked() 231 + * to release the reference. Does nothing if the buffer object has no handle. 232 + * 233 + * Returns: 234 + * True if a handle exists, or false otherwise 232 235 */ 233 - void drm_gem_object_handle_get_unlocked(struct drm_gem_object *obj) 236 + bool drm_gem_object_handle_get_if_exists_unlocked(struct drm_gem_object *obj) 234 237 { 235 238 struct drm_device *dev = obj->dev; 236 239 237 240 guard(mutex)(&dev->object_name_lock); 238 241 239 - drm_WARN_ON(dev, !obj->handle_count); /* first ref taken in create-tail helper */ 242 + /* 243 + * First ref taken during GEM object creation, if any. Some 244 + * drivers set up internal framebuffers with GEM objects that 245 + * do not have a GEM handle. Hence, this counter can be zero. 246 + */ 247 + if (!obj->handle_count) 248 + return false; 249 + 240 250 drm_gem_object_handle_get(obj); 251 + 252 + return true; 241 253 } 242 - EXPORT_SYMBOL(drm_gem_object_handle_get_unlocked); 243 254 244 255 /** 245 256 * drm_gem_object_handle_free - release resources bound to userspace handles ··· 283 272 } 284 273 285 274 /** 286 - * drm_gem_object_handle_put_unlocked - releases reference on user-space handles 275 + * drm_gem_object_handle_put_unlocked - releases reference on user-space handle 287 276 * @obj: GEM object 288 277 * 289 278 * Releases a reference on the GEM buffer object's handle. Possibly releases ··· 294 283 struct drm_device *dev = obj->dev; 295 284 bool final = false; 296 285 297 - if (WARN_ON(READ_ONCE(obj->handle_count) == 0)) 286 + if (drm_WARN_ON(dev, READ_ONCE(obj->handle_count) == 0)) 298 287 return; 299 288 300 289 /* 301 - * Must bump handle count first as this may be the last 302 - * ref, in which case the object would disappear before we 303 - * checked for a name 304 - */ 290 + * Must bump handle count first as this may be the last 291 + * ref, in which case the object would disappear before 292 + * we checked for a name. 293 + */ 305 294 306 295 mutex_lock(&dev->object_name_lock); 307 296 if (--obj->handle_count == 0) { ··· 314 303 if (final) 315 304 drm_gem_object_put(obj); 316 305 } 317 - EXPORT_SYMBOL(drm_gem_object_handle_put_unlocked); 318 306 319 307 /* 320 308 * Called at device or object close to release the file's ··· 324 314 { 325 315 struct drm_file *file_priv = data; 326 316 struct drm_gem_object *obj = ptr; 317 + 318 + if (drm_WARN_ON(obj->dev, !data)) 319 + return 0; 327 320 328 321 if (obj->funcs->close) 329 322 obj->funcs->close(obj, file_priv); ··· 448 435 idr_preload(GFP_KERNEL); 449 436 spin_lock(&file_priv->table_lock); 450 437 451 - ret = idr_alloc(&file_priv->object_idr, obj, 1, 0, GFP_NOWAIT); 438 + ret = idr_alloc(&file_priv->object_idr, NULL, 1, 0, GFP_NOWAIT); 452 439 453 440 spin_unlock(&file_priv->table_lock); 454 441 idr_preload_end(); ··· 469 456 goto err_revoke; 470 457 } 471 458 459 + /* mirrors drm_gem_handle_delete to avoid races */ 460 + spin_lock(&file_priv->table_lock); 461 + obj = idr_replace(&file_priv->object_idr, obj, handle); 462 + WARN_ON(obj != NULL); 463 + spin_unlock(&file_priv->table_lock); 472 464 *handlep = handle; 473 465 return 0; 474 466
+7 -9
drivers/gpu/drm/drm_gem_framebuffer_helper.c
··· 99 99 unsigned int i; 100 100 101 101 for (i = 0; i < fb->format->num_planes; i++) 102 - drm_gem_object_handle_put_unlocked(fb->obj[i]); 102 + drm_gem_object_put(fb->obj[i]); 103 103 104 104 drm_framebuffer_cleanup(fb); 105 105 kfree(fb); ··· 182 182 if (!objs[i]) { 183 183 drm_dbg_kms(dev, "Failed to lookup GEM object\n"); 184 184 ret = -ENOENT; 185 - goto err_gem_object_handle_put_unlocked; 185 + goto err_gem_object_put; 186 186 } 187 - drm_gem_object_handle_get_unlocked(objs[i]); 188 - drm_gem_object_put(objs[i]); 189 187 190 188 min_size = (height - 1) * mode_cmd->pitches[i] 191 189 + drm_format_info_min_pitch(info, i, width) ··· 193 195 drm_dbg_kms(dev, 194 196 "GEM object size (%zu) smaller than minimum size (%u) for plane %d\n", 195 197 objs[i]->size, min_size, i); 196 - drm_gem_object_handle_put_unlocked(objs[i]); 198 + drm_gem_object_put(objs[i]); 197 199 ret = -EINVAL; 198 - goto err_gem_object_handle_put_unlocked; 200 + goto err_gem_object_put; 199 201 } 200 202 } 201 203 202 204 ret = drm_gem_fb_init(dev, fb, mode_cmd, objs, i, funcs); 203 205 if (ret) 204 - goto err_gem_object_handle_put_unlocked; 206 + goto err_gem_object_put; 205 207 206 208 return 0; 207 209 208 - err_gem_object_handle_put_unlocked: 210 + err_gem_object_put: 209 211 while (i > 0) { 210 212 --i; 211 - drm_gem_object_handle_put_unlocked(objs[i]); 213 + drm_gem_object_put(objs[i]); 212 214 } 213 215 return ret; 214 216 }
+1 -1
drivers/gpu/drm/drm_internal.h
··· 161 161 162 162 /* drm_gem.c */ 163 163 int drm_gem_init(struct drm_device *dev); 164 - void drm_gem_object_handle_get_unlocked(struct drm_gem_object *obj); 164 + bool drm_gem_object_handle_get_if_exists_unlocked(struct drm_gem_object *obj); 165 165 void drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj); 166 166 int drm_gem_handle_create_tail(struct drm_file *file_priv, 167 167 struct drm_gem_object *obj,
+1 -1
drivers/gpu/drm/drm_panic_qr.rs
··· 27 27 //! * <https://github.com/erwanvivien/fast_qr> 28 28 //! * <https://github.com/bjguillot/qr> 29 29 30 - use kernel::{prelude::*, str::CStr}; 30 + use kernel::prelude::*; 31 31 32 32 #[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd)] 33 33 struct Version(usize);
+4 -4
drivers/gpu/drm/i915/display/intel_bios.c
··· 1938 1938 int index, len; 1939 1939 1940 1940 if (drm_WARN_ON(display->drm, 1941 - !data || panel->vbt.dsi.seq_version != 1)) 1941 + !data || panel->vbt.dsi.seq_version >= 3)) 1942 1942 return 0; 1943 1943 1944 1944 /* index = 1 to skip sequence byte */ ··· 1961 1961 } 1962 1962 1963 1963 /* 1964 - * Some v1 VBT MIPI sequences do the deassert in the init OTP sequence. 1964 + * Some v1/v2 VBT MIPI sequences do the deassert in the init OTP sequence. 1965 1965 * The deassert must be done before calling intel_dsi_device_ready, so for 1966 1966 * these devices we split the init OTP sequence into a deassert sequence and 1967 1967 * the actual init OTP part. ··· 1972 1972 u8 *init_otp; 1973 1973 int len; 1974 1974 1975 - /* Limit this to v1 vid-mode sequences */ 1975 + /* Limit this to v1/v2 vid-mode sequences */ 1976 1976 if (panel->vbt.dsi.config->is_cmd_mode || 1977 - panel->vbt.dsi.seq_version != 1) 1977 + panel->vbt.dsi.seq_version >= 3) 1978 1978 return; 1979 1979 1980 1980 /* Only do this if there are otp and assert seqs and no deassert seq */
+2 -2
drivers/gpu/drm/imagination/pvr_power.c
··· 386 386 if (!err) { 387 387 if (hard_reset) { 388 388 pvr_dev->fw_dev.booted = false; 389 - WARN_ON(pm_runtime_force_suspend(from_pvr_device(pvr_dev)->dev)); 389 + WARN_ON(pvr_power_device_suspend(from_pvr_device(pvr_dev)->dev)); 390 390 391 391 err = pvr_fw_hard_reset(pvr_dev); 392 392 if (err) 393 393 goto err_device_lost; 394 394 395 - err = pm_runtime_force_resume(from_pvr_device(pvr_dev)->dev); 395 + err = pvr_power_device_resume(from_pvr_device(pvr_dev)->dev); 396 396 pvr_dev->fw_dev.booted = true; 397 397 if (err) 398 398 goto err_device_lost;
+1 -5
drivers/gpu/drm/nouveau/nouveau_debugfs.c
··· 314 314 drm->debugfs = NULL; 315 315 } 316 316 317 - int 317 + void 318 318 nouveau_module_debugfs_init(void) 319 319 { 320 320 nouveau_debugfs_root = debugfs_create_dir("nouveau", NULL); 321 - if (IS_ERR(nouveau_debugfs_root)) 322 - return PTR_ERR(nouveau_debugfs_root); 323 - 324 - return 0; 325 321 } 326 322 327 323 void
+2 -3
drivers/gpu/drm/nouveau/nouveau_debugfs.h
··· 24 24 25 25 extern struct dentry *nouveau_debugfs_root; 26 26 27 - int nouveau_module_debugfs_init(void); 27 + void nouveau_module_debugfs_init(void); 28 28 void nouveau_module_debugfs_fini(void); 29 29 #else 30 30 static inline void ··· 42 42 { 43 43 } 44 44 45 - static inline int 45 + static inline void 46 46 nouveau_module_debugfs_init(void) 47 47 { 48 - return 0; 49 48 } 50 49 51 50 static inline void
+1 -3
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 1461 1461 if (!nouveau_modeset) 1462 1462 return 0; 1463 1463 1464 - ret = nouveau_module_debugfs_init(); 1465 - if (ret) 1466 - return ret; 1464 + nouveau_module_debugfs_init(); 1467 1465 1468 1466 #ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER 1469 1467 platform_driver_register(&nouveau_platform_driver);
+21 -6
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
··· 719 719 union acpi_object argv4 = { 720 720 .buffer.type = ACPI_TYPE_BUFFER, 721 721 .buffer.length = 4, 722 - .buffer.pointer = kmalloc(argv4.buffer.length, GFP_KERNEL), 723 722 }, *obj; 724 723 725 724 caps->status = 0xffff; ··· 726 727 if (!acpi_check_dsm(handle, &NVOP_DSM_GUID, NVOP_DSM_REV, BIT_ULL(0x1a))) 727 728 return; 728 729 730 + argv4.buffer.pointer = kmalloc(argv4.buffer.length, GFP_KERNEL); 731 + if (!argv4.buffer.pointer) 732 + return; 733 + 729 734 obj = acpi_evaluate_dsm(handle, &NVOP_DSM_GUID, NVOP_DSM_REV, 0x1a, &argv4); 730 735 if (!obj) 731 - return; 736 + goto done; 732 737 733 738 if (WARN_ON(obj->type != ACPI_TYPE_BUFFER) || 734 739 WARN_ON(obj->buffer.length != 4)) 735 - return; 740 + goto done; 736 741 737 742 caps->status = 0; 738 743 caps->optimusCaps = *(u32 *)obj->buffer.pointer; 739 744 745 + done: 740 746 ACPI_FREE(obj); 741 747 742 748 kfree(argv4.buffer.pointer); ··· 758 754 union acpi_object argv4 = { 759 755 .buffer.type = ACPI_TYPE_BUFFER, 760 756 .buffer.length = sizeof(caps), 761 - .buffer.pointer = kmalloc(argv4.buffer.length, GFP_KERNEL), 762 757 }, *obj; 763 758 764 759 jt->status = 0xffff; 765 760 761 + argv4.buffer.pointer = kmalloc(argv4.buffer.length, GFP_KERNEL); 762 + if (!argv4.buffer.pointer) 763 + return; 764 + 766 765 obj = acpi_evaluate_dsm(handle, &JT_DSM_GUID, JT_DSM_REV, 0x1, &argv4); 767 766 if (!obj) 768 - return; 767 + goto done; 769 768 770 769 if (WARN_ON(obj->type != ACPI_TYPE_BUFFER) || 771 770 WARN_ON(obj->buffer.length != 4)) 772 - return; 771 + goto done; 773 772 774 773 jt->status = 0; 775 774 jt->jtCaps = *(u32 *)obj->buffer.pointer; 776 775 jt->jtRevId = (jt->jtCaps & 0xfff00000) >> 20; 777 776 jt->bSBIOSCaps = 0; 778 777 778 + done: 779 779 ACPI_FREE(obj); 780 780 781 781 kfree(argv4.buffer.pointer); ··· 1752 1744 nvkm_gsp_sg_free(gsp->subdev.device, &gsp->sr.sgt); 1753 1745 return ret; 1754 1746 } 1747 + 1748 + /* 1749 + * TODO: Debug the GSP firmware / RPC handling to find out why 1750 + * without this Turing (but none of the other architectures) 1751 + * ends up resetting all channels after resume. 1752 + */ 1753 + msleep(50); 1755 1754 } 1756 1755 1757 1756 ret = r535_gsp_rpc_unloading_guest_driver(gsp, suspend);
+2 -4
drivers/gpu/drm/tegra/nvdec.c
··· 261 261 262 262 if (!client->group) { 263 263 virt = dma_alloc_coherent(nvdec->dev, size, &iova, GFP_KERNEL); 264 - 265 - err = dma_mapping_error(nvdec->dev, iova); 266 - if (err < 0) 267 - return err; 264 + if (!virt) 265 + return -ENOMEM; 268 266 } else { 269 267 virt = tegra_drm_alloc(tegra, size, &iova); 270 268 if (IS_ERR(virt))
+28 -10
drivers/gpu/drm/xe/xe_devcoredump.c
··· 171 171 172 172 #define XE_DEVCOREDUMP_CHUNK_MAX (SZ_512M + SZ_1G) 173 173 174 + /** 175 + * xe_devcoredump_read() - Read data from the Xe device coredump snapshot 176 + * @buffer: Destination buffer to copy the coredump data into 177 + * @offset: Offset in the coredump data to start reading from 178 + * @count: Number of bytes to read 179 + * @data: Pointer to the xe_devcoredump structure 180 + * @datalen: Length of the data (unused) 181 + * 182 + * Reads a chunk of the coredump snapshot data into the provided buffer. 183 + * If the devcoredump is smaller than 1.5 GB (XE_DEVCOREDUMP_CHUNK_MAX), 184 + * it is read directly from a pre-written buffer. For larger devcoredumps, 185 + * the pre-written buffer must be periodically repopulated from the snapshot 186 + * state due to kmalloc size limitations. 187 + * 188 + * Return: Number of bytes copied on success, or a negative error code on failure. 189 + */ 174 190 static ssize_t xe_devcoredump_read(char *buffer, loff_t offset, 175 191 size_t count, void *data, size_t datalen) 176 192 { 177 193 struct xe_devcoredump *coredump = data; 178 194 struct xe_devcoredump_snapshot *ss; 179 - ssize_t byte_copied; 195 + ssize_t byte_copied = 0; 180 196 u32 chunk_offset; 181 197 ssize_t new_chunk_position; 198 + bool pm_needed = false; 199 + int ret = 0; 182 200 183 201 if (!coredump) 184 202 return -ENODEV; ··· 206 188 /* Ensure delayed work is captured before continuing */ 207 189 flush_work(&ss->work); 208 190 209 - if (ss->read.size > XE_DEVCOREDUMP_CHUNK_MAX) 191 + pm_needed = ss->read.size > XE_DEVCOREDUMP_CHUNK_MAX; 192 + if (pm_needed) 210 193 xe_pm_runtime_get(gt_to_xe(ss->gt)); 211 194 212 195 mutex_lock(&coredump->lock); 213 196 214 197 if (!ss->read.buffer) { 215 - mutex_unlock(&coredump->lock); 216 - return -ENODEV; 198 + ret = -ENODEV; 199 + goto unlock; 217 200 } 218 201 219 - if (offset >= ss->read.size) { 220 - mutex_unlock(&coredump->lock); 221 - return 0; 222 - } 202 + if (offset >= ss->read.size) 203 + goto unlock; 223 204 224 205 new_chunk_position = div_u64_rem(offset, 225 206 XE_DEVCOREDUMP_CHUNK_MAX, ··· 238 221 ss->read.size - offset; 239 222 memcpy(buffer, ss->read.buffer + chunk_offset, byte_copied); 240 223 224 + unlock: 241 225 mutex_unlock(&coredump->lock); 242 226 243 - if (ss->read.size > XE_DEVCOREDUMP_CHUNK_MAX) 227 + if (pm_needed) 244 228 xe_pm_runtime_put(gt_to_xe(ss->gt)); 245 229 246 - return byte_copied; 230 + return byte_copied ? byte_copied : ret; 247 231 } 248 232 249 233 static void xe_devcoredump_free(void *data)
+1
drivers/gpu/drm/xe/xe_gt_pagefault.c
··· 444 444 #define PF_MULTIPLIER 8 445 445 pf_queue->num_dw = 446 446 (num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW * PF_MULTIPLIER; 447 + pf_queue->num_dw = roundup_pow_of_two(pf_queue->num_dw); 447 448 #undef PF_MULTIPLIER 448 449 449 450 pf_queue->gt = gt;
+11
drivers/gpu/drm/xe/xe_lmtt.c
··· 78 78 } 79 79 80 80 lmtt_assert(lmtt, xe_bo_is_vram(bo)); 81 + lmtt_debug(lmtt, "level=%u addr=%#llx\n", level, (u64)xe_bo_main_addr(bo, XE_PAGE_SIZE)); 82 + 83 + xe_map_memset(lmtt_to_xe(lmtt), &bo->vmap, 0, 0, bo->size); 81 84 82 85 pt->level = level; 83 86 pt->bo = bo; ··· 94 91 95 92 static void lmtt_pt_free(struct xe_lmtt_pt *pt) 96 93 { 94 + lmtt_debug(&pt->bo->tile->sriov.pf.lmtt, "level=%u addr=%llx\n", 95 + pt->level, (u64)xe_bo_main_addr(pt->bo, XE_PAGE_SIZE)); 96 + 97 97 xe_bo_unpin_map_no_vm(pt->bo); 98 98 kfree(pt); 99 99 } ··· 232 226 233 227 switch (lmtt->ops->lmtt_pte_size(level)) { 234 228 case sizeof(u32): 229 + lmtt_assert(lmtt, !overflows_type(pte, u32)); 230 + lmtt_assert(lmtt, !pte || !iosys_map_rd(&pt->bo->vmap, idx * sizeof(u32), u32)); 231 + 235 232 xe_map_wr(lmtt_to_xe(lmtt), &pt->bo->vmap, idx * sizeof(u32), u32, pte); 236 233 break; 237 234 case sizeof(u64): 235 + lmtt_assert(lmtt, !pte || !iosys_map_rd(&pt->bo->vmap, idx * sizeof(u64), u64)); 236 + 238 237 xe_map_wr(lmtt_to_xe(lmtt), &pt->bo->vmap, idx * sizeof(u64), u64, pte); 239 238 break; 240 239 default:
+1 -1
drivers/gpu/drm/xe/xe_migrate.c
··· 863 863 if (src_is_vram && xe_migrate_allow_identity(src_L0, &src_it)) 864 864 xe_res_next(&src_it, src_L0); 865 865 else 866 - emit_pte(m, bb, src_L0_pt, src_is_vram, copy_system_ccs, 866 + emit_pte(m, bb, src_L0_pt, src_is_vram, copy_system_ccs || use_comp_pat, 867 867 &src_it, src_L0, src); 868 868 869 869 if (dst_is_vram && xe_migrate_allow_identity(src_L0, &dst_it))
+1 -1
drivers/gpu/drm/xe/xe_module.c
··· 20 20 21 21 struct xe_modparam xe_modparam = { 22 22 .probe_display = true, 23 - .guc_log_level = 3, 23 + .guc_log_level = IS_ENABLED(CONFIG_DRM_XE_DEBUG) ? 3 : 1, 24 24 .force_probe = CONFIG_DRM_XE_FORCE_PROBE, 25 25 .wedged_mode = 1, 26 26 .svm_notifier_size = 512,
-1
drivers/gpu/drm/xe/xe_pci.c
··· 140 140 .has_asid = 1, \ 141 141 .has_atomic_enable_pte_bit = 1, \ 142 142 .has_flat_ccs = 1, \ 143 - .has_indirect_ring_state = 1, \ 144 143 .has_range_tlb_invalidation = 1, \ 145 144 .has_usm = 1, \ 146 145 .has_64bit_timestamp = 1, \
+6 -5
drivers/gpu/drm/xe/xe_pm.c
··· 134 134 /* FIXME: Super racey... */ 135 135 err = xe_bo_evict_all(xe); 136 136 if (err) 137 - goto err_pxp; 137 + goto err_display; 138 138 139 139 for_each_gt(gt, xe, id) { 140 140 err = xe_gt_suspend(gt); ··· 151 151 152 152 err_display: 153 153 xe_display_pm_resume(xe); 154 - err_pxp: 155 154 xe_pxp_pm_resume(xe->pxp); 156 155 err: 157 156 drm_dbg(&xe->drm, "Device suspend failed %d\n", err); ··· 752 753 } 753 754 754 755 /** 755 - * xe_pm_set_vram_threshold - Set a vram threshold for allowing/blocking D3Cold 756 + * xe_pm_set_vram_threshold - Set a VRAM threshold for allowing/blocking D3Cold 756 757 * @xe: xe device instance 757 - * @threshold: VRAM size in bites for the D3cold threshold 758 + * @threshold: VRAM size in MiB for the D3cold threshold 758 759 * 759 - * Returns 0 for success, negative error code otherwise. 760 + * Return: 761 + * * 0 - success 762 + * * -EINVAL - invalid argument 760 763 */ 761 764 int xe_pm_set_vram_threshold(struct xe_device *xe, u32 threshold) 762 765 {
+3 -3
drivers/gpu/drm/xe/xe_uc_fw.c
··· 114 114 #define XE_GT_TYPE_ANY XE_GT_TYPE_UNINITIALIZED 115 115 116 116 #define XE_GUC_FIRMWARE_DEFS(fw_def, mmp_ver, major_ver) \ 117 - fw_def(BATTLEMAGE, GT_TYPE_ANY, major_ver(xe, guc, bmg, 70, 44, 1)) \ 118 - fw_def(LUNARLAKE, GT_TYPE_ANY, major_ver(xe, guc, lnl, 70, 44, 1)) \ 117 + fw_def(BATTLEMAGE, GT_TYPE_ANY, major_ver(xe, guc, bmg, 70, 45, 2)) \ 118 + fw_def(LUNARLAKE, GT_TYPE_ANY, major_ver(xe, guc, lnl, 70, 45, 2)) \ 119 119 fw_def(METEORLAKE, GT_TYPE_ANY, major_ver(i915, guc, mtl, 70, 44, 1)) \ 120 - fw_def(DG2, GT_TYPE_ANY, major_ver(i915, guc, dg2, 70, 44, 1)) \ 120 + fw_def(DG2, GT_TYPE_ANY, major_ver(i915, guc, dg2, 70, 45, 2)) \ 121 121 fw_def(DG1, GT_TYPE_ANY, major_ver(i915, guc, dg1, 70, 44, 1)) \ 122 122 fw_def(ALDERLAKE_N, GT_TYPE_ANY, major_ver(i915, guc, tgl, 70, 44, 1)) \ 123 123 fw_def(ALDERLAKE_P, GT_TYPE_ANY, major_ver(i915, guc, adlp, 70, 44, 1)) \
+2 -2
drivers/gpu/drm/xe/xe_wa_oob.rules
··· 38 38 GRAPHICS_VERSION(2004) 39 39 GRAPHICS_VERSION_RANGE(3000, 3001) 40 40 22019338487 MEDIA_VERSION(2000) 41 - GRAPHICS_VERSION(2001) 41 + GRAPHICS_VERSION(2001), FUNC(xe_rtp_match_not_sriov_vf) 42 42 MEDIA_VERSION(3000), MEDIA_STEP(A0, B0), FUNC(xe_rtp_match_not_sriov_vf) 43 43 22019338487_display PLATFORM(LUNARLAKE) 44 - 16023588340 GRAPHICS_VERSION(2001) 44 + 16023588340 GRAPHICS_VERSION(2001), FUNC(xe_rtp_match_not_sriov_vf) 45 45 14019789679 GRAPHICS_VERSION(1255) 46 46 GRAPHICS_VERSION_RANGE(1270, 2004) 47 47 no_media_l3 MEDIA_VERSION(3000)
+3
include/drm/drm_file.h
··· 300 300 * 301 301 * Mapping of mm object handles to object pointers. Used by the GEM 302 302 * subsystem. Protected by @table_lock. 303 + * 304 + * Note that allocated entries might be NULL as a transient state when 305 + * creating or deleting a handle. 303 306 */ 304 307 struct idr object_idr; 305 308
+7
include/drm/drm_framebuffer.h
··· 23 23 #ifndef __DRM_FRAMEBUFFER_H__ 24 24 #define __DRM_FRAMEBUFFER_H__ 25 25 26 + #include <linux/bits.h> 26 27 #include <linux/ctype.h> 27 28 #include <linux/list.h> 28 29 #include <linux/sched.h> ··· 100 99 unsigned color, struct drm_clip_rect *clips, 101 100 unsigned num_clips); 102 101 }; 102 + 103 + #define DRM_FRAMEBUFFER_HAS_HANDLE_REF(_i) BIT(0u + (_i)) 103 104 104 105 /** 105 106 * struct drm_framebuffer - frame buffer object ··· 191 188 * DRM_MODE_FB_MODIFIERS. 192 189 */ 193 190 int flags; 191 + /** 192 + * @internal_flags: Framebuffer flags like DRM_FRAMEBUFFER_HAS_HANDLE_REF. 193 + */ 194 + unsigned int internal_flags; 194 195 /** 195 196 * @filp_head: Placed on &drm_file.fbs, protected by &drm_file.fbs_lock. 196 197 */
+11 -1
rust/kernel/drm/device.rs
··· 66 66 open: Some(drm::File::<T::File>::open_callback), 67 67 postclose: Some(drm::File::<T::File>::postclose_callback), 68 68 unload: None, 69 - release: None, 69 + release: Some(Self::release), 70 70 master_set: None, 71 71 master_drop: None, 72 72 debugfs_init: None, ··· 161 161 162 162 // SAFETY: `ptr` is valid by the safety requirements of this function. 163 163 unsafe { &*ptr.cast() } 164 + } 165 + 166 + extern "C" fn release(ptr: *mut bindings::drm_device) { 167 + // SAFETY: `ptr` is a valid pointer to a `struct drm_device` and embedded in `Self`. 168 + let this = unsafe { Self::from_drm_device(ptr) }; 169 + 170 + // SAFETY: 171 + // - When `release` runs it is guaranteed that there is no further access to `this`. 172 + // - `this` is valid for dropping. 173 + unsafe { core::ptr::drop_in_place(this) }; 164 174 } 165 175 } 166 176
-1
rust/kernel/drm/driver.rs
··· 10 10 drm, 11 11 error::{to_result, Result}, 12 12 prelude::*, 13 - str::CStr, 14 13 types::ARef, 15 14 }; 16 15 use macros::vtable;