Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */
0002 /*
0003  * Copyright 2021 Advanced Micro Devices, Inc.
0004  *
0005  * Permission is hereby granted, free of charge, to any person obtaining a
0006  * copy of this software and associated documentation files (the "Software"),
0007  * to deal in the Software without restriction, including without limitation
0008  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0009  * and/or sell copies of the Software, and to permit persons to whom the
0010  * Software is furnished to do so, subject to the following conditions:
0011  *
0012  * The above copyright notice and this permission notice shall be included in
0013  * all copies or substantial portions of the Software.
0014  *
0015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0018  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0019  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0020  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0021  * OTHER DEALINGS IN THE SOFTWARE.
0022  */
0023 
0024 #ifndef KFD_SYSFS_H_INCLUDED
0025 #define KFD_SYSFS_H_INCLUDED
0026 
0027 /* Capability bits in node properties */
0028 #define HSA_CAP_HOT_PLUGGABLE           0x00000001
0029 #define HSA_CAP_ATS_PRESENT         0x00000002
0030 #define HSA_CAP_SHARED_WITH_GRAPHICS        0x00000004
0031 #define HSA_CAP_QUEUE_SIZE_POW2         0x00000008
0032 #define HSA_CAP_QUEUE_SIZE_32BIT        0x00000010
0033 #define HSA_CAP_QUEUE_IDLE_EVENT        0x00000020
0034 #define HSA_CAP_VA_LIMIT            0x00000040
0035 #define HSA_CAP_WATCH_POINTS_SUPPORTED      0x00000080
0036 #define HSA_CAP_WATCH_POINTS_TOTALBITS_MASK 0x00000f00
0037 #define HSA_CAP_WATCH_POINTS_TOTALBITS_SHIFT    8
0038 #define HSA_CAP_DOORBELL_TYPE_TOTALBITS_MASK    0x00003000
0039 #define HSA_CAP_DOORBELL_TYPE_TOTALBITS_SHIFT   12
0040 
0041 #define HSA_CAP_DOORBELL_TYPE_PRE_1_0       0x0
0042 #define HSA_CAP_DOORBELL_TYPE_1_0       0x1
0043 #define HSA_CAP_DOORBELL_TYPE_2_0       0x2
0044 #define HSA_CAP_AQL_QUEUE_DOUBLE_MAP        0x00004000
0045 
0046 /* Old buggy user mode depends on this being 0 */
0047 #define HSA_CAP_RESERVED_WAS_SRAM_EDCSUPPORTED  0x00080000
0048 
0049 #define HSA_CAP_MEM_EDCSUPPORTED        0x00100000
0050 #define HSA_CAP_RASEVENTNOTIFY          0x00200000
0051 #define HSA_CAP_ASIC_REVISION_MASK      0x03c00000
0052 #define HSA_CAP_ASIC_REVISION_SHIFT     22
0053 #define HSA_CAP_SRAM_EDCSUPPORTED       0x04000000
0054 #define HSA_CAP_SVMAPI_SUPPORTED        0x08000000
0055 #define HSA_CAP_FLAGS_COHERENTHOSTACCESS    0x10000000
0056 #define HSA_CAP_RESERVED            0xe00f8000
0057 
0058 /* Heap types in memory properties */
0059 #define HSA_MEM_HEAP_TYPE_SYSTEM    0
0060 #define HSA_MEM_HEAP_TYPE_FB_PUBLIC 1
0061 #define HSA_MEM_HEAP_TYPE_FB_PRIVATE    2
0062 #define HSA_MEM_HEAP_TYPE_GPU_GDS   3
0063 #define HSA_MEM_HEAP_TYPE_GPU_LDS   4
0064 #define HSA_MEM_HEAP_TYPE_GPU_SCRATCH   5
0065 
0066 /* Flag bits in memory properties */
0067 #define HSA_MEM_FLAGS_HOT_PLUGGABLE     0x00000001
0068 #define HSA_MEM_FLAGS_NON_VOLATILE      0x00000002
0069 #define HSA_MEM_FLAGS_RESERVED          0xfffffffc
0070 
0071 /* Cache types in cache properties */
0072 #define HSA_CACHE_TYPE_DATA     0x00000001
0073 #define HSA_CACHE_TYPE_INSTRUCTION  0x00000002
0074 #define HSA_CACHE_TYPE_CPU      0x00000004
0075 #define HSA_CACHE_TYPE_HSACU        0x00000008
0076 #define HSA_CACHE_TYPE_RESERVED     0xfffffff0
0077 
0078 /* Link types in IO link properties (matches CRAT link types) */
0079 #define HSA_IOLINK_TYPE_UNDEFINED   0
0080 #define HSA_IOLINK_TYPE_HYPERTRANSPORT  1
0081 #define HSA_IOLINK_TYPE_PCIEXPRESS  2
0082 #define HSA_IOLINK_TYPE_AMBA        3
0083 #define HSA_IOLINK_TYPE_MIPI        4
0084 #define HSA_IOLINK_TYPE_QPI_1_1 5
0085 #define HSA_IOLINK_TYPE_RESERVED1   6
0086 #define HSA_IOLINK_TYPE_RESERVED2   7
0087 #define HSA_IOLINK_TYPE_RAPID_IO    8
0088 #define HSA_IOLINK_TYPE_INFINIBAND  9
0089 #define HSA_IOLINK_TYPE_RESERVED3   10
0090 #define HSA_IOLINK_TYPE_XGMI        11
0091 #define HSA_IOLINK_TYPE_XGOP        12
0092 #define HSA_IOLINK_TYPE_GZ      13
0093 #define HSA_IOLINK_TYPE_ETHERNET_RDMA   14
0094 #define HSA_IOLINK_TYPE_RDMA_OTHER  15
0095 #define HSA_IOLINK_TYPE_OTHER       16
0096 
0097 /* Flag bits in IO link properties (matches CRAT flags, excluding the
0098  * bi-directional flag, which is not offially part of the CRAT spec, and
0099  * only used internally in KFD)
0100  */
0101 #define HSA_IOLINK_FLAGS_ENABLED        (1 << 0)
0102 #define HSA_IOLINK_FLAGS_NON_COHERENT       (1 << 1)
0103 #define HSA_IOLINK_FLAGS_NO_ATOMICS_32_BIT  (1 << 2)
0104 #define HSA_IOLINK_FLAGS_NO_ATOMICS_64_BIT  (1 << 3)
0105 #define HSA_IOLINK_FLAGS_NO_PEER_TO_PEER_DMA    (1 << 4)
0106 #define HSA_IOLINK_FLAGS_RESERVED       0xffffffe0
0107 
0108 #endif