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.
 -----BEGIN PGP SIGNATURE-----
 
 iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCZo/FPgAKCRAnX84Zoj2+
 dkt/AX9LM8fZS7ArDwJC706l+lEJSOgP6GUE2/xKuYaIkylbX7RYFD9bQGXZchxj
 o8mA4EoBgLTfgDFREmk8Fy+tWijwBdsisCzgpyktxBc2viutPMhDyJa0m2aSGn0h
 fMJbrJaFKw==
 =P2TW
 -----END PGP SIGNATURE-----

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: Dave Airlie <airlied@redhat.com>

From: Maxime Ripard <mripard@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240711-benign-rich-mouflon-2eeafe@houat
This commit is contained in:
Dave Airlie 2024-07-12 10:42:16 +10:00
commit 38e73004c2
5 changed files with 23 additions and 13 deletions

View File

@ -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_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,
sizes->surface_height, format);
if (IS_ERR(buffer))

View File

@ -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);
/* only detach from host for the DSI-LINK2 interface */
if (!sharp)
if (sharp)
sharp_panel_del(sharp);
}

View File

@ -584,11 +584,11 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,
if (ret)
goto err;
ret = qxl_bo_vmap(cursor_bo, &cursor_map);
ret = qxl_bo_pin_and_vmap(cursor_bo, &cursor_map);
if (ret)
goto err_unref;
ret = qxl_bo_vmap(user_bo, &user_map);
ret = qxl_bo_pin_and_vmap(user_bo, &user_map);
if (ret)
goto err_unmap;
@ -614,12 +614,12 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,
user_map.vaddr, size);
}
qxl_bo_vunmap(user_bo);
qxl_bo_vunmap(cursor_bo);
qxl_bo_vunmap_and_unpin(user_bo);
qxl_bo_vunmap_and_unpin(cursor_bo);
return cursor_bo;
err_unmap:
qxl_bo_vunmap(cursor_bo);
qxl_bo_vunmap_and_unpin(cursor_bo);
err_unref:
qxl_bo_unpin(cursor_bo);
qxl_bo_unref(&cursor_bo);
@ -1205,7 +1205,7 @@ int qxl_create_monitors_object(struct qxl_device *qdev)
}
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)
return ret;
@ -1236,7 +1236,7 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
qdev->monitors_config = NULL;
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)
return ret;

View File

@ -182,7 +182,7 @@ out:
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;
@ -190,7 +190,15 @@ int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map)
if (r)
return r;
r = qxl_bo_pin_locked(bo);
if (r) {
qxl_bo_unreserve(bo);
return r;
}
r = qxl_bo_vmap_locked(bo, map);
if (r)
qxl_bo_unpin_locked(bo);
qxl_bo_unreserve(bo);
return r;
}
@ -241,7 +249,7 @@ void qxl_bo_vunmap_locked(struct qxl_bo *bo)
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;
@ -250,6 +258,7 @@ int qxl_bo_vunmap(struct qxl_bo *bo)
return r;
qxl_bo_vunmap_locked(bo);
qxl_bo_unpin_locked(bo);
qxl_bo_unreserve(bo);
return 0;
}

View File

@ -59,9 +59,9 @@ extern int qxl_bo_create(struct qxl_device *qdev,
u32 priority,
struct qxl_surface *surf,
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_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_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);