Lines Matching refs:wi
119 static int get_ia_size(struct s2_walk_info *wi) in get_ia_size() argument
121 return 64 - wi->t0sz; in get_ia_size()
124 static int check_base_s2_limits(struct s2_walk_info *wi, in check_base_s2_limits() argument
129 ia_size = get_ia_size(wi); in check_base_s2_limits()
132 switch (BIT(wi->pgshift)) { in check_base_s2_limits()
152 start_size = input_size - ((3 - level) * stride + wi->pgshift); in check_base_s2_limits()
160 static int check_output_size(struct s2_walk_info *wi, phys_addr_t output) in check_output_size() argument
162 unsigned int output_size = wi->max_oa_bits; in check_output_size()
178 struct s2_walk_info *wi, struct kvm_s2_trans *out) in walk_nested_s2_pgd() argument
187 switch (BIT(wi->pgshift)) { in walk_nested_s2_pgd()
191 level = 3 - wi->sl; in walk_nested_s2_pgd()
195 level = 2 - wi->sl; in walk_nested_s2_pgd()
200 stride = wi->pgshift - 3; in walk_nested_s2_pgd()
201 input_size = get_ia_size(wi); in walk_nested_s2_pgd()
205 ret = check_base_s2_limits(wi, level, input_size, stride); in walk_nested_s2_pgd()
210 wi->pgshift); in walk_nested_s2_pgd()
211 base_addr = wi->baddr & GENMASK_ULL(47, base_lower_bound); in walk_nested_s2_pgd()
213 if (check_output_size(wi, base_addr)) { in walk_nested_s2_pgd()
223 addr_bottom = (3 - level) * stride + wi->pgshift; in walk_nested_s2_pgd()
228 ret = wi->read_desc(paddr, &desc, wi->data); in walk_nested_s2_pgd()
236 if (wi->be) in walk_nested_s2_pgd()
252 if (check_output_size(wi, desc)) { in walk_nested_s2_pgd()
258 base_addr = desc & GENMASK_ULL(47, wi->pgshift); in walk_nested_s2_pgd()
270 if (check_output_size(wi, desc)) { in walk_nested_s2_pgd()
282 addr_bottom += contiguous_bit_shift(desc, wi, level); in walk_nested_s2_pgd()
288 out->block_size = 1UL << ((3 - level) * stride + wi->pgshift); in walk_nested_s2_pgd()
303 static void vtcr_to_walk_info(u64 vtcr, struct s2_walk_info *wi) in vtcr_to_walk_info() argument
305 wi->t0sz = vtcr & TCR_EL2_T0SZ_MASK; in vtcr_to_walk_info()
309 wi->pgshift = 12; break; in vtcr_to_walk_info()
311 wi->pgshift = 14; break; in vtcr_to_walk_info()
314 wi->pgshift = 16; break; in vtcr_to_walk_info()
317 wi->sl = FIELD_GET(VTCR_EL2_SL0_MASK, vtcr); in vtcr_to_walk_info()
319 wi->max_oa_bits = min(get_kvm_ipa_limit(), in vtcr_to_walk_info()
327 struct s2_walk_info wi; in kvm_walk_nested_s2() local
335 wi.read_desc = read_guest_s2_desc; in kvm_walk_nested_s2()
336 wi.data = vcpu; in kvm_walk_nested_s2()
337 wi.baddr = vcpu_read_sys_reg(vcpu, VTTBR_EL2); in kvm_walk_nested_s2()
339 vtcr_to_walk_info(vtcr, &wi); in kvm_walk_nested_s2()
341 wi.be = vcpu_read_sys_reg(vcpu, SCTLR_EL2) & SCTLR_ELx_EE; in kvm_walk_nested_s2()
343 ret = walk_nested_s2_pgd(gipa, &wi, result); in kvm_walk_nested_s2()