Commit 9d395a0a authored by Ben Gardon's avatar Ben Gardon Committed by Paolo Bonzini

KVM: x86/mmu: Remove need for a vcpu from kvm_slot_page_track_is_active

kvm_slot_page_track_is_active only uses its vCPU argument to get a
pointer to the assoicated struct kvm, so just pass in the struct KVM to
remove the need for a vCPU pointer.

No functional change intended.
Signed-off-by: default avatarBen Gardon <bgardon@google.com>
Message-Id: <20211115234603.2908381-6-bgardon@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent ce92ef76
...@@ -63,7 +63,7 @@ void kvm_slot_page_track_add_page(struct kvm *kvm, ...@@ -63,7 +63,7 @@ void kvm_slot_page_track_add_page(struct kvm *kvm,
void kvm_slot_page_track_remove_page(struct kvm *kvm, void kvm_slot_page_track_remove_page(struct kvm *kvm,
struct kvm_memory_slot *slot, gfn_t gfn, struct kvm_memory_slot *slot, gfn_t gfn,
enum kvm_page_track_mode mode); enum kvm_page_track_mode mode);
bool kvm_slot_page_track_is_active(struct kvm_vcpu *vcpu, bool kvm_slot_page_track_is_active(struct kvm *kvm,
struct kvm_memory_slot *slot, gfn_t gfn, struct kvm_memory_slot *slot, gfn_t gfn,
enum kvm_page_track_mode mode); enum kvm_page_track_mode mode);
......
...@@ -2591,7 +2591,7 @@ int mmu_try_to_unsync_pages(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot, ...@@ -2591,7 +2591,7 @@ int mmu_try_to_unsync_pages(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,
* track machinery is used to write-protect upper-level shadow pages, * track machinery is used to write-protect upper-level shadow pages,
* i.e. this guards the role.level == 4K assertion below! * i.e. this guards the role.level == 4K assertion below!
*/ */
if (kvm_slot_page_track_is_active(vcpu, slot, gfn, KVM_PAGE_TRACK_WRITE)) if (kvm_slot_page_track_is_active(vcpu->kvm, slot, gfn, KVM_PAGE_TRACK_WRITE))
return -EPERM; return -EPERM;
/* /*
...@@ -3888,7 +3888,7 @@ static bool page_fault_handle_page_track(struct kvm_vcpu *vcpu, ...@@ -3888,7 +3888,7 @@ static bool page_fault_handle_page_track(struct kvm_vcpu *vcpu,
* guest is writing the page which is write tracked which can * guest is writing the page which is write tracked which can
* not be fixed by page fault handler. * not be fixed by page fault handler.
*/ */
if (kvm_slot_page_track_is_active(vcpu, fault->slot, fault->gfn, KVM_PAGE_TRACK_WRITE)) if (kvm_slot_page_track_is_active(vcpu->kvm, fault->slot, fault->gfn, KVM_PAGE_TRACK_WRITE))
return true; return true;
return false; return false;
......
...@@ -173,7 +173,7 @@ EXPORT_SYMBOL_GPL(kvm_slot_page_track_remove_page); ...@@ -173,7 +173,7 @@ EXPORT_SYMBOL_GPL(kvm_slot_page_track_remove_page);
/* /*
* check if the corresponding access on the specified guest page is tracked. * check if the corresponding access on the specified guest page is tracked.
*/ */
bool kvm_slot_page_track_is_active(struct kvm_vcpu *vcpu, bool kvm_slot_page_track_is_active(struct kvm *kvm,
struct kvm_memory_slot *slot, gfn_t gfn, struct kvm_memory_slot *slot, gfn_t gfn,
enum kvm_page_track_mode mode) enum kvm_page_track_mode mode)
{ {
...@@ -186,7 +186,7 @@ bool kvm_slot_page_track_is_active(struct kvm_vcpu *vcpu, ...@@ -186,7 +186,7 @@ bool kvm_slot_page_track_is_active(struct kvm_vcpu *vcpu,
return false; return false;
if (mode == KVM_PAGE_TRACK_WRITE && if (mode == KVM_PAGE_TRACK_WRITE &&
!kvm_page_track_write_tracking_enabled(vcpu->kvm)) !kvm_page_track_write_tracking_enabled(kvm))
return false; return false;
index = gfn_to_index(gfn, slot->base_gfn, PG_LEVEL_4K); index = gfn_to_index(gfn, slot->base_gfn, PG_LEVEL_4K);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment