1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2019 Arm Ltd. */
4 #ifndef __KVM_ARM_HYPERCALLS_H
5 #define __KVM_ARM_HYPERCALLS_H
7 #include <asm/kvm_emulate.h>
9 int kvm_smccc_call_handler(struct kvm_vcpu
*vcpu
);
11 static inline u32
smccc_get_function(struct kvm_vcpu
*vcpu
)
13 return vcpu_get_reg(vcpu
, 0);
16 static inline unsigned long smccc_get_arg1(struct kvm_vcpu
*vcpu
)
18 return vcpu_get_reg(vcpu
, 1);
21 static inline unsigned long smccc_get_arg2(struct kvm_vcpu
*vcpu
)
23 return vcpu_get_reg(vcpu
, 2);
26 static inline unsigned long smccc_get_arg3(struct kvm_vcpu
*vcpu
)
28 return vcpu_get_reg(vcpu
, 3);
31 static inline void smccc_set_retval(struct kvm_vcpu
*vcpu
,
37 vcpu_set_reg(vcpu
, 0, a0
);
38 vcpu_set_reg(vcpu
, 1, a1
);
39 vcpu_set_reg(vcpu
, 2, a2
);
40 vcpu_set_reg(vcpu
, 3, a3
);
45 void kvm_arm_init_hypercalls(struct kvm
*kvm
);
46 void kvm_arm_teardown_hypercalls(struct kvm
*kvm
);
47 int kvm_arm_get_fw_num_regs(struct kvm_vcpu
*vcpu
);
48 int kvm_arm_copy_fw_reg_indices(struct kvm_vcpu
*vcpu
, u64 __user
*uindices
);
49 int kvm_arm_get_fw_reg(struct kvm_vcpu
*vcpu
, const struct kvm_one_reg
*reg
);
50 int kvm_arm_set_fw_reg(struct kvm_vcpu
*vcpu
, const struct kvm_one_reg
*reg
);
52 int kvm_vm_smccc_has_attr(struct kvm
*kvm
, struct kvm_device_attr
*attr
);
53 int kvm_vm_smccc_set_attr(struct kvm
*kvm
, struct kvm_device_attr
*attr
);