drivers/gpu/drm/xe/xe_lmtt_ml.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_lmtt_ml.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_lmtt_ml.c- Extension
.c- Size
- 5377 bytes
- Lines
- 162
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/align.hlinux/bitfield.hlinux/log2.hlinux/sizes.hxe_lmtt_types.hxe_macros.h
Detected Declarations
function lmtt_ml_root_pd_levelfunction lmtt_ml_pte_numfunction lmtt_ml_pte_sizefunction lmtt_ml_pte_shiftfunction lmtt_ml_pte_indexfunction lmtt_ml_pte_encode
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Copyright © 2023 Intel Corporation
*/
#include <linux/align.h>
#include <linux/bitfield.h>
#include <linux/log2.h>
#include <linux/sizes.h>
#include "xe_lmtt_types.h"
#include "xe_macros.h"
/**
* DOC: Multi-Level LMTT Structure
*
* LMHAW (Local Memory Host Address Width) is 48 bit (256TB)
*
* LMGAW (Local Memory Guest Address Width) is 48 bit (256TB)
*
* The following figure illustrates the structure and function of the ML LMTT::
*
* LMTT L3 Directory
* (1 Entry per VF) LMTT L1 Leaf
* +-----------+ +-----------+
* | | LMTT L2 (per VF) | |
* | | +-----------+ | |
* | | | | index: +===========+
* | | | | GDPA --> | PTE | => LMEM PF offset
* | | | | 34:21 +===========+
* | | index: | | | |
* | | LMEM VF +===========+ | |
* | | offset -> | PTE | ----------> +-----------+
* | | GAW-1:35 +===========+ / \.
* index: +===========+ | | / \.
* VFID --> | PDE | ---------> +-----------+ / \.
* +===========+ / / / \.
* | | / / / \.
* +-----------+ <== [LMTT Directory Ptr] / \.
* / \ / / / \.
* / \ / / +-----------+-----------------+------+---+
* / /\ / | 31:HAW-16 | HAW-17:5 | 4:1 | 0 |
* / / \ / +===========+=================+======+===+
* / / \ / | Reserved | LMEM Page (2MB) | Rsvd | V |
* / / +-----------+-----------------+------+---+
* / /
* +-----------+-----------------+------+---+
* | 63:HAW-12 | HAW-13:4 | 3:1 | 0 |
* +===========+=================+======+===+
* | Reserved | LMTT Ptr (64KB) | Rsvd | V |
* +-----------+-----------------+------+---+
*
*/
typedef u64 lmtt_ml_pde_t;
typedef u32 lmtt_ml_pte_t;
#define LMTT_ML_HAW 48 /* 256 TiB */
#define LMTT_ML_PDE_MAX_NUM 64 /* SRIOV with PF and 63 VFs, index 0 (PF) is unused */
#define LMTT_ML_PDE_LMTT_PTR GENMASK_ULL(LMTT_ML_HAW - 13, 4)
#define LMTT_ML_PDE_VALID BIT(0)
#define LMTT_ML_PDE_L2_SHIFT 35
#define LMTT_ML_PDE_L2_MAX_NUM BIT_ULL(LMTT_ML_HAW - 35)
#define LMTT_ML_PTE_MAX_NUM BIT(35 - ilog2(SZ_2M))
#define LMTT_ML_PTE_LMEM_PAGE GENMASK(LMTT_ML_HAW - 17, 5)
#define LMTT_ML_PTE_VALID BIT(0)
static unsigned int lmtt_ml_root_pd_level(void)
{
return 2; /* implementation is 0-based */
}
static unsigned int lmtt_ml_pte_num(unsigned int level)
{
switch (level) {
case 2:
return LMTT_ML_PDE_MAX_NUM;
case 1:
BUILD_BUG_ON(LMTT_ML_HAW == 48 && LMTT_ML_PDE_L2_MAX_NUM != SZ_8K);
return LMTT_ML_PDE_L2_MAX_NUM;
case 0:
BUILD_BUG_ON(LMTT_ML_PTE_MAX_NUM != SZ_16K);
return LMTT_ML_PTE_MAX_NUM;
default:
return 0;
}
}
Annotation
- Immediate include surface: `linux/align.h`, `linux/bitfield.h`, `linux/log2.h`, `linux/sizes.h`, `xe_lmtt_types.h`, `xe_macros.h`.
- Detected declarations: `function lmtt_ml_root_pd_level`, `function lmtt_ml_pte_num`, `function lmtt_ml_pte_size`, `function lmtt_ml_pte_shift`, `function lmtt_ml_pte_index`, `function lmtt_ml_pte_encode`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.