Commit d0a144f1 authored by Marc Zyngier's avatar Marc Zyngier Committed by Catalin Marinas

arm/arm64: KVM: Add PSCI_VERSION helper

As we're about to trigger a PSCI version explosion, it doesn't
hurt to introduce a PSCI_VERSION helper that is going to be
used everywhere.
Reviewed-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 1a2fb94e
...@@ -18,8 +18,10 @@ ...@@ -18,8 +18,10 @@
#ifndef __KVM_ARM_PSCI_H__ #ifndef __KVM_ARM_PSCI_H__
#define __KVM_ARM_PSCI_H__ #define __KVM_ARM_PSCI_H__
#define KVM_ARM_PSCI_0_1 1 #include <uapi/linux/psci.h>
#define KVM_ARM_PSCI_0_2 2
#define KVM_ARM_PSCI_0_1 PSCI_VERSION(0, 1)
#define KVM_ARM_PSCI_0_2 PSCI_VERSION(0, 2)
int kvm_psci_version(struct kvm_vcpu *vcpu); int kvm_psci_version(struct kvm_vcpu *vcpu);
int kvm_psci_call(struct kvm_vcpu *vcpu); int kvm_psci_call(struct kvm_vcpu *vcpu);
......
...@@ -88,6 +88,9 @@ ...@@ -88,6 +88,9 @@
(((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT) (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT)
#define PSCI_VERSION_MINOR(ver) \ #define PSCI_VERSION_MINOR(ver) \
((ver) & PSCI_VERSION_MINOR_MASK) ((ver) & PSCI_VERSION_MINOR_MASK)
#define PSCI_VERSION(maj, min) \
((((maj) << PSCI_VERSION_MAJOR_SHIFT) & PSCI_VERSION_MAJOR_MASK) | \
((min) & PSCI_VERSION_MINOR_MASK))
/* PSCI features decoding (>=1.0) */ /* PSCI features decoding (>=1.0) */
#define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT 1 #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT 1
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <kvm/arm_psci.h> #include <kvm/arm_psci.h>
#include <uapi/linux/psci.h>
/* /*
* This is an implementation of the Power State Coordination Interface * This is an implementation of the Power State Coordination Interface
* as described in ARM document number ARM DEN 0022A. * as described in ARM document number ARM DEN 0022A.
...@@ -222,7 +220,7 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) ...@@ -222,7 +220,7 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
* Bits[31:16] = Major Version = 0 * Bits[31:16] = Major Version = 0
* Bits[15:0] = Minor Version = 2 * Bits[15:0] = Minor Version = 2
*/ */
val = 2; val = KVM_ARM_PSCI_0_2;
break; break;
case PSCI_0_2_FN_CPU_SUSPEND: case PSCI_0_2_FN_CPU_SUSPEND:
case PSCI_0_2_FN64_CPU_SUSPEND: case PSCI_0_2_FN64_CPU_SUSPEND:
......
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