arch/powerpc/platforms/powernv/opal-call.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powernv/opal-call.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powernv/opal-call.c- Extension
.c- Size
- 12026 bytes
- Lines
- 296
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
Dependency Surface
linux/percpu.hlinux/jump_label.hasm/interrupt.hasm/opal-api.hasm/trace.hasm/asm-prototypes.h
Detected Declarations
function __trace_opal_entryfunction __trace_opal_exitfunction opal_tracepoint_regfuncfunction opal_tracepoint_unregfuncfunction __opal_call_tracefunction __opal_call_tracefunction opal_call
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/percpu.h>
#include <linux/jump_label.h>
#include <asm/interrupt.h>
#include <asm/opal-api.h>
#include <asm/trace.h>
#include <asm/asm-prototypes.h>
#ifdef CONFIG_TRACEPOINTS
/*
* Since the tracing code might execute OPAL calls we need to guard against
* recursion.
*/
static DEFINE_PER_CPU(unsigned int, opal_trace_depth);
static void __trace_opal_entry(s64 a0, s64 a1, s64 a2, s64 a3,
s64 a4, s64 a5, s64 a6, s64 a7,
unsigned long opcode)
{
unsigned int *depth;
unsigned long args[8];
depth = this_cpu_ptr(&opal_trace_depth);
if (*depth)
return;
args[0] = a0;
args[1] = a1;
args[2] = a2;
args[3] = a3;
args[4] = a4;
args[5] = a5;
args[6] = a6;
args[7] = a7;
(*depth)++;
trace_opal_entry(opcode, &args[0]);
(*depth)--;
}
static void __trace_opal_exit(unsigned long opcode, unsigned long retval)
{
unsigned int *depth;
depth = this_cpu_ptr(&opal_trace_depth);
if (*depth)
return;
(*depth)++;
trace_opal_exit(opcode, retval);
(*depth)--;
}
static DEFINE_STATIC_KEY_FALSE(opal_tracepoint_key);
int opal_tracepoint_regfunc(void)
{
static_branch_inc(&opal_tracepoint_key);
return 0;
}
void opal_tracepoint_unregfunc(void)
{
static_branch_dec(&opal_tracepoint_key);
}
static s64 __opal_call_trace(s64 a0, s64 a1, s64 a2, s64 a3,
s64 a4, s64 a5, s64 a6, s64 a7,
unsigned long opcode, unsigned long msr)
{
s64 ret;
__trace_opal_entry(a0, a1, a2, a3, a4, a5, a6, a7, opcode);
ret = __opal_call(a0, a1, a2, a3, a4, a5, a6, a7, opcode, msr);
__trace_opal_exit(opcode, ret);
return ret;
}
#define DO_TRACE (static_branch_unlikely(&opal_tracepoint_key))
#else /* CONFIG_TRACEPOINTS */
static s64 __opal_call_trace(s64 a0, s64 a1, s64 a2, s64 a3,
s64 a4, s64 a5, s64 a6, s64 a7,
unsigned long opcode, unsigned long msr)
{
return 0;
Annotation
- Immediate include surface: `linux/percpu.h`, `linux/jump_label.h`, `asm/interrupt.h`, `asm/opal-api.h`, `asm/trace.h`, `asm/asm-prototypes.h`.
- Detected declarations: `function __trace_opal_entry`, `function __trace_opal_exit`, `function opal_tracepoint_regfunc`, `function opal_tracepoint_unregfunc`, `function __opal_call_trace`, `function __opal_call_trace`, `function opal_call`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.