Short summary of fixes pull:

Fixes GEM SHMEM locking and generic fbdev hotplugging. Constifies
 dma_buf kobj type.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAmP0un0ACgkQaA3BHVML
 eiPvigf+PRovhu/9gMerqq7zfMdujnj+tRo8x0tWeMDhrVNXPuVuza4mS4T/Q/SE
 /SaEJSHLUVOtvdbHDL+K6c4Gz+0zaBLx4ZMua3tBV5a5NXYYsBk073uLmjmVnOKS
 ZuOon4Nr2K5OdNO3Er+M2K305OfymA4UL3F6Gh7YN6XofFhtVWTHvbloya/iwnca
 jiJiZXI0pUQMrL/qadlNHDTfqZC1RRZ1Cl1e5l9MUiBiqvasvhjqXbVsP+Imt+kx
 2dBDuPIxeXiNPfr2WC7dDnhhszqipn+EDDNH826P4NMQs+gvI8o4aZeb1u9/Q2Zg
 wFIVn38kgseWSBOqZ7fiHLkIyugV1g==
 =TjNK
 -----END PGP SIGNATURE-----

Merge tag 'drm-misc-next-fixes-2023-02-21' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

Short summary of fixes pull:

Fixes GEM SHMEM locking and generic fbdev hotplugging. Constifies
dma_buf kobj type.

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/Y/S6tu3gdQ0VizR+@linux-uq9g
This commit is contained in:
Dave Airlie 2023-02-23 09:32:10 +10:00
commit 13daf53619
12 changed files with 52 additions and 24 deletions

View File

@ -112,7 +112,7 @@ static void dma_buf_sysfs_release(struct kobject *kobj)
kfree(sysfs_entry);
}
static struct kobj_type dma_buf_ktype = {
static const struct kobj_type dma_buf_ktype = {
.sysfs_ops = &dma_buf_stats_sysfs_ops,
.release = dma_buf_sysfs_release,
.default_groups = dma_buf_stats_default_groups,

View File

@ -147,6 +147,7 @@ int armada_fbdev_init(struct drm_device *dev)
err_fb_setup:
drm_fb_helper_fini(fbh);
err_fb_helper:
drm_fb_helper_unprepare(fbh);
priv->fbdev = NULL;
return ret;
}
@ -164,6 +165,8 @@ void armada_fbdev_fini(struct drm_device *dev)
if (fbh->fb)
fbh->fb->funcs->destroy(fbh->fb);
drm_fb_helper_unprepare(fbh);
priv->fbdev = NULL;
}
}

View File

@ -590,8 +590,6 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
}
mutex_unlock(&kernel_fb_helper_lock);
drm_fb_helper_unprepare(fb_helper);
if (!fb_helper->client.funcs)
drm_client_release(&fb_helper->client);
}

View File

@ -65,6 +65,8 @@ static void drm_fbdev_fb_destroy(struct fb_info *info)
drm_client_framebuffer_delete(fb_helper->buffer);
drm_client_release(&fb_helper->client);
drm_fb_helper_unprepare(fb_helper);
kfree(fb_helper);
}

View File

@ -678,23 +678,7 @@ struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_shmem_object *shmem)
}
EXPORT_SYMBOL_GPL(drm_gem_shmem_get_sg_table);
/**
* drm_gem_shmem_get_pages_sgt - Pin pages, dma map them, and return a
* scatter/gather table for a shmem GEM object.
* @shmem: shmem GEM object
*
* This function returns a scatter/gather table suitable for driver usage. If
* the sg table doesn't exist, the pages are pinned, dma-mapped, and a sg
* table created.
*
* This is the main function for drivers to get at backing storage, and it hides
* and difference between dma-buf imported and natively allocated objects.
* drm_gem_shmem_get_sg_table() should not be directly called by drivers.
*
* Returns:
* A pointer to the scatter/gather table of pinned pages or errno on failure.
*/
struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_shmem_object *shmem)
static struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_object *shmem)
{
struct drm_gem_object *obj = &shmem->base;
int ret;
@ -705,7 +689,7 @@ struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_shmem_object *shmem)
WARN_ON(obj->import_attach);
ret = drm_gem_shmem_get_pages(shmem);
ret = drm_gem_shmem_get_pages_locked(shmem);
if (ret)
return ERR_PTR(ret);
@ -727,10 +711,40 @@ err_free_sgt:
sg_free_table(sgt);
kfree(sgt);
err_put_pages:
drm_gem_shmem_put_pages(shmem);
drm_gem_shmem_put_pages_locked(shmem);
return ERR_PTR(ret);
}
EXPORT_SYMBOL_GPL(drm_gem_shmem_get_pages_sgt);
/**
* drm_gem_shmem_get_pages_sgt - Pin pages, dma map them, and return a
* scatter/gather table for a shmem GEM object.
* @shmem: shmem GEM object
*
* This function returns a scatter/gather table suitable for driver usage. If
* the sg table doesn't exist, the pages are pinned, dma-mapped, and a sg
* table created.
*
* This is the main function for drivers to get at backing storage, and it hides
* and difference between dma-buf imported and natively allocated objects.
* drm_gem_shmem_get_sg_table() should not be directly called by drivers.
*
* Returns:
* A pointer to the scatter/gather table of pinned pages or errno on failure.
*/
struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_shmem_object *shmem)
{
int ret;
struct sg_table *sgt;
ret = mutex_lock_interruptible(&shmem->pages_lock);
if (ret)
return ERR_PTR(ret);
sgt = drm_gem_shmem_get_pages_sgt_locked(shmem);
mutex_unlock(&shmem->pages_lock);
return sgt;
}
EXPORT_SYMBOL(drm_gem_shmem_get_pages_sgt);
/**
* drm_gem_shmem_prime_import_sg_table - Produce a shmem GEM object from

View File

@ -183,8 +183,8 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
err_setup:
drm_fb_helper_fini(helper);
err_init:
drm_fb_helper_unprepare(helper);
private->fb_helper = NULL;
kfree(fbdev);
@ -219,6 +219,7 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
fbdev = to_exynos_fbdev(private->fb_helper);
exynos_drm_fbdev_destroy(dev, private->fb_helper);
drm_fb_helper_unprepare(private->fb_helper);
kfree(fbdev);
private->fb_helper = NULL;
}

View File

@ -427,6 +427,7 @@ int psb_fbdev_init(struct drm_device *dev)
fini:
drm_fb_helper_fini(fb_helper);
free:
drm_fb_helper_unprepare(fb_helper);
kfree(fb_helper);
return ret;
}
@ -439,6 +440,7 @@ static void psb_fbdev_fini(struct drm_device *dev)
return;
psb_fbdev_destroy(dev, dev_priv->fb_helper);
drm_fb_helper_unprepare(dev_priv->fb_helper);
kfree(dev_priv->fb_helper);
dev_priv->fb_helper = NULL;
}

View File

@ -340,6 +340,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
if (ifbdev->fb)
drm_framebuffer_remove(&ifbdev->fb->base);
drm_fb_helper_unprepare(&ifbdev->helper);
kfree(ifbdev);
}

View File

@ -170,6 +170,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
fini:
drm_fb_helper_fini(helper);
fail:
drm_fb_helper_unprepare(helper);
kfree(fbdev);
return NULL;
}
@ -196,6 +197,7 @@ void msm_fbdev_free(struct drm_device *dev)
drm_framebuffer_remove(fbdev->fb);
}
drm_fb_helper_unprepare(helper);
kfree(fbdev);
priv->fbdev = NULL;

View File

@ -256,6 +256,7 @@ void omap_fbdev_init(struct drm_device *dev)
fini:
drm_fb_helper_fini(helper);
fail:
drm_fb_helper_unprepare(helper);
kfree(fbdev);
dev_warn(dev->dev, "omap_fbdev_init failed\n");
@ -286,6 +287,7 @@ void omap_fbdev_fini(struct drm_device *dev)
if (fbdev->fb)
drm_framebuffer_remove(fbdev->fb);
drm_fb_helper_unprepare(helper);
kfree(fbdev);
priv->fbdev = NULL;

View File

@ -367,6 +367,7 @@ int radeon_fbdev_init(struct radeon_device *rdev)
fini:
drm_fb_helper_fini(&rfbdev->helper);
free:
drm_fb_helper_unprepare(&rfbdev->helper);
kfree(rfbdev);
return ret;
}
@ -377,6 +378,7 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
return;
radeon_fbdev_destroy(rdev->ddev, rdev->mode_info.rfbdev);
drm_fb_helper_unprepare(&rdev->mode_info.rfbdev->helper);
kfree(rdev->mode_info.rfbdev);
rdev->mode_info.rfbdev = NULL;
}

View File

@ -315,6 +315,7 @@ static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm)
static void tegra_fbdev_free(struct tegra_fbdev *fbdev)
{
drm_fb_helper_unprepare(&fbdev->base);
kfree(fbdev);
}