hcall_dbl.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __GH_HCALL_DBL_H
  6. #define __GH_HCALL_DBL_H
  7. #include <linux/err.h>
  8. #include <linux/types.h>
  9. #include <linux/gunyah/hcall_common.h>
  10. #include <linux/gunyah/gh_common.h>
  11. #include <asm/gunyah/hcall.h>
  12. static inline int gh_hcall_dbl_bind(gh_capid_t dbl_capid, gh_capid_t vic_capid,
  13. gh_virq_handle_t virq_info)
  14. {
  15. struct gh_hcall_resp _resp = {0};
  16. return _gh_hcall(0x6010,
  17. (struct gh_hcall_args){ dbl_capid, vic_capid,
  18. virq_info },
  19. &_resp);
  20. }
  21. static inline int gh_hcall_dbl_unbind(gh_capid_t dbl_capid)
  22. {
  23. struct gh_hcall_resp _resp = {0};
  24. return _gh_hcall(0x6011, (struct gh_hcall_args){ dbl_capid }, &_resp);
  25. }
  26. struct gh_hcall_dbl_send_resp {
  27. u64 old_flags;
  28. };
  29. static inline int gh_hcall_dbl_send(gh_capid_t dbl_capid,
  30. gh_dbl_flags_t new_flags,
  31. struct gh_hcall_dbl_send_resp *resp)
  32. {
  33. int ret;
  34. struct gh_hcall_resp _resp = {0};
  35. ret = _gh_hcall(0x6012,
  36. (struct gh_hcall_args){ dbl_capid, new_flags },
  37. &_resp);
  38. if (!ret && resp)
  39. resp->old_flags = _resp.resp1;
  40. return ret;
  41. }
  42. struct gh_hcall_dbl_recv_resp {
  43. u64 old_flags;
  44. };
  45. static inline int gh_hcall_dbl_recv(gh_capid_t dbl_capid,
  46. gh_dbl_flags_t clear_flags,
  47. struct gh_hcall_dbl_recv_resp *resp)
  48. {
  49. int ret;
  50. struct gh_hcall_resp _resp = {0};
  51. ret = _gh_hcall(0x6013,
  52. (struct gh_hcall_args){ dbl_capid, clear_flags },
  53. &_resp);
  54. if (!ret && resp)
  55. resp->old_flags = _resp.resp1;
  56. return ret;
  57. }
  58. static inline int gh_hcall_dbl_reset(gh_capid_t dbl_capid)
  59. {
  60. struct gh_hcall_resp _resp = {0};
  61. return _gh_hcall(0x6014, (struct gh_hcall_args){ dbl_capid }, &_resp);
  62. }
  63. static inline int gh_hcall_dbl_mask(gh_capid_t dbl_capid,
  64. gh_dbl_flags_t enable_mask,
  65. gh_dbl_flags_t ack_mask)
  66. {
  67. struct gh_hcall_resp _resp = {0};
  68. return _gh_hcall(0x6015,
  69. (struct gh_hcall_args){ dbl_capid, enable_mask,
  70. ack_mask },
  71. &_resp);
  72. }
  73. #endif