Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) 2019 Arm Ltd. */
0003 
0004 #ifndef __KVM_ARM_HYPERCALLS_H
0005 #define __KVM_ARM_HYPERCALLS_H
0006 
0007 #include <asm/kvm_emulate.h>
0008 
0009 int kvm_hvc_call_handler(struct kvm_vcpu *vcpu);
0010 
0011 static inline u32 smccc_get_function(struct kvm_vcpu *vcpu)
0012 {
0013     return vcpu_get_reg(vcpu, 0);
0014 }
0015 
0016 static inline unsigned long smccc_get_arg1(struct kvm_vcpu *vcpu)
0017 {
0018     return vcpu_get_reg(vcpu, 1);
0019 }
0020 
0021 static inline unsigned long smccc_get_arg2(struct kvm_vcpu *vcpu)
0022 {
0023     return vcpu_get_reg(vcpu, 2);
0024 }
0025 
0026 static inline unsigned long smccc_get_arg3(struct kvm_vcpu *vcpu)
0027 {
0028     return vcpu_get_reg(vcpu, 3);
0029 }
0030 
0031 static inline void smccc_set_retval(struct kvm_vcpu *vcpu,
0032                     unsigned long a0,
0033                     unsigned long a1,
0034                     unsigned long a2,
0035                     unsigned long a3)
0036 {
0037     vcpu_set_reg(vcpu, 0, a0);
0038     vcpu_set_reg(vcpu, 1, a1);
0039     vcpu_set_reg(vcpu, 2, a2);
0040     vcpu_set_reg(vcpu, 3, a3);
0041 }
0042 
0043 struct kvm_one_reg;
0044 
0045 void kvm_arm_init_hypercalls(struct kvm *kvm);
0046 int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu);
0047 int kvm_arm_copy_fw_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices);
0048 int kvm_arm_get_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
0049 int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
0050 
0051 #endif