kfd_topology.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. #ifndef __KFD_TOPOLOGY_H__
  23. #define __KFD_TOPOLOGY_H__
  24. #include <linux/types.h>
  25. #include <linux/list.h>
  26. #include "kfd_priv.h"
  27. #define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 128
  28. #define HSA_CAP_HOT_PLUGGABLE 0x00000001
  29. #define HSA_CAP_ATS_PRESENT 0x00000002
  30. #define HSA_CAP_SHARED_WITH_GRAPHICS 0x00000004
  31. #define HSA_CAP_QUEUE_SIZE_POW2 0x00000008
  32. #define HSA_CAP_QUEUE_SIZE_32BIT 0x00000010
  33. #define HSA_CAP_QUEUE_IDLE_EVENT 0x00000020
  34. #define HSA_CAP_VA_LIMIT 0x00000040
  35. #define HSA_CAP_WATCH_POINTS_SUPPORTED 0x00000080
  36. #define HSA_CAP_WATCH_POINTS_TOTALBITS_MASK 0x00000f00
  37. #define HSA_CAP_WATCH_POINTS_TOTALBITS_SHIFT 8
  38. #define HSA_CAP_RESERVED 0xfffff000
  39. #define HSA_CAP_DOORBELL_PACKET_TYPE 0x00001000
  40. struct kfd_node_properties {
  41. uint32_t cpu_cores_count;
  42. uint32_t simd_count;
  43. uint32_t mem_banks_count;
  44. uint32_t caches_count;
  45. uint32_t io_links_count;
  46. uint32_t cpu_core_id_base;
  47. uint32_t simd_id_base;
  48. uint32_t capability;
  49. uint32_t max_waves_per_simd;
  50. uint32_t lds_size_in_kb;
  51. uint32_t gds_size_in_kb;
  52. uint32_t wave_front_size;
  53. uint32_t array_count;
  54. uint32_t simd_arrays_per_engine;
  55. uint32_t cu_per_simd_array;
  56. uint32_t simd_per_cu;
  57. uint32_t max_slots_scratch_cu;
  58. uint32_t engine_id;
  59. uint32_t vendor_id;
  60. uint32_t device_id;
  61. uint32_t location_id;
  62. uint32_t max_engine_clk_fcompute;
  63. uint32_t max_engine_clk_ccompute;
  64. uint16_t marketing_name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];
  65. };
  66. #define HSA_MEM_HEAP_TYPE_SYSTEM 0
  67. #define HSA_MEM_HEAP_TYPE_FB_PUBLIC 1
  68. #define HSA_MEM_HEAP_TYPE_FB_PRIVATE 2
  69. #define HSA_MEM_HEAP_TYPE_GPU_GDS 3
  70. #define HSA_MEM_HEAP_TYPE_GPU_LDS 4
  71. #define HSA_MEM_HEAP_TYPE_GPU_SCRATCH 5
  72. #define HSA_MEM_FLAGS_HOT_PLUGGABLE 0x00000001
  73. #define HSA_MEM_FLAGS_NON_VOLATILE 0x00000002
  74. #define HSA_MEM_FLAGS_RESERVED 0xfffffffc
  75. struct kfd_mem_properties {
  76. struct list_head list;
  77. uint32_t heap_type;
  78. uint64_t size_in_bytes;
  79. uint32_t flags;
  80. uint32_t width;
  81. uint32_t mem_clk_max;
  82. struct kobject *kobj;
  83. struct attribute attr;
  84. };
  85. #define KFD_TOPOLOGY_CPU_SIBLINGS 256
  86. #define HSA_CACHE_TYPE_DATA 0x00000001
  87. #define HSA_CACHE_TYPE_INSTRUCTION 0x00000002
  88. #define HSA_CACHE_TYPE_CPU 0x00000004
  89. #define HSA_CACHE_TYPE_HSACU 0x00000008
  90. #define HSA_CACHE_TYPE_RESERVED 0xfffffff0
  91. struct kfd_cache_properties {
  92. struct list_head list;
  93. uint32_t processor_id_low;
  94. uint32_t cache_level;
  95. uint32_t cache_size;
  96. uint32_t cacheline_size;
  97. uint32_t cachelines_per_tag;
  98. uint32_t cache_assoc;
  99. uint32_t cache_latency;
  100. uint32_t cache_type;
  101. uint8_t sibling_map[KFD_TOPOLOGY_CPU_SIBLINGS];
  102. struct kobject *kobj;
  103. struct attribute attr;
  104. };
  105. struct kfd_iolink_properties {
  106. struct list_head list;
  107. uint32_t iolink_type;
  108. uint32_t ver_maj;
  109. uint32_t ver_min;
  110. uint32_t node_from;
  111. uint32_t node_to;
  112. uint32_t weight;
  113. uint32_t min_latency;
  114. uint32_t max_latency;
  115. uint32_t min_bandwidth;
  116. uint32_t max_bandwidth;
  117. uint32_t rec_transfer_size;
  118. uint32_t flags;
  119. struct kobject *kobj;
  120. struct attribute attr;
  121. };
  122. struct kfd_topology_device {
  123. struct list_head list;
  124. uint32_t gpu_id;
  125. struct kfd_node_properties node_props;
  126. uint32_t mem_bank_count;
  127. struct list_head mem_props;
  128. uint32_t cache_count;
  129. struct list_head cache_props;
  130. uint32_t io_link_count;
  131. struct list_head io_link_props;
  132. struct kfd_dev *gpu;
  133. struct kobject *kobj_node;
  134. struct kobject *kobj_mem;
  135. struct kobject *kobj_cache;
  136. struct kobject *kobj_iolink;
  137. struct attribute attr_gpuid;
  138. struct attribute attr_name;
  139. struct attribute attr_props;
  140. };
  141. struct kfd_system_properties {
  142. uint32_t num_devices; /* Number of H-NUMA nodes */
  143. uint32_t generation_count;
  144. uint64_t platform_oem;
  145. uint64_t platform_id;
  146. uint64_t platform_rev;
  147. struct kobject *kobj_topology;
  148. struct kobject *kobj_nodes;
  149. struct attribute attr_genid;
  150. struct attribute attr_props;
  151. };
  152. #endif /* __KFD_TOPOLOGY_H__ */