drivers/iommu/generic_pt/pt_fmt_defaults.h
Source file repositories/reference/linux-study-clean/drivers/iommu/generic_pt/pt_fmt_defaults.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/iommu/generic_pt/pt_fmt_defaults.h- Extension
.h- Size
- 7544 bytes
- Lines
- 296
- 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
pt_defs.hlinux/log2.hfmt/amdv1.h
Detected Declarations
function Copyrightfunction pt_pgsz_lg2_to_levelfunction pt_contig_count_lg2function pt_contig_count_lg2function pt_entry_is_write_dirtyfunction pt_entry_make_write_cleanfunction pt_dirty_supportedfunction pt_entry_make_write_dirtyfunction _pt_entry_oa_fastfunction pt_entry_oafunction pt_max_oa_lg2function pt_has_system_page_sizefunction pt_possible_sizesfunction pt_full_va_prefixfunction pt_clear_entries64function pt_clear_entries32function pt_clear_entriesfunction pt_test_sw_bit_acquirefunction pt_set_sw_bit_releasefunction pt_max_sw_bitfunction pt_test_sw_bit_acquirefunction pt_set_sw_bit_releasefunction pt_install_leaf_entry
Annotated Snippet
#ifndef __GENERIC_PT_PT_FMT_DEFAULTS_H
#define __GENERIC_PT_PT_FMT_DEFAULTS_H
#include "pt_defs.h"
#include <linux/log2.h>
/* Header self-compile default defines */
#ifndef pt_load_entry_raw
#include "fmt/amdv1.h"
#endif
/*
* The format must provide PT_GRANULE_LG2SZ, PT_TABLEMEM_LG2SZ, and
* PT_ITEM_WORD_SIZE. They must be the same at every level excluding the top.
*/
#ifndef pt_table_item_lg2sz
static inline unsigned int pt_table_item_lg2sz(const struct pt_state *pts)
{
return PT_GRANULE_LG2SZ +
(PT_TABLEMEM_LG2SZ - ilog2(PT_ITEM_WORD_SIZE)) * pts->level;
}
#endif
#ifndef pt_pgsz_lg2_to_level
static inline unsigned int pt_pgsz_lg2_to_level(struct pt_common *common,
unsigned int pgsize_lg2)
{
return ((unsigned int)(pgsize_lg2 - PT_GRANULE_LG2SZ)) /
(PT_TABLEMEM_LG2SZ - ilog2(PT_ITEM_WORD_SIZE));
}
#endif
/*
* If not supplied by the format then contiguous pages are not supported.
*
* If contiguous pages are supported then the format must also provide
* pt_contig_count_lg2() if it supports a single contiguous size per level,
* or pt_possible_sizes() if it supports multiple sizes per level.
*/
#ifndef pt_entry_num_contig_lg2
static inline unsigned int pt_entry_num_contig_lg2(const struct pt_state *pts)
{
return ilog2(1);
}
/*
* Return the number of contiguous OA items forming an entry at this table level
*/
static inline unsigned short pt_contig_count_lg2(const struct pt_state *pts)
{
return ilog2(1);
}
#endif
/* If not supplied by the format then dirty tracking is not supported */
#ifndef pt_entry_is_write_dirty
static inline bool pt_entry_is_write_dirty(const struct pt_state *pts)
{
return false;
}
static inline void pt_entry_make_write_clean(struct pt_state *pts)
{
}
static inline bool pt_dirty_supported(struct pt_common *common)
{
return false;
}
#else
/* If not supplied then dirty tracking is always enabled */
#ifndef pt_dirty_supported
static inline bool pt_dirty_supported(struct pt_common *common)
{
return true;
}
#endif
#endif
#ifndef pt_entry_make_write_dirty
static inline bool pt_entry_make_write_dirty(struct pt_state *pts)
{
return false;
}
#endif
/*
* Format supplies either:
* pt_entry_oa - OA is at the start of a contiguous entry
* or
Annotation
- Immediate include surface: `pt_defs.h`, `linux/log2.h`, `fmt/amdv1.h`.
- Detected declarations: `function Copyright`, `function pt_pgsz_lg2_to_level`, `function pt_contig_count_lg2`, `function pt_contig_count_lg2`, `function pt_entry_is_write_dirty`, `function pt_entry_make_write_clean`, `function pt_dirty_supported`, `function pt_entry_make_write_dirty`, `function _pt_entry_oa_fast`, `function pt_entry_oa`.
- 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.