Commit 984f0103 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-fixes-2020-02-07' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes

Fixes for v5.6:
- Revert allow_fb_modifiers in sun4i, as it causes a regression for DE2 and DE3.
- Fix null pointer deref in drm_dp_mst_process_up_req().
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/672810c3-4212-0a46-337b-2cb855573fd2@linux.intel.com
parents bb6d3fb3 7e0cf7e9
...@@ -3838,6 +3838,7 @@ drm_dp_mst_process_up_req(struct drm_dp_mst_topology_mgr *mgr, ...@@ -3838,6 +3838,7 @@ drm_dp_mst_process_up_req(struct drm_dp_mst_topology_mgr *mgr,
else if (msg->req_type == DP_RESOURCE_STATUS_NOTIFY) else if (msg->req_type == DP_RESOURCE_STATUS_NOTIFY)
guid = msg->u.resource_stat.guid; guid = msg->u.resource_stat.guid;
if (guid)
mstb = drm_dp_get_mst_branch_device_by_guid(mgr, guid); mstb = drm_dp_get_mst_branch_device_by_guid(mgr, guid);
} else { } else {
mstb = drm_dp_get_mst_branch_device(mgr, hdr->lct, hdr->rad); mstb = drm_dp_get_mst_branch_device(mgr, hdr->lct, hdr->rad);
......
...@@ -166,6 +166,7 @@ panfrost_lookup_bos(struct drm_device *dev, ...@@ -166,6 +166,7 @@ panfrost_lookup_bos(struct drm_device *dev,
break; break;
} }
atomic_inc(&bo->gpu_usecount);
job->mappings[i] = mapping; job->mappings[i] = mapping;
} }
......
...@@ -30,6 +30,12 @@ struct panfrost_gem_object { ...@@ -30,6 +30,12 @@ struct panfrost_gem_object {
struct mutex lock; struct mutex lock;
} mappings; } mappings;
/*
* Count the number of jobs referencing this BO so we don't let the
* shrinker reclaim this object prematurely.
*/
atomic_t gpu_usecount;
bool noexec :1; bool noexec :1;
bool is_heap :1; bool is_heap :1;
}; };
......
...@@ -41,6 +41,9 @@ static bool panfrost_gem_purge(struct drm_gem_object *obj) ...@@ -41,6 +41,9 @@ static bool panfrost_gem_purge(struct drm_gem_object *obj)
struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj); struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
struct panfrost_gem_object *bo = to_panfrost_bo(obj); struct panfrost_gem_object *bo = to_panfrost_bo(obj);
if (atomic_read(&bo->gpu_usecount))
return false;
if (!mutex_trylock(&shmem->pages_lock)) if (!mutex_trylock(&shmem->pages_lock))
return false; return false;
......
...@@ -269,8 +269,13 @@ static void panfrost_job_cleanup(struct kref *ref) ...@@ -269,8 +269,13 @@ static void panfrost_job_cleanup(struct kref *ref)
dma_fence_put(job->render_done_fence); dma_fence_put(job->render_done_fence);
if (job->mappings) { if (job->mappings) {
for (i = 0; i < job->bo_count; i++) for (i = 0; i < job->bo_count; i++) {
if (!job->mappings[i])
break;
atomic_dec(&job->mappings[i]->obj->gpu_usecount);
panfrost_gem_mapping_put(job->mappings[i]); panfrost_gem_mapping_put(job->mappings[i]);
}
kvfree(job->mappings); kvfree(job->mappings);
} }
......
...@@ -85,7 +85,6 @@ static int sun4i_drv_bind(struct device *dev) ...@@ -85,7 +85,6 @@ static int sun4i_drv_bind(struct device *dev)
} }
drm_mode_config_init(drm); drm_mode_config_init(drm);
drm->mode_config.allow_fb_modifiers = true;
ret = component_bind_all(drm->dev, drm); ret = component_bind_all(drm->dev, drm);
if (ret) { if (ret) {
......
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