Skip to contentSkip to conversation

powerpc/pseries/htmdump: Include header file to get is_kvm_guest() definition

PATCH Applied Athira Rajeev 3 participants 3 messages May 6, 2025 – May 18, 2025 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/pseries/htmdump: Include header file to get is_kvm_guest() definition

htmdump_init calls is_kvm_guest() to check for guest environment. is_kvm_guest() is defined in kvm_guest.h header file. Without including the header file, build hits error failing to find the function.

arch/powerpc/platforms/pseries/htmdump.c: In function 'htmdump_init':
arch/powerpc/platforms/pseries/htmdump.c:469:6: error: implicit declaration of function 'is_kvm_guest'; did you mean '__key_get'? [-Werror=implicit-function-declaration]

  if (is_kvm_guest()) {
      ^~~~~~~~~~~~
      __key_get

This is observed in configs where CONFIG_KVM_GUEST is disabled. Include header file explicitly to avoid the build error

---
 arch/powerpc/platforms/pseries/htmdump.c | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/platforms/pseries/htmdump.c +1 -0
index af15d50c924b..742ec52c9d4d 100644
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/machdep.h>
 #include <asm/plpar_wrappers.h>
+#include <asm/kvm_guest.h>
 
 static void *htm_buf;
 static void *htm_status_buf;
Signature · 1 line
2.43.0
Tested-by on v1 1/1
#1 lore raw
Quoted 26 lines · Athira Rajeev

htmdump_init calls is_kvm_guest() to check for guest environment. is_kvm_guest() is defined in kvm_guest.h header file. Without including the header file, build hits error failing to find the function.

   arch/powerpc/platforms/pseries/htmdump.c: In function 'htmdump_init':
   arch/powerpc/platforms/pseries/htmdump.c:469:6: error: implicit declaration of function 'is_kvm_guest';
   did you mean '__key_get'? [-Werror=implicit-function-declaration]
   if (is_kvm_guest()) {
       ^~~~~~~~~~~~
       __key_get

This is observed in configs where CONFIG_KVM_GUEST is disabled. Include header file explicitly to avoid the build error

---
  arch/powerpc/platforms/pseries/htmdump.c | 1 +
  1 file changed, 1 insertion(+)
arch/powerpc/platforms/pseries/htmdump.c +0 -0
index af15d50c924b..742ec52c9d4d 100644

arch/powerpc/platforms/pseries/htmdump.c line 16

Quoted 7 lines
arch/powerpc/platforms/pseries/htmdump.c +1 -0
@@ -10,6 +10,7 @@
  #include <asm/io.h>
  #include <asm/machdep.h>
  #include <asm/plpar_wrappers.h>
+#include <asm/kvm_guest.h>
 
  static void *htm_buf;
  static void *htm_status_buf;

Tested this patch by applying on ppc tree, next-test branch and it fixes the reported issue. Hence,

With this patch:

  SIGN /lib/modules/6.15.0-rc2-00040-gab1456c5aa7a-dirty/kernel/net/vmw_vsock/vmw_vsock_virtio_transport_common.ko INSTALL /lib/modules/6.15.0-rc2-00040-gab1456c5aa7a-dirty/kernel/net/vmw_vsock/vsock_loopback.ko SIGN /lib/modules/6.15.0-rc2-00040-gab1456c5aa7a-dirty/kernel/net/vmw_vsock/vsock_loopback.ko INSTALL /lib/modules/6.15.0-rc2-00040-gab1456c5aa7a-dirty/kernel/net/nsh/nsh.ko
  SIGN /lib/modules/6.15.0-rc2-00040-gab1456c5aa7a-dirty/kernel/net/nsh/nsh.ko
  DEPMOD  /lib/modules/6.15.0-rc2-00040-gab1456c5aa7a-dirty
  INSTALL /boot

# git diff
arch/powerpc/platforms/pseries/htmdump.c +0 -0
index af15d50c924b..742ec52c9d4d 100644
@@ -10,6 +10,7 @@

 #include <asm/io.h>
 #include <asm/machdep.h>
 #include <asm/plpar_wrappers.h>
+#include <asm/kvm_guest.h>

 static void *htm_buf;
 static void *htm_status_buf;

With out this patch:

make -j 81 -s && make modules_install && make install
gcc: error: missing argument to '-falign-functions='
gcc: error: missing argument to '-Wframe-larger-than='
gcc: error: missing argument to '-falign-functions='
gcc: error: missing argument to '-Wframe-larger-than='
make[2]: *** [scripts/Makefile.build:203: scripts/mod/empty.o] Error 1 make[2]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:98: scripts/mod/devicetable-offsets.s] Error 1 make[1]: *** [/root/linux/Makefile:1279: prepare0] Error 2
make: *** [Makefile:248: __sub-make] Error 2

Regards,

Venkat.

maintainer Applied
#2 lore raw
In reply to Athira Rajeev
Quoted 4 lines · Athira Rajeev

htmdump_init calls is_kvm_guest() to check for guest environment. is_kvm_guest() is defined in kvm_guest.h header file. Without including the header file, build hits error failing to find the function.

Quoted 8 lines

arch/powerpc/platforms/pseries/htmdump.c: In function 'htmdump_init':
arch/powerpc/platforms/pseries/htmdump.c:469:6: error: implicit declaration of function 'is_kvm_guest'; did you mean '__key_get'? [-Werror=implicit-function-declaration]

  if (is_kvm_guest()) {
      ^~~~~~~~~~~~
      __key_get

[...]

Applied to powerpc/next.

[1/1] powerpc/pseries/htmdump: Include header file to get is_kvm_guest() definition

      https://git.kernel.org/powerpc/c/2c54e431574f829ec0895d5104575b3f209eae28

Thanks