drivers/accel/habanalabs/common/memory_mgr.c

Source file repositories/reference/linux-study-clean/drivers/accel/habanalabs/common/memory_mgr.c

File Facts

System
Linux kernel
Corpus path
drivers/accel/habanalabs/common/memory_mgr.c
Extension
.c
Size
9766 bytes
Lines
388
Domain
Driver Families
Bucket
drivers/accel
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (hl_mmap_mem_buf_put(buf) != 1) {
			dev_err(mmg->dev,
				"%s: Buff handle %u for CTX is still alive\n",
				topic, id);
			hl_mem_mgr_fini_stats_inc(mem_id, stats);
		}
	}
}

/**
 * hl_mem_mgr_idr_destroy() - destroy memory manager IDR.
 * @mmg: parent unified memory manager
 *
 * Destroy the memory manager IDR.
 * Shall be called when IDR is empty and no memory buffers are in use.
 */
void hl_mem_mgr_idr_destroy(struct hl_mem_mgr *mmg)
{
	if (!idr_is_empty(&mmg->handles))
		dev_crit(mmg->dev, "memory manager IDR is destroyed while it is not empty!\n");

	idr_destroy(&mmg->handles);
}

Annotation

Implementation Notes