qti-smmu-proxy-msgq.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef SMMU_PROXY_MSGQ_H
  6. #define SMMU_PROXY_MSGQ_H
  7. #include <linux/gunyah/gh_rm_drv.h>
  8. /**
  9. * enum smmu_proxy_msg_type: Message types used by the SMMU proxy driver for
  10. * communication.
  11. * @SMMU_PROXY_MAP: The message is a request to map memory into the VM's
  12. * SMMU.
  13. * @SMMU_PROXY_MAP_RESP: The message is a response from a remote VM to a
  14. * mapping request issued by the receiving VM
  15. * @SMMU_PROXY_UNMAP: The message is a request to unmap some previously
  16. * SMMU-mapped memory from the VM
  17. * @SMMU_PROXY_UNMAP_RESP: The message is a response from a remote VM to an
  18. * unmapping request issued by the receiving VM
  19. * @SMMU_PROXY_ERR_RESP: The message is a response from a remote VM to give
  20. * a generic error response for a prior message sent to the remote VM
  21. */
  22. enum smmu_proxy_msg_type {
  23. SMMU_PROXY_MAP,
  24. SMMU_PROXY_MAP_RESP,
  25. SMMU_PROXY_UNMAP,
  26. SMMU_PROXY_UNMAP_RESP,
  27. SMMU_PROXY_ERR_RESP,
  28. SMMU_PROXY_MSG_MAX,
  29. };
  30. /**
  31. * struct smmu_proxy_msg_hdr: The header for SMMU proxy messages
  32. * @msg_type: The type of message.
  33. * @msg_size: The size of message.
  34. */
  35. struct smmu_proxy_msg_hdr {
  36. u32 msg_type;
  37. u32 msg_size;
  38. } __packed;
  39. /**
  40. * struct smmu_proxy_msg_hdr: The header for responses to SMMU proxy messages
  41. * @msg_type: The type of message.
  42. * @msg_size: The size of message.
  43. * @ret: Return code from remote VM
  44. */
  45. struct smmu_proxy_resp_hdr {
  46. u32 msg_type;
  47. u32 msg_size;
  48. s32 ret;
  49. } __packed;
  50. /**
  51. * struct smmu_proxy_map_req: The message format for an SMMU mapping request from
  52. * another VM.
  53. * @hdr: Message header
  54. * @hdl: The memparcel handle associated with the memory to be mapped in the SMMU
  55. * of the relevant VM
  56. * @cb_id: Context bank ID that we will map the memory associated with @hdl to
  57. * @acl_desc: A GH ACL descriptor that describes the VMIDs that will be
  58. * accessing the memory, as well as what permissions each VMID will have.
  59. */
  60. struct smmu_proxy_map_req {
  61. struct smmu_proxy_msg_hdr hdr;
  62. u32 hdl;
  63. u32 cb_id;
  64. struct gh_acl_desc acl_desc;
  65. } __packed;
  66. /**
  67. * struct smmu_proxy_map_resp: The message format for an SMMU mapping
  68. * request response.
  69. * @hdr: Response header
  70. * @iova: IOVA of mapped memory
  71. * @mapping_len: Lenth of IOMMU IOVA mapping
  72. */
  73. struct smmu_proxy_map_resp {
  74. struct smmu_proxy_resp_hdr hdr;
  75. u64 iova;
  76. u64 mapping_len;
  77. } __packed;
  78. /**
  79. * struct smmu_proxy_unmap_req: The message format for an SMMU unmapping request from
  80. * another VM.
  81. * @hdr: Message header
  82. * @hdl: The memparcel handle associated with the memory to be mapped in the SMMU
  83. * of the relevant VM
  84. */
  85. struct smmu_proxy_unmap_req {
  86. struct smmu_proxy_msg_hdr hdr;
  87. u32 hdl;
  88. } __packed;
  89. /**
  90. * struct smmu_proxy_unmap_resp: The message format for an SMMU unmapping
  91. * request response.
  92. * @hdr: Response header
  93. */
  94. struct smmu_proxy_unmap_resp {
  95. struct smmu_proxy_resp_hdr hdr;
  96. } __packed;
  97. #endif /* SMMU_PROXY_MSGQ_H */