kfd_topology.h 4.8 KB

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