[arm-platforms:kvm-arm64/nv3 19/19] arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h:207:2: warning: variable '__val' is uninitialized when used within its own initialization

kernel test robot lkp at intel.com
Tue Sep 1 18:46:43 PDT 2026


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git kvm-arm64/nv3
head:   ae6cf96796e7f11ecba10429d64400e708687cdf
commit: ae6cf96796e7f11ecba10429d64400e708687cdf [19/19] KVM: arm64: Avoid writing to MDSCR_EL1 unless necessary
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20260902/202609020944.8Ffx8eaS-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 678058af7da6a20593d8bb23076dc4773f9e55f1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260902/202609020944.8Ffx8eaS-lkp@intel.com/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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609020944.8Ffx8eaS-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/arm64/kvm/hyp/vhe/sysreg-sr.c:7:
>> arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h:207:2: warning: variable '__val' is uninitialized when used within its own initialization [-Wuninitialized]
     207 |         sysreg_cond_write(*ctxt_mdscr_el1(ctxt), mdscr_el1);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/sysreg.h:1222:16: note: expanded from macro 'sysreg_cond_write'
    1222 |                 write_sysreg(__val, sysreg);                            \
         |                 ~~~~~~~~~~~~~^~~~~~~~~~~~~~
   arch/arm64/include/asm/sysreg.h:1179:20: note: expanded from macro 'write_sysreg'
    1179 |         u64 __val = (u64)(v);                                   \
         |             ~~~~~         ^
   1 warning generated.


vim +/__val +207 arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h

   199	
   200	static inline void __sysreg_restore_common_state(struct kvm_cpu_context *ctxt)
   201	{
   202		/*
   203		 * KVM NV traps writes to MDSCR_EL1, as the access is
   204		 * otherwise written to memory, with no effects. Avoid the
   205		 * high trap cost by only writing if the value has changed.
   206		 */
 > 207		sysreg_cond_write(*ctxt_mdscr_el1(ctxt), mdscr_el1);
   208	
   209		// POR_EL0 can affect uaccess, so must be saved/restored early.
   210		if (ctxt_has_s1poe(ctxt))
   211			write_sysreg_s(ctxt_sys_reg(ctxt, POR_EL0),	SYS_POR_EL0);
   212	}
   213	

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



More information about the linux-arm-kernel mailing list