Skip to contentSkip to conversation

drm/xe: Add mocs kunit

PATCH New Ruthuvikas Ravikumar 2 participants 4 messages Oct 10, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/xe: Add mocs kunit

This kunit verifies the hardware values of the mocs and l3cc registers with the KMD programmed values.

Cc Aravind Iddamsetty <[email protected]>
Cc Mathew D Roper <[email protected]>
---
 drivers/gpu/drm/xe/tests/Makefile       |   1 +
 drivers/gpu/drm/xe/tests/xe_mocs.c      | 143 ++++++++++++++++++++++++
 drivers/gpu/drm/xe/tests/xe_mocs_test.c |  24 ++++
 drivers/gpu/drm/xe/tests/xe_mocs_test.h |  13 +++
 drivers/gpu/drm/xe/xe_mocs.c            |   4 +
 5 files changed, 185 insertions(+)
 create mode 100644 drivers/gpu/drm/xe/tests/xe_mocs.c
 create mode 100644 drivers/gpu/drm/xe/tests/xe_mocs_test.c
 create mode 100644 drivers/gpu/drm/xe/tests/xe_mocs_test.h
drivers/gpu/drm/xe/tests/Makefile +1 -0
index 51f1a7f017d4..39d8a0892274 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_XE_KUNIT_TEST) += \
 	xe_bo_test.o \
 	xe_dma_buf_test.o \
 	xe_migrate_test.o \
+	xe_mocs_test.o \
 	xe_pci_test.o \
 	xe_rtp_test.o \
 	xe_wa_test.o
drivers/gpu/drm/xe/tests/xe_mocs.c new file +143 -0

143 lines not on this page · raw message

drivers/gpu/drm/xe/tests/xe_mocs_test.c new file +24 -0
new file mode 100644
index 000000000000..ef56bd517b28
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#include "xe_mocs_test.h"
+
+#include <kunit/test.h>
+
+static struct kunit_case xe_mocs_tests[] = {
+	KUNIT_CASE(xe_live_mocs_kernel_kunit),
+	{}
+};
+
+static struct kunit_suite xe_mocs_test_suite = {
+	.name = "xe_mocs",
+	.test_cases = xe_mocs_tests,
+};
+
+kunit_test_suite(xe_mocs_test_suite);
+
+MODULE_AUTHOR("Intel Corporation");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING);
drivers/gpu/drm/xe/tests/xe_mocs_test.h new file +13 -0
new file mode 100644
index 000000000000..7faa3575e6c3
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 AND MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_MOCS_TEST_H_
+#define _XE_MOCS_TEST_H_
+
+struct kunit;
+
+void xe_live_mocs_kernel_kunit(struct kunit *test);
+
+#endif
drivers/gpu/drm/xe/xe_mocs.c +3 -0
index 19a8146ded9a..0594ee7c0c15 100644
@@ -579,3 +579,6 @@ void xe_mocs_init(struct xe_gt *gt)
 	if (table.table)
 		init_l3cc_table(gt, &table);
 }
+
+#if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)
+#include "tests/xe_mocs.c"

+#endif

Signature · 1 line
2.25.1
#1 lore raw

[Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Add mocs kunit

== Series Details ==

== Series Details ==

Series: drm/xe: Add mocs kunit
URL : https://patchwork.freedesktop.org/series/124926/
State : success

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: ===
Base commit: 37b2d042c drm/xe: refactor xe_mmio_probe_tiles to support MMIO extension === git am output follows ===
Applying: drm/xe: Add mocs kunit

#2 lore raw

[Intel-xe] ✗ CI.checkpatch: warning for drm/xe: Add mocs kunit

In reply to Ruthuvikas Ravikumar
== Series Details ==

== Series Details ==

Series: drm/xe: Add mocs kunit
URL : https://patchwork.freedesktop.org/series/124926/
State : warning

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 63c2b6b160bca2df6efc7bc4cea6f442097d7854
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit fddb7550e661b05bcd18752999f737576b54bd4e

Author: Ruthuvikas Ravikumar <[email protected]>
Date:   Wed Oct 11 02:44:15 2023 +0530

drm/xe: Add mocs kunit

This kunit verifies the hardware values of the mocs and l3cc
registers with the KMD programmed values.

Cc Aravind Iddamsetty <[email protected]>
Cc Mathew D Roper <[email protected]>

+ /mt/dim checkpatch 37b2d042c23ae6a10055ea92101a15083d64c718 drm-intel
fddb7550e drm/xe: Add mocs kunit
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:26: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #26:
new file mode 100644

-:105: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #105: FILE: drivers/gpu/drm/xe/tests/xe_mocs.c:75:
+ KUNIT_FAIL(test, "l3cc reg 0x%x has incorrect val:\n",
+ LNCFCMOCS(i).addr);

-:112: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #112: FILE: drivers/gpu/drm/xe/tests/xe_mocs.c:82:
+}
+static void read_mocs_table(struct xe_gt *gt, const struct xe_mocs_info *info,

-:145: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #145: FILE: drivers/gpu/drm/xe/tests/xe_mocs.c:115:
+ KUNIT_FAIL(test, "mocs reg 0x%x has incorrect val:\n",
+ reg.addr);

-:151: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #151: FILE: drivers/gpu/drm/xe/tests/xe_mocs.c:121:
+}
+static int mocs_kernel_test_run_device(struct xe_device *xe)

-:169: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #169: FILE: drivers/gpu/drm/xe/tests/xe_mocs.c:139:
+}
+void xe_live_mocs_kernel_kunit(struct kunit *test)

total: 0 errors, 1 warnings, 5 checks, 193 lines checked

#3 lore raw

[Intel-xe] ✗ CI.KUnit: failure for drm/xe: Add mocs kunit

In reply to Ruthuvikas Ravikumar
== Series Details ==

== Series Details ==

Series: drm/xe: Add mocs kunit
URL : https://patchwork.freedesktop.org/series/124926/
State : failure

== Summary ==

+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig ERROR:root:../drivers/gpu/drm/xe/xe_mocs.c:583: error: unterminated #if
583 | #if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)

      | 

make[7]: *** [../scripts/Makefile.build:243: drivers/gpu/drm/xe/xe_mocs.o] Error 1 make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:480: drivers/gpu/drm/xe] Error 2 make[5]: *** [../scripts/Makefile.build:480: drivers/gpu/drm] Error 2 make[4]: *** [../scripts/Makefile.build:480: drivers/gpu] Error 2 make[3]: *** [../scripts/Makefile.build:480: drivers] Error 2 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/kernel/Makefile:1913: .] Error 2
make[1]: *** [/kernel/Makefile:234: __sub-make] Error 2
make: *** [Makefile:234: __sub-make] Error 2

[21:53:29] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[21:53:34] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel