[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 <[email protected]>
Newsgroups dev.linux.lists.llvm,dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.