TLB API¶
Static KV-cache TLB initialization and page management (Bertha DC EVT0), and low-level TLB configuration, page table range, and invalidation for the current device. See Memory Model.
Contents¶
| API | 설명 |
|---|---|
HaAllocTlbPage |
TLB/페이지 단위 메모리 할당 (low-level/compile 경로) |
HaConfigureTlb |
페이지 크기·공유 채널·자동 프리페치 등 TLB 동작 설정 |
HaDeallocTlbPage |
HaAllocTlbPage()로 할당한 메모리 해제 |
HaFlushTlb |
현재 디바이스의 TLB 캐시 전체 무효화 |
HaInitTlb |
정적 KV 캐시 지오메트리로 TLB 초기화 (Bertha DC EVT0 전용) |
HaSetPageTableRange |
페이지 테이블 시작 주소·크기와 유효 VPN 폭 설정 |
HaAllocTlbPage¶
Allocates memory at the TLB/page level (low-level/compile path).
| Parameter | Direction | Default | Description |
|---|---|---|---|
page_alloc_info |
inout | — | Allocation request/response structure (required). See TLBAllocInfo. |
Returns — Success or an error code.
시그니처 · 예제
1 | |
예제
1 2 3 4 5 | |
Note
Use this when you need explicit page-level mapping instead of HaMemAlloc(). Details are defined by the fields in TLBAllocInfo.
HaConfigureTlb¶
Configures TLB behavior: page size, shared channels, and optional auto prefetch. Low-level control for the current device.
| Parameter | Direction | Default | Description |
|---|---|---|---|
page_size |
in | — | Page size in bytes (platform constraints apply). |
shared_channel_number |
in | — | Shared channel number/count (platform-dependent). |
auto_prefetch_enable |
in | 0 |
Enables auto prefetch. |
auto_prefetch_len_x |
in | 0 |
Prefetch length X. |
auto_prefetch_len_y |
in | 0 |
Prefetch length Y. |
auto_prefetch_stride_y |
in | 0 |
Prefetch stride Y. |
transl_time_limit |
in | 0 |
Translation time limit/timeout. |
Returns — Success or an error code.
시그니처
1 | |
Note
(Re)configuration always invalidates the TLB cache, because a changed page size makes cached translations stale. Use HaFlushTlb() when mappings changed but the configuration did not.
HaDeallocTlbPage¶
Frees memory allocated via HaAllocTlbPage().
| Parameter | Direction | Default | Description |
|---|---|---|---|
page_dealloc_info |
inout | — | Deallocation structure describing what to free (required). See TLBDeallocInfo. |
Returns — Success or an error code.
시그니처 · 예제
1 | |
예제
1 2 3 4 5 | |
HaFlushTlb¶
Flushes (invalidates) the entire TLB cache for the current device. Call it when the page mapping changes (e.g. a KV-cache remap) and cached translations must be dropped. HaConfigureTlb() and HaSetPageTableRange() already invalidate, so call this only when neither of them is called.
Returns — Success or an error code.
시그니처
1 | |
HaInitTlb¶
Initializes the TLB with static KV-cache geometry (Bertha DC EVT0 only). On EVT1, configure the TLB with HaConfigureTlb() and HaSetPageTableRange() instead.
| Parameter | Direction | Default | Description |
|---|---|---|---|
info |
in | — | TLB init info (page size, base address, layer/head counts, value page mode, …). Required. See TLBInitInfo. |
Returns — Success or an error code.
시그니처 · 예제
1 | |
예제
1 2 3 4 5 6 7 | |
Note
Bertha DC EVT0의 정적 KV 캐시 TLB 경로입니다.
KV 캐시 매핑에는 이 TLB를 감싸는 VMM API를 권장합니다. HaVmmInitBlocks()가
TLB를 초기화하고, 매핑·언매핑이 요청별 페이지를 할당·반환합니다.
HaSetPageTableRange¶
Sets the page table base address, size, and effective VPN width for the current device.
| Parameter | Direction | Default | Description |
|---|---|---|---|
page_table_base_addr |
in | — | Page table base address. |
page_table_size |
in | — | Page table size in bytes. |
effective_vpn_width |
in | — | Effective virtual page number (VPN) width in bits. |
cache_invalidate |
in | 1 |
Whether to invalidate the TLB cache once after updating the range. Pass 0 only when the caller flushes deliberately afterwards with HaFlushTlb(). |
Returns — Success or an error code.
시그니처
1 | |