Commit 38e73004 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-next-fixes-2024-07-11' of...

Merge tag 'drm-misc-next-fixes-2024-07-11' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next

A fix for fbdev on big endian systems, a condition fix for a sharp panel
at removal, and a fix for qxl to prevent unpinned buffer access under
certain conditions.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Maxime Ripard <mripard@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240711-benign-rich-mouflon-2eeafe@houat
parents 62a05f4a c537fb4e
...@@ -101,7 +101,8 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper, ...@@ -101,7 +101,8 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
sizes->surface_width, sizes->surface_height, sizes->surface_width, sizes->surface_height,
sizes->surface_bpp); sizes->surface_bpp);
format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth); format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp,
sizes->surface_depth);
buffer = drm_client_framebuffer_create(client, sizes->surface_width, buffer = drm_client_framebuffer_create(client, sizes->surface_width,
sizes->surface_height, format); sizes->surface_height, format);
if (IS_ERR(buffer)) if (IS_ERR(buffer))
......
...@@ -362,7 +362,7 @@ static void sharp_panel_remove(struct mipi_dsi_device *dsi) ...@@ -362,7 +362,7 @@ static void sharp_panel_remove(struct mipi_dsi_device *dsi)
dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
/* only detach from host for the DSI-LINK2 interface */ /* only detach from host for the DSI-LINK2 interface */
if (!sharp) if (sharp)
sharp_panel_del(sharp); sharp_panel_del(sharp);
} }
......
...@@ -584,11 +584,11 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev, ...@@ -584,11 +584,11 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,
if (ret) if (ret)
goto err; goto err;
ret = qxl_bo_vmap(cursor_bo, &cursor_map); ret = qxl_bo_pin_and_vmap(cursor_bo, &cursor_map);
if (ret) if (ret)
goto err_unref; goto err_unref;
ret = qxl_bo_vmap(user_bo, &user_map); ret = qxl_bo_pin_and_vmap(user_bo, &user_map);
if (ret) if (ret)
goto err_unmap; goto err_unmap;
...@@ -614,12 +614,12 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev, ...@@ -614,12 +614,12 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,
user_map.vaddr, size); user_map.vaddr, size);
} }
qxl_bo_vunmap(user_bo); qxl_bo_vunmap_and_unpin(user_bo);
qxl_bo_vunmap(cursor_bo); qxl_bo_vunmap_and_unpin(cursor_bo);
return cursor_bo; return cursor_bo;
err_unmap: err_unmap:
qxl_bo_vunmap(cursor_bo); qxl_bo_vunmap_and_unpin(cursor_bo);
err_unref: err_unref:
qxl_bo_unpin(cursor_bo); qxl_bo_unpin(cursor_bo);
qxl_bo_unref(&cursor_bo); qxl_bo_unref(&cursor_bo);
...@@ -1205,7 +1205,7 @@ int qxl_create_monitors_object(struct qxl_device *qdev) ...@@ -1205,7 +1205,7 @@ int qxl_create_monitors_object(struct qxl_device *qdev)
} }
qdev->monitors_config_bo = gem_to_qxl_bo(gobj); qdev->monitors_config_bo = gem_to_qxl_bo(gobj);
ret = qxl_bo_vmap(qdev->monitors_config_bo, &map); ret = qxl_bo_pin_and_vmap(qdev->monitors_config_bo, &map);
if (ret) if (ret)
return ret; return ret;
...@@ -1236,7 +1236,7 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) ...@@ -1236,7 +1236,7 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
qdev->monitors_config = NULL; qdev->monitors_config = NULL;
qdev->ram_header->monitors_config = 0; qdev->ram_header->monitors_config = 0;
ret = qxl_bo_vunmap(qdev->monitors_config_bo); ret = qxl_bo_vunmap_and_unpin(qdev->monitors_config_bo);
if (ret) if (ret)
return ret; return ret;
......
...@@ -182,7 +182,7 @@ int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map) ...@@ -182,7 +182,7 @@ int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map)
return 0; return 0;
} }
int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map) int qxl_bo_pin_and_vmap(struct qxl_bo *bo, struct iosys_map *map)
{ {
int r; int r;
...@@ -190,7 +190,15 @@ int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map) ...@@ -190,7 +190,15 @@ int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map)
if (r) if (r)
return r; return r;
r = qxl_bo_pin_locked(bo);
if (r) {
qxl_bo_unreserve(bo);
return r;
}
r = qxl_bo_vmap_locked(bo, map); r = qxl_bo_vmap_locked(bo, map);
if (r)
qxl_bo_unpin_locked(bo);
qxl_bo_unreserve(bo); qxl_bo_unreserve(bo);
return r; return r;
} }
...@@ -241,7 +249,7 @@ void qxl_bo_vunmap_locked(struct qxl_bo *bo) ...@@ -241,7 +249,7 @@ void qxl_bo_vunmap_locked(struct qxl_bo *bo)
ttm_bo_vunmap(&bo->tbo, &bo->map); ttm_bo_vunmap(&bo->tbo, &bo->map);
} }
int qxl_bo_vunmap(struct qxl_bo *bo) int qxl_bo_vunmap_and_unpin(struct qxl_bo *bo)
{ {
int r; int r;
...@@ -250,6 +258,7 @@ int qxl_bo_vunmap(struct qxl_bo *bo) ...@@ -250,6 +258,7 @@ int qxl_bo_vunmap(struct qxl_bo *bo)
return r; return r;
qxl_bo_vunmap_locked(bo); qxl_bo_vunmap_locked(bo);
qxl_bo_unpin_locked(bo);
qxl_bo_unreserve(bo); qxl_bo_unreserve(bo);
return 0; return 0;
} }
......
...@@ -59,9 +59,9 @@ extern int qxl_bo_create(struct qxl_device *qdev, ...@@ -59,9 +59,9 @@ extern int qxl_bo_create(struct qxl_device *qdev,
u32 priority, u32 priority,
struct qxl_surface *surf, struct qxl_surface *surf,
struct qxl_bo **bo_ptr); struct qxl_bo **bo_ptr);
int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map); int qxl_bo_pin_and_vmap(struct qxl_bo *bo, struct iosys_map *map);
int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map); int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map);
int qxl_bo_vunmap(struct qxl_bo *bo); int qxl_bo_vunmap_and_unpin(struct qxl_bo *bo);
void qxl_bo_vunmap_locked(struct qxl_bo *bo); void qxl_bo_vunmap_locked(struct qxl_bo *bo);
void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, int page_offset); void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, int page_offset);
void qxl_bo_kunmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, void *map); void qxl_bo_kunmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, void *map);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment