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 <joey.gouly@arm.com> Reviewed-by: Zenghui Yu <yuzenghui@huawei.com> Tested-by: Joey Gouly <joey.gouly@arm.com> Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230927090911.3355209-10-maz@kernel.org Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 5544750 commit 54a8006

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

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)