Skip to content

Commit 54a8006

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Fast-track kvm_mpidr_to_vcpu() when mpidr_data is available
If our fancy little table is present when calling kvm_mpidr_to_vcpu(), use it to recover the corresponding vcpu. Reviewed-by: Joey Gouly <[email protected]> Reviewed-by: Zenghui Yu <[email protected]> Tested-by: Joey Gouly <[email protected]> Tested-by: Shameer Kolothum <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 5544750 commit 54a8006

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

arch/arm64/kvm/arm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,6 +2388,18 @@ struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr)
23882388
unsigned long i;
23892389

23902390
mpidr &= MPIDR_HWID_BITMASK;
2391+
2392+
if (kvm->arch.mpidr_data) {
2393+
u16 idx = kvm_mpidr_index(kvm->arch.mpidr_data, mpidr);
2394+
2395+
vcpu = kvm_get_vcpu(kvm,
2396+
kvm->arch.mpidr_data->cmpidr_to_idx[idx]);
2397+
if (mpidr != kvm_vcpu_get_mpidr_aff(vcpu))
2398+
vcpu = NULL;
2399+
2400+
return vcpu;
2401+
}
2402+
23912403
kvm_for_each_vcpu(i, vcpu, kvm) {
23922404
if (mpidr == kvm_vcpu_get_mpidr_aff(vcpu))
23932405
return vcpu;

0 commit comments

Comments
 (0)