arch/openrisc/kernel/smp.c
Source file repositories/reference/linux-study-clean/arch/openrisc/kernel/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/openrisc/kernel/smp.c- Extension
.c- Size
- 7647 bytes
- Lines
- 370
- Domain
- Architecture Layer
- Bucket
- arch/openrisc
- 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/smp.hlinux/cpu.hlinux/interrupt.hlinux/sched.hlinux/sched/mm.hlinux/irq.hlinux/of.hasm/cpuinfo.hasm/mmu_context.hasm/tlbflush.hasm/cacheflush.hasm/time.h
Detected Declarations
struct flush_tlb_dataenum ipi_msg_typefunction or1k_ipi_enablefunction boot_secondaryfunction smp_init_cpusfunction for_each_of_cpu_nodefunction smp_prepare_cpusfunction smp_cpus_donefunction __cpu_upfunction msecs_to_jiffiesfunction secondary_start_kernelfunction handle_IPIfunction arch_smp_send_reschedulefunction stop_this_cpufunction smp_send_stopfunction set_smp_cross_callfunction arch_send_call_function_single_ipifunction arch_send_call_function_ipi_maskfunction ipi_flush_tlb_allfunction ipi_flush_tlb_mmfunction smp_flush_tlb_mmfunction ipi_flush_tlb_pagefunction ipi_flush_tlb_rangefunction smp_flush_tlb_rangefunction flush_tlb_allfunction flush_tlb_mmfunction flush_tlb_pagefunction flush_tlb_rangefunction ipi_icache_page_invfunction smp_icache_page_invfunction ipi_icache_all_invfunction smp_icache_all_invexport smp_icache_page_inv
Annotated Snippet
struct flush_tlb_data {
unsigned long addr1;
unsigned long addr2;
};
static inline void ipi_flush_tlb_page(void *info)
{
struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
local_flush_tlb_page(NULL, fd->addr1);
}
static inline void ipi_flush_tlb_range(void *info)
{
struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
local_flush_tlb_range(NULL, fd->addr1, fd->addr2);
}
static void smp_flush_tlb_range(const struct cpumask *cmask, unsigned long start,
unsigned long end)
{
unsigned int cpuid;
if (cpumask_empty(cmask))
return;
cpuid = get_cpu();
if (cpumask_any_but(cmask, cpuid) >= nr_cpu_ids) {
/* local cpu is the only cpu present in cpumask */
if ((end - start) <= PAGE_SIZE)
local_flush_tlb_page(NULL, start);
else
local_flush_tlb_range(NULL, start, end);
} else {
struct flush_tlb_data fd;
fd.addr1 = start;
fd.addr2 = end;
if ((end - start) <= PAGE_SIZE)
on_each_cpu_mask(cmask, ipi_flush_tlb_page, &fd, 1);
else
on_each_cpu_mask(cmask, ipi_flush_tlb_range, &fd, 1);
}
put_cpu();
}
void flush_tlb_all(void)
{
on_each_cpu(ipi_flush_tlb_all, NULL, 1);
}
void flush_tlb_mm(struct mm_struct *mm)
{
smp_flush_tlb_mm(mm_cpumask(mm), mm);
}
void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
{
smp_flush_tlb_range(mm_cpumask(vma->vm_mm), uaddr, uaddr + PAGE_SIZE);
}
void flush_tlb_range(struct vm_area_struct *vma,
unsigned long start, unsigned long end)
{
const struct cpumask *cmask = vma ? mm_cpumask(vma->vm_mm)
: cpu_online_mask;
smp_flush_tlb_range(cmask, start, end);
}
/* Instruction cache invalidate - performed on each cpu */
static void ipi_icache_page_inv(void *arg)
{
struct page *page = arg;
local_icache_page_inv(page);
}
void smp_icache_page_inv(struct page *page)
{
on_each_cpu(ipi_icache_page_inv, page, 1);
}
EXPORT_SYMBOL(smp_icache_page_inv);
static void ipi_icache_all_inv(void *arg)
{
local_icache_all_inv();
}
Annotation
- Immediate include surface: `linux/smp.h`, `linux/cpu.h`, `linux/interrupt.h`, `linux/sched.h`, `linux/sched/mm.h`, `linux/irq.h`, `linux/of.h`, `asm/cpuinfo.h`.
- Detected declarations: `struct flush_tlb_data`, `enum ipi_msg_type`, `function or1k_ipi_enable`, `function boot_secondary`, `function smp_init_cpus`, `function for_each_of_cpu_node`, `function smp_prepare_cpus`, `function smp_cpus_done`, `function __cpu_up`, `function msecs_to_jiffies`.
- Atlas domain: Architecture Layer / arch/openrisc.
- 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.