arch/powerpc/kernel/irq_64.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/irq_64.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/irq_64.c- Extension
.c- Size
- 14382 bytes
- Lines
- 523
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hlinux/threads.hlinux/kernel_stat.hlinux/signal.hlinux/sched.hlinux/ptrace.hlinux/ioport.hlinux/interrupt.hlinux/timex.hlinux/init.hlinux/slab.hlinux/delay.hlinux/irq.hlinux/seq_file.hlinux/cpumask.hlinux/profile.hlinux/bitops.hlinux/list.hlinux/radix-tree.hlinux/mutex.hlinux/pci.hlinux/debugfs.hlinux/of.hlinux/of_irq.hlinux/vmalloc.hlinux/pgtable.hlinux/static_call.hlinux/uaccess.hasm/interrupt.hasm/io.hasm/irq.hasm/cache.h
Detected Declarations
function next_interruptfunction irq_happened_test_and_clearfunction __replay_soft_interruptsfunction get_pacafunction irq_happened_test_and_clearfunction irq_happened_test_and_clearfunction replay_soft_interruptsfunction replay_soft_interrupts_irqrestorefunction arch_local_irq_restorefunction arch_cpu_idlefunction prep_irq_for_idle_irqsofffunction replay_system_resetfunction irq_set_pending_from_srr1function force_external_irq_replayfunction setup_noirqdistribexport arch_local_irq_restoreexport replay_system_reset
Annotated Snippet
irq_happened_test_and_clear(PACA_IRQ_HMI)) {
regs.trap = INTERRUPT_HMI;
handle_hmi_exception(®s);
next_interrupt(®s);
}
if (irq_happened_test_and_clear(PACA_IRQ_DEC)) {
regs.trap = INTERRUPT_DECREMENTER;
timer_interrupt(®s);
next_interrupt(®s);
}
if (irq_happened_test_and_clear(PACA_IRQ_EE)) {
regs.trap = INTERRUPT_EXTERNAL;
do_IRQ(®s);
next_interrupt(®s);
}
if (IS_ENABLED(CONFIG_PPC_DOORBELL) &&
irq_happened_test_and_clear(PACA_IRQ_DBELL)) {
regs.trap = INTERRUPT_DOORBELL;
doorbell_exception(®s);
next_interrupt(®s);
}
/* Book3E does not support soft-masking PMI interrupts */
if (IS_ENABLED(CONFIG_PPC_BOOK3S) &&
irq_happened_test_and_clear(PACA_IRQ_PMI)) {
regs.trap = INTERRUPT_PERFMON;
performance_monitor_exception(®s);
next_interrupt(®s);
}
local_paca->irq_happened &= ~PACA_IRQ_REPLAYING;
}
__no_kcsan void replay_soft_interrupts(void)
{
irq_enter(); /* See comment in arch_local_irq_restore */
__replay_soft_interrupts();
irq_exit();
}
#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_KUAP)
static inline __no_kcsan void replay_soft_interrupts_irqrestore(void)
{
unsigned long kuap_state = get_kuap();
/*
* Check if anything calls local_irq_enable/restore() when KUAP is
* disabled (user access enabled). We handle that case here by saving
* and re-locking AMR but we shouldn't get here in the first place,
* hence the warning.
*/
kuap_assert_locked();
if (kuap_state != AMR_KUAP_BLOCKED)
set_kuap(AMR_KUAP_BLOCKED);
__replay_soft_interrupts();
if (kuap_state != AMR_KUAP_BLOCKED)
set_kuap(kuap_state);
}
#else
#define replay_soft_interrupts_irqrestore() __replay_soft_interrupts()
#endif
notrace __no_kcsan void arch_local_irq_restore(unsigned long mask)
{
unsigned char irq_happened;
/* Write the new soft-enabled value if it is a disable */
if (mask) {
irq_soft_mask_set(mask);
return;
}
if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) {
WARN_ON_ONCE(in_nmi());
WARN_ON_ONCE(in_hardirq());
WARN_ON_ONCE(local_paca->irq_happened & PACA_IRQ_REPLAYING);
}
again:
/*
* After the stb, interrupts are unmasked and there are no interrupts
* pending replay. The restart sequence makes this atomic with
* respect to soft-masked interrupts. If this was just a simple code
* sequence, a soft-masked interrupt could become pending right after
Annotation
- Immediate include surface: `linux/export.h`, `linux/threads.h`, `linux/kernel_stat.h`, `linux/signal.h`, `linux/sched.h`, `linux/ptrace.h`, `linux/ioport.h`, `linux/interrupt.h`.
- Detected declarations: `function next_interrupt`, `function irq_happened_test_and_clear`, `function __replay_soft_interrupts`, `function get_paca`, `function irq_happened_test_and_clear`, `function irq_happened_test_and_clear`, `function replay_soft_interrupts`, `function replay_soft_interrupts_irqrestore`, `function arch_local_irq_restore`, `function arch_cpu_idle`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration 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.