arch/powerpc/kernel/mce.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/mce.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/mce.c- Extension
.c- Size
- 20102 bytes
- Lines
- 772
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/hardirq.hlinux/types.hlinux/ptrace.hlinux/percpu.hlinux/export.hlinux/irq_work.hlinux/extable.hlinux/ftrace.hlinux/memblock.hlinux/of.hasm/interrupt.hasm/machdep.hasm/mce.hasm/nmi.hsetup.h
Detected Declarations
function mce_register_notifierfunction mce_unregister_notifierfunction mce_set_error_infofunction mce_irq_work_queuefunction save_mce_eventfunction release_mce_eventfunction release_mce_eventfunction machine_check_ue_workfunction machine_check_ue_eventfunction machine_check_queue_eventfunction mce_common_process_uefunction machine_process_ue_eventfunction machine_check_process_queued_eventfunction set_mce_pending_irq_workfunction clear_mce_pending_irq_workfunction mce_run_irq_context_handlersfunction machine_check_print_event_infofunction init_debug_trig_functionfunction of_property_for_each_stringfunction hmi_handle_debugtrigfunction mce_initexport mce_register_notifierexport mce_unregister_notifierexport machine_check_print_event_info
Annotated Snippet
if (phys_addr != ULONG_MAX) {
mce->u.ue_error.physical_address_provided = true;
mce->u.ue_error.physical_address = phys_addr;
machine_check_ue_event(mce);
}
}
return;
}
/*
* get_mce_event:
* mce Pointer to machine_check_event structure to be filled.
* release Flag to indicate whether to free the event slot or not.
* 0 <= do not release the mce event. Caller will invoke
* release_mce_event() once event has been consumed.
* 1 <= release the slot.
*
* return 1 = success
* 0 = failure
*
* get_mce_event() will be called by platform specific machine check
* handle routine and in KVM.
* When we call get_mce_event(), we are still in interrupt context and
* preemption will not be scheduled until ret_from_expect() routine
* is called.
*/
int get_mce_event(struct machine_check_event *mce, bool release)
{
int index = local_paca->mce_info->mce_nest_count - 1;
struct machine_check_event *mc_evt;
int ret = 0;
/* Sanity check */
if (index < 0)
return ret;
/* Check if we have MCE info to process. */
if (index < MAX_MC_EVT) {
mc_evt = &local_paca->mce_info->mce_event[index];
/* Copy the event structure and release the original */
if (mce)
*mce = *mc_evt;
if (release)
mc_evt->in_use = 0;
ret = 1;
}
/* Decrement the count to free the slot. */
if (release)
local_paca->mce_info->mce_nest_count--;
return ret;
}
void release_mce_event(void)
{
get_mce_event(NULL, true);
}
static void machine_check_ue_work(void)
{
schedule_work(&mce_ue_event_work);
}
/*
* Queue up the MCE event which then can be handled later.
*/
static void machine_check_ue_event(struct machine_check_event *evt)
{
int index;
index = local_paca->mce_info->mce_ue_count++;
/* If queue is full, just return for now. */
if (index >= MAX_MC_EVT) {
local_paca->mce_info->mce_ue_count--;
return;
}
memcpy(&local_paca->mce_info->mce_ue_event_queue[index],
evt, sizeof(*evt));
}
/*
* Queue up the MCE event which then can be handled later.
*/
void machine_check_queue_event(void)
{
int index;
struct machine_check_event evt;
if (!get_mce_event(&evt, MCE_EVENT_RELEASE))
return;
Annotation
- Immediate include surface: `linux/hardirq.h`, `linux/types.h`, `linux/ptrace.h`, `linux/percpu.h`, `linux/export.h`, `linux/irq_work.h`, `linux/extable.h`, `linux/ftrace.h`.
- Detected declarations: `function mce_register_notifier`, `function mce_unregister_notifier`, `function mce_set_error_info`, `function mce_irq_work_queue`, `function save_mce_event`, `function release_mce_event`, `function release_mce_event`, `function machine_check_ue_work`, `function machine_check_ue_event`, `function machine_check_queue_event`.
- 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.