arch/powerpc/kexec/core_64.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kexec/core_64.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kexec/core_64.c- Extension
.c- Size
- 15939 bytes
- Lines
- 562
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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/kexec.hlinux/smp.hlinux/thread_info.hlinux/init_task.hlinux/errno.hlinux/kernel.hlinux/cpu.hlinux/hardirq.hlinux/of.hlinux/libfdt.hasm/page.hasm/current.hasm/machdep.hasm/cacheflush.hasm/firmware.hasm/paca.hasm/mmu.hasm/sections.hasm/setup.hasm/smp.hasm/hw_breakpoint.hasm/svm.hasm/ultravisor.hasm/crashdump-ppc64.h
Detected Declarations
function Copyrightfunction copy_segmentsfunction kexec_copy_flushfunction kexec_smp_downfunction kexec_prepare_cpus_waitfunction kexec_smp_waitfunction add_cpufunction wake_offline_cpusfunction for_each_present_cpufunction kexec_prepare_cpusfunction kexec_prepare_cpusfunction default_machine_kexecfunction export_htab_valuesfunction add_node_propsfunction for_each_property_of_nodefunction update_cpus_node
Annotated Snippet
if ((begin < high) && (end > low)) {
of_node_put(node);
return -ETXTBSY;
}
}
}
return 0;
}
/* Called during kexec sequence with MMU off */
static notrace void copy_segments(unsigned long ind)
{
unsigned long entry;
unsigned long *ptr;
void *dest;
void *addr;
/*
* We rely on kexec_load to create a lists that properly
* initializes these pointers before they are used.
* We will still crash if the list is wrong, but at least
* the compiler will be quiet.
*/
ptr = NULL;
dest = NULL;
for (entry = ind; !(entry & IND_DONE); entry = *ptr++) {
addr = __va(entry & PAGE_MASK);
switch (entry & IND_FLAGS) {
case IND_DESTINATION:
dest = addr;
break;
case IND_INDIRECTION:
ptr = addr;
break;
case IND_SOURCE:
copy_page(dest, addr);
dest += PAGE_SIZE;
}
}
}
/* Called during kexec sequence with MMU off */
notrace void kexec_copy_flush(struct kimage *image)
{
long i, nr_segments = image->nr_segments;
struct kexec_segment ranges[KEXEC_SEGMENT_MAX];
/* save the ranges on the stack to efficiently flush the icache */
memcpy(ranges, image->segment, sizeof(ranges));
/*
* After this call we may not use anything allocated in dynamic
* memory, including *image.
*
* Only globals and the stack are allowed.
*/
copy_segments(image->head);
/*
* we need to clear the icache for all dest pages sometime,
* including ones that were in place on the original copy
*/
for (i = 0; i < nr_segments; i++)
flush_icache_range((unsigned long)__va(ranges[i].mem),
(unsigned long)__va(ranges[i].mem + ranges[i].memsz));
}
#ifdef CONFIG_SMP
static int kexec_all_irq_disabled = 0;
static void kexec_smp_down(void *arg)
{
local_irq_disable();
hard_irq_disable();
mb(); /* make sure our irqs are disabled before we say they are */
get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
while(kexec_all_irq_disabled == 0)
cpu_relax();
mb(); /* make sure all irqs are disabled before this */
hw_breakpoint_disable();
/*
* Now every CPU has IRQs off, we can clear out any pending
* IPIs and be sure that no more will come in after this.
*/
if (ppc_md.kexec_cpu_down)
Annotation
- Immediate include surface: `linux/kexec.h`, `linux/smp.h`, `linux/thread_info.h`, `linux/init_task.h`, `linux/errno.h`, `linux/kernel.h`, `linux/cpu.h`, `linux/hardirq.h`.
- Detected declarations: `function Copyright`, `function copy_segments`, `function kexec_copy_flush`, `function kexec_smp_down`, `function kexec_prepare_cpus_wait`, `function kexec_smp_wait`, `function add_cpu`, `function wake_offline_cpus`, `function for_each_present_cpu`, `function kexec_prepare_cpus`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.