arch/x86/kernel/cpu/sgx/encl.h
Source file repositories/reference/linux-study-clean/arch/x86/kernel/cpu/sgx/encl.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/cpu/sgx/encl.h- Extension
.h- Size
- 3551 bytes
- Lines
- 130
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpumask.hlinux/kref.hlinux/list.hlinux/mm_types.hlinux/mmu_notifier.hlinux/mutex.hlinux/notifier.hlinux/srcu.hlinux/workqueue.hlinux/xarray.hsgx.h
Detected Declarations
struct sgx_encl_pagestruct sgx_encl_mmstruct sgx_enclstruct sgx_va_pagestruct sgx_backingenum sgx_encl_flagsfunction sgx_encl_find
Annotated Snippet
struct sgx_encl_page {
unsigned long desc;
unsigned long vm_max_prot_bits:8;
enum sgx_page_type type:16;
struct sgx_epc_page *epc_page;
struct sgx_encl *encl;
struct sgx_va_page *va_page;
};
enum sgx_encl_flags {
SGX_ENCL_IOCTL = BIT(0),
SGX_ENCL_DEBUG = BIT(1),
SGX_ENCL_CREATED = BIT(2),
SGX_ENCL_INITIALIZED = BIT(3),
};
struct sgx_encl_mm {
struct sgx_encl *encl;
struct mm_struct *mm;
struct list_head list;
struct mmu_notifier mmu_notifier;
};
struct sgx_encl {
unsigned long base;
unsigned long size;
unsigned long flags;
unsigned int page_cnt;
unsigned int secs_child_cnt;
struct mutex lock;
struct xarray page_array;
struct sgx_encl_page secs;
unsigned long attributes;
unsigned long attributes_mask;
cpumask_t cpumask;
struct file *backing;
struct kref refcount;
struct list_head va_pages;
unsigned long mm_list_version;
struct list_head mm_list;
spinlock_t mm_lock;
struct srcu_struct srcu;
};
#define SGX_VA_SLOT_COUNT 512
struct sgx_va_page {
struct sgx_epc_page *epc_page;
DECLARE_BITMAP(slots, SGX_VA_SLOT_COUNT);
struct list_head list;
};
struct sgx_backing {
struct page *contents;
struct page *pcmd;
unsigned long pcmd_offset;
};
extern const struct vm_operations_struct sgx_vm_ops;
static inline int sgx_encl_find(struct mm_struct *mm, unsigned long addr,
struct vm_area_struct **vma)
{
struct vm_area_struct *result;
result = vma_lookup(mm, addr);
if (!result || result->vm_ops != &sgx_vm_ops)
return -EINVAL;
*vma = result;
return 0;
}
int sgx_encl_may_map(struct sgx_encl *encl, unsigned long start,
unsigned long end, vm_flags_t vm_flags);
bool current_is_ksgxd(void);
void sgx_encl_release(struct kref *ref);
int sgx_encl_mm_add(struct sgx_encl *encl, struct mm_struct *mm);
const cpumask_t *sgx_encl_cpumask(struct sgx_encl *encl);
int sgx_encl_alloc_backing(struct sgx_encl *encl, unsigned long page_index,
struct sgx_backing *backing);
void sgx_encl_put_backing(struct sgx_backing *backing);
int sgx_encl_test_and_clear_young(struct mm_struct *mm,
struct sgx_encl_page *page);
struct sgx_encl_page *sgx_encl_page_alloc(struct sgx_encl *encl,
unsigned long offset,
u64 secinfo_flags);
Annotation
- Immediate include surface: `linux/cpumask.h`, `linux/kref.h`, `linux/list.h`, `linux/mm_types.h`, `linux/mmu_notifier.h`, `linux/mutex.h`, `linux/notifier.h`, `linux/srcu.h`.
- Detected declarations: `struct sgx_encl_page`, `struct sgx_encl_mm`, `struct sgx_encl`, `struct sgx_va_page`, `struct sgx_backing`, `enum sgx_encl_flags`, `function sgx_encl_find`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.