No conflicts!
Showing the changes to include/uapi (8 of 1129 files). Show all
Unified · Split
| @@ -673,15 +673,15 @@ __SYSCALL(__NR_madvise, sys_madvise) · 672 unmodified lines | ||
| 673 | 673 | #define __NR_remap_file_pages 234 |
| 674 | 674 | __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) |
| 675 | 675 | #define __NR_mbind 235 |
| 676 | −__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind) | |
| 676 | +__SYSCALL(__NR_mbind, sys_mbind) | |
| 677 | 677 | #define __NR_get_mempolicy 236 |
| 678 | −__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy) | |
| 678 | +__SYSCALL(__NR_get_mempolicy, sys_get_mempolicy) | |
| 679 | 679 | #define __NR_set_mempolicy 237 |
| 680 | −__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy) | |
| 680 | +__SYSCALL(__NR_set_mempolicy, sys_set_mempolicy) | |
| 681 | 681 | #define __NR_migrate_pages 238 |
| 682 | −__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages) | |
| 682 | +__SYSCALL(__NR_migrate_pages, sys_migrate_pages) | |
| 683 | 683 | #define __NR_move_pages 239 |
| 684 | −__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages) | |
| 684 | +__SYSCALL(__NR_move_pages, sys_move_pages) | |
| 685 | 685 | #endif |
| 686 | 686 | |
| 687 | 687 | #define __NR_rt_tgsigqueueinfo 240 |
| @@ -50,7 +50,7 @@ enum { CXL_CMDS }; · 49 unmodified lines | ||
| 50 | 50 | #define ___C(a, b) { b } |
| 51 | 51 | static const struct { |
| 52 | 52 | const char *name; |
| 53 | −} cxl_command_names[] = { CXL_CMDS }; | |
| 53 | +} cxl_command_names[] __attribute__((__unused__)) = { CXL_CMDS }; | |
| 54 | 54 | |
| 55 | 55 | /* |
| 56 | 56 | * Here's how this actually breaks out: |
| @@ -9,6 +9,30 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <stdint.h> |
| 10 | 10 | #endif |
| 11 | 11 | |
| 12 | +/* Driver command error status */ | |
| 13 | +enum idxd_scmd_stat { | |
| 14 | + IDXD_SCMD_DEV_ENABLED = 0x80000010, | |
| 15 | + IDXD_SCMD_DEV_NOT_ENABLED = 0x80000020, | |
| 16 | + IDXD_SCMD_WQ_ENABLED = 0x80000021, | |
| 17 | + IDXD_SCMD_DEV_DMA_ERR = 0x80020000, | |
| 18 | + IDXD_SCMD_WQ_NO_GRP = 0x80030000, | |
| 19 | + IDXD_SCMD_WQ_NO_NAME = 0x80040000, | |
| 20 | + IDXD_SCMD_WQ_NO_SVM = 0x80050000, | |
| 21 | + IDXD_SCMD_WQ_NO_THRESH = 0x80060000, | |
| 22 | + IDXD_SCMD_WQ_PORTAL_ERR = 0x80070000, | |
| 23 | + IDXD_SCMD_WQ_RES_ALLOC_ERR = 0x80080000, | |
| 24 | + IDXD_SCMD_PERCPU_ERR = 0x80090000, | |
| 25 | + IDXD_SCMD_DMA_CHAN_ERR = 0x800a0000, | |
| 26 | + IDXD_SCMD_CDEV_ERR = 0x800b0000, | |
| 27 | + IDXD_SCMD_WQ_NO_SWQ_SUPPORT = 0x800c0000, | |
| 28 | + IDXD_SCMD_WQ_NONE_CONFIGURED = 0x800d0000, | |
| 29 | + IDXD_SCMD_WQ_NO_SIZE = 0x800e0000, | |
| 30 | + IDXD_SCMD_WQ_NO_PRIV = 0x800f0000, | |
| 31 | +}; | |
| 32 | + | |
| 33 | +#define IDXD_SCMD_SOFTERR_MASK 0x80000000 | |
| 34 | +#define IDXD_SCMD_SOFTERR_SHIFT 16 | |
| 35 | + | |
| 12 | 36 | /* Descriptor flags */ |
| 13 | 37 | #define IDXD_OP_FLAG_FENCE 0x0001 |
| 14 | 38 | #define IDXD_OP_FLAG_BOF 0x0002 |
| @@ -0,0 +1,306 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | +#ifndef _UAPI_VDUSE_H_ | |
| 3 | +#define _UAPI_VDUSE_H_ | |
| 4 | + | |
| 5 | +#include <linux/types.h> | |
| 6 | + | |
| 7 | +#define VDUSE_BASE 0x81 | |
| 8 | + | |
| 9 | +/* The ioctls for control device (/dev/vduse/control) */ | |
| 10 | + | |
| 11 | +#define VDUSE_API_VERSION 0 | |
| 12 | + | |
| 13 | +/* | |
| 14 | + * Get the version of VDUSE API that kernel supported (VDUSE_API_VERSION). | |
| 15 | + * This is used for future extension. | |
| 16 | + */ | |
| 17 | +#define VDUSE_GET_API_VERSION _IOR(VDUSE_BASE, 0x00, __u64) | |
| 18 | + | |
| 19 | +/* Set the version of VDUSE API that userspace supported. */ | |
| 20 | +#define VDUSE_SET_API_VERSION _IOW(VDUSE_BASE, 0x01, __u64) | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * struct vduse_dev_config - basic configuration of a VDUSE device | |
| 24 | + * @name: VDUSE device name, needs to be NUL terminated | |
| 25 | + * @vendor_id: virtio vendor id | |
| 26 | + * @device_id: virtio device id | |
| 27 | + * @features: virtio features | |
| 28 | + * @vq_num: the number of virtqueues | |
| 29 | + * @vq_align: the allocation alignment of virtqueue's metadata | |
| 30 | + * @reserved: for future use, needs to be initialized to zero | |
| 31 | + * @config_size: the size of the configuration space | |
| 32 | + * @config: the buffer of the configuration space | |
| 33 | + * | |
| 34 | + * Structure used by VDUSE_CREATE_DEV ioctl to create VDUSE device. | |
| 35 | + */ | |
| 36 | +struct vduse_dev_config { | |
| 37 | +#define VDUSE_NAME_MAX 256 | |
| 38 | + char name[VDUSE_NAME_MAX]; | |
| 39 | + __u32 vendor_id; | |
| 40 | + __u32 device_id; | |
| 41 | + __u64 features; | |
| 42 | + __u32 vq_num; | |
| 43 | + __u32 vq_align; | |
| 44 | + __u32 reserved[13]; | |
| 45 | + __u32 config_size; | |
| 46 | + __u8 config[]; | |
| 47 | +}; | |
| 48 | + | |
| 49 | +/* Create a VDUSE device which is represented by a char device (/dev/vduse/$NAME) */ | |
| 50 | +#define VDUSE_CREATE_DEV _IOW(VDUSE_BASE, 0x02, struct vduse_dev_config) | |
| 51 | + | |
| 52 | +/* | |
| 53 | + * Destroy a VDUSE device. Make sure there are no more references | |
| 54 | + * to the char device (/dev/vduse/$NAME). | |
| 55 | + */ | |
| 56 | +#define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX]) | |
| 57 | + | |
| 58 | +/* The ioctls for VDUSE device (/dev/vduse/$NAME) */ | |
| 59 | + | |
| 60 | +/** | |
| 61 | + * struct vduse_iotlb_entry - entry of IOTLB to describe one IOVA region [start, last] | |
| 62 | + * @offset: the mmap offset on returned file descriptor | |
| 63 | + * @start: start of the IOVA region | |
| 64 | + * @last: last of the IOVA region | |
| 65 | + * @perm: access permission of the IOVA region | |
| 66 | + * | |
| 67 | + * Structure used by VDUSE_IOTLB_GET_FD ioctl to find an overlapped IOVA region. | |
| 68 | + */ | |
| 69 | +struct vduse_iotlb_entry { | |
| 70 | + __u64 offset; | |
| 71 | + __u64 start; | |
| 72 | + __u64 last; | |
| 73 | +#define VDUSE_ACCESS_RO 0x1 | |
| 74 | +#define VDUSE_ACCESS_WO 0x2 | |
| 75 | +#define VDUSE_ACCESS_RW 0x3 | |
| 76 | + __u8 perm; | |
| 77 | +}; | |
| 78 | + | |
| 79 | +/* | |
| 80 | + * Find the first IOVA region that overlaps with the range [start, last] | |
| 81 | + * and return the corresponding file descriptor. Return -EINVAL means the | |
| 82 | + * IOVA region doesn't exist. Caller should set start and last fields. | |
| 83 | + */ | |
| 84 | +#define VDUSE_IOTLB_GET_FD _IOWR(VDUSE_BASE, 0x10, struct vduse_iotlb_entry) | |
| 85 | + | |
| 86 | +/* | |
| 87 | + * Get the negotiated virtio features. It's a subset of the features in | |
| 88 | + * struct vduse_dev_config which can be accepted by virtio driver. It's | |
| 89 | + * only valid after FEATURES_OK status bit is set. | |
| 90 | + */ | |
| 91 | +#define VDUSE_DEV_GET_FEATURES _IOR(VDUSE_BASE, 0x11, __u64) | |
| 92 | + | |
| 93 | +/** | |
| 94 | + * struct vduse_config_data - data used to update configuration space | |
| 95 | + * @offset: the offset from the beginning of configuration space | |
| 96 | + * @length: the length to write to configuration space | |
| 97 | + * @buffer: the buffer used to write from | |
| 98 | + * | |
| 99 | + * Structure used by VDUSE_DEV_SET_CONFIG ioctl to update device | |
| 100 | + * configuration space. | |
| 101 | + */ | |
| 102 | +struct vduse_config_data { | |
| 103 | + __u32 offset; | |
| 104 | + __u32 length; | |
| 105 | + __u8 buffer[]; | |
| 106 | +}; | |
| 107 | + | |
| 108 | +/* Set device configuration space */ | |
| 109 | +#define VDUSE_DEV_SET_CONFIG _IOW(VDUSE_BASE, 0x12, struct vduse_config_data) | |
| 110 | + | |
| 111 | +/* | |
| 112 | + * Inject a config interrupt. It's usually used to notify virtio driver | |
| 113 | + * that device configuration space has changed. | |
| 114 | + */ | |
| 115 | +#define VDUSE_DEV_INJECT_CONFIG_IRQ _IO(VDUSE_BASE, 0x13) | |
| 116 | + | |
| 117 | +/** | |
| 118 | + * struct vduse_vq_config - basic configuration of a virtqueue | |
| 119 | + * @index: virtqueue index | |
| 120 | + * @max_size: the max size of virtqueue | |
| 121 | + * @reserved: for future use, needs to be initialized to zero | |
| 122 | + * | |
| 123 | + * Structure used by VDUSE_VQ_SETUP ioctl to setup a virtqueue. | |
| 124 | + */ | |
| 125 | +struct vduse_vq_config { | |
| 126 | + __u32 index; | |
| 127 | + __u16 max_size; | |
| 128 | + __u16 reserved[13]; | |
| 129 | +}; | |
| 130 | + | |
| 131 | +/* | |
| 132 | + * Setup the specified virtqueue. Make sure all virtqueues have been | |
| 133 | + * configured before the device is attached to vDPA bus. | |
| 134 | + */ | |
| 135 | +#define VDUSE_VQ_SETUP _IOW(VDUSE_BASE, 0x14, struct vduse_vq_config) | |
| 136 | + | |
| 137 | +/** | |
| 138 | + * struct vduse_vq_state_split - split virtqueue state | |
| 139 | + * @avail_index: available index | |
| 140 | + */ | |
| 141 | +struct vduse_vq_state_split { | |
| 142 | + __u16 avail_index; | |
| 143 | +}; | |
| 144 | + | |
| 145 | +/** | |
| 146 | + * struct vduse_vq_state_packed - packed virtqueue state | |
| 147 | + * @last_avail_counter: last driver ring wrap counter observed by device | |
| 148 | + * @last_avail_idx: device available index | |
| 149 | + * @last_used_counter: device ring wrap counter | |
| 150 | + * @last_used_idx: used index | |
| 151 | + */ | |
| 152 | +struct vduse_vq_state_packed { | |
| 153 | + __u16 last_avail_counter; | |
| 154 | + __u16 last_avail_idx; | |
| 155 | + __u16 last_used_counter; | |
| 156 | + __u16 last_used_idx; | |
| 157 | +}; | |
| 158 | + | |
| 159 | +/** | |
| 160 | + * struct vduse_vq_info - information of a virtqueue | |
| 161 | + * @index: virtqueue index | |
| 162 | + * @num: the size of virtqueue | |
| 163 | + * @desc_addr: address of desc area | |
| 164 | + * @driver_addr: address of driver area | |
| 165 | + * @device_addr: address of device area | |
| 166 | + * @split: split virtqueue state | |
| 167 | + * @packed: packed virtqueue state | |
| 168 | + * @ready: ready status of virtqueue | |
| 169 | + * | |
| 170 | + * Structure used by VDUSE_VQ_GET_INFO ioctl to get virtqueue's information. | |
| 171 | + */ | |
| 172 | +struct vduse_vq_info { | |
| 173 | + __u32 index; | |
| 174 | + __u32 num; | |
| 175 | + __u64 desc_addr; | |
| 176 | + __u64 driver_addr; | |
| 177 | + __u64 device_addr; | |
| 178 | + union { | |
| 179 | + struct vduse_vq_state_split split; | |
| 180 | + struct vduse_vq_state_packed packed; | |
| 181 | + }; | |
| 182 | + __u8 ready; | |
| 183 | +}; | |
| 184 | + | |
| 185 | +/* Get the specified virtqueue's information. Caller should set index field. */ | |
| 186 | +#define VDUSE_VQ_GET_INFO _IOWR(VDUSE_BASE, 0x15, struct vduse_vq_info) | |
| 187 | + | |
| 188 | +/** | |
| 189 | + * struct vduse_vq_eventfd - eventfd configuration for a virtqueue | |
| 190 | + * @index: virtqueue index | |
| 191 | + * @fd: eventfd, -1 means de-assigning the eventfd | |
| 192 | + * | |
| 193 | + * Structure used by VDUSE_VQ_SETUP_KICKFD ioctl to setup kick eventfd. | |
| 194 | + */ | |
| 195 | +struct vduse_vq_eventfd { | |
| 196 | + __u32 index; | |
| 197 | +#define VDUSE_EVENTFD_DEASSIGN -1 | |
| 198 | + int fd; | |
| 199 | +}; | |
| 200 | + | |
| 201 | +/* | |
| 202 | + * Setup kick eventfd for specified virtqueue. The kick eventfd is used | |
| 203 | + * by VDUSE kernel module to notify userspace to consume the avail vring. | |
| 204 | + */ | |
| 205 | +#define VDUSE_VQ_SETUP_KICKFD _IOW(VDUSE_BASE, 0x16, struct vduse_vq_eventfd) | |
| 206 | + | |
| 207 | +/* | |
| 208 | + * Inject an interrupt for specific virtqueue. It's used to notify virtio driver | |
| 209 | + * to consume the used vring. | |
| 210 | + */ | |
| 211 | +#define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32) | |
| 212 | + | |
| 213 | +/* The control messages definition for read(2)/write(2) on /dev/vduse/$NAME */ | |
| 214 | + | |
| 215 | +/** | |
| 216 | + * enum vduse_req_type - request type | |
| 217 | + * @VDUSE_GET_VQ_STATE: get the state for specified virtqueue from userspace | |
| 218 | + * @VDUSE_SET_STATUS: set the device status | |
| 219 | + * @VDUSE_UPDATE_IOTLB: Notify userspace to update the memory mapping for | |
| 220 | + * specified IOVA range via VDUSE_IOTLB_GET_FD ioctl | |
| 221 | + */ | |
| 222 | +enum vduse_req_type { | |
| 223 | + VDUSE_GET_VQ_STATE, | |
| 224 | + VDUSE_SET_STATUS, | |
| 225 | + VDUSE_UPDATE_IOTLB, | |
| 226 | +}; | |
| 227 | + | |
| 228 | +/** | |
| 229 | + * struct vduse_vq_state - virtqueue state | |
| 230 | + * @index: virtqueue index | |
| 231 | + * @split: split virtqueue state | |
| 232 | + * @packed: packed virtqueue state | |
| 233 | + */ | |
| 234 | +struct vduse_vq_state { | |
| 235 | + __u32 index; | |
| 236 | + union { | |
| 237 | + struct vduse_vq_state_split split; | |
| 238 | + struct vduse_vq_state_packed packed; | |
| 239 | + }; | |
| 240 | +}; | |
| 241 | + | |
| 242 | +/** | |
| 243 | + * struct vduse_dev_status - device status | |
| 244 | + * @status: device status | |
| 245 | + */ | |
| 246 | +struct vduse_dev_status { | |
| 247 | + __u8 status; | |
| 248 | +}; | |
| 249 | + | |
| 250 | +/** | |
| 251 | + * struct vduse_iova_range - IOVA range [start, last] | |
| 252 | + * @start: start of the IOVA range | |
| 253 | + * @last: last of the IOVA range | |
| 254 | + */ | |
| 255 | +struct vduse_iova_range { | |
| 256 | + __u64 start; | |
| 257 | + __u64 last; | |
| 258 | +}; | |
| 259 | + | |
| 260 | +/** | |
| 261 | + * struct vduse_dev_request - control request | |
| 262 | + * @type: request type | |
| 263 | + * @request_id: request id | |
| 264 | + * @reserved: for future use | |
| 265 | + * @vq_state: virtqueue state, only index field is available | |
| 266 | + * @s: device status | |
| 267 | + * @iova: IOVA range for updating | |
| 268 | + * @padding: padding | |
| 269 | + * | |
| 270 | + * Structure used by read(2) on /dev/vduse/$NAME. | |
| 271 | + */ | |
| 272 | +struct vduse_dev_request { | |
| 273 | + __u32 type; | |
| 274 | + __u32 request_id; | |
| 275 | + __u32 reserved[4]; | |
| 276 | + union { | |
| 277 | + struct vduse_vq_state vq_state; | |
| 278 | + struct vduse_dev_status s; | |
| 279 | + struct vduse_iova_range iova; | |
| 280 | + __u32 padding[32]; | |
| 281 | + }; | |
| 282 | +}; | |
| 283 | + | |
| 284 | +/** | |
| 285 | + * struct vduse_dev_response - response to control request | |
| 286 | + * @request_id: corresponding request id | |
| 287 | + * @result: the result of request | |
| 288 | + * @reserved: for future use, needs to be initialized to zero | |
| 289 | + * @vq_state: virtqueue state | |
| 290 | + * @padding: padding | |
| 291 | + * | |
| 292 | + * Structure used by write(2) on /dev/vduse/$NAME. | |
| 293 | + */ | |
| 294 | +struct vduse_dev_response { | |
| 295 | + __u32 request_id; | |
| 296 | +#define VDUSE_REQ_RESULT_OK 0x00 | |
| 297 | +#define VDUSE_REQ_RESULT_FAILED 0x01 | |
| 298 | + __u32 result; | |
| 299 | + __u32 reserved[4]; | |
| 300 | + union { | |
| 301 | + struct vduse_vq_state vq_state; | |
| 302 | + __u32 padding[32]; | |
| 303 | + }; | |
| 304 | +}; | |
| 305 | + | |
| 306 | +#endif /* _UAPI_VDUSE_H_ */ | |
| @@ -54,9 +54,18 @@ · 53 unmodified lines | ||
| 54 | 54 | #define VIRTIO_ID_SOUND 25 /* virtio sound */ |
| 55 | 55 | #define VIRTIO_ID_FS 26 /* virtio filesystem */ |
| 56 | 56 | #define VIRTIO_ID_PMEM 27 /* virtio pmem */ |
| 57 | +#define VIRTIO_ID_RPMB 28 /* virtio rpmb */ | |
| 57 | 58 | #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */ |
| 59 | +#define VIRTIO_ID_VIDEO_ENCODER 30 /* virtio video encoder */ | |
| 60 | +#define VIRTIO_ID_VIDEO_DECODER 31 /* virtio video decoder */ | |
| 58 | 61 | #define VIRTIO_ID_SCMI 32 /* virtio SCMI */ |
| 62 | +#define VIRTIO_ID_NITRO_SEC_MOD 33 /* virtio nitro secure module*/ | |
| 59 | 63 | #define VIRTIO_ID_I2C_ADAPTER 34 /* virtio i2c adapter */ |
| 64 | +#define VIRTIO_ID_WATCHDOG 35 /* virtio watchdog */ | |
| 65 | +#define VIRTIO_ID_CAN 36 /* virtio can */ | |
| 66 | +#define VIRTIO_ID_DMABUF 37 /* virtio dmabuf */ | |
| 67 | +#define VIRTIO_ID_PARAM_SERV 38 /* virtio parameter server */ | |
| 68 | +#define VIRTIO_ID_AUDIO_POLICY 39 /* virtio audio policy */ | |
| 60 | 69 | #define VIRTIO_ID_BT 40 /* virtio bluetooth */ |
| 61 | 70 | #define VIRTIO_ID_GPIO 41 /* virtio gpio */ |
| 62 | 71 | |
| @@ -9,13 +9,14 @@ · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * enum virtio_pcidev_ops - virtual PCI device operations |
| 12 | + * @VIRTIO_PCIDEV_OP_RESERVED: reserved to catch errors | |
| 12 | 13 | * @VIRTIO_PCIDEV_OP_CFG_READ: read config space, size is 1, 2, 4 or 8; |
| 13 | 14 | * the @data field should be filled in by the device (in little endian). |
| 14 | 15 | * @VIRTIO_PCIDEV_OP_CFG_WRITE: write config space, size is 1, 2, 4 or 8; |
| 15 | 16 | * the @data field contains the data to write (in little endian). |
| 16 | − * @VIRTIO_PCIDEV_OP_BAR_READ: read BAR mem/pio, size can be variable; | |
| 17 | + * @VIRTIO_PCIDEV_OP_MMIO_READ: read BAR mem/pio, size can be variable; | |
| 17 | 18 | * the @data field should be filled in by the device (in little endian). |
| 18 | − * @VIRTIO_PCIDEV_OP_BAR_WRITE: write BAR mem/pio, size can be variable; | |
| 19 | + * @VIRTIO_PCIDEV_OP_MMIO_WRITE: write BAR mem/pio, size can be variable; | |
| 19 | 20 | * the @data field contains the data to write (in little endian). |
| 20 | 21 | * @VIRTIO_PCIDEV_OP_MMIO_MEMSET: memset MMIO, size is variable but |
| 21 | 22 | * the @data field only has one byte (unlike @VIRTIO_PCIDEV_OP_MMIO_WRITE) |
| @@ -97,7 +97,8 @@ enum virtio_vsock_shutdown { · 96 unmodified lines | ||
| 97 | 97 | |
| 98 | 98 | /* VIRTIO_VSOCK_OP_RW flags values */ |
| 99 | 99 | enum virtio_vsock_rw { |
| 100 | − VIRTIO_VSOCK_SEQ_EOR = 1, | |
| 100 | + VIRTIO_VSOCK_SEQ_EOM = 1, | |
| 101 | + VIRTIO_VSOCK_SEQ_EOR = 2, | |
| 101 | 102 | }; |
| 102 | 103 | |
| 103 | 104 | #endif /* _UAPI_LINUX_VIRTIO_VSOCK_H */ |
| @@ -276,7 +276,17 @@ enum hl_device_status { · 275 unmodified lines | ||
| 276 | 276 | HL_DEVICE_STATUS_OPERATIONAL, |
| 277 | 277 | HL_DEVICE_STATUS_IN_RESET, |
| 278 | 278 | HL_DEVICE_STATUS_MALFUNCTION, |
| 279 | − HL_DEVICE_STATUS_NEEDS_RESET | |
| 279 | + HL_DEVICE_STATUS_NEEDS_RESET, | |
| 280 | + HL_DEVICE_STATUS_IN_DEVICE_CREATION, | |
| 281 | + HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_DEVICE_CREATION | |
| 282 | +}; | |
| 283 | + | |
| 284 | +enum hl_server_type { | |
| 285 | + HL_SERVER_TYPE_UNKNOWN = 0, | |
| 286 | + HL_SERVER_GAUDI_HLS1 = 1, | |
| 287 | + HL_SERVER_GAUDI_HLS1H = 2, | |
| 288 | + HL_SERVER_GAUDI_TYPE1 = 3, | |
| 289 | + HL_SERVER_GAUDI_TYPE2 = 4 | |
| 280 | 290 | }; |
| 281 | 291 | |
| 282 | 292 | /* Opcode for management ioctl |
| @@ -337,17 +347,49 @@ enum hl_device_status { · 54 unmodified lines | ||
| 337 | 347 | #define HL_INFO_VERSION_MAX_LEN 128 |
| 338 | 348 | #define HL_INFO_CARD_NAME_MAX_LEN 16 |
| 339 | 349 | |
| 350 | +/** | |
| 351 | + * struct hl_info_hw_ip_info - hardware information on various IPs in the ASIC | |
| 352 | + * @sram_base_address: The first SRAM physical base address that is free to be | |
| 353 | + * used by the user. | |
| 354 | + * @dram_base_address: The first DRAM virtual or physical base address that is | |
| 355 | + * free to be used by the user. | |
| 356 | + * @dram_size: The DRAM size that is available to the user. | |
| 357 | + * @sram_size: The SRAM size that is available to the user. | |
| 358 | + * @num_of_events: The number of events that can be received from the f/w. This | |
| 359 | + * is needed so the user can what is the size of the h/w events | |
| 360 | + * array he needs to pass to the kernel when he wants to fetch | |
| 361 | + * the event counters. | |
| 362 | + * @device_id: PCI device ID of the ASIC. | |
| 363 | + * @module_id: Module ID of the ASIC for mezzanine cards in servers | |
| 364 | + * (From OCP spec). | |
| 365 | + * @first_available_interrupt_id: The first available interrupt ID for the user | |
| 366 | + * to be used when it works with user interrupts. | |
| 367 | + * @server_type: Server type that the Gaudi ASIC is currently installed in. | |
| 368 | + * The value is according to enum hl_server_type | |
| 369 | + * @cpld_version: CPLD version on the board. | |
| 370 | + * @psoc_pci_pll_nr: PCI PLL NR value. Needed by the profiler in some ASICs. | |
| 371 | + * @psoc_pci_pll_nf: PCI PLL NF value. Needed by the profiler in some ASICs. | |
| 372 | + * @psoc_pci_pll_od: PCI PLL OD value. Needed by the profiler in some ASICs. | |
| 373 | + * @psoc_pci_pll_div_factor: PCI PLL DIV factor value. Needed by the profiler | |
| 374 | + * in some ASICs. | |
| 375 | + * @tpc_enabled_mask: Bit-mask that represents which TPCs are enabled. Relevant | |
| 376 | + * for Goya/Gaudi only. | |
| 377 | + * @dram_enabled: Whether the DRAM is enabled. | |
| 378 | + * @cpucp_version: The CPUCP f/w version. | |
| 379 | + * @card_name: The card name as passed by the f/w. | |
| 380 | + * @dram_page_size: The DRAM physical page size. | |
| 381 | + */ | |
| 340 | 382 | struct hl_info_hw_ip_info { |
| 341 | 383 | __u64 sram_base_address; |
| 342 | 384 | __u64 dram_base_address; |
| 343 | 385 | __u64 dram_size; |
| 344 | 386 | __u32 sram_size; |
| 345 | 387 | __u32 num_of_events; |
| 346 | − __u32 device_id; /* PCI Device ID */ | |
| 347 | − __u32 module_id; /* For mezzanine cards in servers (From OCP spec.) */ | |
| 388 | + __u32 device_id; | |
| 389 | + __u32 module_id; | |
| 348 | 390 | __u32 reserved; |
| 349 | 391 | __u16 first_available_interrupt_id; |
| 350 | − __u16 reserved2; | |
| 392 | + __u16 server_type; | |
| 351 | 393 | __u32 cpld_version; |
| 352 | 394 | __u32 psoc_pci_pll_nr; |
| 353 | 395 | __u32 psoc_pci_pll_nf; |
| @@ -358,7 +400,7 @@ struct hl_info_hw_ip_info { · 4 unmodified lines | ||
| 358 | 400 | __u8 pad[2]; |
| 359 | 401 | __u8 cpucp_version[HL_INFO_VERSION_MAX_LEN]; |
| 360 | 402 | __u8 card_name[HL_INFO_CARD_NAME_MAX_LEN]; |
| 361 | − __u64 reserved3; | |
| 403 | + __u64 reserved2; | |
| 362 | 404 | __u64 dram_page_size; |
| 363 | 405 | }; |
| 364 | 406 | |
| @@ -628,12 +670,21 @@ struct hl_cs_chunk { · 263 unmodified lines | ||
| 628 | 670 | __u64 cb_handle; |
| 629 | 671 | |
| 630 | 672 | /* Relevant only when HL_CS_FLAGS_WAIT or |
| 631 | − * HL_CS_FLAGS_COLLECTIVE_WAIT is set. | |
| 673 | + * HL_CS_FLAGS_COLLECTIVE_WAIT is set | |
| 632 | 674 | * This holds address of array of u64 values that contain |
| 633 | − * signal CS sequence numbers. The wait described by this job | |
| 634 | − * will listen on all those signals (wait event per signal) | |
| 675 | + * signal CS sequence numbers. The wait described by | |
| 676 | + * this job will listen on all those signals | |
| 677 | + * (wait event per signal) | |
| 635 | 678 | */ |
| 636 | 679 | __u64 signal_seq_arr; |
| 680 | + | |
| 681 | + /* | |
| 682 | + * Relevant only when HL_CS_FLAGS_WAIT or | |
| 683 | + * HL_CS_FLAGS_COLLECTIVE_WAIT is set | |
| 684 | + * along with HL_CS_FLAGS_ENCAP_SIGNALS. | |
| 685 | + * This is the CS sequence which has the encapsulated signals. | |
| 686 | + */ | |
| 687 | + __u64 encaps_signal_seq; | |
| 637 | 688 | }; |
| 638 | 689 | |
| 639 | 690 | /* Index of queue to put the CB on */ |
| @@ -651,6 +702,17 @@ struct hl_cs_chunk { · 11 unmodified lines | ||
| 651 | 702 | * Number of entries in signal_seq_arr |
| 652 | 703 | */ |
| 653 | 704 | __u32 num_signal_seq_arr; |
| 705 | + | |
| 706 | + /* Relevant only when HL_CS_FLAGS_WAIT or | |
| 707 | + * HL_CS_FLAGS_COLLECTIVE_WAIT is set along | |
| 708 | + * with HL_CS_FLAGS_ENCAP_SIGNALS | |
| 709 | + * This set the signals range that the user want to wait for | |
| 710 | + * out of the whole reserved signals range. | |
| 711 | + * e.g if the signals range is 20, and user don't want | |
| 712 | + * to wait for signal 8, so he set this offset to 7, then | |
| 713 | + * he call the API again with 9 and so on till 20. | |
| 714 | + */ | |
| 715 | + __u32 encaps_signal_offset; | |
| 654 | 716 | }; |
| 655 | 717 | |
| 656 | 718 | /* HL_CS_CHUNK_FLAGS_* */ |
| @@ -678,6 +740,28 @@ struct hl_cs_chunk { · 21 unmodified lines | ||
| 678 | 740 | #define HL_CS_FLAGS_CUSTOM_TIMEOUT 0x200 |
| 679 | 741 | #define HL_CS_FLAGS_SKIP_RESET_ON_TIMEOUT 0x400 |
| 680 | 742 | |
| 743 | +/* | |
| 744 | + * The encapsulated signals CS is merged into the existing CS ioctls. | |
| 745 | + * In order to use this feature need to follow the below procedure: | |
| 746 | + * 1. Reserve signals, set the CS type to HL_CS_FLAGS_RESERVE_SIGNALS_ONLY | |
| 747 | + * the output of this API will be the SOB offset from CFG_BASE. | |
| 748 | + * this address will be used to patch CB cmds to do the signaling for this | |
| 749 | + * SOB by incrementing it's value. | |
| 750 | + * for reverting the reservation use HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY | |
| 751 | + * CS type, note that this might fail if out-of-sync happened to the SOB | |
| 752 | + * value, in case other signaling request to the same SOB occurred between | |
| 753 | + * reserve-unreserve calls. | |
| 754 | + * 2. Use the staged CS to do the encapsulated signaling jobs. | |
| 755 | + * use HL_CS_FLAGS_STAGED_SUBMISSION and HL_CS_FLAGS_STAGED_SUBMISSION_FIRST | |
| 756 | + * along with HL_CS_FLAGS_ENCAP_SIGNALS flag, and set encaps_signal_offset | |
| 757 | + * field. This offset allows app to wait on part of the reserved signals. | |
| 758 | + * 3. Use WAIT/COLLECTIVE WAIT CS along with HL_CS_FLAGS_ENCAP_SIGNALS flag | |
| 759 | + * to wait for the encapsulated signals. | |
| 760 | + */ | |
| 761 | +#define HL_CS_FLAGS_ENCAP_SIGNALS 0x800 | |
| 762 | +#define HL_CS_FLAGS_RESERVE_SIGNALS_ONLY 0x1000 | |
| 763 | +#define HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY 0x2000 | |
| 764 | + | |
| 681 | 765 | #define HL_CS_STATUS_SUCCESS 0 |
| 682 | 766 | |
| 683 | 767 | #define HL_MAX_JOBS_PER_CS 512 |
| @@ -690,10 +774,35 @@ struct hl_cs_in { · 6 unmodified lines | ||
| 690 | 774 | /* holds address of array of hl_cs_chunk for execution phase */ |
| 691 | 775 | __u64 chunks_execute; |
| 692 | 776 | |
| 693 | − /* Sequence number of a staged submission CS | |
| 694 | − * valid only if HL_CS_FLAGS_STAGED_SUBMISSION is set | |
| 695 | − */ | |
| 696 | − __u64 seq; | |
| 777 | + union { | |
| 778 | + /* | |
| 779 | + * Sequence number of a staged submission CS | |
| 780 | + * valid only if HL_CS_FLAGS_STAGED_SUBMISSION is set and | |
| 781 | + * HL_CS_FLAGS_STAGED_SUBMISSION_FIRST is unset. | |
| 782 | + */ | |
| 783 | + __u64 seq; | |
| 784 | + | |
| 785 | + /* | |
| 786 | + * Encapsulated signals handle id | |
| 787 | + * Valid for two flows: | |
| 788 | + * 1. CS with encapsulated signals: | |
| 789 | + * when HL_CS_FLAGS_STAGED_SUBMISSION and | |
| 790 | + * HL_CS_FLAGS_STAGED_SUBMISSION_FIRST | |
| 791 | + * and HL_CS_FLAGS_ENCAP_SIGNALS are set. | |
| 792 | + * 2. unreserve signals: | |
| 793 | + * valid when HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY is set. | |
| 794 | + */ | |
| 795 | + __u32 encaps_sig_handle_id; | |
| 796 | + | |
| 797 | + /* Valid only when HL_CS_FLAGS_RESERVE_SIGNALS_ONLY is set */ | |
| 798 | + struct { | |
| 799 | + /* Encapsulated signals number */ | |
| 800 | + __u32 encaps_signals_count; | |
| 801 | + | |
| 802 | + /* Encapsulated signals queue index (stream) */ | |
| 803 | + __u32 encaps_signals_q_idx; | |
| 804 | + }; | |
| 805 | + }; | |
| 697 | 806 | |
| 698 | 807 | /* Number of chunks in restore phase array. Maximum number is |
| 699 | 808 | * HL_MAX_JOBS_PER_CS |
| @@ -718,14 +827,31 @@ struct hl_cs_in { · 18 unmodified lines | ||
| 718 | 827 | }; |
| 719 | 828 | |
| 720 | 829 | struct hl_cs_out { |
| 830 | + union { | |
| 831 | + /* | |
| 832 | + * seq holds the sequence number of the CS to pass to wait | |
| 833 | + * ioctl. All values are valid except for 0 and ULLONG_MAX | |
| 834 | + */ | |
| 835 | + __u64 seq; | |
| 836 | + | |
| 837 | + /* Valid only when HL_CS_FLAGS_RESERVE_SIGNALS_ONLY is set */ | |
| 838 | + struct { | |
| 839 | + /* This is the resereved signal handle id */ | |
| 840 | + __u32 handle_id; | |
| 841 | + | |
| 842 | + /* This is the signals count */ | |
| 843 | + __u32 count; | |
| 844 | + }; | |
| 845 | + }; | |
| 846 | + | |
| 847 | + /* HL_CS_STATUS */ | |
| 848 | + __u32 status; | |
| 849 | + | |
| 721 | 850 | /* |
| 722 | − * seq holds the sequence number of the CS to pass to wait ioctl. All | |
| 723 | − * values are valid except for 0 and ULLONG_MAX | |
| 851 | + * SOB base address offset | |
| 852 | + * Valid only when HL_CS_FLAGS_RESERVE_SIGNALS_ONLY is set | |
| 724 | 853 | */ |
| 725 | − __u64 seq; | |
| 726 | − /* HL_CS_STATUS_* */ | |
| 727 | − __u32 status; | |
| 728 | − __u32 pad; | |
| 854 | + __u32 sob_base_addr_offset; | |
| 729 | 855 | }; |
| 730 | 856 | |
| 731 | 857 | union hl_cs_args { |
| @@ -735,11 +861,18 @@ union hl_cs_args { · 3 unmodified lines | ||
| 735 | 861 | |
| 736 | 862 | #define HL_WAIT_CS_FLAGS_INTERRUPT 0x2 |
| 737 | 863 | #define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000 |
| 864 | +#define HL_WAIT_CS_FLAGS_MULTI_CS 0x4 | |
| 865 | + | |
| 866 | +#define HL_WAIT_MULTI_CS_LIST_MAX_LEN 32 | |
| 738 | 867 | |
| 739 | 868 | struct hl_wait_cs_in { |
| 740 | 869 | union { |
| 741 | 870 | struct { |
| 742 | − /* Command submission sequence number */ | |
| 871 | + /* | |
| 872 | + * In case of wait_cs holds the CS sequence number. | |
| 873 | + * In case of wait for multi CS hold a user pointer to | |
| 874 | + * an array of CS sequence numbers | |
| 875 | + */ | |
| 743 | 876 | __u64 seq; |
| 744 | 877 | /* Absolute timeout to wait for command submission |
| 745 | 878 | * in microseconds |
| @@ -767,12 +900,17 @@ struct hl_wait_cs_in { · 21 unmodified lines | ||
| 767 | 900 | |
| 768 | 901 | /* Context ID - Currently not in use */ |
| 769 | 902 | __u32 ctx_id; |
| 903 | + | |
| 770 | 904 | /* HL_WAIT_CS_FLAGS_* |
| 771 | 905 | * If HL_WAIT_CS_FLAGS_INTERRUPT is set, this field should include |
| 772 | 906 | * interrupt id according to HL_WAIT_CS_FLAGS_INTERRUPT_MASK, in order |
| 773 | 907 | * not to specify an interrupt id ,set mask to all 1s. |
| 774 | 908 | */ |
| 775 | 909 | __u32 flags; |
| 910 | + | |
| 911 | + /* Multi CS API info- valid entries in multi-CS array */ | |
| 912 | + __u8 seq_arr_len; | |
| 913 | + __u8 pad[7]; | |
| 776 | 914 | }; |
| 777 | 915 | |
| 778 | 916 | #define HL_WAIT_CS_STATUS_COMPLETED 0 |
| @@ -789,8 +927,15 @@ struct hl_wait_cs_out { · 10 unmodified lines | ||
| 789 | 927 | __u32 status; |
| 790 | 928 | /* HL_WAIT_CS_STATUS_FLAG* */ |
| 791 | 929 | __u32 flags; |
| 792 | − /* valid only if HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD is set */ | |
| 930 | + /* | |
| 931 | + * valid only if HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD is set | |
| 932 | + * for wait_cs: timestamp of CS completion | |
| 933 | + * for wait_multi_cs: timestamp of FIRST CS completion | |
| 934 | + */ | |
| 793 | 935 | __s64 timestamp_nsec; |
| 936 | + /* multi CS completion bitmap */ | |
| 937 | + __u32 cs_completion_map; | |
| 938 | + __u32 pad; | |
| 794 | 939 | }; |
| 795 | 940 | |
| 796 | 941 | union hl_wait_cs_args { |
| @@ -813,6 +958,7 @@ union hl_wait_cs_args { · 16 unmodified lines | ||
| 813 | 958 | #define HL_MEM_CONTIGUOUS 0x1 |
| 814 | 959 | #define HL_MEM_SHARED 0x2 |
| 815 | 960 | #define HL_MEM_USERPTR 0x4 |
| 961 | +#define HL_MEM_FORCE_HINT 0x8 | |
| 816 | 962 | |
| 817 | 963 | struct hl_mem_in { |
| 818 | 964 | union { |