Lines Matching defs:hdev

31 static int device_status_info(struct hl_device *hdev, struct hl_info_args *args)
40 dev_stat.status = hl_device_status(hdev);
46 static int hw_ip_info(struct hl_device *hdev, struct hl_info_args *args)
51 struct asic_fixed_properties *prop = &hdev->asic_prop;
62 hw_ip.device_id = hdev->asic_funcs->get_pci_id(hdev);
107 hw_ip.revision_id = hdev->pdev->revision;
116 static int hw_events_info(struct hl_device *hdev, bool aggregate,
126 arr = hdev->asic_funcs->get_events_stat(hdev, aggregate, &size);
128 dev_err(hdev->dev, "Events info not supported\n");
154 struct hl_device *hdev = hpriv->hdev;
158 struct asic_fixed_properties *prop = &hdev->asic_prop;
167 atomic64_read(&hdev->dram_used_mem);
176 static int hw_idle(struct hl_device *hdev, struct hl_info_args *args)
185 hw_idle.is_idle = hdev->asic_funcs->is_device_idle(hdev,
195 static int debug_coresight(struct hl_device *hdev, struct hl_ctx *ctx, struct hl_debug_args *args)
219 dev_err(hdev->dev, "failed to copy input debug data\n");
237 rc = hdev->asic_funcs->debug_coresight(hdev, ctx, params);
239 dev_err(hdev->dev,
246 dev_err(hdev->dev, "copy to user failed in debug ioctl\n");
260 static int device_utilization(struct hl_device *hdev, struct hl_info_args *args)
270 rc = hl_device_utilization(hdev, &device_util.utilization);
278 static int get_clk_rate(struct hl_device *hdev, struct hl_info_args *args)
288 rc = hl_fw_get_clk_rate(hdev, &clk_rate.cur_clk_rate_mhz, &clk_rate.max_clk_rate_mhz);
296 static int get_reset_count(struct hl_device *hdev, struct hl_info_args *args)
305 reset_count.hard_reset_cnt = hdev->reset_info.hard_reset_cnt;
306 reset_count.soft_reset_cnt = hdev->reset_info.compute_reset_cnt;
312 static int time_sync_info(struct hl_device *hdev, struct hl_info_args *args)
321 time_sync.device_time = hdev->asic_funcs->get_device_time(hdev);
330 struct hl_device *hdev = hpriv->hdev;
339 rc = hl_fw_cpucp_pci_counters_get(hdev, &pci_counters);
350 struct hl_device *hdev = hpriv->hdev;
359 mutex_lock(&hdev->clk_throttling.lock);
361 clk_throttle.clk_throttling_reason = hdev->clk_throttling.current_reason;
364 if (!(hdev->clk_throttling.aggregated_reason & BIT(i)))
368 ktime_to_us(hdev->clk_throttling.timestamp[i].start);
370 if (ktime_compare(hdev->clk_throttling.timestamp[i].end, zero_time))
371 end_time = hdev->clk_throttling.timestamp[i].end;
377 hdev->clk_throttling.timestamp[i].start));
380 mutex_unlock(&hdev->clk_throttling.lock);
390 struct hl_device *hdev = hpriv->hdev;
394 cntr = &hdev->aggregated_cs_counters;
439 struct hl_device *hdev = hpriv->hdev;
440 struct asic_fixed_properties *prop = &hdev->asic_prop;
465 struct hl_device *hdev = hpriv->hdev;
474 rc = hl_fw_cpucp_total_energy_get(hdev,
485 struct hl_device *hdev = hpriv->hdev;
494 rc = hl_fw_cpucp_pll_info_get(hdev, args->pll_index, freq_info.output);
504 struct hl_device *hdev = hpriv->hdev;
513 rc = hl_fw_cpucp_power_get(hdev, &power_info.power);
523 struct hl_device *hdev = hpriv->hdev;
532 hdev->last_open_session_duration_jif);
533 open_stats_info.open_counter = hdev->open_counter;
534 open_stats_info.is_compute_ctx_active = hdev->is_compute_ctx_active;
535 open_stats_info.compute_ctx_in_release = hdev->compute_ctx_in_release;
543 struct hl_device *hdev = hpriv->hdev;
552 rc = hl_fw_dram_pending_row_get(hdev, &pend_rows_num);
562 struct hl_device *hdev = hpriv->hdev;
571 rc = hl_fw_dram_replaced_row_get(hdev, &info);
581 struct hl_device *hdev = hpriv->hdev;
588 info.timestamp = ktime_to_ns(hdev->last_successful_open_ktime);
596 struct hl_device *hdev = hpriv->hdev;
603 info.seq = hdev->captured_err_info.cs_timeout.seq;
604 info.timestamp = ktime_to_ns(hdev->captured_err_info.cs_timeout.timestamp);
612 struct hl_device *hdev = hpriv->hdev;
619 razwi_info = &hdev->captured_err_info.razwi_info;
629 struct hl_device *hdev = hpriv->hdev;
637 info.timestamp = ktime_to_ns(hdev->captured_err_info.undef_opcode.timestamp);
638 info.engine_id = hdev->captured_err_info.undef_opcode.engine_id;
639 info.cq_addr = hdev->captured_err_info.undef_opcode.cq_addr;
640 info.cq_size = hdev->captured_err_info.undef_opcode.cq_size;
641 info.stream_id = hdev->captured_err_info.undef_opcode.stream_id;
642 info.cb_addr_streams_len = hdev->captured_err_info.undef_opcode.cb_addr_streams_len;
643 memcpy(info.cb_addr_streams, hdev->captured_err_info.undef_opcode.cb_addr_streams,
653 struct hl_device *hdev = hpriv->hdev;
665 info.page_order_bitmask = hdev->asic_prop.dmmu.supported_pages_mask;
691 rc = hl_fw_get_sec_attest_info(hpriv->hdev, sec_attest_info, args->sec_attest_nonce);
760 struct hl_device *hdev = hpriv->hdev;
773 hdev->asic_funcs->is_device_idle(hdev, NULL, 0, &eng_data);
776 dev_err(hdev->dev,
795 struct hl_device *hdev = hpriv->hdev;
802 pgf_info = &hdev->captured_err_info.page_fault_info;
814 struct hl_device *hdev = hpriv->hdev;
821 pgf_info = &hdev->captured_err_info.page_fault_info;
837 struct hl_device *hdev = hpriv->hdev;
845 info = &hdev->captured_err_info.hw_err;
859 struct hl_device *hdev = hpriv->hdev;
867 info = &hdev->captured_err_info.fw_err;
878 static int send_fw_generic_request(struct hl_device *hdev, struct hl_info_args *info_args)
896 dev_err(hdev->dev, "buffer size cannot exceed 1MB\n");
900 fw_buff = hl_cpu_accessible_dma_pool_alloc(hdev, size, &dma_handle);
906 dev_dbg(hdev->dev, "Failed to copy from user FW buff\n");
911 rc = hl_fw_send_generic_request(hdev, info_args->fw_sub_opcode, dma_handle, &size);
916 dev_dbg(hdev->dev, "Failed to copy to user FW generic req output\n");
921 hl_cpu_accessible_dma_pool_free(hdev, info_args->return_size, fw_buff);
931 struct hl_device *hdev = hpriv->hdev;
935 dev_dbg(hdev->dev, "Padding bytes must be 0\n");
945 return hw_ip_info(hdev, args);
948 return device_status_info(hdev, args);
951 return get_reset_count(hdev, args);
954 return hw_events_info(hdev, false, args);
957 return hw_events_info(hdev, true, args);
1010 if (!hl_device_operational(hdev, &status)) {
1013 hdev->status[status]);
1019 rc = hw_idle(hdev, args);
1023 rc = device_utilization(hdev, args);
1027 rc = get_clk_rate(hdev, args);
1031 return time_sync_info(hdev, args);
1062 return send_fw_generic_request(hdev, args);
1075 return _hl_info_ioctl(hpriv, data, hpriv->hdev->dev);
1080 return _hl_info_ioctl(hpriv, data, hpriv->hdev->dev_ctrl);
1086 struct hl_device *hdev = hpriv->hdev;
1091 if (!hl_device_operational(hdev, &status)) {
1092 dev_dbg_ratelimited(hdev->dev,
1094 hdev->status[status]);
1106 if (!hdev->in_debug) {
1107 dev_err_ratelimited(hdev->dev,
1112 rc = debug_coresight(hdev, hpriv->ctx, args);
1116 rc = hl_device_set_debug_mode(hdev, hpriv->ctx, (bool) args->enable);
1120 dev_err(hdev->dev, "Invalid request %d\n", args->op);
1210 struct hl_device *hdev = hpriv->hdev;
1214 if (!hdev) {
1222 dev_dbg_ratelimited(hdev->dev, "invalid ioctl: pid=%d, nr=0x%02x\n",
1227 return _hl_ioctl(filep, cmd, arg, ioctl, hdev->dev);
1233 struct hl_device *hdev = hpriv->hdev;
1237 if (!hdev) {
1245 dev_dbg_ratelimited(hdev->dev_ctrl, "invalid ioctl: pid=%d, nr=0x%02x\n",
1250 return _hl_ioctl(filep, cmd, arg, ioctl, hdev->dev_ctrl);