Skip to content

Commit

Permalink
Merge tag 'drm-misc-fixes-2024-12-19' of https://gitlab.freedesktop.o…
Browse files Browse the repository at this point in the history
…rg/drm/misc/kernel into drm-fixes

drm-misc-fixes for v6.13-rc4:
- udma-buf fixes related to sealing.
- dma-buf build warning fix when debugfs is not enabled.
- Assorted drm/panel fixes.
- Correct error return in drm_dp_tunnel_mgr_create.
- Fix even more divide by zero in drm_mode_vrefresh.
- Fix FBDEV dependencies in Kconfig.
- Documentation fix for drm_sched_fini.
- IVPU NULL pointer, memory leak and WARN fix.

Signed-off-by: Dave Airlie <[email protected]>
From: Maarten Lankhorst <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
airlied committed Dec 19, 2024
2 parents e9088ac + 1b684ca commit 87fd883
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 45 deletions.
4 changes: 2 additions & 2 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -7347,7 +7347,7 @@ F: drivers/gpu/drm/panel/panel-novatek-nt36672a.c
DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
M: Karol Herbst <[email protected]>
M: Lyude Paul <[email protected]>
M: Danilo Krummrich <dakr@redhat.com>
M: Danilo Krummrich <dakr@kernel.org>
L: [email protected]
L: [email protected]
S: Supported
Expand Down Expand Up @@ -8924,7 +8924,7 @@ F: include/linux/arm_ffa.h
FIRMWARE LOADER (request_firmware)
M: Luis Chamberlain <[email protected]>
M: Russ Weight <[email protected]>
M: Danilo Krummrich <dakr@redhat.com>
M: Danilo Krummrich <dakr@kernel.org>
L: [email protected]
S: Maintained
F: Documentation/firmware_class/
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/configs/pmac32_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ CONFIG_FB_ATY=y
CONFIG_FB_ATY_CT=y
CONFIG_FB_ATY_GX=y
CONFIG_FB_3DFX=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_VGA_CONSOLE is not set
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_LOGO=y
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/configs/ppc6xx_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ CONFIG_FB_TRIDENT=m
CONFIG_FB_SM501=m
CONFIG_FB_IBM_GXT4500=y
CONFIG_LCD_PLATFORM=m
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
CONFIG_LOGO=y
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/ivpu/ivpu_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static void ivpu_bo_print_info(struct ivpu_bo *bo, struct drm_printer *p)
mutex_lock(&bo->lock);

drm_printf(p, "%-9p %-3u 0x%-12llx %-10lu 0x%-8x %-4u",
bo, bo->ctx->id, bo->vpu_addr, bo->base.base.size,
bo, bo->ctx ? bo->ctx->id : 0, bo->vpu_addr, bo->base.base.size,
bo->flags, kref_read(&bo->base.base.refcount));

if (bo->base.pages)
Expand Down
10 changes: 7 additions & 3 deletions drivers/accel/ivpu/ivpu_mmu_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,18 +612,22 @@ int ivpu_mmu_reserved_context_init(struct ivpu_device *vdev)
if (!ivpu_mmu_ensure_pgd(vdev, &vdev->rctx.pgtable)) {
ivpu_err(vdev, "Failed to allocate root page table for reserved context\n");
ret = -ENOMEM;
goto unlock;
goto err_ctx_fini;
}

ret = ivpu_mmu_cd_set(vdev, vdev->rctx.id, &vdev->rctx.pgtable);
if (ret) {
ivpu_err(vdev, "Failed to set context descriptor for reserved context\n");
goto unlock;
goto err_ctx_fini;
}

unlock:
mutex_unlock(&vdev->rctx.lock);
return ret;

err_ctx_fini:
mutex_unlock(&vdev->rctx.lock);
ivpu_mmu_context_fini(vdev, &vdev->rctx);
return ret;
}

void ivpu_mmu_reserved_context_fini(struct ivpu_device *vdev)
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/ivpu/ivpu_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ void ivpu_pm_init(struct ivpu_device *vdev)

pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, delay);
pm_runtime_set_active(dev);

ivpu_dbg(vdev, PM, "Autosuspend delay = %d\n", delay);
}
Expand All @@ -392,7 +393,6 @@ void ivpu_pm_enable(struct ivpu_device *vdev)
{
struct device *dev = vdev->drm.dev;

pm_runtime_set_active(dev);
pm_runtime_allow(dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/auxdisplay/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ config IMG_ASCII_LCD

config HT16K33
tristate "Holtek Ht16K33 LED controller with keyscan"
depends on FB && I2C && INPUT
depends on FB && I2C && INPUT && BACKLIGHT_CLASS_DEVICE
select FB_SYSMEM_HELPERS
select INPUT_MATRIXKMAP
select FB_BACKLIGHT
Expand Down
2 changes: 1 addition & 1 deletion drivers/dma-buf/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
{
}

static void __dma_buf_debugfs_list_del(struct file *file)
static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf)
{
}
#endif
Expand Down
43 changes: 27 additions & 16 deletions drivers/dma-buf/udmabuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static const struct dma_buf_ops udmabuf_ops = {
};

#define SEALS_WANTED (F_SEAL_SHRINK)
#define SEALS_DENIED (F_SEAL_WRITE)
#define SEALS_DENIED (F_SEAL_WRITE|F_SEAL_FUTURE_WRITE)

static int check_memfd_seals(struct file *memfd)
{
Expand All @@ -317,24 +317,18 @@ static int check_memfd_seals(struct file *memfd)
return 0;
}

static int export_udmabuf(struct udmabuf *ubuf,
struct miscdevice *device,
u32 flags)
static struct dma_buf *export_udmabuf(struct udmabuf *ubuf,
struct miscdevice *device)
{
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
struct dma_buf *buf;

ubuf->device = device;
exp_info.ops = &udmabuf_ops;
exp_info.size = ubuf->pagecount << PAGE_SHIFT;
exp_info.priv = ubuf;
exp_info.flags = O_RDWR;

buf = dma_buf_export(&exp_info);
if (IS_ERR(buf))
return PTR_ERR(buf);

return dma_buf_fd(buf, flags);
return dma_buf_export(&exp_info);
}

static long udmabuf_pin_folios(struct udmabuf *ubuf, struct file *memfd,
Expand Down Expand Up @@ -391,6 +385,7 @@ static long udmabuf_create(struct miscdevice *device,
struct folio **folios = NULL;
pgoff_t pgcnt = 0, pglimit;
struct udmabuf *ubuf;
struct dma_buf *dmabuf;
long ret = -EINVAL;
u32 i, flags;

Expand Down Expand Up @@ -436,23 +431,39 @@ static long udmabuf_create(struct miscdevice *device,
goto err;
}

/*
* Take the inode lock to protect against concurrent
* memfd_add_seals(), which takes this lock in write mode.
*/
inode_lock_shared(file_inode(memfd));
ret = check_memfd_seals(memfd);
if (ret < 0) {
fput(memfd);
goto err;
}
if (ret)
goto out_unlock;

ret = udmabuf_pin_folios(ubuf, memfd, list[i].offset,
list[i].size, folios);
out_unlock:
inode_unlock_shared(file_inode(memfd));
fput(memfd);
if (ret)
goto err;
}

flags = head->flags & UDMABUF_FLAGS_CLOEXEC ? O_CLOEXEC : 0;
ret = export_udmabuf(ubuf, device, flags);
if (ret < 0)
dmabuf = export_udmabuf(ubuf, device);
if (IS_ERR(dmabuf)) {
ret = PTR_ERR(dmabuf);
goto err;
}
/*
* Ownership of ubuf is held by the dmabuf from here.
* If the following dma_buf_fd() fails, dma_buf_put() cleans up both the
* dmabuf and the ubuf (through udmabuf_ops.release).
*/

ret = dma_buf_fd(dmabuf, flags);
if (ret < 0)
dma_buf_put(dmabuf);

kvfree(folios);
return ret;
Expand Down
4 changes: 4 additions & 0 deletions drivers/gpu/drm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ config DRM_KUNIT_TEST
config DRM_KMS_HELPER
tristate
depends on DRM
select FB_CORE if DRM_FBDEV_EMULATION
help
CRTC helpers for KMS drivers.

Expand Down Expand Up @@ -358,20 +359,23 @@ config DRM_TTM_HELPER
tristate
depends on DRM
select DRM_TTM
select FB_CORE if DRM_FBDEV_EMULATION
select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
help
Helpers for ttm-based gem objects

config DRM_GEM_DMA_HELPER
tristate
depends on DRM
select FB_CORE if DRM_FBDEV_EMULATION
select FB_DMAMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
help
Choose this if you need the GEM DMA helper functions

config DRM_GEM_SHMEM_HELPER
tristate
depends on DRM && MMU
select FB_CORE if DRM_FBDEV_EMULATION
select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
help
Choose this if you need the GEM shmem helper functions
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/display/drm_dp_tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1896,8 +1896,8 @@ static void destroy_mgr(struct drm_dp_tunnel_mgr *mgr)
*
* Creates a DP tunnel manager for @dev.
*
* Returns a pointer to the tunnel manager if created successfully or NULL in
* case of an error.
* Returns a pointer to the tunnel manager if created successfully or error
* pointer in case of failure.
*/
struct drm_dp_tunnel_mgr *
drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
Expand All @@ -1907,7 +1907,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)

mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
if (!mgr)
return NULL;
return ERR_PTR(-ENOMEM);

mgr->dev = dev;
init_waitqueue_head(&mgr->bw_req_queue);
Expand All @@ -1916,7 +1916,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
if (!mgr->groups) {
kfree(mgr);

return NULL;
return ERR_PTR(-ENOMEM);
}

#ifdef CONFIG_DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG
Expand All @@ -1927,7 +1927,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
if (!init_group(mgr, &mgr->groups[i])) {
destroy_mgr(mgr);

return NULL;
return ERR_PTR(-ENOMEM);
}

mgr->group_count++;
Expand Down
11 changes: 7 additions & 4 deletions drivers/gpu/drm/drm_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1287,21 +1287,24 @@ EXPORT_SYMBOL(drm_mode_set_name);
*/
int drm_mode_vrefresh(const struct drm_display_mode *mode)
{
unsigned int num, den;
unsigned int num = 1, den = 1;

if (mode->htotal == 0 || mode->vtotal == 0)
return 0;

num = mode->clock;
den = mode->htotal * mode->vtotal;

if (mode->flags & DRM_MODE_FLAG_INTERLACE)
num *= 2;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
den *= 2;
if (mode->vscan > 1)
den *= mode->vscan;

if (check_mul_overflow(mode->clock, num, &num))
return 0;

if (check_mul_overflow(mode->htotal * mode->vtotal, den, &den))
return 0;

return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(num, 1000), den);
}
EXPORT_SYMBOL(drm_mode_vrefresh);
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/panel/panel-himax-hx83102.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ static int hx83102_get_modes(struct drm_panel *panel,
struct drm_display_mode *mode;

mode = drm_mode_duplicate(connector->dev, m);
if (!mode)
return -ENOMEM;

mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_set_name(mode);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/panel/panel-novatek-nt35950.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
return dev_err_probe(dev, -EPROBE_DEFER, "Cannot get secondary DSI host\n");

nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
if (!nt->dsi[1]) {
if (IS_ERR(nt->dsi[1])) {
dev_err(dev, "Cannot get secondary DSI node\n");
return -ENODEV;
return PTR_ERR(nt->dsi[1]);
}
num_dsis++;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/panel/panel-sitronix-st7701.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,7 @@ static int st7701_probe(struct device *dev, int connector_type)
return dev_err_probe(dev, ret, "Failed to get orientation\n");

drm_panel_init(&st7701->panel, dev, &st7701_funcs, connector_type);
st7701->panel.prepare_prev_first = true;

/**
* Once sleep out has been issued, ST7701 IC required to wait 120ms
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/panel/panel-synaptics-r63353.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static void r63353_panel_shutdown(struct mipi_dsi_device *dsi)
{
struct r63353_panel *rpanel = mipi_dsi_get_drvdata(dsi);

r63353_panel_unprepare(&rpanel->base);
drm_panel_unprepare(&rpanel->base);
}

static const struct r63353_desc sharp_ls068b3sx02_data = {
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/scheduler/sched_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,8 @@ EXPORT_SYMBOL(drm_sched_init);
* drm_sched_backend_ops.run_job(). Consequently, drm_sched_backend_ops.free_job()
* will not be called for all jobs still in drm_gpu_scheduler.pending_list.
* There is no solution for this currently. Thus, it is up to the driver to make
* sure that
* sure that:
*
* a) drm_sched_fini() is only called after for all submitted jobs
* drm_sched_backend_ops.free_job() has been called or that
* b) the jobs for which drm_sched_backend_ops.free_job() has not been called
Expand Down
1 change: 1 addition & 0 deletions drivers/macintosh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ config PMAC_MEDIABAY
config PMAC_BACKLIGHT
bool "Backlight control for LCD screens"
depends on PPC_PMAC && ADB_PMU && FB = y && (BROKEN || !PPC64)
depends on BACKLIGHT_CLASS_DEVICE=y
select FB_BACKLIGHT
help
Say Y here to enable Macintosh specific extensions of the generic
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/fbtft/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ menuconfig FB_TFT
tristate "Support for small TFT LCD display modules"
depends on FB && SPI
depends on FB_DEVICE
depends on BACKLIGHT_CLASS_DEVICE
depends on GPIOLIB || COMPILE_TEST
select FB_BACKLIGHT
select FB_SYSMEM_HELPERS_DEFERRED
Expand Down
Loading

0 comments on commit 87fd883

Please sign in to comment.