Lines Matching defs:hdev

90 	struct hl_device *hdev;
95 hdev = idr_find(&hl_devs_idr, iminor(inode));
98 if (!hdev) {
108 hpriv->hdev = hdev;
120 mutex_lock(&hdev->fpriv_list_lock);
122 if (hl_device_disabled_or_in_reset(hdev)) {
123 dev_err_ratelimited(hdev->dev,
125 dev_name(hdev->dev));
130 if (hdev->in_debug) {
131 dev_err_ratelimited(hdev->dev,
133 dev_name(hdev->dev));
138 if (hdev->compute_ctx) {
139 dev_dbg_ratelimited(hdev->dev,
141 dev_name(hdev->dev));
146 rc = hl_ctx_create(hdev, hpriv);
148 dev_err(hdev->dev, "Failed to create context %d\n", rc);
157 hl_device_set_frequency(hdev, PLL_HIGH);
159 list_add(&hpriv->dev_node, &hdev->fpriv_list);
160 mutex_unlock(&hdev->fpriv_list_lock);
167 mutex_unlock(&hdev->fpriv_list_lock);
169 hl_cb_mgr_fini(hpriv->hdev, &hpriv->cb_mgr);
170 hl_ctx_mgr_fini(hpriv->hdev, &hpriv->ctx_mgr);
182 struct hl_device *hdev;
187 hdev = idr_find(&hl_devs_idr, iminor(inode));
190 if (!hdev) {
200 mutex_lock(&hdev->fpriv_list_lock);
202 if (hl_device_disabled_or_in_reset(hdev)) {
203 dev_err_ratelimited(hdev->dev_ctrl,
205 dev_name(hdev->dev_ctrl));
210 list_add(&hpriv->dev_node, &hdev->fpriv_list);
211 mutex_unlock(&hdev->fpriv_list_lock);
213 hpriv->hdev = hdev;
224 mutex_unlock(&hdev->fpriv_list_lock);
229 static void set_driver_behavior_per_device(struct hl_device *hdev)
231 hdev->mmu_enable = 1;
232 hdev->cpu_enable = 1;
233 hdev->fw_loading = 1;
234 hdev->cpu_queues_enable = 1;
235 hdev->heartbeat = 1;
236 hdev->clock_gating_mask = ULONG_MAX;
238 hdev->reset_pcilink = 0;
239 hdev->axi_drain = 0;
240 hdev->sram_scrambler_enable = 1;
241 hdev->dram_scrambler_enable = 1;
242 hdev->bmc_enable = 1;
243 hdev->hard_reset_on_fw_events = 1;
261 struct hl_device *hdev;
266 hdev = kzalloc(sizeof(*hdev), GFP_KERNEL);
267 if (!hdev)
274 hdev->asic_type = get_asic_type(pdev->device);
275 if (hdev->asic_type == ASIC_INVALID) {
281 hdev->asic_type = asic_type;
284 hdev->major = hl_major;
285 hdev->reset_on_lockup = reset_on_lockup;
286 hdev->pldm = 0;
288 set_driver_behavior_per_device(hdev);
291 hdev->timeout_jiffies = msecs_to_jiffies(timeout_locked * 1000);
293 hdev->timeout_jiffies = MAX_SCHEDULE_TIMEOUT;
295 hdev->disabled = true;
296 hdev->pdev = pdev; /* can be NULL in case of simulator device */
299 hdev->dma_mask = 32;
306 main_id = idr_alloc(&hl_devs_idr, hdev, 0, HL_MAX_MINORS,
310 ctrl_id = idr_alloc(&hl_devs_idr, hdev, main_id + 1,
329 hdev->id = main_id;
330 hdev->id_control = ctrl_id;
332 *dev = hdev;
337 kfree(hdev);
347 void destroy_hdev(struct hl_device *hdev)
351 idr_remove(&hl_devs_idr, hdev->id);
352 idr_remove(&hl_devs_idr, hdev->id_control);
355 kfree(hdev);
360 struct hl_device *hdev = dev_get_drvdata(dev);
364 if (!hdev) {
369 return hl_device_suspend(hdev);
374 struct hl_device *hdev = dev_get_drvdata(dev);
378 if (!hdev) {
383 return hl_device_resume(hdev);
399 struct hl_device *hdev;
406 rc = create_hdev(&hdev, pdev, ASIC_INVALID, -1);
410 pci_set_drvdata(pdev, hdev);
414 rc = hl_device_init(hdev, hl_class);
426 destroy_hdev(hdev);
440 struct hl_device *hdev;
442 hdev = pci_get_drvdata(pdev);
443 if (!hdev)
446 hl_device_fini(hdev);
449 destroy_hdev(hdev);
464 struct hl_device *hdev = pci_get_drvdata(pdev);
472 dev_warn(hdev->dev, "frozen state error detected\n");
477 dev_warn(hdev->dev, "failure state error detected\n");
485 hdev->asic_funcs->halt_engines(hdev, true);
498 struct hl_device *hdev = pci_get_drvdata(pdev);
500 dev_warn(hdev->dev, "Resuming device after PCI slot reset\n");
501 hl_device_resume(hdev);