drivers/iommu/generic_pt/pt_common.h
Source file repositories/reference/linux-study-clean/drivers/iommu/generic_pt/pt_common.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/iommu/generic_pt/pt_common.h- Extension
.h- Size
- 13387 bytes
- Lines
- 390
- 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.hpt_fmt_defaults.h
Detected Declarations
function Copyrightfunction pt_can_have_tablefunction pt_entry_oa_lg2szfunction pt_entry_oa_exactfunction pt_table_oa_lg2szfunction pt_table_ptrfunction pt_load_entry
Annotated Snippet
* static inline FMTpt_XXX(..) {..}
* #define pt_XXX FMTpt_XXX
*
* If the format doesn't implement a function then pt_fmt_defaults.h can provide
* a generic version.
*
* The routines marked "@pts: Entry to query" operate on the entire contiguous
* entry and can be called with a pts->index pointing to any sub item that makes
* up that entry.
*
* The header order is:
* pt_defs.h
* FMT.h
* pt_common.h
*/
#ifndef __GENERIC_PT_PT_COMMON_H
#define __GENERIC_PT_PT_COMMON_H
#include "pt_defs.h"
#include "pt_fmt_defaults.h"
/**
* pt_attr_from_entry() - Convert the permission bits back to attrs
* @pts: Entry to convert from
* @attrs: Resulting attrs
*
* Fill in the attrs with the permission bits encoded in the current leaf entry.
* The attrs should be usable with pt_install_leaf_entry() to reconstruct the
* same entry.
*/
static inline void pt_attr_from_entry(const struct pt_state *pts,
struct pt_write_attrs *attrs);
/**
* pt_can_have_leaf() - True if the current level can have an OA entry
* @pts: The current level
*
* True if the current level can support pt_install_leaf_entry(). A leaf
* entry produce an OA.
*/
static inline bool pt_can_have_leaf(const struct pt_state *pts);
/**
* pt_can_have_table() - True if the current level can have a lower table
* @pts: The current level
*
* Every level except 0 is allowed to have a lower table.
*/
static inline bool pt_can_have_table(const struct pt_state *pts)
{
/* No further tables at level 0 */
return pts->level > 0;
}
/**
* pt_clear_entries() - Make entries empty (non-present)
* @pts: Starting table index
* @num_contig_lg2: Number of contiguous items to clear
*
* Clear a run of entries. A cleared entry will load back as PT_ENTRY_EMPTY
* and does not have any effect on table walking. The starting index must be
* aligned to num_contig_lg2.
*/
static inline void pt_clear_entries(struct pt_state *pts,
unsigned int num_contig_lg2);
/**
* pt_entry_make_write_dirty() - Make an entry dirty
* @pts: Table entry to change
*
* Make pt_entry_is_write_dirty() return true for this entry. This can be called
* asynchronously with any other table manipulation under a RCU lock and must
* not corrupt the table.
*/
static inline bool pt_entry_make_write_dirty(struct pt_state *pts);
/**
* pt_entry_make_write_clean() - Make the entry write clean
* @pts: Table entry to change
*
* Modify the entry so that pt_entry_is_write_dirty() == false. The HW will
* eventually be notified of this change via a TLB flush, which is the point
* that the HW must become synchronized. Any "write dirty" prior to the TLB
* flush can be lost, but once the TLB flush completes all writes must make
* their entries write dirty.
*
* The format should alter the entry in a way that is compatible with any
* concurrent update from HW. The entire contiguous entry is changed.
*/
static inline void pt_entry_make_write_clean(struct pt_state *pts);
Annotation
- Immediate include surface: `pt_defs.h`, `pt_fmt_defaults.h`.
- Detected declarations: `function Copyright`, `function pt_can_have_table`, `function pt_entry_oa_lg2sz`, `function pt_entry_oa_exact`, `function pt_table_oa_lg2sz`, `function pt_table_ptr`, `function pt_load_entry`.
- 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.