summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu/tdp_iter.c
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2021-03-16 00:38:03 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2021-03-16 19:16:34 +0100
commit08889894cc82bc3b213bdb192f274358e5a6b78d (patch)
tree78145b0f09f4a5e0a4ca0d296911a21f1101efc5 /arch/x86/kvm/mmu/tdp_iter.c
parentKVM: x86/mmu: Factor out tdp_iter_return_to_root (diff)
downloadlinux-08889894cc82bc3b213bdb192f274358e5a6b78d.tar.xz
linux-08889894cc82bc3b213bdb192f274358e5a6b78d.zip
KVM: x86/mmu: Store the address space ID in the TDP iterator
Store the address space ID in the TDP iterator so that it can be retrieved without having to bounce through the root shadow page. This streamlines the code and fixes a Sparse warning about not properly using rcu_dereference() when grabbing the ID from the root on the fly. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Ben Gardon <bgardon@google.com> Message-Id: <20210315233803.2706477-5-bgardon@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu/tdp_iter.c')
-rw-r--r--arch/x86/kvm/mmu/tdp_iter.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu/tdp_iter.c b/arch/x86/kvm/mmu/tdp_iter.c
index f7f94ea65243..b3ed302c1a35 100644
--- a/arch/x86/kvm/mmu/tdp_iter.c
+++ b/arch/x86/kvm/mmu/tdp_iter.c
@@ -49,6 +49,7 @@ void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level,
iter->root_level = root_level;
iter->min_level = min_level;
iter->pt_path[iter->root_level - 1] = (tdp_ptep_t)root_pt;
+ iter->as_id = kvm_mmu_page_as_id(sptep_to_sp(root_pt));
tdp_iter_restart(iter);
}
@@ -169,8 +170,3 @@ void tdp_iter_next(struct tdp_iter *iter)
iter->valid = false;
}
-tdp_ptep_t tdp_iter_root_pt(struct tdp_iter *iter)
-{
- return iter->pt_path[iter->root_level - 1];
-}
-