Commit fc70e13d authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-msm-fixes-2023-01-16' of https://gitlab.freedesktop.org/drm/msm into drm-fixes

msm-fixes for v6.3-rc5

Two GPU fixes which were meant to be part of the previous pull request,
but I'd forgotten to fetch from gitlab after the MR was merged so that
git tag was applied to the wrong commit.

- kexec shutdown fix
- fix potential double free
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Rob Clark <robdclark@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGskguoVsz2wqAK2k+f32LwcVY5JC6+e2RwLqZswz3RY2Q@mail.gmail.com
parents 5dc4c995 a66f1efc
...@@ -551,13 +551,14 @@ static int adreno_bind(struct device *dev, struct device *master, void *data) ...@@ -551,13 +551,14 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
return 0; return 0;
} }
static int adreno_system_suspend(struct device *dev);
static void adreno_unbind(struct device *dev, struct device *master, static void adreno_unbind(struct device *dev, struct device *master,
void *data) void *data)
{ {
struct msm_drm_private *priv = dev_get_drvdata(master); struct msm_drm_private *priv = dev_get_drvdata(master);
struct msm_gpu *gpu = dev_to_gpu(dev); struct msm_gpu *gpu = dev_to_gpu(dev);
pm_runtime_force_suspend(dev); WARN_ON_ONCE(adreno_system_suspend(dev));
gpu->funcs->destroy(gpu); gpu->funcs->destroy(gpu);
priv->gpu_pdev = NULL; priv->gpu_pdev = NULL;
...@@ -609,7 +610,7 @@ static int adreno_remove(struct platform_device *pdev) ...@@ -609,7 +610,7 @@ static int adreno_remove(struct platform_device *pdev)
static void adreno_shutdown(struct platform_device *pdev) static void adreno_shutdown(struct platform_device *pdev)
{ {
pm_runtime_force_suspend(&pdev->dev); WARN_ON_ONCE(adreno_system_suspend(&pdev->dev));
} }
static const struct of_device_id dt_match[] = { static const struct of_device_id dt_match[] = {
......
...@@ -352,6 +352,8 @@ int adreno_set_param(struct msm_gpu *gpu, struct msm_file_private *ctx, ...@@ -352,6 +352,8 @@ int adreno_set_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
/* Ensure string is null terminated: */ /* Ensure string is null terminated: */
str[len] = '\0'; str[len] = '\0';
mutex_lock(&gpu->lock);
if (param == MSM_PARAM_COMM) { if (param == MSM_PARAM_COMM) {
paramp = &ctx->comm; paramp = &ctx->comm;
} else { } else {
...@@ -361,6 +363,8 @@ int adreno_set_param(struct msm_gpu *gpu, struct msm_file_private *ctx, ...@@ -361,6 +363,8 @@ int adreno_set_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
kfree(*paramp); kfree(*paramp);
*paramp = str; *paramp = str;
mutex_unlock(&gpu->lock);
return 0; return 0;
} }
case MSM_PARAM_SYSPROF: case MSM_PARAM_SYSPROF:
......
...@@ -335,6 +335,8 @@ static void get_comm_cmdline(struct msm_gem_submit *submit, char **comm, char ** ...@@ -335,6 +335,8 @@ static void get_comm_cmdline(struct msm_gem_submit *submit, char **comm, char **
struct msm_file_private *ctx = submit->queue->ctx; struct msm_file_private *ctx = submit->queue->ctx;
struct task_struct *task; struct task_struct *task;
WARN_ON(!mutex_is_locked(&submit->gpu->lock));
/* Note that kstrdup will return NULL if argument is NULL: */ /* Note that kstrdup will return NULL if argument is NULL: */
*comm = kstrdup(ctx->comm, GFP_KERNEL); *comm = kstrdup(ctx->comm, GFP_KERNEL);
*cmd = kstrdup(ctx->cmdline, GFP_KERNEL); *cmd = kstrdup(ctx->cmdline, GFP_KERNEL);
......
...@@ -376,10 +376,18 @@ struct msm_file_private { ...@@ -376,10 +376,18 @@ struct msm_file_private {
*/ */
int sysprof; int sysprof;
/** comm: Overridden task comm, see MSM_PARAM_COMM */ /**
* comm: Overridden task comm, see MSM_PARAM_COMM
*
* Accessed under msm_gpu::lock
*/
char *comm; char *comm;
/** cmdline: Overridden task cmdline, see MSM_PARAM_CMDLINE */ /**
* cmdline: Overridden task cmdline, see MSM_PARAM_CMDLINE
*
* Accessed under msm_gpu::lock
*/
char *cmdline; char *cmdline;
/** /**
......
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