Lines Matching refs:iter

12 static void tdp_iter_refresh_sptep(struct tdp_iter *iter)  in tdp_iter_refresh_sptep()  argument
14 iter->sptep = iter->pt_path[iter->level - 1] + in tdp_iter_refresh_sptep()
15 SPTE_INDEX(iter->gfn << PAGE_SHIFT, iter->level); in tdp_iter_refresh_sptep()
16 iter->old_spte = kvm_tdp_mmu_read_spte(iter->sptep); in tdp_iter_refresh_sptep()
23 void tdp_iter_restart(struct tdp_iter *iter) in tdp_iter_restart() argument
25 iter->yielded = false; in tdp_iter_restart()
26 iter->yielded_gfn = iter->next_last_level_gfn; in tdp_iter_restart()
27 iter->level = iter->root_level; in tdp_iter_restart()
29 iter->gfn = gfn_round_for_level(iter->next_last_level_gfn, iter->level); in tdp_iter_restart()
30 tdp_iter_refresh_sptep(iter); in tdp_iter_restart()
32 iter->valid = true; in tdp_iter_restart()
39 void tdp_iter_start(struct tdp_iter *iter, struct kvm_mmu_page *root, in tdp_iter_start() argument
44 iter->valid = false; in tdp_iter_start()
48 iter->next_last_level_gfn = next_last_level_gfn; in tdp_iter_start()
49 iter->root_level = root->role.level; in tdp_iter_start()
50 iter->min_level = min_level; in tdp_iter_start()
51 iter->pt_path[iter->root_level - 1] = (tdp_ptep_t)root->spt; in tdp_iter_start()
52 iter->as_id = kvm_mmu_page_as_id(root); in tdp_iter_start()
54 tdp_iter_restart(iter); in tdp_iter_start()
78 static bool try_step_down(struct tdp_iter *iter) in try_step_down() argument
82 if (iter->level == iter->min_level) in try_step_down()
89 iter->old_spte = kvm_tdp_mmu_read_spte(iter->sptep); in try_step_down()
91 child_pt = spte_to_child_pt(iter->old_spte, iter->level); in try_step_down()
95 iter->level--; in try_step_down()
96 iter->pt_path[iter->level - 1] = child_pt; in try_step_down()
97 iter->gfn = gfn_round_for_level(iter->next_last_level_gfn, iter->level); in try_step_down()
98 tdp_iter_refresh_sptep(iter); in try_step_down()
110 static bool try_step_side(struct tdp_iter *iter) in try_step_side() argument
116 if (SPTE_INDEX(iter->gfn << PAGE_SHIFT, iter->level) == in try_step_side()
120 iter->gfn += KVM_PAGES_PER_HPAGE(iter->level); in try_step_side()
121 iter->next_last_level_gfn = iter->gfn; in try_step_side()
122 iter->sptep++; in try_step_side()
123 iter->old_spte = kvm_tdp_mmu_read_spte(iter->sptep); in try_step_side()
133 static bool try_step_up(struct tdp_iter *iter) in try_step_up() argument
135 if (iter->level == iter->root_level) in try_step_up()
138 iter->level++; in try_step_up()
139 iter->gfn = gfn_round_for_level(iter->gfn, iter->level); in try_step_up()
140 tdp_iter_refresh_sptep(iter); in try_step_up()
161 void tdp_iter_next(struct tdp_iter *iter) in tdp_iter_next() argument
163 if (iter->yielded) { in tdp_iter_next()
164 tdp_iter_restart(iter); in tdp_iter_next()
168 if (try_step_down(iter)) in tdp_iter_next()
172 if (try_step_side(iter)) in tdp_iter_next()
174 } while (try_step_up(iter)); in tdp_iter_next()
175 iter->valid = false; in tdp_iter_next()