Lines Matching defs:hdev

20  * @hdev: pointer to hl_device structure.
28 int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name,
36 rc = request_firmware(&fw, fw_name, hdev->dev);
38 dev_err(hdev->dev, "Firmware file %s is not found!\n", fw_name);
44 dev_err(hdev->dev, "Illegal %s firmware size %zu\n",
50 dev_dbg(hdev->dev, "%s firmware size == %zu\n", fw_name, fw_size);
53 dev_err(hdev->dev,
69 int hl_fw_send_pci_access_msg(struct hl_device *hdev, u32 opcode)
75 return hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt,
79 int hl_fw_send_cpu_message(struct hl_device *hdev, u32 hw_queue_id, u32 *msg,
87 pkt = hdev->asic_funcs->cpu_accessible_dma_pool_alloc(hdev, len,
90 dev_err(hdev->dev,
97 mutex_lock(&hdev->send_cpu_message_lock);
99 if (hdev->disabled)
102 if (hdev->device_cpu_disabled) {
107 rc = hl_hw_queue_send_cb_no_cmpl(hdev, hw_queue_id, len, pkt_dma_addr);
109 dev_err(hdev->dev, "Failed to send CB on CPU PQ (%d)\n", rc);
113 rc = hl_poll_timeout_memory(hdev, &pkt->fence, tmp,
117 hl_hw_queue_inc_ci_kernel(hdev, hw_queue_id);
120 dev_err(hdev->dev, "Device CPU packet timeout (0x%x)\n", tmp);
121 hdev->device_cpu_disabled = true;
129 dev_err(hdev->dev, "F/W ERROR %d for CPU packet %d\n",
139 mutex_unlock(&hdev->send_cpu_message_lock);
141 hdev->asic_funcs->cpu_accessible_dma_pool_free(hdev, len, pkt);
146 int hl_fw_unmask_irq(struct hl_device *hdev, u16 event_type)
158 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
162 dev_err(hdev->dev, "failed to unmask RAZWI IRQ %d", event_type);
167 int hl_fw_unmask_irq_arr(struct hl_device *hdev, const u32 *irq_arr,
183 dev_err(hdev->dev, "too many elements in IRQ array\n");
197 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) pkt,
201 dev_err(hdev->dev, "failed to unmask IRQ array\n");
208 int hl_fw_test_cpu_queue(struct hl_device *hdev)
218 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &test_pkt,
223 dev_err(hdev->dev,
226 dev_err(hdev->dev, "CPU queue test failed, error %d\n", rc);
232 void *hl_fw_cpu_accessible_dma_pool_alloc(struct hl_device *hdev, size_t size,
237 kernel_addr = gen_pool_alloc(hdev->cpu_accessible_dma_pool, size);
239 *dma_handle = hdev->cpu_accessible_dma_address +
240 (kernel_addr - (u64) (uintptr_t) hdev->cpu_accessible_dma_mem);
245 void hl_fw_cpu_accessible_dma_pool_free(struct hl_device *hdev, size_t size,
248 gen_pool_free(hdev->cpu_accessible_dma_pool, (u64) (uintptr_t) vaddr,
252 int hl_fw_send_heartbeat(struct hl_device *hdev)
262 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &hb_pkt,
271 int hl_fw_cpucp_info_get(struct hl_device *hdev)
273 struct asic_fixed_properties *prop = &hdev->asic_prop;
281 hdev->asic_funcs->cpu_accessible_dma_pool_alloc(hdev,
285 dev_err(hdev->dev,
297 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
300 dev_err(hdev->dev,
308 rc = hl_build_hwmon_channel_info(hdev, prop->cpucp_info.sensors);
310 dev_err(hdev->dev,
317 hdev->asic_funcs->cpu_accessible_dma_pool_free(hdev,
323 int hl_fw_get_eeprom_data(struct hl_device *hdev, void *data, size_t max_size)
332 hdev->asic_funcs->cpu_accessible_dma_pool_alloc(hdev,
335 dev_err(hdev->dev,
347 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
351 dev_err(hdev->dev,
361 hdev->asic_funcs->cpu_accessible_dma_pool_free(hdev, max_size,
367 int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev,
379 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
382 dev_err(hdev->dev,
394 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
397 dev_err(hdev->dev,
408 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
411 dev_err(hdev->dev,
420 int hl_fw_cpucp_total_energy_get(struct hl_device *hdev, u64 *total_energy)
429 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
432 dev_err(hdev->dev,
443 static void fw_read_errors(struct hl_device *hdev, u32 boot_err0_reg)
461 dev_err(hdev->dev,
464 dev_err(hdev->dev, "Device boot error - FIT image corrupted\n");
466 dev_err(hdev->dev,
469 dev_warn(hdev->dev,
472 dev_warn(hdev->dev,
475 dev_err(hdev->dev,
478 dev_err(hdev->dev,
482 static void detect_cpu_boot_status(struct hl_device *hdev, u32 status)
489 dev_err(hdev->dev,
493 dev_err(hdev->dev,
497 dev_err(hdev->dev,
501 dev_err(hdev->dev,
505 dev_err(hdev->dev,
509 dev_err(hdev->dev,
513 dev_err(hdev->dev,
517 dev_err(hdev->dev,
521 dev_err(hdev->dev,
525 dev_err(hdev->dev,
532 int hl_fw_read_preboot_ver(struct hl_device *hdev, u32 cpu_boot_status_reg,
538 if (!hdev->cpu_enable)
550 hdev,
563 dev_err(hdev->dev, "Failed to read preboot version\n");
564 detect_cpu_boot_status(hdev, status);
565 fw_read_errors(hdev, boot_err0_reg);
569 hdev->asic_funcs->read_device_fw_version(hdev, FW_COMP_PREBOOT);
574 int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg,
582 dev_info(hdev->dev, "Going to wait for device boot (up to %lds)\n",
587 hdev,
595 dev_dbg(hdev->dev,
598 rc = hdev->asic_funcs->load_boot_fit_to_device(hdev);
610 hdev,
618 dev_err(hdev->dev,
629 hdev,
640 hdev->asic_funcs->read_device_fw_version(hdev, FW_COMP_UBOOT);
643 detect_cpu_boot_status(hdev, status);
648 if (!hdev->fw_loading) {
649 dev_info(hdev->dev, "Skip loading FW\n");
656 dev_info(hdev->dev,
659 rc = hdev->asic_funcs->load_firmware_to_device(hdev);
667 hdev,
675 dev_err(hdev->dev,
687 hdev,
699 dev_err(hdev->dev,
702 dev_err(hdev->dev,
710 dev_info(hdev->dev, "Successfully loaded firmware to device\n");
713 fw_read_errors(hdev, boot_err0_reg);