@@ -72,10 +72,6 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id)
if (vcpu->kvm_run == MAP_FAILED)
die("unable to mmap vcpu fd");
- /* VCPU 0 is the boot CPU, the others start in a poweroff state. */
- if (cpu_id > 0)
- vcpu_init.features[0] |= (1UL << KVM_ARM_VCPU_POWER_OFF);
-
/* Set KVM_ARM_VCPU_PSCI_0_2 if available */
if (kvm__supports_extension(kvm, KVM_CAP_ARM_PSCI_0_2)) {
vcpu_init.features[0] |= (1UL << KVM_ARM_VCPU_PSCI_0_2);
@@ -133,6 +129,16 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id)
kvm_cpu__arm_reset(vcpu);
+ /* VCPU 0 is the boot CPU, the others start in a poweroff state. */
+ if (cpu_id > 0) {
+ struct kvm_mp_state mp_state = {
+ .mp_state = KVM_MP_STATE_STOPPED,
+ };
+
+ if (ioctl(vcpu->vcpu_fd, KVM_SET_MP_STATE, &mp_state))
+ die_perror("KVM_SET_MP_STATE failed");
+ }
+
coalesced_offset = ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION,
KVM_CAP_COALESCED_MMIO);
if (coalesced_offset)
Using the POWER_OFF flag in kvm_vcpu_init gets in the way of resetting a vCPU in response to a PSCI CPU_ON call, for obvious reasons. Drop the flag in favor of using the KVM_SET_MP_STATE call for non-boot vCPUs. Signed-off-by: Oliver Upton <oliver.upton@linux.dev> --- arm/kvm-cpu.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)