Lines Matching +full:required +full:- +full:for +full:- +full:hardware +full:- +full:jobs

1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
3 * Copyright 2016-2022 HabanaLabs, Ltd.
15 * Defines that are asic-specific but constitutes as ABI between kernel driver
22 * 128 SOBs reserved for collective wait
23 * 16 SOBs reserved for sync stream
28 * 64 monitors reserved for collective wait
29 * 8 monitors reserved for sync stream
190 * 2. F/W mode, where we use F/W to schedule the JOBS to the different queues.
196 * stream id is a running number from 0 up to (N-1), where N is the number
657 * enum hl_goya_dma_direction - Direction of DMA operation inside a LIN_DMA packet that is
684 * enum hl_device_status - Device status information.
716 * Notifier event values - for the notification mechanism and the HL_INFO_GET_EVENTS command
718 * HL_NOTIFIER_EVENT_TPC_ASSERT - Indicates TPC assert event
719 * HL_NOTIFIER_EVENT_UNDEFINED_OPCODE - Indicates undefined operation code
720 * HL_NOTIFIER_EVENT_DEVICE_RESET - Indicates device requires a reset
721 * HL_NOTIFIER_EVENT_CS_TIMEOUT - Indicates CS timeout error
722 * HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE - Indicates device is unavailable
723 * HL_NOTIFIER_EVENT_USER_ENGINE_ERR - Indicates device engine in error state
724 * HL_NOTIFIER_EVENT_GENERAL_HW_ERR - Indicates device HW error
725 * HL_NOTIFIER_EVENT_RAZWI - Indicates razwi happened
726 * HL_NOTIFIER_EVENT_PAGE_FAULT - Indicates page fault happened
727 * HL_NOTIFIER_EVENT_CRITICAL_HW_ERR - Indicates a HW error that requires SW abort and
729 * HL_NOTIFIER_EVENT_CRITICAL_FW_ERR - Indicates a FW error that requires SW abort and
744 /* Opcode for management ioctl
746 * HW_IP_INFO - Receive information about different IP blocks in the
748 * HL_INFO_HW_EVENTS - Receive an array describing how many times each event
750 * HL_INFO_DRAM_USAGE - Retrieve the dram usage inside the device and of the
751 * specific context. This is relevant only for devices
753 * HL_INFO_HW_IDLE - Retrieve information about the idle status of each
755 * HL_INFO_DEVICE_STATUS - Retrieve the device's status. This opcode doesn't
757 * HL_INFO_DEVICE_UTILIZATION - Retrieve the total utilization of the device
762 * HL_INFO_HW_EVENTS_AGGREGATE - Receive an array describing how many times each
764 * HL_INFO_CLK_RATE - Retrieve the current and maximum clock rate
767 * HL_INFO_RESET_COUNT - Retrieve the counts of the soft and hard reset
770 * HL_INFO_TIME_SYNC - Retrieve the device's time alongside the host's time
771 * for synchronization.
772 * HL_INFO_CS_COUNTERS - Retrieve command submission counters
773 * HL_INFO_PCI_COUNTERS - Retrieve PCI counters
774 * HL_INFO_CLK_THROTTLE_REASON - Retrieve clock throttling reason
775 * HL_INFO_SYNC_MANAGER - Retrieve sync manager info per dcore
776 * HL_INFO_TOTAL_ENERGY - Retrieve total energy consumption
777 * HL_INFO_PLL_FREQUENCY - Retrieve PLL frequency
778 * HL_INFO_POWER - Retrieve power information
779 * HL_INFO_OPEN_STATS - Retrieve info regarding recent device open calls
780 * HL_INFO_DRAM_REPLACED_ROWS - Retrieve DRAM replaced rows info
781 * HL_INFO_DRAM_PENDING_ROWS - Retrieve DRAM pending rows num
782 * HL_INFO_LAST_ERR_OPEN_DEV_TIME - Retrieve timestamp of the last time the device was opened
784 * HL_INFO_CS_TIMEOUT_EVENT - Retrieve CS timeout timestamp and its related CS sequence number.
785 * HL_INFO_RAZWI_EVENT - Retrieve parameters of razwi:
792 * HL_INFO_DEV_MEM_ALLOC_PAGE_SIZES - Retrieve valid page sizes for device memory allocation
793 * HL_INFO_SECURED_ATTESTATION - Retrieve attestation report of the boot.
794 * HL_INFO_REGISTER_EVENTFD - Register eventfd for event notifications.
795 * HL_INFO_UNREGISTER_EVENTFD - Unregister eventfd
796 * HL_INFO_GET_EVENTS - Retrieve the last occurred events
797 * HL_INFO_UNDEFINED_OPCODE_EVENT - Retrieve last undefined opcode error information.
800 * HL_INFO_ENGINE_STATUS - Retrieve the status of all the h/w engines in the asic.
801 * HL_INFO_PAGE_FAULT_EVENT - Retrieve parameters of captured page fault.
804 * HL_INFO_USER_MAPPINGS - Retrieve user mappings, captured after page fault event.
805 * HL_INFO_FW_GENERIC_REQ - Send generic request to FW.
806 * HL_INFO_HW_ERR_EVENT - Retrieve information on the reported HW error.
809 * HL_INFO_FW_ERR_EVENT - Retrieve information on the reported FW error.
852 /* Maximum buffer size for retrieving engines status */
856 * struct hl_info_hw_ip_info - hardware information on various IPs in the ASIC
868 * @module_id: Module ID of the ASIC for mezzanine cards in servers
870 * @decoder_enabled_mask: Bit-mask that represents which decoders are enabled.
871 * @first_available_interrupt_id: The first available interrupt ID for the user
873 * Relevant for Gaudi2 and later.
882 * @tpc_enabled_mask: Bit-mask that represents which TPCs are enabled. Relevant
883 * for Goya/Gaudi only.
887 * configuration. Relevant for Greco and later.
890 * @tpc_enabled_mask_ext: Bit-mask that represents which TPCs are enabled.
891 * Relevant for Greco and later.
893 * @edma_enabled_mask: Bit-mask that represents which EDMAs are enabled.
894 * Relevant for Gaudi2 and later.
896 * application to use. Relevant for Gaudi2 and later.
899 * @tpc_interrupt_id: interrupt id for TPC to use in order to raise events towards the host.
900 * @rotator_enabled_mask: Bit-mask that represents which rotators are enabled.
901 * Relevant for Gaudi3 and later.
902 * @engine_core_interrupt_reg_addr: interrupt register address for engine core to use
904 * @reserved_dram_size: DRAM size reserved for driver and firmware.
996 * struct hl_info_pci_counters - pci counters
1018 * struct hl_info_clk_throttle - clock throttling reason
1020 * @clk_throttling_timestamp_us: represents CPU timestamp in microseconds of the start-event
1031 * struct hl_info_energy - device energy information
1045 * struct hl_open_stats_info - device open statistics information
1060 * struct hl_power_info - power information
1068 * struct hl_info_sync_manager - sync manager information
1081 * struct hl_info_cs_counters - command submission counters
1090 * @total_max_cs_in_flight_drop_cnt: total dropped due to maximum CS in-flight
1091 * @ctx_max_cs_in_flight_drop_cnt: context dropped due to maximum CS in-flight
1111 * struct hl_info_last_err_open_dev_time - last error boot information.
1119 * struct hl_info_cs_timeout_event - last CS timeout information.
1138 * struct hl_info_razwi_event - razwi information.
1145 * might be common for several engines and there is no way to get the
1150 * @flags: bitmask for additional data: HL_RAZWI_READ - razwi caused by read operation
1151 * HL_RAZWI_WRITE - razwi caused by write operation
1152 * HL_RAZWI_LBW - razwi caused by lbw fabric transaction
1153 * HL_RAZWI_HBW - razwi caused by hbw fabric transaction
1154 * HL_RAZWI_RR - razwi caused by range register
1155 * HL_RAZWI_ADDR_DEC - razwi caused by address decode error
1171 * struct hl_info_undefined_opcode_event - info about last undefined opcode error
1175 * filled with values, it means the execution was in Lower-CP.
1178 * @cb_addr_streams_len: num of streams - actual len of cb_addr_streams array.
1180 * in Upper-CP (specific stream) and equal to 4 incase
1181 * of undefined opcode in Lower-CP.
1182 * @engine_id: engine-id that the error occurred on
1184 * MAX_QMAN_STREAMS_INFO it means the error occurred on a Lower-CP.
1197 * struct hl_info_hw_err_event - info about HW error
1200 * @pad: size padding for u64 granularity.
1208 /* FW error definition for event_type in struct hl_info_fw_err_event */
1215 * struct hl_info_fw_err_event - info about FW error
1216 * @timestamp: time-stamp of error occurrence
1220 * @pad: size padding for u64 granularity.
1230 * struct hl_info_dev_memalloc_page_sizes - valid page sizes in device mem alloc information.
1239 #define SEC_PCR_QUOTE_BUF_SZ 510 /* (512 - 2) 2 bytes used for size */
1240 #define SEC_SIGNATURE_BUF_SZ 255 /* (256 - 1) 1 byte used for size */
1241 #define SEC_PUB_DATA_BUF_SZ 510 /* (512 - 2) 2 bytes used for size */
1242 #define SEC_CERTIFICATE_BUF_SZ 2046 /* (2048 - 2) 2 bytes used for size */
1245 * struct hl_info_sec_attest - attestation report of the boot
1257 * @public_data: public key for the signed attestation
1259 * @certificate: certificate for the attestation signing key
1278 * struct hl_page_fault_info - page fault information.
1291 * struct hl_user_mapping - user mapping information.
1308 * struct hl_info_args - Main structure to retrieve device related information.
1312 * limits how many bytes the kernel can write. For hw_events array, the size should be
1314 * @op: Defines which type of information to be retrieved. Refer HL_INFO_* for details.
1315 * @dcore_id: DCORE id for which the information is relevant (for Gaudi refer to enum gaudi_dcores).
1317 * @period_ms: Period value, in milliseconds, for utilization rate in range 100ms - 1000ms in 100 ms
1320 * @eventfd: event file descriptor for event notifications.
1322 * driver. It is possible for the user to allocate buffer larger than
1325 * @sec_attest_nonce: Nonce number used for attestation report.
1327 * Relevant for HL_INFO_USER_MAPPINGS info ioctl.
1358 /* 2MB minus 32 bytes for 2xMSG_PROT */
1359 #define HL_MAX_CB_SIZE (0x200000 - 32)
1364 /* Used with HL_CB_OP_INFO opcode to get the device va address for kernel mapped CB */
1378 /* Context ID - Currently not in use */
1414 * CB, the user invokes - “memory ioctl” to map the user memory into a
1418 * increases the PCI-DMA queues throughput. This CB allocation method
1419 * also reduces the use of Linux DMA-able memory pool. Which are limited
1420 * and used by other Linux sub-systems.
1425 * This structure size must always be fixed to 64-bytes for backward
1431 * For external queue, this represents a Handle of CB on the
1433 * For internal queue in Goya, this represents an SRAM or
1438 * For H/W queue, this represents either a Handle of CB on the
1483 * This set the signals range that the user want to wait for
1486 * to wait for signal 8, so he set this offset to 7, then
1523 * this address will be used to patch CB cmds to do the signaling for this
1525 * for reverting the reservation use HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY
1526 * CS type, note that this might fail if out-of-sync happened to the SOB
1528 * reserve-unreserve calls.
1529 * 2. Use the staged CS to do the encapsulated signaling jobs.
1534 * to wait for the encapsulated signals.
1549 * This is a blocking operation and for this reason the user shall not use
1565 * enum hl_engine_command - engine command
1584 /* this holds address of array of hl_cs_chunk for restore phase */
1587 /* holds address of array of hl_cs_chunk for execution phase */
1593 /* this holds address of array of uint32 for engine_cores */
1605 /* this holds address of array of uint32 for engines */
1626 * Valid for two flows:
1656 /* timeout in seconds - valid only if HL_CS_FLAGS_CUSTOM_TIMEOUT
1664 /* Context ID - Currently not in use */
1673 * ioctl. All values are valid except for 0 and ULLONG_MAX
1725 * In case of wait for multi CS hold a user pointer to
1729 /* Absolute timeout to wait for command submission
1737 /* User address for completion comparison.
1753 /* Target value for completion comparison */
1758 /* Context ID - Currently not in use */
1765 * in order to wait for any CQ interrupt, set interrupt value to
1768 * in order to wait for any decoder interrupt, set interrupt value to
1775 /* Multi CS API info- valid entries in multi-CS array */
1780 /* Absolute timeout to wait for an interrupt in microseconds.
1825 * for wait_cs: timestamp of CS completion
1826 * for wait_multi_cs: timestamp of FIRST CS completion
1854 /* Opcode to create DMA-BUF object for an existing device memory allocation
1855 * and to export an FD of that DMA-BUF back to the caller
1859 /* Opcode to create timestamps pool for user interrupts registration support
1861 * will get handle to it for mmap, and another internal buffer used by the
1862 * driver for registration management
1875 * structure hl_mem_in - structure that handle input args for memory IOCTL
1878 * @flags: flags for the memory operation (one of the HL_MEM_* definitions).
1879 * For the HL_MEM_OP_EXPORT_DMABUF_FD opcode, this field holds the DMA-BUF file/FD flags.
1880 * @ctx_id: context ID - currently not in use.
1886 * structure for device memory allocation (used with the HL_MEM_OP_ALLOC op)
1897 * structure for free-ing device memory (used with the HL_MEM_OP_FREE op)
1905 * structure for mapping device memory (used with the HL_MEM_OP_MAP op)
1920 * structure for mapping host memory (used with the HL_MEM_OP_MAP op)
1937 * structure for mapping hw block (used with the HL_MEM_OP_MAP_BLOCK op)
1947 * structure for unmapping host memory (used with the HL_MEM_OP_UNMAP op)
1955 * structure for exporting DMABUF object (used with
1957 * @addr: for Gaudi1, the driver expects a physical address
1960 * for all other ASICs, the driver expects a device
1966 * @offset: for Gaudi1, this value must be 0. For all other ASICs,
1969 * address of that the exported dma-buf object describes.
1987 * Used for HL_MEM_OP_MAP as the virtual address that was
1995 * This is the assigned handle for the allocated memory
2002 * This is the assigned handle for the mapped block
2016 * DMA-BUF object that was created to describe a memory
2056 /* Two bit masks for HW event and Stimulus Port */
2063 /* Frequency for the timestamp register */
2106 /* Opcode for ETR component */
2108 /* Opcode for ETF component */
2110 /* Opcode for STM component */
2112 /* Opcode for FUNNEL component */
2114 /* Opcode for BMON component */
2116 /* Opcode for SPMU component */
2118 /* Opcode for timestamp (deprecated) */
2120 /* Opcode for setting the device into or out of debug mode. The enable
2121 * variable should be 1 for enabling debug mode and 0 for disabling it
2146 /* Context ID - Currently not in use */
2152 * - H/W IP information
2153 * - Current dram usage
2155 * The user calls this IOCTL with an opcode that describes the required
2156 * information. The user should supply a pointer to a user-allocated memory
2169 * - Request a Command Buffer
2170 * - Destroy a Command Buffer
2172 * The command buffers are memory blocks that reside in DMA-able address
2176 * When creating a new CB, the IOCTL returns a handle of it, and the user-space
2181 * indicate the driver that such a mapping is required.
2193 * of JOBS. That set of JOBS constitutes a CS object.
2197 * The CS IOCTL will receive two sets of JOBS. One set is for "restore" phase
2198 * and a second set is for "execution" phase.
2199 * The JOBS on the "restore" phase are enqueued only after context-switch
2200 * (or if its the first CS for this context). The user can also order the
2204 * There are two types of queues - external and internal. External queues
2207 * on JOBS which are enqueued in the external queues.
2210 * There is a single type of queue for all types of engines, either DMA engines
2211 * for transfers from/to the host or inside the device, or compute engines.
2212 * The driver will get completion notifications from the device for all queues.
2214 * For jobs on external queues, the user needs to create command buffers
2215 * through the CB ioctl and give the CB's handle to the CS ioctl. For jobs on
2219 * For jobs on H/W queues both options of command buffers are valid.
2222 * means it returns immediately after ALL the JOBS were enqueued on their
2227 * can use with the "Wait for CS" IOCTL to check whether the handle's CS
2228 * non-internal JOBS have been completed. Note that if the CS has internal JOBS
2229 * which can execute AFTER the external JOBS have finished, the driver might
2230 * report that the CS has finished executing BEFORE the internal JOBS have
2235 * with sequence number N-1 also finished. The user can make this assumption if
2236 * and only if CS N and CS N-1 are exactly the same (same CBs for the same
2243 * Wait for Command Submission
2247 * inside the kernel until the CS has finished or until the user-requested
2256 * EINTR - Kernel waiting has been interrupted, e.g. due to OS signal
2258 * ETIMEDOUT - The CS has caused a timeout on the device
2259 * EIO - The CS was aborted (usually because the device was reset)
2260 * ENODEV - The device wants to do hard-reset (so user need to close FD)
2265 * HL_WAIT_CS_STATUS_COMPLETED - The CS has been completed successfully (0)
2266 * HL_WAIT_CS_STATUS_BUSY - The CS is still executing (0)
2267 * HL_WAIT_CS_STATUS_TIMEDOUT - The CS has caused a timeout on the device
2269 * HL_WAIT_CS_STATUS_ABORTED - The CS was aborted, usually because the
2278 * - Map host memory to device MMU
2279 * - Unmap host memory from device MMU
2283 * For host memory, the IOCTL doesn't allocate memory. The user is supposed
2284 * to allocate the memory in user-space (malloc/new). The driver pins the
2288 * There is an option for the user to specify the requested virtual address.
2296 * - Enable/disable the ETR/ETF/FUNNEL/STM/BMON/SPMU debug traces
2309 * For each configuration request, the user needs to provide the register index
2313 * set the device into non-debug mode, i.e. disable debug mode.