Skip to content

Commit 3ad8b3d

Browse files
committed
arm/arm64: KVM: Correct KVM_ARM_VCPU_INIT power off option
The implementation of KVM_ARM_VCPU_INIT is currently not doing what userspace expects, namely making sure that a vcpu which may have been turned off using PSCI is returned to its initial state, which would be powered on if userspace does not set the KVM_ARM_VCPU_POWER_OFF flag. Implement the expected functionality and clarify the ABI. Acked-by: Marc Zyngier <[email protected]> Signed-off-by: Christoffer Dall <[email protected]>
1 parent 03f1d4c commit 3ad8b3d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Documentation/virtual/kvm/api.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2455,7 +2455,8 @@ should be created before this ioctl is invoked.
24552455

24562456
Possible features:
24572457
- KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state.
2458-
Depends on KVM_CAP_ARM_PSCI.
2458+
Depends on KVM_CAP_ARM_PSCI. If not set, the CPU will be powered on
2459+
and execute guest code when KVM_RUN is called.
24592460
- KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode.
24602461
Depends on KVM_CAP_ARM_EL1_32BIT (arm64 only).
24612462
- KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 for the CPU.

arch/arm/kvm/arm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
663663
*/
664664
if (test_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features))
665665
vcpu->arch.pause = true;
666+
else
667+
vcpu->arch.pause = false;
666668

667669
return 0;
668670
}

0 commit comments

Comments
 (0)