Lines Matching +full:cs +full:- +full:number

1 /* SPDX-License-Identifier: GPL-2.0
3 * Copyright 2016-2019 HabanaLabs, Ltd.
19 #include <linux/dma-direction.h>
27 #include <linux/io-64-nonatomic-lo-hi.h>
33 * bits[63:61] - Encode mmap type
34 * bits[45:0] - mmap offset value
39 #define HL_MMAP_TYPE_SHIFT (61 - PAGE_SHIFT)
81 * enum hl_mmu_page_table_locaion - mmu page table location
82 * @MMU_DR_PGT: page-table is located on device DRAM.
83 * @MMU_HR_PGT: page-table is located on host memory.
84 * @MMU_NUM_PGT_LOCATIONS: number of page-table locations currently supported.
87 MMU_DR_PGT = 0, /* device-dram-resident MMU PGT */
106 #define IS_POWER_OF_2(n) (n != 0 && ((n & (n - 1)) == 0))
116 * - HL_RESET_HARD
120 * - HL_RESET_FROM_RESET_THREAD
121 * Set if the caller is the hard-reset thread
123 * - HL_RESET_HEARTBEAT
126 * - HL_RESET_TDR
129 * - HL_RESET_DEVICE_RELEASE
132 * - HL_RESET_FW
146 * struct hl_gen_wait_properties - properties for generating a wait CB
166 * struct pgt_info - MMU hop page info.
167 * @node: hash linked-list node for the pgts shadow hash of pgts.
190 * enum hl_pci_match_mode - pci match mode per region
200 * enum hl_fw_component - F/W components to read version through registers.
212 * enum hl_fw_types - F/W types present in the system
215 * @FW_TYPE_PREBOOT_CPU: Indicates pre-loaded CPUs are present in the system
228 * enum hl_queue_type - Supported QUEUE types.
256 * struct hl_inbound_pci_region - inbound region descriptor
272 * struct hl_outbound_pci_region - outbound region descriptor
282 * enum queue_cb_alloc_flags - Indicates queue support for CBs that
293 * struct hl_hw_sob - H/W SOB info.
317 * struct hw_queue_properties - queue information.
337 * enum vm_type - virtual memory mapping request information.
347 * enum hl_device_hw_state - H/W device state. use this to understand whether
361 * struct hl_mmu_properties - ASIC specific MMU address translation properties.
402 * struct hl_hints_range - hint addresses reserved va range.
412 * struct asic_fixed_properties - ASIC specific immutable properties.
414 * @cpucp_info: received various information from CPU-CP regarding the H/W, e.g.
416 * @uboot_ver: F/W U-boot version.
428 * @sram_user_base_address - SRAM physical start address for user access.
457 * @max_asid: maximum number of open contexts (ASIDs).
458 * @num_of_events: number of possible internal H/W IRQs.
465 * @cb_pool_cb_cnt: number of CBs in the CB pool.
496 * @user_interrupt_count: number of user interrupts.
500 * @completion_queues_count: number of completion queues.
509 * @num_functional_hbms: number of functional HBMs in each DCORE.
596 * struct hl_fence - software synchronization primitive
601 * masters QIDs that multi cs is waiting on
615 * struct hl_cs_compl - command submission completion object.
619 * @hw_sob: the H/W SOB used in this signal/wait CS.
621 * @cs_seq: command submission sequence number.
622 * @type: type of the CS - signal/wait.
623 * @sob_val: the SOB value that is used in this signal/wait CS.
624 * @sob_group: the SOB group that is used in this collective wait CS.
625 * @encaps_signals: indication whether it's a completion object of cs with
646 * struct hl_cb_mgr - describes a Command Buffer Manager.
656 * struct hl_cb - describes a Command Buffer.
670 * @cs_cnt: holds number of CS that this CB participates in.
720 /* Host <-> CPU-CP shared memory size */
724 * struct hl_sync_stream_properties -
751 * struct hl_encaps_signals_mgr - describes sync stream encapsulated signals
762 * struct hl_hw_queue - describes a H/W transport queue.
773 * @msi_vec: the IRQ number of the H/W queue.
774 * @int_queue_len: length of internal queue (number of entries).
797 * struct hl_cq - describes a completion queue
819 * struct hl_user_interrupt - holds user interrupt information
833 * struct hl_user_pending_interrupt - holds a context to a user thread
844 * struct hl_eq - describes the event queue (single one per device)
870 * enum hl_asic_type - supported ASIC types.
874 * @ASIC_GAUDI_SEC: Gaudi secured device (HL-2000).
886 * enum hl_pm_mng_profile - power management profile.
898 * enum hl_pll_frequency - PLL frequency.
927 * struct pci_mem_region - describe memory region in a PCI bar
945 * struct static_fw_load_mgr - static FW load manager
948 * @kmd_msg_to_cpu_reg: register address for KDM->CPU messages
977 * struct fw_response - FW response to LKD command
989 * struct dynamic_fw_load_mgr - dynamic FW load manager
1005 * struct fw_image_props - properties of FW image
1017 * struct fw_load_mgr - manager FW loading process
1045 * struct hl_asic_funcs - ASIC specific functions that are can be called from
1049 * @late_init: sets up late driver/hw state (post hw_init) - Optional.
1050 * @late_fini: tears down what was done in late_init (pre hw_fini) - Optional.
1057 * hw_fini and before CS rollback.
1062 * @pqe_write: Write the PQ entry to the PQ. This is ASIC-specific
1083 * @hl_dma_unmap_sg: DMA unmap scatter-gather list.
1085 * @asic_dma_map_sg: DMA map scatter-gather list.
1086 * @get_dma_desc_list_size: get number of LIN_DMA packets required for CB.
1098 * @handle_eqe: handle event queue entry (IRQ) from CPU-CP.
1106 * ASID-VA-size mask.
1107 * @send_heartbeat: send is-alive packet to CPU-CP and verify response.
1145 * and place them in the relevant cs jobs
1146 * @collective_wait_create_jobs: allocate collective wait cs jobs
1149 * @descramble_addr: Routine to de-scramble the address prior of
1159 * after every hard-reset of the device
1160 * @get_msi_info: Retrieve asic-specific MSI ID of the f/w async event
1278 int (*collective_wait_init_cs)(struct hl_cs *cs);
1280 struct hl_ctx *ctx, struct hl_cs *cs,
1309 * enum hl_va_range_type - virtual address range type.
1322 * struct hl_va_range - virtual addresses range.
1338 * struct hl_cs_counters_atomic - command submission counters
1343 * @max_cs_in_flight_drop_cnt: dropped due to maximum CS in-flight
1356 * struct hl_ctx - user/kernel context.
1363 * this hits 0l. It is incremented on CS and CS_WAIT.
1364 * @cs_pending: array of hl fence objects representing pending CS.
1376 * @cs_sequence: sequence number for CS. Value is assigned to a CS and passed
1377 * to user so user could inquire about CS. It is used as
1420 * struct hl_ctx_mgr - for handling multiple contexts.
1436 * struct hl_userptr - memory mapping chunk information
1438 * @job_node: linked-list node for hanging the object on the Job's list.
1441 * @sgt: pointer to the scatter-gather table that holds the pages.
1445 * @addr: user-space virtual address of the start of the memory area.
1464 * struct hl_cs - command submission.
1466 * @ctx: the context this CS belongs to.
1467 * @job_list: list of the CS's jobs in the various queues.
1468 * @job_lock: spinlock for the CS's jobs list. Needed for free_job.
1469 * @refcount: reference counter for usage of the CS.
1470 * @fence: pointer to the fence object of this CS.
1471 * @signal_fence: pointer to the fence object of the signal CS (used by wait
1472 * CS only).
1473 * @finish_work: workqueue object to run when CS is completed by H/W.
1476 * @staged_cs_node: node in the staged cs list.
1479 * @sequence: the sequence number of this CS.
1480 * @staged_sequence: the sequence of the staged submission this CS is part of,
1482 * @timeout_jiffies: cs timeout in jiffies.
1483 * @submission_time_jiffies: submission time of the cs
1485 * @encaps_sig_hdl_id: encaps signals handle id, set for the first staged cs.
1486 * @submitted: true if CS was submitted to H/W.
1487 * @completed: true if CS was completed by device.
1488 * @timedout : true if CS was timedout.
1489 * @tdr_active: true if TDR was activated for this CS (to prevent
1491 * @aborted: true if CS was aborted due to some device error.
1493 * @staged_last: true if this is the last staged CS and needs completion.
1494 * @staged_first: true if this is the first staged CS and we need to receive
1495 * timeout for this CS.
1496 * @staged_cs: true if this CS is part of a staged submission.
1499 * @encaps_signals: true if this CS has encaps reserved signals.
1535 * struct hl_cs_job - command submission job.
1536 * @cs_node: the node to hang on the CS jobs list.
1537 * @cs: the CS this job belongs to.
1542 * @userptr_list: linked-list of userptr mappings that belong to this job and
1545 * @refcount: reference counter for usage of the CS job.
1547 * @id: the id of this job inside a CS.
1554 * handle to a kernel-allocated CB object, false
1565 struct hl_cs *cs; member
1583 * struct hl_cs_parser - command submission parser properties.
1587 * @job_userptr_list: linked-list of userptr mappings that belong to the related
1589 * @cs_sequence: the sequence number of the related CS.
1591 * @ctx_id: the ID of the context the related CS belongs to.
1595 * @job_id: the id of the related job inside the related CS.
1597 * handle to a kernel-allocated CB object, false
1605 * @completion: true if we need completion for this CS.
1628 * struct hl_vm_hash_node - hash element from virtual address to virtual
1642 * struct hl_vm_hw_block_list_node - list element from user virtual address to
1659 * struct hl_vm_phys_pg_pack - physical page pack.
1664 * @mapping_cnt: number of shared mappings.
1689 * struct hl_vm_va_block - virtual range block information.
1703 * struct hl_vm - virtual memory manager for MMU.
1725 * struct hl_debug_params - Coresight debug parameters.
1747 * struct hl_fpriv - process information stored in FD private data.
1756 * @refcount: number of related contexts.
1780 * struct hl_info_list - debugfs file ops.
1793 * struct hl_debugfs_entry - debugfs dentry wrapper.
1803 * struct hl_dbg_device_entry - ASIC specific debugfs manager.
1820 * @state_dump: data of the system states in case of a bad cs.
1861 * struct hl_hw_obj_name_entry - single hw object name, member of
1914 * struct hl_mon_state_dump - represents a state dump of a single monitor
1932 * struct hl_sync_to_engine_map_entry - sync object id to engine mapping entry
1945 * struct hl_sync_to_engine_map - maps sync object id to associated engine id
1954 * struct hl_state_dump_specs_funcs - virtual functions used by the state dump
1976 * struct hl_state_dump_specs - defines ASIC known hw objects names
2012 #define RREG32(reg) hdev->asic_funcs->rreg(hdev, (reg))
2013 #define WREG32(reg, v) hdev->asic_funcs->wreg(hdev, (reg), (v))
2015 hdev->asic_funcs->rreg(hdev, (reg)))
2050 if (hdev->pdev) \
2068 (cond) ? 0 : -ETIMEDOUT; \
2081 * might need to be byte-swapped before returning value to caller.
2087 if (hdev->pdev) \
2111 (cond) ? 0 : -ETIMEDOUT; \
2118 if (hdev->pdev) \
2136 (cond) ? 0 : -ETIMEDOUT; \
2142 * struct hl_device_reset_work - reset workqueue task wrapper.
2156 * struct hr_mmu_hop_addrs - used for holding per-device host-resident mmu hop
2159 * @phys-addr: the physical address of the hop (used by the device-mmu).
2169 * struct hl_mmu_hr_pgt_priv - used for holding per-device mmu host-resident
2170 * page-table internal information.
2180 * struct hl_mmu_dr_pgt_priv - used for holding per-device mmu device-resident
2181 * page-table internal information.
2191 * struct hl_mmu_priv - used for holding per-device mmu internal information.
2192 * @dr: information on the device-resident MMU, when exists.
2193 * @hr: information on the host-resident MMU, when exists.
2201 * struct hl_mmu_per_hop_info - A structure describing one TLB HOP and its entry
2215 * struct hl_mmu_hop_info - A structure describing the TLB hops and their
2216 * hop-entries that were created in order to translate a virtual address to a
2219 * address replaces the original virtual-address when mapped
2221 * @unscrambled_paddr: The un-scrambled physical address.
2222 * @hop_info: Array holding the per-hop information used for the translation.
2223 * @used_hops: The number of hops used for the translation.
2235 * struct hl_mmu_funcs - Device related MMU functions.
2245 * @get_tlb_info: returns the list of hops and hop-entries used that were
2267 * number of user contexts allowed to call wait_for_multi_cs ioctl in
2273 * struct multi_cs_completion - multi CS wait completion.
2274 * @completion: completion of any of the CS in the list
2276 * @timestamp: timestamp for the multi-CS completion
2277 * @stream_master_qid_map: bitmap of all stream masters on which the multi-CS
2290 * struct multi_cs_data - internal data for multi CS call
2293 * @seq_arr: array of CS sequence numbers
2294 * @timeout_us: timeout in usec for waiting for CS to complete
2295 * @timestamp: timestamp of first completed CS
2296 * @wait_status: wait for CS status
2297 * @completion_bitmap: bitmap of completed CSs (1- completed, otherwise 0)
2299 * multi-CS is waiting
2301 * @gone_cs: indication of gone CS (1- there was gone CS, otherwise 0)
2302 * @update_ts: update timestamp. 1- update the timestamp, otherwise 0.
2319 * struct hl_device - habanalabs device structure.
2330 * @work_heartbeat: delayed work for CPU-CP is-alive check.
2347 * @cs_mirror_list: CS mirror list for TDR.
2350 * @event_queue: event queue for IRQ from CPU-CP.
2352 * @cpu_accessible_dma_mem: Host <-> CPU-CP shared memory CPU address.
2353 * @cpu_accessible_dma_address: Host <-> CPU-CP shared memory DMA address.
2354 * @cpu_accessible_dma_pool: Host <-> CPU-CP shared memory pool.
2357 * @send_cpu_message_lock: enforces only one message in Host <-> CPU-CP queue.
2378 * @aggregated_cs_counters: aggregated cs counters among all contexts
2379 * @mmu_priv: device-specific MMU data.
2380 * @mmu_func: device-related MMU functions.
2384 * @multi_cs_completion: array of multi-CS completion.
2386 * @timeout_jiffies: device CS timeout value.
2388 * value is saved so in case of hard-reset, the driver will restore
2389 * this value and update the F/W after the re-initialization
2391 * different engines. See debugfs-driver-habanalabs for
2403 * @open_counter: number of successful device open operations.
2410 * @soft_reset_cnt: number of soft reset since the driver was loaded.
2411 * @hard_reset_cnt: number of hard reset since the driver was loaded.
2415 * @cpu_pci_msb_addr: 50-bit extension bits for the device CPU's 40-bit
2421 * @heartbeat: is heartbeat sanity check towards CPU-CP enabled.
2422 * @reset_on_lockup: true if a reset should be done in case of stuck CS, false
2426 * such as context-switch, context close, page free, etc.
2434 * @power9_64bit_dma_enable: true to enable 64-bit DMA mask support. Relevant
2448 * @process_kill_trial_cnt: number of trials reset thread tried killing
2455 * @skip_reset_on_timeout: Skip device reset if CS has timed out, wait for it to
2461 * @supports_wait_for_multi_cs: true if wait for multi CS is supported
2587 /* Parameters for bring-up */
2608 * struct hl_cs_encaps_sig_handle - encapsulated signals handle structure
2610 * wait cs are used to wait of the reserved encaps signals.
2613 * @cs_seq: staged cs sequence which contains encapsulated signals
2617 * @count: signals number
2635 * typedef hl_ioctl_t - typedef for ioctl function in the driver
2645 * struct hl_ioctl_desc - describes an IOCTL entry of the driver.
2660 * hl_get_sg_info() - get number of pages and the DMA address from SG list.
2664 * Calculate the number of consecutive pages described by the SG list. Take the
2666 * to the number of needed pages.
2672 return ((((*dma_addr) & (PAGE_SIZE - 1)) + sg_dma_len(sg)) + in hl_get_sg_info()
2673 (PAGE_SIZE - 1)) >> PAGE_SHIFT; in hl_get_sg_info()
2677 * hl_mem_area_inside_range() - Checks whether address+size are inside a range.
2699 * hl_mem_area_crosses_range() - Checks whether address+size crossing a range.
2743 int hl_hw_queue_schedule_cs(struct hl_cs *cs);
2746 void hl_hw_queue_update_ci(struct hl_cs *cs);
2750 #define hl_pi_2_offset(pi) ((pi) & (HL_QUEUE_LENGTH - 1))
2826 void cs_get(struct hl_cs *cs);
2827 bool cs_needs_completion(struct hl_cs *cs);
2828 bool cs_needs_timeout(struct hl_cs *cs);
2829 bool is_staged_cs_last_exists(struct hl_device *hdev, struct hl_cs *cs);
2963 struct hl_cs *cs, struct hl_cs_job *job,
2989 void hl_debugfs_add_cs(struct hl_cs *cs);
2990 void hl_debugfs_remove_cs(struct hl_cs *cs);
3035 static inline void hl_debugfs_add_cs(struct hl_cs *cs) in hl_debugfs_add_cs() argument
3039 static inline void hl_debugfs_remove_cs(struct hl_cs *cs) in hl_debugfs_remove_cs() argument