arm_hypercalls.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (C) 2019 Arm Ltd. */
  3. #ifndef __KVM_ARM_HYPERCALLS_H
  4. #define __KVM_ARM_HYPERCALLS_H
  5. #include <asm/kvm_emulate.h>
  6. int kvm_hvc_call_handler(struct kvm_vcpu *vcpu);
  7. static inline u32 smccc_get_function(struct kvm_vcpu *vcpu)
  8. {
  9. return vcpu_get_reg(vcpu, 0);
  10. }
  11. static inline unsigned long smccc_get_arg1(struct kvm_vcpu *vcpu)
  12. {
  13. return vcpu_get_reg(vcpu, 1);
  14. }
  15. static inline unsigned long smccc_get_arg2(struct kvm_vcpu *vcpu)
  16. {
  17. return vcpu_get_reg(vcpu, 2);
  18. }
  19. static inline unsigned long smccc_get_arg3(struct kvm_vcpu *vcpu)
  20. {
  21. return vcpu_get_reg(vcpu, 3);
  22. }
  23. static inline void smccc_set_retval(struct kvm_vcpu *vcpu,
  24. unsigned long a0,
  25. unsigned long a1,
  26. unsigned long a2,
  27. unsigned long a3)
  28. {
  29. vcpu_set_reg(vcpu, 0, a0);
  30. vcpu_set_reg(vcpu, 1, a1);
  31. vcpu_set_reg(vcpu, 2, a2);
  32. vcpu_set_reg(vcpu, 3, a3);
  33. }
  34. struct kvm_one_reg;
  35. void kvm_arm_init_hypercalls(struct kvm *kvm);
  36. int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu);
  37. int kvm_arm_copy_fw_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices);
  38. int kvm_arm_get_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
  39. int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
  40. #endif