arm_hypercalls.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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_smccc_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. void kvm_arm_teardown_hypercalls(struct kvm *kvm);
  37. int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu);
  38. int kvm_arm_copy_fw_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices);
  39. int kvm_arm_get_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
  40. int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
  41. int kvm_vm_smccc_has_attr(struct kvm *kvm, struct kvm_device_attr *attr);
  42. int kvm_vm_smccc_set_attr(struct kvm *kvm, struct kvm_device_attr *attr);
  43. #endif