Skip to contentSkip to conversation

drm/xe: Fix compilation without CONFIG_KUNIT

PATCH In review Michal Wajdeczko 4 participants 6 messages Jan 5, 2024 – Jan 9, 2024

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

PATCH 1/1 drm/xe: Fix compilation without CONFIG_KUNIT

It looks that declaration of kunit_get_current_test() was available in xe_guc_relay.c only with CONFIG_KUNIT enabled. If CONFIG_KUNIT is disabled we fail with:

In file included from ../include/linux/build_bug.h:5,

                 from ../include/linux/bitfield.h:10,
                 from ../drivers/gpu/drm/xe/xe_guc_relay.c:6:
../drivers/gpu/drm/xe/xe_guc_relay.c: In function ‘xe_guc_relay_process_guc2vf’:
../drivers/gpu/drm/xe/xe_guc_relay.c:863:52: error: implicit declaration of function ‘kunit_get_current_test’ [-Werror=implicit-function-declaration]
  863 |  if (unlikely(!IS_SRIOV_VF(relay_to_xe(relay)) && !kunit_get_current_test()))
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~

../include/linux/compiler.h:77:42: note: in definition of macro ‘unlikely’
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^

Fixes 9a2c2ecb1b77 ("drm/xe/guc: Introduce Relay Communication for SR-IOV")
---
 drivers/gpu/drm/xe/xe_guc_relay.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/xe/xe_guc_relay.c +1 -0
index b772088979bd..c0a2d8d5d3b3 100644
@@ -9,6 +9,7 @@
 #include <drm/drm_managed.h>
 
 #include <kunit/static_stub.h>
+#include <kunit/test-bug.h>
 
 #include "abi/guc_actions_sriov_abi.h"
 #include "abi/guc_relay_actions_abi.h"
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Michal Wajdeczko

It looks that declaration of kunit_get_current_test() was available in xe_guc_relay.c only with CONFIG_KUNIT enabled. If CONFIG_KUNIT is disabled we fail with:

In file included from ../include/linux/build_bug.h:5,

                 from ../include/linux/bitfield.h:10,
                 from ../drivers/gpu/drm/xe/xe_guc_relay.c:6:
../drivers/gpu/drm/xe/xe_guc_relay.c: In function ‘xe_guc_relay_process_guc2vf’:
../drivers/gpu/drm/xe/xe_guc_relay.c:863:52: error: implicit declaration of function ‘kunit_get_current_test’ [-Werror=implicit-function-declaration]
  863 |  if (unlikely(!IS_SRIOV_VF(relay_to_xe(relay)) && !kunit_get_current_test()))
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~
Quoted 4 lines

../include/linux/compiler.h:77:42: note: in definition of macro ‘unlikely’
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^

Quoted 19 lines
Fixes 9a2c2ecb1b77 ("drm/xe/guc: Introduce Relay Communication for SR-IOV")
---
 drivers/gpu/drm/xe/xe_guc_relay.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/xe/xe_guc_relay.c +1 -0
index b772088979bd..c0a2d8d5d3b3 100644
@@ -9,6 +9,7 @@
 #include <drm/drm_managed.h>
 
 #include <kunit/static_stub.h>
+#include <kunit/test-bug.h>
 
 #include "abi/guc_actions_sriov_abi.h"
 #include "abi/guc_relay_actions_abi.h"
Tested-by on v1 1/1
#2 lore raw
In reply to Michal Wajdeczko
Quoted 27 lines · Michal Wajdeczko

It looks that declaration of kunit_get_current_test() was available in xe_guc_relay.c only with CONFIG_KUNIT enabled. If CONFIG_KUNIT is disabled we fail with:

In file included from ../include/linux/build_bug.h:5,

                  from ../include/linux/bitfield.h:10,
                  from ../drivers/gpu/drm/xe/xe_guc_relay.c:6:
../drivers/gpu/drm/xe/xe_guc_relay.c: In function ‘xe_guc_relay_process_guc2vf’:
../drivers/gpu/drm/xe/xe_guc_relay.c:863:52: error: implicit declaration of function ‘kunit_get_current_test’ [-Werror=implicit-function-declaration]
   863 |  if (unlikely(!IS_SRIOV_VF(relay_to_xe(relay)) && !kunit_get_current_test()))
       |                                                    ^~~~~~~~~~~~~~~~~~~~~~
../include/linux/compiler.h:77:42: note: in definition of macro ‘unlikely’
    77 | # define unlikely(x) __builtin_expect(!!(x), 0)
       |                                          ^
Fixes 9a2c2ecb1b77 ("drm/xe/guc: Introduce Relay Communication for SR-IOV")
---
  drivers/gpu/drm/xe/xe_guc_relay.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/xe/xe_guc_relay.c +0 -0
index b772088979bd..c0a2d8d5d3b3 100644

drivers/gpu/drm/xe/xe_guc_relay.c line 12

Quoted 4 lines
drivers/gpu/drm/xe/xe_guc_relay.c +1 -0
@@ -9,6 +9,7 @@
  #include <drm/drm_managed.h>
 
  #include <kunit/static_stub.h>
+#include <kunit/test-bug.h>

Compile works with this fix-

Quoted 3 lines
drivers/gpu/drm/xe/xe_guc_relay.c +0 -0
  #include "abi/guc_actions_sriov_abi.h"
  #include "abi/guc_relay_actions_abi.h"
#3 lore raw

✗ CI.Patch_applied: failure for drm/xe: Fix compilation without CONFIG_KUNIT

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: drm/xe: Fix compilation without CONFIG_KUNIT
URL : https://patchwork.freedesktop.org/series/128273/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: cca0607b6 drm/xe: Fix compilation without CONFIG_KUNIT === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_guc_relay.c:9
error: drivers/gpu/drm/xe/xe_guc_relay.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe: Fix compilation without CONFIG_KUNIT
Patch failed at 0001 drm/xe: Fix compilation without CONFIG_KUNIT When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

#4 lore raw

✗ CI.Patch_applied: failure for drm/xe: Fix compilation without CONFIG_KUNIT

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: drm/xe: Fix compilation without CONFIG_KUNIT
URL : https://patchwork.freedesktop.org/series/128273/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: cca0607b6 drm/xe: Fix compilation without CONFIG_KUNIT === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_guc_relay.c:9
error: drivers/gpu/drm/xe/xe_guc_relay.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe: Fix compilation without CONFIG_KUNIT
Patch failed at 0001 drm/xe: Fix compilation without CONFIG_KUNIT When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

#5 lore raw
In reply to Michal Wajdeczko
Quoted 11 lines · Michal Wajdeczko

It looks that declaration of kunit_get_current_test() was available in xe_guc_relay.c only with CONFIG_KUNIT enabled. If CONFIG_KUNIT is disabled we fail with:

In file included from ../include/linux/build_bug.h:5,

                 from ../include/linux/bitfield.h:10,
                 from ../drivers/gpu/drm/xe/xe_guc_relay.c:6:
../drivers/gpu/drm/xe/xe_guc_relay.c: In function ‘xe_guc_relay_process_guc2vf’:
../drivers/gpu/drm/xe/xe_guc_relay.c:863:52: error: implicit declaration of function ‘kunit_get_current_test’ [-Werror=implicit-function-declaration]
  863 |  if (unlikely(!IS_SRIOV_VF(relay_to_xe(relay)) && !kunit_get_current_test()))
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines

../include/linux/compiler.h:77:42: note: in definition of macro ‘unlikely’
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^

Fixes 9a2c2ecb1b77 ("drm/xe/guc: Introduce Relay Communication for SR-IOV")

kernel test robot says problem was introduces by other patch, so it should rather be:

Fixes 27b717bac93f ("drm/xe/kunit: Add GuC Relay kunit test")

and since it's already merged, also for the record:

Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 17 lines
---
 drivers/gpu/drm/xe/xe_guc_relay.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/xe/xe_guc_relay.c +1 -0
index b772088979bd..c0a2d8d5d3b3 100644
@@ -9,6 +9,7 @@
 #include <drm/drm_managed.h>
 
 #include <kunit/static_stub.h>
+#include <kunit/test-bug.h>
 
 #include "abi/guc_actions_sriov_abi.h"
 #include "abi/guc_relay_actions_abi.h"