amdgpu_ih.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright 2014 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. */
  23. #ifndef __AMDGPU_IH_H__
  24. #define __AMDGPU_IH_H__
  25. struct amdgpu_device;
  26. /*
  27. * vega10+ IH clients
  28. */
  29. enum amdgpu_ih_clientid
  30. {
  31. AMDGPU_IH_CLIENTID_IH = 0x00,
  32. AMDGPU_IH_CLIENTID_ACP = 0x01,
  33. AMDGPU_IH_CLIENTID_ATHUB = 0x02,
  34. AMDGPU_IH_CLIENTID_BIF = 0x03,
  35. AMDGPU_IH_CLIENTID_DCE = 0x04,
  36. AMDGPU_IH_CLIENTID_ISP = 0x05,
  37. AMDGPU_IH_CLIENTID_PCIE0 = 0x06,
  38. AMDGPU_IH_CLIENTID_RLC = 0x07,
  39. AMDGPU_IH_CLIENTID_SDMA0 = 0x08,
  40. AMDGPU_IH_CLIENTID_SDMA1 = 0x09,
  41. AMDGPU_IH_CLIENTID_SE0SH = 0x0a,
  42. AMDGPU_IH_CLIENTID_SE1SH = 0x0b,
  43. AMDGPU_IH_CLIENTID_SE2SH = 0x0c,
  44. AMDGPU_IH_CLIENTID_SE3SH = 0x0d,
  45. AMDGPU_IH_CLIENTID_SYSHUB = 0x0e,
  46. AMDGPU_IH_CLIENTID_THM = 0x0f,
  47. AMDGPU_IH_CLIENTID_UVD = 0x10,
  48. AMDGPU_IH_CLIENTID_VCE0 = 0x11,
  49. AMDGPU_IH_CLIENTID_VMC = 0x12,
  50. AMDGPU_IH_CLIENTID_XDMA = 0x13,
  51. AMDGPU_IH_CLIENTID_GRBM_CP = 0x14,
  52. AMDGPU_IH_CLIENTID_ATS = 0x15,
  53. AMDGPU_IH_CLIENTID_ROM_SMUIO = 0x16,
  54. AMDGPU_IH_CLIENTID_DF = 0x17,
  55. AMDGPU_IH_CLIENTID_VCE1 = 0x18,
  56. AMDGPU_IH_CLIENTID_PWR = 0x19,
  57. AMDGPU_IH_CLIENTID_UTCL2 = 0x1b,
  58. AMDGPU_IH_CLIENTID_EA = 0x1c,
  59. AMDGPU_IH_CLIENTID_UTCL2LOG = 0x1d,
  60. AMDGPU_IH_CLIENTID_MP0 = 0x1e,
  61. AMDGPU_IH_CLIENTID_MP1 = 0x1f,
  62. AMDGPU_IH_CLIENTID_MAX,
  63. AMDGPU_IH_CLIENTID_VCN = AMDGPU_IH_CLIENTID_UVD
  64. };
  65. #define AMDGPU_IH_CLIENTID_LEGACY 0
  66. /*
  67. * R6xx+ IH ring
  68. */
  69. struct amdgpu_ih_ring {
  70. struct amdgpu_bo *ring_obj;
  71. volatile uint32_t *ring;
  72. unsigned rptr;
  73. unsigned ring_size;
  74. uint64_t gpu_addr;
  75. uint32_t ptr_mask;
  76. atomic_t lock;
  77. bool enabled;
  78. unsigned wptr_offs;
  79. unsigned rptr_offs;
  80. u32 doorbell_index;
  81. bool use_doorbell;
  82. bool use_bus_addr;
  83. dma_addr_t rb_dma_addr; /* only used when use_bus_addr = true */
  84. };
  85. #define AMDGPU_IH_SRC_DATA_MAX_SIZE_DW 4
  86. struct amdgpu_iv_entry {
  87. unsigned client_id;
  88. unsigned src_id;
  89. unsigned ring_id;
  90. unsigned vm_id;
  91. unsigned vm_id_src;
  92. uint64_t timestamp;
  93. unsigned timestamp_src;
  94. unsigned pas_id;
  95. unsigned pasid_src;
  96. unsigned src_data[AMDGPU_IH_SRC_DATA_MAX_SIZE_DW];
  97. const uint32_t *iv_entry;
  98. };
  99. int amdgpu_ih_ring_init(struct amdgpu_device *adev, unsigned ring_size,
  100. bool use_bus_addr);
  101. void amdgpu_ih_ring_fini(struct amdgpu_device *adev);
  102. int amdgpu_ih_process(struct amdgpu_device *adev);
  103. #endif