drivers/iommu/generic_pt/fmt/vtdss.h
Source file repositories/reference/linux-study-clean/drivers/iommu/generic_pt/fmt/vtdss.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/iommu/generic_pt/fmt/vtdss.h- Extension
.h- Size
- 7707 bytes
- Lines
- 286
- Domain
- Driver Families
- Bucket
- drivers/iommu
- 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
defs_vtdss.h../pt_defs.hlinux/bitfield.hlinux/container_of.hlinux/log2.hlinux/generic_pt/iommu.hlinux/iommu.h
Detected Declarations
function vtdss_pt_table_pafunction vtdss_pt_entry_oafunction vtdss_pt_can_have_leaffunction vtdss_pt_num_items_lg2function vtdss_pt_load_entry_rawfunction vtdss_pt_install_leaf_entryfunction vtdss_pt_install_tablefunction vtdss_pt_attr_from_entryfunction vtdss_pt_entry_is_write_dirtyfunction vtdss_pt_entry_make_write_cleanfunction vtdss_pt_entry_make_write_dirtyfunction vtdss_pt_max_sw_bitfunction vtdss_pt_sw_bitfunction vtdss_pt_iommu_set_protfunction vtdss_pt_iommu_fmt_initfunction vtdss_pt_iommu_fmt_hw_info
Annotated Snippet
#ifndef __GENERIC_PT_FMT_VTDSS_H
#define __GENERIC_PT_FMT_VTDSS_H
#include "defs_vtdss.h"
#include "../pt_defs.h"
#include <linux/bitfield.h>
#include <linux/container_of.h>
#include <linux/log2.h>
enum {
PT_MAX_OUTPUT_ADDRESS_LG2 = 52,
PT_MAX_VA_ADDRESS_LG2 = 57,
PT_ITEM_WORD_SIZE = sizeof(u64),
PT_MAX_TOP_LEVEL = 4,
PT_GRANULE_LG2SZ = 12,
PT_TABLEMEM_LG2SZ = 12,
/* SSPTPTR is 4k aligned and limited by HAW */
PT_TOP_PHYS_MASK = GENMASK_ULL(63, 12),
};
/* Shared descriptor bits */
enum {
VTDSS_FMT_R = BIT(0),
VTDSS_FMT_W = BIT(1),
VTDSS_FMT_A = BIT(8),
VTDSS_FMT_D = BIT(9),
VTDSS_FMT_SNP = BIT(11),
VTDSS_FMT_OA = GENMASK_ULL(51, 12),
};
/* PDPTE/PDE */
enum {
VTDSS_FMT_PS = BIT(7),
};
#define common_to_vtdss_pt(common_ptr) \
container_of_const(common_ptr, struct pt_vtdss, common)
#define to_vtdss_pt(pts) common_to_vtdss_pt((pts)->range->common)
static inline pt_oaddr_t vtdss_pt_table_pa(const struct pt_state *pts)
{
return oalog2_mul(FIELD_GET(VTDSS_FMT_OA, pts->entry),
PT_TABLEMEM_LG2SZ);
}
#define pt_table_pa vtdss_pt_table_pa
static inline pt_oaddr_t vtdss_pt_entry_oa(const struct pt_state *pts)
{
return oalog2_mul(FIELD_GET(VTDSS_FMT_OA, pts->entry),
PT_GRANULE_LG2SZ);
}
#define pt_entry_oa vtdss_pt_entry_oa
static inline bool vtdss_pt_can_have_leaf(const struct pt_state *pts)
{
return pts->level <= 2;
}
#define pt_can_have_leaf vtdss_pt_can_have_leaf
static inline unsigned int vtdss_pt_num_items_lg2(const struct pt_state *pts)
{
return PT_TABLEMEM_LG2SZ - ilog2(sizeof(u64));
}
#define pt_num_items_lg2 vtdss_pt_num_items_lg2
static inline enum pt_entry_type vtdss_pt_load_entry_raw(struct pt_state *pts)
{
const u64 *tablep = pt_cur_table(pts, u64);
u64 entry;
pts->entry = entry = READ_ONCE(tablep[pts->index]);
if (!entry)
return PT_ENTRY_EMPTY;
if (pts->level == 0 ||
(vtdss_pt_can_have_leaf(pts) && (pts->entry & VTDSS_FMT_PS)))
return PT_ENTRY_OA;
return PT_ENTRY_TABLE;
}
#define pt_load_entry_raw vtdss_pt_load_entry_raw
static inline void
vtdss_pt_install_leaf_entry(struct pt_state *pts, pt_oaddr_t oa,
unsigned int oasz_lg2,
const struct pt_write_attrs *attrs)
{
u64 *tablep = pt_cur_table(pts, u64);
u64 entry;
Annotation
- Immediate include surface: `defs_vtdss.h`, `../pt_defs.h`, `linux/bitfield.h`, `linux/container_of.h`, `linux/log2.h`, `linux/generic_pt/iommu.h`, `linux/iommu.h`.
- Detected declarations: `function vtdss_pt_table_pa`, `function vtdss_pt_entry_oa`, `function vtdss_pt_can_have_leaf`, `function vtdss_pt_num_items_lg2`, `function vtdss_pt_load_entry_raw`, `function vtdss_pt_install_leaf_entry`, `function vtdss_pt_install_table`, `function vtdss_pt_attr_from_entry`, `function vtdss_pt_entry_is_write_dirty`, `function vtdss_pt_entry_make_write_clean`.
- Atlas domain: Driver Families / drivers/iommu.
- 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.