Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [avpatel:riscv_kvm_nested_v2 22/22] arch/riscv/kvm/vcpu_nested_swtlb.c:116:8: warning: variable 'gstage_gpa' set but not used
@ 2026-07-11 19:55 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-11 19:55 UTC (permalink / raw)
  To: Anup Patel; +Cc: llvm, oe-kbuild-all

tree:   https://github.com/avpatel/linux.git riscv_kvm_nested_v2
head:   8f3684e0c4a0188f47cba12c50d419fdf6c5a69e
commit: 8f3684e0c4a0188f47cba12c50d419fdf6c5a69e [22/22] RISC-V: KVM: Emulate G-stage using software walks for nested guest
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20260712/202607120314.kpuwkBUA-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project b3e6e6dabdc02153552a64fc74ff5c7532447eed)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260712/202607120314.kpuwkBUA-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607120314.kpuwkBUA-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/riscv/kvm/vcpu_nested_swtlb.c:116:8: warning: variable 'gstage_gpa' set but not used [-Wunused-but-set-variable]
     116 |         gpa_t gstage_gpa;
         |               ^
   1 warning generated.


vim +/gstage_gpa +116 arch/riscv/kvm/vcpu_nested_swtlb.c

   107	
   108	int kvm_riscv_vcpu_nested_swtlb_xlate(struct kvm_vcpu *vcpu,
   109					      const struct kvm_cpu_trap *trap,
   110					      struct kvm_gstage_mapping *out_map,
   111					      struct kvm_cpu_trap *out_trap)
   112	{
   113		struct riscv_guest_gstage_walk_data wdata = { 0 };
   114		unsigned long page_size, fault_addr;
   115		struct kvm_vcpu_nested_csr *nsc;
 > 116		gpa_t gstage_gpa;
   117		int rc = 0;
   118	
   119		if (!kvm_riscv_nested_available())
   120			return -ENOENT;
   121	
   122		nsc = vcpu->arch.nested.csr;
   123		switch ((nsc->hgatp & HGATP_MODE) >> HGATP_MODE_SHIFT) {
   124		case HGATP_MODE_OFF:
   125			wdata.pgd_levels = 0;
   126			break;
   127	#ifdef CONFIG_32BIT
   128		case HGATP_MODE_SV32X4:
   129			wdata.pgd_levels = 2;
   130			break;
   131	#else
   132		case HGATP_MODE_SV39X4:
   133			wdata.pgd_levels = 3;
   134			break;
   135		case HGATP_MODE_SV48X4:
   136			wdata.pgd_levels = 4;
   137			break;
   138		case HGATP_MODE_SV57X4:
   139			wdata.pgd_levels = 5;
   140			break;
   141	#endif
   142		default:
   143			return -EINVAL;
   144		}
   145		wdata.out_trap = out_trap;
   146	
   147		fault_addr = (trap->htval << 2) | (trap->stval & 0x3);
   148		if (wdata.pgd_levels) {
   149			/* TODO: */
   150			gstage_gpa = (nsc->hgatp & HGATP_PPN) << PAGE_SHIFT;
   151			rc = riscv_guest_pgtbl_walk(&riscv_guest_gstage_ops, &wdata, vcpu,
   152						    0, wdata.pgd_levels - 1, fault_addr, out_map);
   153		} else {
   154			out_map->level = wdata.pgd_levels - 1;
   155			page_size = kvm_riscv_gstage_level_to_page_size(out_map->level);
   156			out_map->addr = fault_addr & ~(page_size - 1);
   157			out_map->pte = pfn_pte(PFN_DOWN(out_map->addr),
   158					       __pgprot(_PAGE_PRESENT |
   159							_PAGE_READ |
   160							_PAGE_WRITE |
   161							_PAGE_EXEC |
   162							_PAGE_USER |
   163							_PAGE_GLOBAL |
   164							_PAGE_ACCESSED |
   165							_PAGE_DIRTY));
   166		}
   167	
   168		return rc;
   169	}
   170	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-11 19:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-11 19:55 [avpatel:riscv_kvm_nested_v2 22/22] arch/riscv/kvm/vcpu_nested_swtlb.c:116:8: warning: variable 'gstage_gpa' set but not used kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox