Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2012,2013 - ARM Ltd
0004  * Author: Marc Zyngier <marc.zyngier@arm.com>
0005  */
0006 
0007 #ifndef __KVM_ARM_PSCI_H__
0008 #define __KVM_ARM_PSCI_H__
0009 
0010 #include <linux/kvm_host.h>
0011 #include <uapi/linux/psci.h>
0012 
0013 #define KVM_ARM_PSCI_0_1    PSCI_VERSION(0, 1)
0014 #define KVM_ARM_PSCI_0_2    PSCI_VERSION(0, 2)
0015 #define KVM_ARM_PSCI_1_0    PSCI_VERSION(1, 0)
0016 #define KVM_ARM_PSCI_1_1    PSCI_VERSION(1, 1)
0017 
0018 #define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_1
0019 
0020 static inline int kvm_psci_version(struct kvm_vcpu *vcpu)
0021 {
0022     /*
0023      * Our PSCI implementation stays the same across versions from
0024      * v0.2 onward, only adding the few mandatory functions (such
0025      * as FEATURES with 1.0) that are required by newer
0026      * revisions. It is thus safe to return the latest, unless
0027      * userspace has instructed us otherwise.
0028      */
0029     if (test_bit(KVM_ARM_VCPU_PSCI_0_2, vcpu->arch.features)) {
0030         if (vcpu->kvm->arch.psci_version)
0031             return vcpu->kvm->arch.psci_version;
0032 
0033         return KVM_ARM_PSCI_LATEST;
0034     }
0035 
0036     return KVM_ARM_PSCI_0_1;
0037 }
0038 
0039 
0040 int kvm_psci_call(struct kvm_vcpu *vcpu);
0041 
0042 #endif /* __KVM_ARM_PSCI_H__ */