Re: [PATCH v4 2/6] KVM: x86: Move guest_mode helpers to x86.h

From: kernel test robot

Date: Thu Mar 26 2026 - 18:49:55 EST


Hi Yosry,

kernel test robot noticed the following build errors:

[auto build test ERROR on 3d6cdcc8883b5726513d245eef0e91cabfc397f7]

url: https://github.com/intel-lab-lkp/linux/commits/Yosry-Ahmed/KVM-x86-Move-enable_pmu-enable_mediated_pmu-to-pmu-h-and-pmu-c/20260326-191518
base: 3d6cdcc8883b5726513d245eef0e91cabfc397f7
patch link: https://lore.kernel.org/r/20260326031150.3774017-3-yosry%40kernel.org
patch subject: [PATCH v4 2/6] KVM: x86: Move guest_mode helpers to x86.h
config: x86_64-buildonly-randconfig-004-20260327 (https://download.01.org/0day-ci/archive/20260327/202603270611.WB2i1rjQ-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260327/202603270611.WB2i1rjQ-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603270611.WB2i1rjQ-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from arch/x86/kvm/svm/svm_onhyperv.c:11:
>> arch/x86/kvm/svm/svm.h:520:6: error: call to undeclared function 'is_guest_mode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
520 | if (is_guest_mode(&svm->vcpu))
| ^
arch/x86/kvm/svm/svm.h:578:6: error: call to undeclared function 'is_guest_mode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
578 | if (is_guest_mode(&svm->vcpu) && !nested_vgif_enabled(svm))
| ^
arch/x86/kvm/svm/svm.h:639:6: error: call to undeclared function 'is_guest_mode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
639 | if (is_guest_mode(&svm->vcpu))
| ^
arch/x86/kvm/svm/svm.h:802:9: error: call to undeclared function 'is_guest_mode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
802 | return is_guest_mode(vcpu) && (svm->nested.ctl.int_ctl & V_INTR_MASKING_MASK);
| ^
In file included from arch/x86/kvm/svm/svm_onhyperv.c:12:
In file included from arch/x86/kvm/svm/svm_ops.h:7:
>> arch/x86/kvm/x86.h:169:20: error: conflicting types for 'is_guest_mode'
169 | static inline bool is_guest_mode(struct kvm_vcpu *vcpu)
| ^
arch/x86/kvm/svm/svm.h:520:6: note: previous implicit declaration is here
520 | if (is_guest_mode(&svm->vcpu))
| ^
5 errors generated.


vim +/is_guest_mode +520 arch/x86/kvm/svm/svm.h

0b97f929831a70 Sean Christopherson 2026-02-18 509
0b97f929831a70 Sean Christopherson 2026-02-18 510 static inline void svm_mark_intercepts_dirty(struct vcpu_svm *svm)
0b97f929831a70 Sean Christopherson 2026-02-18 511 {
0b97f929831a70 Sean Christopherson 2026-02-18 512 vmcb_mark_dirty(svm->vmcb01.ptr, VMCB_INTERCEPTS);
0b97f929831a70 Sean Christopherson 2026-02-18 513
0b97f929831a70 Sean Christopherson 2026-02-18 514 /*
0b97f929831a70 Sean Christopherson 2026-02-18 515 * If L2 is active, recalculate the intercepts for vmcb02 to account
0b97f929831a70 Sean Christopherson 2026-02-18 516 * for the changes made to vmcb01. All intercept configuration is done
0b97f929831a70 Sean Christopherson 2026-02-18 517 * for vmcb01 and then propagated to vmcb02 to combine KVM's intercepts
0b97f929831a70 Sean Christopherson 2026-02-18 518 * with L1's intercepts (from the vmcb12 snapshot).
0b97f929831a70 Sean Christopherson 2026-02-18 519 */
0b97f929831a70 Sean Christopherson 2026-02-18 @520 if (is_guest_mode(&svm->vcpu))
0b97f929831a70 Sean Christopherson 2026-02-18 521 nested_vmcb02_recalc_intercepts(svm);
0b97f929831a70 Sean Christopherson 2026-02-18 522 }
0b97f929831a70 Sean Christopherson 2026-02-18 523

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki