Commit a4a43070 authored by John Harrison's avatar John Harrison
Browse files

drm/i915/guc: Don't use pr_err when not necessary



A bunch of code was copy/pasted using pr_err as the default way to
report errors. However, drm_err is significantly more useful in
identifying where the error came from. So update the code to use that
instead.

Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Reviewed-by: default avatarAshutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220715004028.2126239-1-John.C.Harrison@Intel.com
parent 774ce151
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ __uc_fw_auto_select(struct drm_i915_private *i915, struct intel_uc_fw *uc_fw)
			    fw_blobs[i].rev < fw_blobs[i - 1].rev)
				continue;

			pr_err("invalid FW blob order: %s r%u comes before %s r%u\n",
			drm_err(&i915->drm, "Invalid FW blob order: %s r%u comes before %s r%u\n",
				intel_platform_name(fw_blobs[i - 1].p),
				fw_blobs[i - 1].rev,
				intel_platform_name(fw_blobs[i].p),
+18 −19
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ static int intel_guc_scrub_ctbs(void *arg)
		ce = intel_context_create(engine);
		if (IS_ERR(ce)) {
			ret = PTR_ERR(ce);
			pr_err("Failed to create context, %d: %d\n", i, ret);
			drm_err(&gt->i915->drm, "Failed to create context, %d: %d\n", i, ret);
			goto err;
		}

@@ -83,7 +83,7 @@ static int intel_guc_scrub_ctbs(void *arg)

		if (IS_ERR(rq)) {
			ret = PTR_ERR(rq);
			pr_err("Failed to create request, %d: %d\n", i, ret);
			drm_err(&gt->i915->drm, "Failed to create request, %d: %d\n", i, ret);
			goto err;
		}

@@ -93,7 +93,7 @@ static int intel_guc_scrub_ctbs(void *arg)
	for (i = 0; i < 3; ++i) {
		ret = i915_request_wait(last[i], 0, HZ);
		if (ret < 0) {
			pr_err("Last request failed to complete: %d\n", ret);
			drm_err(&gt->i915->drm, "Last request failed to complete: %d\n", ret);
			goto err;
		}
		i915_request_put(last[i]);
@@ -110,7 +110,7 @@ static int intel_guc_scrub_ctbs(void *arg)
	/* GT will not idle if G2H are lost */
	ret = intel_gt_wait_for_idle(gt, HZ);
	if (ret < 0) {
		pr_err("GT failed to idle: %d\n", ret);
		drm_err(&gt->i915->drm, "GT failed to idle: %d\n", ret);
		goto err;
	}

@@ -150,7 +150,7 @@ static int intel_guc_steal_guc_ids(void *arg)

	ce = kcalloc(GUC_MAX_CONTEXT_ID, sizeof(*ce), GFP_KERNEL);
	if (!ce) {
		pr_err("Context array allocation failed\n");
		drm_err(&gt->i915->drm, "Context array allocation failed\n");
		return -ENOMEM;
	}

@@ -164,24 +164,24 @@ static int intel_guc_steal_guc_ids(void *arg)
	if (IS_ERR(ce[context_index])) {
		ret = PTR_ERR(ce[context_index]);
		ce[context_index] = NULL;
		pr_err("Failed to create context: %d\n", ret);
		drm_err(&gt->i915->drm, "Failed to create context: %d\n", ret);
		goto err_wakeref;
	}
	ret = igt_spinner_init(&spin, engine->gt);
	if (ret) {
		pr_err("Failed to create spinner: %d\n", ret);
		drm_err(&gt->i915->drm, "Failed to create spinner: %d\n", ret);
		goto err_contexts;
	}
	spin_rq = igt_spinner_create_request(&spin, ce[context_index],
					     MI_ARB_CHECK);
	if (IS_ERR(spin_rq)) {
		ret = PTR_ERR(spin_rq);
		pr_err("Failed to create spinner request: %d\n", ret);
		drm_err(&gt->i915->drm, "Failed to create spinner request: %d\n", ret);
		goto err_contexts;
	}
	ret = request_add_spin(spin_rq, &spin);
	if (ret) {
		pr_err("Failed to add Spinner request: %d\n", ret);
		drm_err(&gt->i915->drm, "Failed to add Spinner request: %d\n", ret);
		goto err_spin_rq;
	}

@@ -191,7 +191,7 @@ static int intel_guc_steal_guc_ids(void *arg)
		if (IS_ERR(ce[context_index])) {
			ret = PTR_ERR(ce[context_index--]);
			ce[context_index] = NULL;
			pr_err("Failed to create context: %d\n", ret);
			drm_err(&gt->i915->drm, "Failed to create context: %d\n", ret);
			goto err_spin_rq;
		}

@@ -200,7 +200,7 @@ static int intel_guc_steal_guc_ids(void *arg)
			ret = PTR_ERR(rq);
			rq = NULL;
			if (ret != -EAGAIN) {
				pr_err("Failed to create request, %d: %d\n",
				drm_err(&gt->i915->drm, "Failed to create request, %d: %d\n",
					context_index, ret);
				goto err_spin_rq;
			}
@@ -215,7 +215,7 @@ static int intel_guc_steal_guc_ids(void *arg)
	igt_spinner_end(&spin);
	ret = intel_selftest_wait_for_rq(spin_rq);
	if (ret) {
		pr_err("Spin request failed to complete: %d\n", ret);
		drm_err(&gt->i915->drm, "Spin request failed to complete: %d\n", ret);
		i915_request_put(last);
		goto err_spin_rq;
	}
@@ -227,7 +227,7 @@ static int intel_guc_steal_guc_ids(void *arg)
	ret = i915_request_wait(last, 0, HZ * 30);
	i915_request_put(last);
	if (ret < 0) {
		pr_err("Last request failed to complete: %d\n", ret);
		drm_err(&gt->i915->drm, "Last request failed to complete: %d\n", ret);
		goto err_spin_rq;
	}

@@ -235,7 +235,7 @@ static int intel_guc_steal_guc_ids(void *arg)
	rq = nop_user_request(ce[context_index], NULL);
	if (IS_ERR(rq)) {
		ret = PTR_ERR(rq);
		pr_err("Failed to steal guc_id, %d: %d\n", context_index, ret);
		drm_err(&gt->i915->drm, "Failed to steal guc_id, %d: %d\n", context_index, ret);
		goto err_spin_rq;
	}

@@ -243,21 +243,20 @@ static int intel_guc_steal_guc_ids(void *arg)
	ret = i915_request_wait(rq, 0, HZ);
	i915_request_put(rq);
	if (ret < 0) {
		pr_err("Request with stolen guc_id failed to complete: %d\n",
		       ret);
		drm_err(&gt->i915->drm, "Request with stolen guc_id failed to complete: %d\n", ret);
		goto err_spin_rq;
	}

	/* Wait for idle */
	ret = intel_gt_wait_for_idle(gt, HZ * 30);
	if (ret < 0) {
		pr_err("GT failed to idle: %d\n", ret);
		drm_err(&gt->i915->drm, "GT failed to idle: %d\n", ret);
		goto err_spin_rq;
	}

	/* Verify a guc_id was stolen */
	if (guc->number_guc_id_stolen == number_guc_id_stolen) {
		pr_err("No guc_id was stolen");
		drm_err(&gt->i915->drm, "No guc_id was stolen");
		ret = -EINVAL;
	} else {
		ret = 0;
+5 −5
Original line number Diff line number Diff line
@@ -115,30 +115,30 @@ static int __intel_guc_multi_lrc_basic(struct intel_gt *gt, unsigned int class)

	parent = multi_lrc_create_parent(gt, class, 0);
	if (IS_ERR(parent)) {
		pr_err("Failed creating contexts: %ld", PTR_ERR(parent));
		drm_err(&gt->i915->drm, "Failed creating contexts: %ld", PTR_ERR(parent));
		return PTR_ERR(parent);
	} else if (!parent) {
		pr_debug("Not enough engines in class: %d", class);
		drm_dbg(&gt->i915->drm, "Not enough engines in class: %d", class);
		return 0;
	}

	rq = multi_lrc_nop_request(parent);
	if (IS_ERR(rq)) {
		ret = PTR_ERR(rq);
		pr_err("Failed creating requests: %d", ret);
		drm_err(&gt->i915->drm, "Failed creating requests: %d", ret);
		goto out;
	}

	ret = intel_selftest_wait_for_rq(rq);
	if (ret)
		pr_err("Failed waiting on request: %d", ret);
		drm_err(&gt->i915->drm, "Failed waiting on request: %d", ret);

	i915_request_put(rq);

	if (ret >= 0) {
		ret = intel_gt_wait_for_idle(gt, HZ * 5);
		if (ret < 0)
			pr_err("GT failed to idle: %d\n", ret);
			drm_err(&gt->i915->drm, "GT failed to idle: %d\n", ret);
	}

out: