arch/sparc/kernel/pcr.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/pcr.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/pcr.c- Extension
.c- Size
- 7991 bytes
- Lines
- 374
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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/kernel.hlinux/export.hlinux/init.hlinux/irq.hlinux/irq_work.hlinux/ftrace.hasm/pil.hasm/pcr.hasm/nmi.hasm/asi.hasm/spitfire.h
Detected Declarations
function Copyrightfunction arch_irq_work_raisefunction direct_pcr_readfunction direct_pcr_writefunction direct_pic_readfunction direct_pic_writefunction direct_picl_valuefunction n2_pcr_writefunction n2_picl_valuefunction n4_pcr_readfunction n4_pcr_writefunction n4_pic_readfunction n4_pic_writefunction n4_picl_valuefunction n5_pcr_readfunction n5_pcr_writefunction m7_pcr_readfunction m7_pcr_writefunction register_perf_hsvcfunction unregister_perf_hsvcfunction setup_sun4v_pcr_opsfunction pcr_arch_initexport pcr_ops
Annotated Snippet
switch (sun4v_chip_type) {
case SUN4V_CHIP_NIAGARA1:
perf_hsvc_group = HV_GRP_NIAG_PERF;
break;
case SUN4V_CHIP_NIAGARA2:
perf_hsvc_group = HV_GRP_N2_CPU;
break;
case SUN4V_CHIP_NIAGARA3:
perf_hsvc_group = HV_GRP_KT_CPU;
break;
case SUN4V_CHIP_NIAGARA4:
perf_hsvc_group = HV_GRP_VT_CPU;
break;
case SUN4V_CHIP_NIAGARA5:
perf_hsvc_group = HV_GRP_T5_CPU;
break;
case SUN4V_CHIP_SPARC_M7:
perf_hsvc_group = HV_GRP_M7_PERF;
break;
default:
return -ENODEV;
}
perf_hsvc_major = 1;
perf_hsvc_minor = 0;
hverror = sun4v_hvapi_register(perf_hsvc_group,
perf_hsvc_major,
&perf_hsvc_minor);
if (hverror) {
pr_err("perfmon: Could not register hvapi(0x%lx).\n",
hverror);
return -ENODEV;
}
}
return 0;
}
static void __init unregister_perf_hsvc(void)
{
if (tlb_type != hypervisor)
return;
sun4v_hvapi_unregister(perf_hsvc_group);
}
static int __init setup_sun4v_pcr_ops(void)
{
int ret = 0;
switch (sun4v_chip_type) {
case SUN4V_CHIP_NIAGARA1:
case SUN4V_CHIP_NIAGARA2:
case SUN4V_CHIP_NIAGARA3:
pcr_ops = &n2_pcr_ops;
break;
case SUN4V_CHIP_NIAGARA4:
pcr_ops = &n4_pcr_ops;
break;
case SUN4V_CHIP_NIAGARA5:
pcr_ops = &n5_pcr_ops;
break;
case SUN4V_CHIP_SPARC_M7:
pcr_ops = &m7_pcr_ops;
break;
default:
ret = -ENODEV;
break;
}
return ret;
}
int __init pcr_arch_init(void)
{
int err = register_perf_hsvc();
if (err)
return err;
switch (tlb_type) {
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/export.h`, `linux/init.h`, `linux/irq.h`, `linux/irq_work.h`, `linux/ftrace.h`, `asm/pil.h`, `asm/pcr.h`.
- Detected declarations: `function Copyright`, `function arch_irq_work_raise`, `function direct_pcr_read`, `function direct_pcr_write`, `function direct_pic_read`, `function direct_pic_write`, `function direct_picl_value`, `function n2_pcr_write`, `function n2_picl_value`, `function n4_pcr_read`.
- Atlas domain: Architecture Layer / arch/sparc.
- 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.