Commit 3a344ddc authored by Matt Roper's avatar Matt Roper
Browse files

drm/xe/tests: Use scope-based runtime PM



Use scope-based handling of runtime PM in the kunit tests for
consistency with other parts of the driver.

Reviewed-by: default avatarGustavo Sousa <gustavo.sousa@intel.com>
Link: https://patch.msgid.link/20251118164338.3572146-54-matthew.d.roper@intel.com


Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
parent fcee6854
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -185,8 +185,7 @@ static int ccs_test_run_device(struct xe_device *xe)
		return 0;
	}

	xe_pm_runtime_get(xe);

	guard(xe_pm_runtime)(xe);
	for_each_tile(tile, xe, id) {
		/* For igfx run only for primary tile */
		if (!IS_DGFX(xe) && id > 0)
@@ -194,8 +193,6 @@ static int ccs_test_run_device(struct xe_device *xe)
		ccs_test_run_tile(xe, tile, test);
	}

	xe_pm_runtime_put(xe);

	return 0;
}

@@ -356,13 +353,10 @@ static int evict_test_run_device(struct xe_device *xe)
		return 0;
	}

	xe_pm_runtime_get(xe);

	guard(xe_pm_runtime)(xe);
	for_each_tile(tile, xe, id)
		evict_test_run_tile(xe, tile, test);

	xe_pm_runtime_put(xe);

	return 0;
}

+1 −2
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ static int dma_buf_run_device(struct xe_device *xe)
	const struct dma_buf_test_params *params;
	struct kunit *test = kunit_get_current_test();

	xe_pm_runtime_get(xe);
	guard(xe_pm_runtime)(xe);
	for (params = test_params; params->mem_mask; ++params) {
		struct dma_buf_test_params p = *params;

@@ -274,7 +274,6 @@ static int dma_buf_run_device(struct xe_device *xe)
		test->priv = &p;
		xe_test_dmabuf_import_same_driver(xe);
	}
	xe_pm_runtime_put(xe);

	/* A non-zero return would halt iteration over driver devices */
	return 0;
+2 −8
Original line number Diff line number Diff line
@@ -344,8 +344,7 @@ static int migrate_test_run_device(struct xe_device *xe)
	struct xe_tile *tile;
	int id;

	xe_pm_runtime_get(xe);

	guard(xe_pm_runtime)(xe);
	for_each_tile(tile, xe, id) {
		struct xe_migrate *m = tile->migrate;
		struct drm_exec *exec = XE_VALIDATION_OPT_OUT;
@@ -356,8 +355,6 @@ static int migrate_test_run_device(struct xe_device *xe)
		xe_vm_unlock(m->q->vm);
	}

	xe_pm_runtime_put(xe);

	return 0;
}

@@ -759,13 +756,10 @@ static int validate_ccs_test_run_device(struct xe_device *xe)
		return 0;
	}

	xe_pm_runtime_get(xe);

	guard(xe_pm_runtime)(xe);
	for_each_tile(tile, xe, id)
		validate_ccs_test_run_tile(xe, tile, test);

	xe_pm_runtime_put(xe);

	return 0;
}

+2 −8
Original line number Diff line number Diff line
@@ -115,8 +115,7 @@ static int mocs_kernel_test_run_device(struct xe_device *xe)
	unsigned int flags;
	int id;

	xe_pm_runtime_get(xe);

	guard(xe_pm_runtime)(xe);
	for_each_gt(gt, xe, id) {
		flags = live_mocs_init(&mocs, gt);
		if (flags & HAS_GLOBAL_MOCS)
@@ -125,8 +124,6 @@ static int mocs_kernel_test_run_device(struct xe_device *xe)
			read_l3cc_table(gt, &mocs.table);
	}

	xe_pm_runtime_put(xe);

	return 0;
}

@@ -150,8 +147,7 @@ static int mocs_reset_test_run_device(struct xe_device *xe)
	int id;
	struct kunit *test = kunit_get_current_test();

	xe_pm_runtime_get(xe);

	guard(xe_pm_runtime)(xe);
	for_each_gt(gt, xe, id) {
		flags = live_mocs_init(&mocs, gt);
		kunit_info(test, "mocs_reset_test before reset\n");
@@ -169,8 +165,6 @@ static int mocs_reset_test_run_device(struct xe_device *xe)
			read_l3cc_table(gt, &mocs.table);
	}

	xe_pm_runtime_put(xe);

	return 0;
}