Commit 512865d8 authored by Will Deacon's avatar Will Deacon Committed by Marc Zyngier

KVM: arm64: Bump guest PSCI version to 1.1

Expose PSCI version v1.1 to the guest by default. The only difference
for now is that an updated version number is reported by PSCI_VERSION.

Cc: Marc Zyngier <maz@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220221153524.15397-2-will@kernel.org
parent dfd42fac
...@@ -305,16 +305,19 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) ...@@ -305,16 +305,19 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
return ret; return ret;
} }
static int kvm_psci_1_0_call(struct kvm_vcpu *vcpu) static int kvm_psci_1_x_call(struct kvm_vcpu *vcpu, u32 minor)
{ {
u32 psci_fn = smccc_get_function(vcpu); u32 psci_fn = smccc_get_function(vcpu);
u32 feature; u32 feature;
unsigned long val; unsigned long val;
int ret = 1; int ret = 1;
if (minor > 1)
return -EINVAL;
switch(psci_fn) { switch(psci_fn) {
case PSCI_0_2_FN_PSCI_VERSION: case PSCI_0_2_FN_PSCI_VERSION:
val = KVM_ARM_PSCI_1_0; val = minor == 0 ? KVM_ARM_PSCI_1_0 : KVM_ARM_PSCI_1_1;
break; break;
case PSCI_1_0_FN_PSCI_FEATURES: case PSCI_1_0_FN_PSCI_FEATURES:
feature = smccc_get_arg1(vcpu); feature = smccc_get_arg1(vcpu);
...@@ -393,8 +396,10 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) ...@@ -393,8 +396,10 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu)
int kvm_psci_call(struct kvm_vcpu *vcpu) int kvm_psci_call(struct kvm_vcpu *vcpu)
{ {
switch (kvm_psci_version(vcpu, vcpu->kvm)) { switch (kvm_psci_version(vcpu, vcpu->kvm)) {
case KVM_ARM_PSCI_1_1:
return kvm_psci_1_x_call(vcpu, 1);
case KVM_ARM_PSCI_1_0: case KVM_ARM_PSCI_1_0:
return kvm_psci_1_0_call(vcpu); return kvm_psci_1_x_call(vcpu, 0);
case KVM_ARM_PSCI_0_2: case KVM_ARM_PSCI_0_2:
return kvm_psci_0_2_call(vcpu); return kvm_psci_0_2_call(vcpu);
case KVM_ARM_PSCI_0_1: case KVM_ARM_PSCI_0_1:
...@@ -511,6 +516,7 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) ...@@ -511,6 +516,7 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
return 0; return 0;
case KVM_ARM_PSCI_0_2: case KVM_ARM_PSCI_0_2:
case KVM_ARM_PSCI_1_0: case KVM_ARM_PSCI_1_0:
case KVM_ARM_PSCI_1_1:
if (!wants_02) if (!wants_02)
return -EINVAL; return -EINVAL;
vcpu->kvm->arch.psci_version = val; vcpu->kvm->arch.psci_version = val;
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
#define KVM_ARM_PSCI_0_1 PSCI_VERSION(0, 1) #define KVM_ARM_PSCI_0_1 PSCI_VERSION(0, 1)
#define KVM_ARM_PSCI_0_2 PSCI_VERSION(0, 2) #define KVM_ARM_PSCI_0_2 PSCI_VERSION(0, 2)
#define KVM_ARM_PSCI_1_0 PSCI_VERSION(1, 0) #define KVM_ARM_PSCI_1_0 PSCI_VERSION(1, 0)
#define KVM_ARM_PSCI_1_1 PSCI_VERSION(1, 1)
#define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_0 #define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_1
/* /*
* We need the KVM pointer independently from the vcpu as we can call * We need the KVM pointer independently from the vcpu as we can call
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment