Commit 3c5ab240 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-misc-next-fixes-2026-02-05' of...

Merge tag 'drm-misc-next-fixes-2026-02-05' of https://gitlab.freedesktop.org/drm/misc/kernel

 into drm-next

Several fixes for amdxdna around PM handling, error reporting and
memory safety, a compilation fix for ilitek-ili9882t, a NULL pointer
dereference fix for imx8qxp-pixel-combiner and several PTE fixes for
nouveau

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

From: Maxime Ripard <mripard@redhat.com>
Link: https://patch.msgid.link/20260205-refreshing-natural-vole-4c73af@houat
parents 1099b651 69674c1c
Loading
Loading
Loading
Loading
+16 −32
Original line number Diff line number Diff line
@@ -47,17 +47,6 @@ static void aie2_job_put(struct amdxdna_sched_job *job)
	kref_put(&job->refcnt, aie2_job_release);
}

static void aie2_hwctx_status_shift_stop(struct amdxdna_hwctx *hwctx)
{
	 hwctx->old_status = hwctx->status;
	 hwctx->status = HWCTX_STAT_STOP;
}

static void aie2_hwctx_status_restore(struct amdxdna_hwctx *hwctx)
{
	hwctx->status = hwctx->old_status;
}

/* The bad_job is used in aie2_sched_job_timedout, otherwise, set it to NULL */
static void aie2_hwctx_stop(struct amdxdna_dev *xdna, struct amdxdna_hwctx *hwctx,
			    struct drm_sched_job *bad_job)
@@ -84,11 +73,6 @@ static int aie2_hwctx_restart(struct amdxdna_dev *xdna, struct amdxdna_hwctx *hw
		goto out;
	}

	if (hwctx->status != HWCTX_STAT_READY) {
		XDNA_DBG(xdna, "hwctx is not ready, status %d", hwctx->status);
		goto out;
	}

	ret = aie2_config_cu(hwctx, NULL);
	if (ret) {
		XDNA_ERR(xdna, "Config cu failed, ret %d", ret);
@@ -140,7 +124,6 @@ static int aie2_hwctx_suspend_cb(struct amdxdna_hwctx *hwctx, void *arg)

	aie2_hwctx_wait_for_idle(hwctx);
	aie2_hwctx_stop(xdna, hwctx, NULL);
	aie2_hwctx_status_shift_stop(hwctx);

	return 0;
}
@@ -162,7 +145,6 @@ static int aie2_hwctx_resume_cb(struct amdxdna_hwctx *hwctx, void *arg)
{
	struct amdxdna_dev *xdna = hwctx->client->xdna;

	aie2_hwctx_status_restore(hwctx);
	return aie2_hwctx_restart(xdna, hwctx);
}

@@ -292,7 +274,7 @@ aie2_sched_cmdlist_resp_handler(void *handle, void __iomem *data, size_t size)
		ret = -EINVAL;
		goto out;
	}
	amdxdna_cmd_set_state(cmd_abo, fail_cmd_status);
	amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_ERROR);

	if (amdxdna_cmd_get_op(cmd_abo) == ERT_CMD_CHAIN) {
		struct amdxdna_cmd_chain *cc = amdxdna_cmd_get_payload(cmd_abo, NULL);
@@ -315,12 +297,19 @@ aie2_sched_job_run(struct drm_sched_job *sched_job)
	struct dma_fence *fence;
	int ret;

	if (!hwctx->priv->mbox_chann)
		return NULL;

	if (!mmget_not_zero(job->mm))
		return ERR_PTR(-ESRCH);

	kref_get(&job->refcnt);
	fence = dma_fence_get(job->fence);

	ret = amdxdna_pm_resume_get(hwctx->client->xdna);
	if (ret)
		goto out;

	if (job->drv_cmd) {
		switch (job->drv_cmd->opcode) {
		case SYNC_DEBUG_BO:
@@ -347,6 +336,7 @@ aie2_sched_job_run(struct drm_sched_job *sched_job)

out:
	if (ret) {
		amdxdna_pm_suspend_put(hwctx->client->xdna);
		dma_fence_put(job->fence);
		aie2_job_put(job);
		mmput(job->mm);
@@ -663,7 +653,6 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
	}
	amdxdna_pm_suspend_put(xdna);

	hwctx->status = HWCTX_STAT_INIT;
	init_waitqueue_head(&priv->job_free_wq);

	XDNA_DBG(xdna, "hwctx %s init completed", hwctx->name);
@@ -705,7 +694,9 @@ void aie2_hwctx_fini(struct amdxdna_hwctx *hwctx)
	aie2_hwctx_wait_for_idle(hwctx);

	/* Request fw to destroy hwctx and cancel the rest pending requests */
	drm_sched_stop(&hwctx->priv->sched, NULL);
	aie2_release_resource(hwctx);
	drm_sched_start(&hwctx->priv->sched, 0);

	mutex_unlock(&xdna->dev_lock);
	drm_sched_entity_destroy(&hwctx->priv->entity);
@@ -749,7 +740,7 @@ static int aie2_hwctx_cu_config(struct amdxdna_hwctx *hwctx, void *buf, u32 size
	if (XDNA_MBZ_DBG(xdna, config->pad, sizeof(config->pad)))
		return -EINVAL;

	if (hwctx->status != HWCTX_STAT_INIT) {
	if (hwctx->cus) {
		XDNA_ERR(xdna, "Not support re-config CU");
		return -EINVAL;
	}
@@ -780,7 +771,6 @@ static int aie2_hwctx_cu_config(struct amdxdna_hwctx *hwctx, void *buf, u32 size
	}

	wmb(); /* To avoid locking in command submit when check status */
	hwctx->status = HWCTX_STAT_READY;

	return 0;

@@ -1003,15 +993,11 @@ int aie2_cmd_submit(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job,
		goto free_chain;
	}

	ret = amdxdna_pm_resume_get(xdna);
	if (ret)
		goto cleanup_job;

retry:
	ret = drm_gem_lock_reservations(job->bos, job->bo_cnt, &acquire_ctx);
	if (ret) {
		XDNA_WARN(xdna, "Failed to lock BOs, ret %d", ret);
		goto suspend_put;
		goto cleanup_job;
	}

	for (i = 0; i < job->bo_cnt; i++) {
@@ -1019,7 +1005,7 @@ int aie2_cmd_submit(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job,
		if (ret) {
			XDNA_WARN(xdna, "Failed to reserve fences %d", ret);
			drm_gem_unlock_reservations(job->bos, job->bo_cnt, &acquire_ctx);
			goto suspend_put;
			goto cleanup_job;
		}
	}

@@ -1034,12 +1020,12 @@ int aie2_cmd_submit(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job,
					msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
			} else if (time_after(jiffies, timeout)) {
				ret = -ETIME;
				goto suspend_put;
				goto cleanup_job;
			}

			ret = aie2_populate_range(abo);
			if (ret)
				goto suspend_put;
				goto cleanup_job;
			goto retry;
		}
	}
@@ -1065,8 +1051,6 @@ int aie2_cmd_submit(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job,

	return 0;

suspend_put:
	amdxdna_pm_suspend_put(xdna);
cleanup_job:
	drm_sched_job_cleanup(&job->base);
free_chain:
+3 −0
Original line number Diff line number Diff line
@@ -493,6 +493,9 @@ int aie2_config_cu(struct amdxdna_hwctx *hwctx,
	if (!chann)
		return -ENODEV;

	if (!hwctx->cus)
		return 0;

	if (hwctx->cus->num_cus > MAX_NUM_CUS) {
		XDNA_DBG(xdna, "Exceed maximum CU %d", MAX_NUM_CUS);
		return -EINVAL;
+3 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ int aie2_pm_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
		return ret;

	ret = ndev->priv->hw_ops.set_dpm(ndev, dpm_level);
	if (!ret)
		ndev->dpm_level = dpm_level;
	amdxdna_pm_suspend_put(ndev->xdna);

	return ret;
@@ -65,6 +67,7 @@ int aie2_pm_init(struct amdxdna_dev_hdl *ndev)
	ret = ndev->priv->hw_ops.set_dpm(ndev, ndev->max_dpm_level);
	if (ret)
		return ret;
	ndev->dpm_level = ndev->max_dpm_level;

	ret = aie2_pm_set_clk_gating(ndev, AIE2_CLK_GATING_ENABLE);
	if (ret)
+0 −2
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ int npu1_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
	}

	ndev->hclk_freq = freq;
	ndev->dpm_level = dpm_level;
	ndev->max_tops = 2 * ndev->total_col;
	ndev->curr_tops = ndev->max_tops * freq / 1028;

@@ -114,7 +113,6 @@ int npu4_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)

	ndev->npuclk_freq = ndev->priv->dpm_clk_tbl[dpm_level].npuclk;
	ndev->hclk_freq = ndev->priv->dpm_clk_tbl[dpm_level].hclk;
	ndev->dpm_level = dpm_level;
	ndev->max_tops = NPU4_DPM_TOPS(ndev, ndev->max_dpm_level);
	ndev->curr_tops = NPU4_DPM_TOPS(ndev, dpm_level);

+0 −5
Original line number Diff line number Diff line
@@ -99,11 +99,6 @@ struct amdxdna_hwctx {
	u32				start_col;
	u32				num_col;
	u32				num_unused_col;
#define HWCTX_STAT_INIT  0
#define HWCTX_STAT_READY 1
#define HWCTX_STAT_STOP  2
	u32				status;
	u32				old_status;

	struct amdxdna_qos_info		     qos;
	struct amdxdna_hwctx_param_config_cu *cus;
Loading