File: xe_wa_test.c

package info (click to toggle)
linux 6.19.6-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,760,712 kB
  • sloc: ansic: 27,010,185; asm: 273,400; sh: 151,347; python: 81,280; makefile: 58,564; perl: 34,311; xml: 21,064; cpp: 5,986; yacc: 4,841; lex: 2,901; awk: 1,707; sed: 30; ruby: 25
file content (73 lines) | stat: -rw-r--r-- 1,502 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright © 2023 Intel Corporation
 */

#include <drm/drm_drv.h>
#include <drm/drm_kunit_helpers.h>

#include <kunit/test.h>

#include "xe_device.h"
#include "xe_kunit_helpers.h"
#include "xe_pci_test.h"
#include "xe_reg_sr.h"
#include "xe_tuning.h"
#include "xe_wa.h"

static int xe_wa_test_init(struct kunit *test)
{
	const struct xe_pci_fake_data *param = test->param_value;
	struct xe_pci_fake_data data = *param;
	struct xe_device *xe;
	struct device *dev;
	int ret;

	dev = drm_kunit_helper_alloc_device(test);
	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);

	xe = xe_kunit_helper_alloc_xe_device(test, dev);
	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xe);

	test->priv = &data;
	ret = xe_pci_fake_device_init(xe);
	KUNIT_ASSERT_EQ(test, ret, 0);

	if (!param->graphics_verx100)
		xe->info.step = param->step;

	/* TODO: init hw engines for engine/LRC WAs */
	xe->drm.dev = dev;
	test->priv = xe;

	return 0;
}

static void xe_wa_gt(struct kunit *test)
{
	struct xe_device *xe = test->priv;
	struct xe_gt *gt;
	int id;

	for_each_gt(gt, xe, id) {
		xe_reg_sr_init(&gt->reg_sr, "GT", xe);

		xe_wa_process_gt(gt);
		xe_tuning_process_gt(gt);

		KUNIT_ASSERT_EQ(test, gt->reg_sr.errors, 0);
	}
}

static struct kunit_case xe_wa_tests[] = {
	KUNIT_CASE_PARAM(xe_wa_gt, xe_pci_fake_data_gen_params),
	{}
};

static struct kunit_suite xe_rtp_test_suite = {
	.name = "xe_wa",
	.init = xe_wa_test_init,
	.test_cases = xe_wa_tests,
};

kunit_test_suite(xe_rtp_test_suite);