[PATCH 0/2] KVM: arm64: Fix MPIDR lookup for unreset vCPUs

From: fuqiang wang

Date: Thu Jun 11 2026 - 05:11:42 EST


From: wangfuqiang49 <wangfuqiang49@xxxxxx>

Hi,

This series fixes an MPIDR lookup issue when a VM is created with CPU
hotplug support.

kvm_init_mpidr_data() builds a compressed MPIDR-to-vCPU lookup table by
walking all possible vCPUs. However, vCPUs that have not been reset yet
still have a zero MPIDR_EL1 state, which aliases vCPU0. This can cause
cmpidr_to_idx[0] to be overwritten with the index of an unreset vCPU.

As a result, MPIDR 0 lookups can return the wrong vCPU, preventing
interrupts targeting vCPU0 from being delivered correctly and making
guest boot extremely slow in configurations using CPU hotplug.

Patch 1 adds named definitions for the MIDR_EL1 RES1 bit used to detect
whether a vCPU's MPIDR_EL1 state has been reset.
Patch 2 skips unreset vCPUs when populating the compressed MPIDR lookup
table.

Thanks,
Fuqiang

fuqiang wang (2):
arm64: Add MIDR_EL1 RES1 definitions
KVM: arm64: Skip unreset vCPUs in MPIDR lookup table

arch/arm64/include/asm/cputype.h | 2 ++
arch/arm64/include/asm/kvm_emulate.h | 9 +++++++++
arch/arm64/kvm/arm.c | 10 ++++++++++
3 files changed, 21 insertions(+)

--
2.47.0