Skip to content

Commit 8be82d5

Browse files
dwmw2oupton
authored andcommitted
KVM: arm64: Add support for PSCI v1.2 and v1.3
As with PSCI v1.1 in commit 512865d ("KVM: arm64: Bump guest PSCI version to 1.1"), expose v1.3 to the guest by default. The SYSTEM_OFF2 call which is exposed by doing so is compatible for userspace because it's just a new flag in the event that KVM raises, in precisely the same way that SYSTEM_RESET2 was compatible when v1.1 was enabled by default. Signed-off-by: David Woodhouse <[email protected]> Reviewed-by: Miguel Luis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 97413ce commit 8be82d5

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

arch/arm64/kvm/hypercalls.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,8 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
575575
case KVM_ARM_PSCI_0_2:
576576
case KVM_ARM_PSCI_1_0:
577577
case KVM_ARM_PSCI_1_1:
578+
case KVM_ARM_PSCI_1_2:
579+
case KVM_ARM_PSCI_1_3:
578580
if (!wants_02)
579581
return -EINVAL;
580582
vcpu->kvm->arch.psci_version = val;

arch/arm64/kvm/psci.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static int kvm_psci_1_x_call(struct kvm_vcpu *vcpu, u32 minor)
328328

329329
switch(psci_fn) {
330330
case PSCI_0_2_FN_PSCI_VERSION:
331-
val = minor == 0 ? KVM_ARM_PSCI_1_0 : KVM_ARM_PSCI_1_1;
331+
val = PSCI_VERSION(1, minor);
332332
break;
333333
case PSCI_1_0_FN_PSCI_FEATURES:
334334
arg = smccc_get_arg1(vcpu);
@@ -487,6 +487,10 @@ int kvm_psci_call(struct kvm_vcpu *vcpu)
487487
}
488488

489489
switch (version) {
490+
case KVM_ARM_PSCI_1_3:
491+
return kvm_psci_1_x_call(vcpu, 3);
492+
case KVM_ARM_PSCI_1_2:
493+
return kvm_psci_1_x_call(vcpu, 2);
490494
case KVM_ARM_PSCI_1_1:
491495
return kvm_psci_1_x_call(vcpu, 1);
492496
case KVM_ARM_PSCI_1_0:

include/kvm/arm_psci.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
#define KVM_ARM_PSCI_0_2 PSCI_VERSION(0, 2)
1515
#define KVM_ARM_PSCI_1_0 PSCI_VERSION(1, 0)
1616
#define KVM_ARM_PSCI_1_1 PSCI_VERSION(1, 1)
17+
#define KVM_ARM_PSCI_1_2 PSCI_VERSION(1, 2)
18+
#define KVM_ARM_PSCI_1_3 PSCI_VERSION(1, 3)
1719

18-
#define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_1
20+
#define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_3
1921

2022
static inline int kvm_psci_version(struct kvm_vcpu *vcpu)
2123
{

0 commit comments

Comments
 (0)