Lines Matching +full:step +full:- +full:down
1 // SPDX-License-Identifier: GPL-2.0
13 iter->sptep = iter->pt_path[iter->level - 1] + in tdp_iter_refresh_sptep()
14 SPTE_INDEX(iter->gfn << PAGE_SHIFT, iter->level); in tdp_iter_refresh_sptep()
15 iter->old_spte = kvm_tdp_mmu_read_spte(iter->sptep); in tdp_iter_refresh_sptep()
20 return gfn & -KVM_PAGES_PER_HPAGE(level); in round_gfn_for_level()
29 iter->yielded = false; in tdp_iter_restart()
30 iter->yielded_gfn = iter->next_last_level_gfn; in tdp_iter_restart()
31 iter->level = iter->root_level; in tdp_iter_restart()
33 iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); in tdp_iter_restart()
36 iter->valid = true; in tdp_iter_restart()
40 * Sets a TDP iterator to walk a pre-order traversal of the paging structure
46 int root_level = root->role.level; in tdp_iter_start()
51 iter->next_last_level_gfn = next_last_level_gfn; in tdp_iter_start()
52 iter->root_level = root_level; in tdp_iter_start()
53 iter->min_level = min_level; in tdp_iter_start()
54 iter->pt_path[iter->root_level - 1] = (tdp_ptep_t)root->spt; in tdp_iter_start()
55 iter->as_id = kvm_mmu_page_as_id(root); in tdp_iter_start()
69 * last-level entry. in spte_to_child_pt()
78 * Steps down one level in the paging structure towards the goal GFN. Returns
79 * true if the iterator was able to step down a level, false otherwise.
85 if (iter->level == iter->min_level) in try_step_down()
89 * Reread the SPTE before stepping down to avoid traversing into page in try_step_down()
92 iter->old_spte = kvm_tdp_mmu_read_spte(iter->sptep); in try_step_down()
94 child_pt = spte_to_child_pt(iter->old_spte, iter->level); in try_step_down()
98 iter->level--; in try_step_down()
99 iter->pt_path[iter->level - 1] = child_pt; in try_step_down()
100 iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); in try_step_down()
109 * page table, or it could be non-present. Returns true if the iterator was
110 * able to step to the next entry in the page table, false if the iterator was
119 if (SPTE_INDEX(iter->gfn << PAGE_SHIFT, iter->level) == in try_step_side()
120 (SPTE_ENT_PER_PAGE - 1)) in try_step_side()
123 iter->gfn += KVM_PAGES_PER_HPAGE(iter->level); in try_step_side()
124 iter->next_last_level_gfn = iter->gfn; in try_step_side()
125 iter->sptep++; in try_step_side()
126 iter->old_spte = kvm_tdp_mmu_read_spte(iter->sptep); in try_step_side()
134 * successful step up, false if already in the root page.
138 if (iter->level == iter->root_level) in try_step_up()
141 iter->level++; in try_step_up()
142 iter->gfn = round_gfn_for_level(iter->gfn, iter->level); in try_step_up()
149 * Step to the next SPTE in a pre-order traversal of the paging structure.
150 * To get to the next SPTE, the iterator either steps down towards the goal
151 * GFN, if at a present, non-last-level SPTE, or over to a SPTE mapping a
155 * 1. If the current SPTE is a non-last-level SPTE, step down into the page
157 * 2. If the iterator cannot step down, it will try to step to the next SPTE
159 * 3. If the iterator cannot step to the next entry in the current page, it will
160 * try to step up to the parent paging structure page. In this case, that
161 * SPTE will have already been visited, and so the iterator must also step
166 if (iter->yielded) { in tdp_iter_next()
178 iter->valid = false; in tdp_iter_next()