drm/vmwgfx: Fix the lifetime of the bo cursor memory
authorZack Rusin <zack.rusin@broadcom.com>
Fri, 26 Jan 2024 20:08:04 +0000 (15:08 -0500)
committerZack Rusin <zack.rusin@broadcom.com>
Tue, 30 Jan 2024 19:18:21 +0000 (14:18 -0500)
commit9a9e8a7159ca09af9b1a300a6c8e8b6ff7501c76
tree3f0e04657bfb934d1d4ff13bc8f828061d514fd8
parented96cf7ad590989b009d6da5cd26387d995dac13
drm/vmwgfx: Fix the lifetime of the bo cursor memory

The cleanup can be dispatched while the atomic update is still active,
which means that the memory acquired in the atomic update needs to
not be invalidated by the cleanup. The buffer objects in vmw_plane_state
instead of using the builtin map_and_cache were trying to handle
the lifetime of the mapped memory themselves, leading to crashes.

Use the map_and_cache instead of trying to manage the lifetime of the
buffer objects held by the vmw_plane_state.

Fixes kernel oops'es in IGT's kms_cursor_legacy forked-bo.

Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Fixes: bb6780aa5a1d ("drm/vmwgfx: Diff cursors when using cmds")
Cc: <stable@vger.kernel.org> # v6.2+
Reviewed-by: Martin Krastev <martin.krastev@broadcom.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240126200804.732454-6-zack.rusin@broadcom.com
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c