KVM: x86/mmu: Rename goal_gfn to next_last_level_gfn
The goal_gfn field in tdp_iter can be misleading as it implies that it is the iterator's final goal. It is really a target for the lowest gfn mapped by the leaf level SPTE the iterator will traverse towards. Change the field's name to be more precise. Signed-off-by: Ben Gardon <bgardon@google.com> Message-Id: <20210202185734.1680553-13-bgardon@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e139a34ef9
commit
74953d3530
|
@ -22,21 +22,21 @@ static gfn_t round_gfn_for_level(gfn_t gfn, int level)
|
|||
|
||||
/*
|
||||
* Sets a TDP iterator to walk a pre-order traversal of the paging structure
|
||||
* rooted at root_pt, starting with the walk to translate goal_gfn.
|
||||
* rooted at root_pt, starting with the walk to translate next_last_level_gfn.
|
||||
*/
|
||||
void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level,
|
||||
int min_level, gfn_t goal_gfn)
|
||||
int min_level, gfn_t next_last_level_gfn)
|
||||
{
|
||||
WARN_ON(root_level < 1);
|
||||
WARN_ON(root_level > PT64_ROOT_MAX_LEVEL);
|
||||
|
||||
iter->goal_gfn = goal_gfn;
|
||||
iter->next_last_level_gfn = next_last_level_gfn;
|
||||
iter->root_level = root_level;
|
||||
iter->min_level = min_level;
|
||||
iter->level = root_level;
|
||||
iter->pt_path[iter->level - 1] = root_pt;
|
||||
|
||||
iter->gfn = round_gfn_for_level(iter->goal_gfn, iter->level);
|
||||
iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level);
|
||||
tdp_iter_refresh_sptep(iter);
|
||||
|
||||
iter->valid = true;
|
||||
|
@ -82,7 +82,7 @@ static bool try_step_down(struct tdp_iter *iter)
|
|||
|
||||
iter->level--;
|
||||
iter->pt_path[iter->level - 1] = child_pt;
|
||||
iter->gfn = round_gfn_for_level(iter->goal_gfn, iter->level);
|
||||
iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level);
|
||||
tdp_iter_refresh_sptep(iter);
|
||||
|
||||
return true;
|
||||
|
@ -106,7 +106,7 @@ static bool try_step_side(struct tdp_iter *iter)
|
|||
return false;
|
||||
|
||||
iter->gfn += KVM_PAGES_PER_HPAGE(iter->level);
|
||||
iter->goal_gfn = iter->gfn;
|
||||
iter->next_last_level_gfn = iter->gfn;
|
||||
iter->sptep++;
|
||||
iter->old_spte = READ_ONCE(*iter->sptep);
|
||||
|
||||
|
@ -166,13 +166,13 @@ void tdp_iter_next(struct tdp_iter *iter)
|
|||
*/
|
||||
void tdp_iter_refresh_walk(struct tdp_iter *iter)
|
||||
{
|
||||
gfn_t goal_gfn = iter->goal_gfn;
|
||||
gfn_t next_last_level_gfn = iter->next_last_level_gfn;
|
||||
|
||||
if (iter->gfn > goal_gfn)
|
||||
goal_gfn = iter->gfn;
|
||||
if (iter->gfn > next_last_level_gfn)
|
||||
next_last_level_gfn = iter->gfn;
|
||||
|
||||
tdp_iter_start(iter, iter->pt_path[iter->root_level - 1],
|
||||
iter->root_level, iter->min_level, goal_gfn);
|
||||
iter->root_level, iter->min_level, next_last_level_gfn);
|
||||
}
|
||||
|
||||
u64 *tdp_iter_root_pt(struct tdp_iter *iter)
|
||||
|
|
|
@ -15,7 +15,7 @@ struct tdp_iter {
|
|||
* The iterator will traverse the paging structure towards the mapping
|
||||
* for this GFN.
|
||||
*/
|
||||
gfn_t goal_gfn;
|
||||
gfn_t next_last_level_gfn;
|
||||
/* Pointers to the page tables traversed to reach the current SPTE */
|
||||
u64 *pt_path[PT64_ROOT_MAX_LEVEL];
|
||||
/* A pointer to the current SPTE */
|
||||
|
@ -52,7 +52,7 @@ struct tdp_iter {
|
|||
u64 *spte_to_child_pt(u64 pte, int level);
|
||||
|
||||
void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level,
|
||||
int min_level, gfn_t goal_gfn);
|
||||
int min_level, gfn_t next_last_level_gfn);
|
||||
void tdp_iter_next(struct tdp_iter *iter);
|
||||
void tdp_iter_refresh_walk(struct tdp_iter *iter);
|
||||
u64 *tdp_iter_root_pt(struct tdp_iter *iter);
|
||||
|
|
Loading…
Reference in New Issue