umber-kernel/drivers/gpu/drm
Srinivasan Shanmugam 0ac822bf99 drm/amdgpu: Refactor amdgpu_gem_va_ioctl for Handling Last Fence Update and Timeline Management v7
[ Upstream commit efdc66fe12b07e7b7d28650bd8d4f7e3bb92c5d4 ]

When GPU memory mappings are updated, the driver returns a fence so
userspace knows when the update is finished.

The previous refactor could pick the wrong fence or rely on checks that
are not safe for GPU mappings that stay valid even when memory is
missing. In some cases this could return an invalid fence or cause fence
reference counting problems.

Fix this by (v5,v6, per Christian):
- Starting from the VM’s existing last update fence, so a valid and
  meaningful fence is always returned even when no new work is required.
- Selecting the VM-level fence only for always-valid / PRT mappings using
  the required combined bo_va + bo guard.
- Using the per-BO page table update fence for normal MAP and REPLACE
  operations.
- For UNMAP and CLEAR, returning the fence provided by
  amdgpu_vm_clear_freed(), which may remain unchanged when nothing needs
  clearing.
- Keeping fence reference counting balanced.

v7: Drop the extra bo_va/bo NULL guard since
    amdgpu_vm_is_bo_always_valid() handles NULL BOs correctly (including
    PRT). (Christian)

This makes VM timeline fences correct and prevents crashes caused by
incorrect fence handling.

Fixes: bd8150a1b337 ("drm/amdgpu: Refactor amdgpu_gem_va_ioctl for Handling Last Fence Update and Timeline Management v4")
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-03-04 07:21:36 -05:00
..
adp
amd drm/amdgpu: Refactor amdgpu_gem_va_ioctl for Handling Last Fence Update and Timeline Management v7 2026-03-04 07:21:36 -05:00
arm
armada
aspeed
ast drm/ast: Clear preserved bits from register output value 2025-10-30 20:44:44 +01:00
atmel-hlcdc drm/atmel-hlcdc: fix use-after-free of drm_crtc_commit after release 2026-03-04 07:20:02 -05:00
bridge drm/bridge: anx7625: Fix invalid EDID size 2026-03-04 07:21:10 -05:00
ci drm/ci: disable broken MR check in sanity job 2025-10-16 07:49:06 -07:00
clients drm/client: fix MODULE_PARM_DESC string for "active" 2025-11-13 14:15:24 +01:00
display drm/display/dp_mst: Add protection against 0 vcpi 2026-03-04 07:19:45 -05:00
etnaviv drm/etnaviv: fix flush sequence logic 2025-10-27 22:47:09 +01:00
exynos drm/exynos: vidi: fix to avoid directly dereferencing user pointer 2026-02-26 14:59:47 -08:00
fsl-dcu
gma500 drm/gma500: Remove unused helper psb_fbdev_fb_setcolreg() 2026-01-08 10:17:16 +01:00
gud drm/gud: fix NULL fb and crtc dereferences on USB disconnect 2026-01-23 11:21:13 +01:00
hisilicon drm/hisilicon/hibmc: Adding reset colorbar cfg in dp init. 2026-02-26 14:59:13 -08:00
hyperv
i915 drm/i915/wakeref: clean up INTEL_WAKEREF_PUT_* flag macros 2026-03-04 07:21:35 -05:00
imagination drm/imagination: Wait for FW trace update command completion 2026-01-30 10:32:17 +01:00
imx drm/imx/tve: fix probe device leak 2026-02-06 16:57:43 +01:00
ingenic
kmb
lib
lima
logicvc
loongson
mcde
mediatek drm/mediatek: dpi: Find next bridge during probe 2026-01-30 10:32:17 +01:00
meson
mgag200 drm/mgag200: fix mgag200_bmc_stop_scanout() 2026-02-11 13:41:58 +01:00
msm drm/msm/dp: Avoid division by zero in msm_dp_ctrl_config_msa() 2026-02-26 14:59:13 -08:00
mxsfb
nouveau nouveau/gsp: fix suspend/resume regression on r570 firmware 2026-02-11 13:41:43 +01:00
nova drm: nova: depend on CONFIG_64BIT 2026-01-08 10:16:41 +01:00
omapdrm
panel drm/panel: Fix a possible null-pointer dereference in jdi_panel_dsi_remove() 2026-03-04 07:19:56 -05:00
panfrost
panthor drm/panthor: fix for dma-fence safe access rules 2026-03-04 07:20:53 -05:00
pl111 drm/pl111: Fix error handling in pl111_amba_probe 2026-01-17 16:35:13 +01:00
qxl
radeon drm/radeon: Add HAINAN clock adjustment 2026-03-04 07:20:41 -05:00
renesas drm: renesas: rz-du: mipi_dsi: fix kernel panic when rebooting for some panels 2026-03-04 07:19:59 -05:00
rockchip drm/rockchip: dw_hdmi_qp: Fix RK3576 HPD interrupt handling 2026-02-26 14:59:13 -08:00
scheduler drm/sched: Fix deadlock in drm_sched_entity_kill_jobs_cb 2025-11-05 12:29:52 +01:00
sitronix
solomon
sprd
sti drm: sti: fix device leaks at component probe 2025-11-24 13:56:16 +01:00
stm
sun4i
sysfb drm/sysfb: Remove duplicate declarations 2026-01-23 11:21:31 +01:00
tegra drm/tegra: hdmi: sor: Fix error: variable ‘j’ set but not used 2026-02-19 16:31:32 +01:00
tests drm/tests: shmem: Hold reservation lock around purge 2026-03-04 07:20:55 -05:00
tidss drm/tidss: Fix enable/disable order 2026-01-17 16:35:13 +01:00
tilcdc drm/tilcdc: Fix removal actions in case of failed probe 2026-01-08 10:17:18 +01:00
tiny drm/tiny: pixpaper: add explicit dependency on MMU 2025-11-06 13:47:29 +01:00
ttm drm/ttm: Avoid NULL pointer deref for evicted BOs 2026-01-08 10:17:18 +01:00
tve200
tyr drm/tyr: fix register name in error print 2026-03-04 07:21:08 -05:00
udl
v3d drm/v3d: Set DMA segment size to avoid debug warnings 2026-03-04 07:19:50 -05:00
vboxvideo
vc4
vgem drm/vgem-fence: Fix potential deadlock on release 2025-12-18 14:02:26 +01:00
virtio
vkms
vmwgfx drm/vmwgfx: Fix an error return check in vmw_compat_shader_add() 2026-01-23 11:21:32 +01:00
xe drm/xe: Add bounds check on pat_index to prevent OOB kernel read in madvise 2026-03-04 07:21:33 -05:00
xen
xlnx
Kconfig drm, drm/xe: Fix xe userptr in the absence of CONFIG_DEVICE_PRIVATE 2026-01-30 10:32:15 +01:00
Kconfig.debug
Makefile drm, drm/xe: Fix xe userptr in the absence of CONFIG_DEVICE_PRIVATE 2026-01-30 10:32:15 +01:00
drm_atomic.c
drm_atomic_helper.c drm/atomic-helper: Export and namespace some functions 2026-01-17 16:35:13 +01:00
drm_atomic_state_helper.c
drm_atomic_uapi.c
drm_auth.c
drm_blend.c
drm_bridge.c
drm_bridge_helper.c
drm_buddy.c drm/buddy: Prevent BUG_ON by validating rounded allocation 2026-03-04 07:21:10 -05:00
drm_cache.c
drm_client.c
drm_client_event.c
drm_client_modeset.c
drm_color_mgmt.c
drm_connector.c
drm_crtc.c
drm_crtc_helper.c
drm_crtc_helper_internal.h
drm_crtc_internal.h
drm_damage_helper.c
drm_debugfs.c
drm_debugfs_crc.c
drm_displayid.c drm/displayid: add quirk to ignore DisplayID checksum errors 2026-01-08 10:16:42 +01:00
drm_displayid_internal.h drm/displayid: add quirk to ignore DisplayID checksum errors 2026-01-08 10:16:42 +01:00
drm_draw.c drm/draw: fix color truncation in drm_draw_fill24 2025-10-14 09:25:10 +02:00
drm_draw_internal.h drm/draw: fix color truncation in drm_draw_fill24 2025-10-14 09:25:10 +02:00
drm_drv.c
drm_dumb_buffers.c
drm_edid.c
drm_edid_load.c
drm_eld.c
drm_encoder.c
drm_exec.c
drm_fb_dma_helper.c
drm_fb_helper.c drm, fbcon, vga_switcheroo: Avoid race condition in fbcon setup 2025-11-25 09:08:32 +01:00
drm_fbdev_dma.c
drm_fbdev_shmem.c
drm_fbdev_ttm.c
drm_file.c
drm_flip_work.c
drm_format_helper.c
drm_format_internal.h
drm_fourcc.c
drm_framebuffer.c
drm_gem.c drm: Do not allow userspace to trigger kernel warnings in drm_gem_change_handle_ioctl() 2026-02-06 16:57:42 +01:00
drm_gem_atomic_helper.c drm/sysfb: Do not dereference NULL pointer in plane reset 2025-10-26 17:09:56 +01:00
drm_gem_dma_helper.c
drm_gem_framebuffer_helper.c
drm_gem_shmem_helper.c drm/tests: shmem: Hold reservation lock around purge 2026-03-04 07:20:55 -05:00
drm_gem_ttm_helper.c
drm_gem_vram_helper.c
drm_gpusvm.c
drm_gpuvm.c
drm_internal.h
drm_ioc32.c
drm_ioctl.c
drm_kms_helper_common.c
drm_lease.c
drm_managed.c
drm_mipi_dbi.c
drm_mipi_dsi.c
drm_mm.c
drm_mode_config.c
drm_mode_object.c
drm_modes.c
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c
drm_pagemap.c drm/pagemap, drm/xe: Ensure that the devmem allocation is idle before use 2026-01-08 10:17:20 +01:00
drm_panel.c
drm_panel_backlight_quirks.c
drm_panel_orientation_quirks.c
drm_panic.c drm/panic: Fix 24bit pixel crossing page boundaries 2025-10-21 11:28:03 +02:00
drm_panic_qr.rs
drm_pci.c
drm_plane.c drm/plane: Fix IS_ERR() vs NULL check in drm_plane_create_hotspot_properties() 2025-12-18 14:03:36 +01:00
drm_plane_helper.c
drm_prime.c
drm_print.c
drm_privacy_screen.c
drm_privacy_screen_x86.c
drm_probe_helper.c
drm_property.c drm: Account property blob allocations to memcg 2026-03-04 07:19:59 -05:00
drm_rect.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c
drm_suballoc.c
drm_syncobj.c
drm_sysfs.c
drm_trace.h
drm_trace_points.c
drm_vblank.c
drm_vblank_work.c
drm_vma_manager.c
drm_writeback.c