arch/powerpc/mm/book3s64/radix_tlb.c
Source file repositories/reference/linux-study-clean/arch/powerpc/mm/book3s64/radix_tlb.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/mm/book3s64/radix_tlb.c- Extension
.c- Size
- 43892 bytes
- Lines
- 1581
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mm.hlinux/hugetlb.hlinux/memblock.hlinux/mmu_context.hlinux/sched/mm.hlinux/debugfs.hasm/ppc-opcode.hasm/tlb.hasm/tlbflush.hasm/trace.hasm/cputhreads.hasm/plpar_wrappers.h
Detected Declarations
struct tlbiel_pidstruct tlbiel_vastruct tlbiel_va_rangeenum tlb_flush_typefunction tlbiel_radix_set_isa300function tlbiel_all_isa300function radix__tlbiel_allfunction __tlbiel_pidfunction __tlbie_pidfunction __tlbie_lpidfunction __tlbie_lpid_guestfunction __tlbiel_vafunction __tlbie_vafunction __tlbie_va_lpidfunction fixup_tlbie_vafunction fixup_tlbie_va_rangefunction fixup_tlbie_pidfunction fixup_tlbie_va_lpidfunction fixup_tlbie_lpidfunction _tlbiel_pidfunction _tlbie_pidfunction do_tlbiel_pidfunction _tlbiel_pid_multicastfunction _tlbie_lpidfunction _tlbie_lpid_guestfunction __tlbiel_va_rangefunction _tlbiel_vafunction _tlbiel_va_rangefunction __tlbie_va_rangefunction _tlbie_vafunction do_tlbiel_vafunction _tlbiel_va_multicastfunction do_tlbiel_va_rangefunction _tlbie_va_lpidfunction _tlbie_va_rangefunction _tlbiel_va_range_multicastfunction radix__local_flush_tlb_mmfunction radix__local_flush_all_mmfunction __flush_all_mmfunction radix__local_flush_tlb_page_psizefunction radix__local_flush_tlb_pagefunction mm_needs_flush_escalationfunction exit_lazy_flush_tlbfunction do_exit_flush_lazy_tlbfunction exit_flush_lazy_tlbsfunction exit_flush_lazy_tlbsfunction tick_and_test_trim_clockfunction flush_type_needed
Annotated Snippet
struct tlbiel_pid {
unsigned long pid;
unsigned long ric;
};
static void do_tlbiel_pid(void *info)
{
struct tlbiel_pid *t = info;
if (t->ric == RIC_FLUSH_TLB)
_tlbiel_pid(t->pid, RIC_FLUSH_TLB);
else if (t->ric == RIC_FLUSH_PWC)
_tlbiel_pid(t->pid, RIC_FLUSH_PWC);
else
_tlbiel_pid(t->pid, RIC_FLUSH_ALL);
}
static inline void _tlbiel_pid_multicast(struct mm_struct *mm,
unsigned long pid, unsigned long ric)
{
struct cpumask *cpus = mm_cpumask(mm);
struct tlbiel_pid t = { .pid = pid, .ric = ric };
on_each_cpu_mask(cpus, do_tlbiel_pid, &t, 1);
/*
* Always want the CPU translations to be invalidated with tlbiel in
* these paths, so while coprocessors must use tlbie, we can not
* optimise away the tlbiel component.
*/
if (atomic_read(&mm->context.copros) > 0)
_tlbie_pid(pid, RIC_FLUSH_ALL);
}
static inline void _tlbie_lpid(unsigned long lpid, unsigned long ric)
{
asm volatile("ptesync": : :"memory");
/*
* Workaround the fact that the "ric" argument to __tlbie_pid
* must be a compile-time contraint to match the "i" constraint
* in the asm statement.
*/
switch (ric) {
case RIC_FLUSH_TLB:
__tlbie_lpid(lpid, RIC_FLUSH_TLB);
fixup_tlbie_lpid(lpid);
break;
case RIC_FLUSH_PWC:
__tlbie_lpid(lpid, RIC_FLUSH_PWC);
break;
case RIC_FLUSH_ALL:
default:
__tlbie_lpid(lpid, RIC_FLUSH_ALL);
fixup_tlbie_lpid(lpid);
}
asm volatile("eieio; tlbsync; ptesync": : :"memory");
}
static __always_inline void _tlbie_lpid_guest(unsigned long lpid, unsigned long ric)
{
/*
* Workaround the fact that the "ric" argument to __tlbie_pid
* must be a compile-time contraint to match the "i" constraint
* in the asm statement.
*/
switch (ric) {
case RIC_FLUSH_TLB:
__tlbie_lpid_guest(lpid, RIC_FLUSH_TLB);
break;
case RIC_FLUSH_PWC:
__tlbie_lpid_guest(lpid, RIC_FLUSH_PWC);
break;
case RIC_FLUSH_ALL:
default:
__tlbie_lpid_guest(lpid, RIC_FLUSH_ALL);
}
fixup_tlbie_lpid(lpid);
asm volatile("eieio; tlbsync; ptesync": : :"memory");
}
static inline void __tlbiel_va_range(unsigned long start, unsigned long end,
unsigned long pid, unsigned long page_size,
unsigned long psize)
{
unsigned long addr;
unsigned long ap = mmu_get_ap(psize);
for (addr = start; addr < end; addr += page_size)
__tlbiel_va(addr, pid, ap, RIC_FLUSH_TLB);
}
Annotation
- Immediate include surface: `linux/mm.h`, `linux/hugetlb.h`, `linux/memblock.h`, `linux/mmu_context.h`, `linux/sched/mm.h`, `linux/debugfs.h`, `asm/ppc-opcode.h`, `asm/tlb.h`.
- Detected declarations: `struct tlbiel_pid`, `struct tlbiel_va`, `struct tlbiel_va_range`, `enum tlb_flush_type`, `function tlbiel_radix_set_isa300`, `function tlbiel_all_isa300`, `function radix__tlbiel_all`, `function __tlbiel_pid`, `function __tlbie_pid`, `function __tlbie_lpid`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.