Lines Matching defs:hdev

30 	struct hl_device *hdev = ctx->hdev;
32 gen_pool_free(hdev->mmu_priv.mmu_pgt_pool, pgt_info->phys_addr,
33 hdev->asic_prop.mmu_hop_table_size);
48 struct hl_device *hdev = ctx->hdev;
49 struct asic_fixed_properties *prop = &hdev->asic_prop;
57 phys_addr = (u64) gen_pool_alloc(hdev->mmu_priv.mmu_pgt_pool,
60 dev_err(hdev->dev, "failed to allocate page\n");
78 gen_pool_free(hdev->mmu_priv.mmu_pgt_pool, phys_addr,
88 return ctx->hdev->asic_prop.mmu_pgt_addr +
89 (ctx->asid * ctx->hdev->asic_prop.mmu_hop_table_size);
94 return (u64) (uintptr_t) ctx->hdev->mmu_priv.mmu_shadow_hop0 +
95 (ctx->asid * ctx->hdev->asic_prop.mmu_hop_table_size);
102 ctx->hdev->asic_funcs->read_pte(ctx->hdev, get_phys_hop0_addr(ctx));
118 ctx->hdev->asic_funcs->write_pte(ctx->hdev,
129 ctx->hdev->asic_funcs->write_pte(ctx->hdev,
177 return hop_addr + ctx->hdev->asic_prop.mmu_pte_size *
245 u64 page_mask = (ctx->hdev->asic_prop.mmu_hop_table_size - 1);
260 struct hl_device *hdev = ctx->hdev;
261 struct asic_fixed_properties *prop = &hdev->asic_prop;
266 if ((!hdev->dram_supports_virtual_memory) ||
267 (!hdev->dram_default_page_mapping) ||
286 dev_err(hdev->dev, "failed to alloc hop 1\n");
295 dev_err(hdev->dev, "failed to alloc hop 2\n");
305 dev_err(hdev->dev, "failed to alloc hop 3, i: %d\n", i);
360 struct hl_device *hdev = ctx->hdev;
361 struct asic_fixed_properties *prop = &hdev->asic_prop;
366 if ((!hdev->dram_supports_virtual_memory) ||
367 (!hdev->dram_default_page_mapping) ||
409 * @hdev: habanalabs device structure.
417 static int hl_mmu_v1_init(struct hl_device *hdev)
419 struct asic_fixed_properties *prop = &hdev->asic_prop;
422 hdev->mmu_priv.mmu_pgt_pool =
425 if (!hdev->mmu_priv.mmu_pgt_pool) {
426 dev_err(hdev->dev, "Failed to create page gen pool\n");
430 rc = gen_pool_add(hdev->mmu_priv.mmu_pgt_pool, prop->mmu_pgt_addr +
435 dev_err(hdev->dev, "Failed to add memory to page gen pool\n");
439 hdev->mmu_priv.mmu_shadow_hop0 = kvmalloc_array(prop->max_asid,
442 if (ZERO_OR_NULL_PTR(hdev->mmu_priv.mmu_shadow_hop0)) {
452 gen_pool_destroy(hdev->mmu_priv.mmu_pgt_pool);
459 * @hdev: habanalabs device structure.
467 static void hl_mmu_v1_fini(struct hl_device *hdev)
471 kvfree(hdev->mmu_priv.mmu_shadow_hop0);
472 gen_pool_destroy(hdev->mmu_priv.mmu_pgt_pool);
503 struct hl_device *hdev = ctx->hdev;
511 dev_err(hdev->dev, "ctx %d is freed while it has pgts in use\n",
515 dev_err_ratelimited(hdev->dev,
527 struct hl_device *hdev = ctx->hdev;
528 struct asic_fixed_properties *prop = &hdev->asic_prop;
576 dev_err(hdev->dev,
595 if (hdev->dram_default_page_mapping && is_dram_addr) {
600 dev_err(hdev->dev,
607 dev_err(hdev->dev,
652 dev_err(hdev->dev, "virt addr 0x%llx is not mapped to phys addr\n",
661 struct hl_device *hdev = ctx->hdev;
662 struct asic_fixed_properties *prop = &hdev->asic_prop;
727 if (hdev->dram_default_page_mapping && is_dram_addr) {
733 dev_err(hdev->dev,
741 dev_err(hdev->dev,
747 dev_err(hdev->dev,
751 dev_dbg(hdev->dev, "hop0 pte: 0x%llx (0x%llx)\n",
753 dev_dbg(hdev->dev, "hop1 pte: 0x%llx (0x%llx)\n",
755 dev_dbg(hdev->dev, "hop2 pte: 0x%llx (0x%llx)\n",
757 dev_dbg(hdev->dev, "hop3 pte: 0x%llx (0x%llx)\n",
761 dev_dbg(hdev->dev, "hop4 pte: 0x%llx (0x%llx)\n",
848 * @hdev: pointer to the device structure
850 void hl_mmu_v1_set_funcs(struct hl_device *hdev)
852 struct hl_mmu_funcs *mmu = &hdev->mmu_func;