Skip to content

Commit

Permalink
KVM: arm64: Convert to the generic perf callbacks
Browse files Browse the repository at this point in the history
Drop arm64's version of the callbacks in favor of the callbacks provided
by generic KVM, which are semantically identical.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211111020738.2512932-15-seanjc@google.com
  • Loading branch information
Sean Christopherson authored and Peter Zijlstra committed Nov 17, 2021
1 parent 33271a9 commit 7b51783
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions arch/arm64/kvm/perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,12 @@

DEFINE_STATIC_KEY_FALSE(kvm_arm_pmu_available);

static unsigned int kvm_guest_state(void)
{
struct kvm_vcpu *vcpu = kvm_get_running_vcpu();
unsigned int state;

if (!vcpu)
return 0;

state = PERF_GUEST_ACTIVE;
if (!vcpu_mode_priv(vcpu))
state |= PERF_GUEST_USER;

return state;
}

static unsigned long kvm_get_guest_ip(void)
{
struct kvm_vcpu *vcpu = kvm_get_running_vcpu();

if (WARN_ON_ONCE(!vcpu))
return 0;

return *vcpu_pc(vcpu);
}

static struct perf_guest_info_callbacks kvm_guest_cbs = {
.state = kvm_guest_state,
.get_ip = kvm_get_guest_ip,
};

void kvm_perf_init(void)
{
perf_register_guest_info_callbacks(&kvm_guest_cbs);
kvm_register_perf_callbacks(NULL);
}

void kvm_perf_teardown(void)
{
perf_unregister_guest_info_callbacks(&kvm_guest_cbs);
kvm_unregister_perf_callbacks();
}

0 comments on commit 7b51783

Please sign in to comment.