arch/powerpc/platforms/pseries/lparcfg.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pseries/lparcfg.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/pseries/lparcfg.c- Extension
.c- Size
- 22588 bytes
- Lines
- 840
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/module.hlinux/types.hlinux/errno.hlinux/proc_fs.hlinux/init.hasm/papr-sysparm.hlinux/seq_file.hlinux/slab.hlinux/string.hlinux/uaccess.hlinux/hugetlb.hasm/lppaca.hasm/hvcall.hasm/firmware.hasm/rtas.hasm/time.hasm/vio.hasm/mmu.hasm/machdep.hasm/drmem.hpseries.hvas.h
Detected Declarations
struct hvcall_ppp_datafunction Copyrightfunction get_purrfunction R6function show_gpci_datafunction h_picfunction parse_ppp_datafunction parse_mpp_datafunction parse_mpp_x_datafunction hypervisorfunction read_dt_lpar_namefunction read_lpar_namefunction parse_system_parameter_stringfunction lparcfg_count_active_processorsfunction for_each_node_by_typefunction pseries_cmo_datafunction for_each_possible_cpufunction splpar_dispatch_datafunction for_each_possible_cpufunction parse_em_datafunction maxmem_datafunction pseries_lparcfg_datafunction update_pppfunction update_mppfunction lparcfg_writefunction lparcfg_datafunction lparcfg_openfunction lparcfg_init
Annotated Snippet
struct hvcall_ppp_data {
u64 entitlement;
u64 unallocated_entitlement;
u16 group_num;
u16 pool_num;
u8 capped;
u8 weight;
u8 unallocated_weight;
u8 resource_group_index;
u16 active_procs_in_resource_group;
u16 active_procs_in_pool;
u16 active_system_procs;
u16 phys_platform_procs;
u32 max_proc_cap_avail;
u32 entitled_proc_cap_avail;
};
/*
* H_GET_PPP hcall returns info in 5 parms.
* entitled_capacity,unallocated_capacity,
* aggregation, resource_capability).
*
* R4 = Entitled Processor Capacity Percentage.
* R5 = Unallocated Processor Capacity Percentage.
* R6 (AABBCCDDEEFFGGHH).
* XXXX - reserved (0)
* XXXX - Active Cores in Resource Group
* XXXX - Group Number
* XXXX - Pool Number.
* R7 (IIJJKKLLMMNNOOPP).
* XX - Resource group Number
* XX - bit 0-6 reserved (0). bit 7 is Capped indicator.
* XX - variable processor Capacity Weight
* XX - Unallocated Variable Processor Capacity Weight.
* XXXX - Active processors in Physical Processor Pool.
* XXXX - Processors active on platform.
* R8 (QQQQRRRRRRSSSSSS). if ibm,partition-performance-parameters-level >= 1
* XXXX - Physical platform procs allocated to virtualization.
* XXXXXX - Max procs capacity % available to the partitions pool.
* XXXXXX - Entitled procs capacity % available to the
* partitions pool.
*/
static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
{
unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
long rc;
rc = plpar_hcall9(H_GET_PPP, retbuf);
ppp_data->entitlement = retbuf[0];
ppp_data->unallocated_entitlement = retbuf[1];
ppp_data->active_procs_in_resource_group = (retbuf[2] >> 4 * 8) & 0xffff;
ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff;
ppp_data->pool_num = retbuf[2] & 0xffff;
ppp_data->resource_group_index = (retbuf[3] >> 7 * 8) & 0xff;
ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01;
ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff;
ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff;
ppp_data->active_procs_in_pool = (retbuf[3] >> 2 * 8) & 0xffff;
ppp_data->active_system_procs = retbuf[3] & 0xffff;
ppp_data->phys_platform_procs = retbuf[4] >> 6 * 8;
ppp_data->max_proc_cap_avail = (retbuf[4] >> 3 * 8) & 0xffffff;
ppp_data->entitled_proc_cap_avail = retbuf[4] & 0xffffff;
return rc;
}
static void show_gpci_data(struct seq_file *m)
{
struct hv_gpci_request_buffer *buf;
unsigned int affinity_score;
long ret;
buf = kmalloc_obj(*buf);
if (buf == NULL)
return;
/*
* Show the local LPAR's affinity score.
*
* 0xB1 selects the Affinity_Domain_Info_By_Partition subcall.
* The score is at byte 0xB in the output buffer.
*/
memset(&buf->params, 0, sizeof(buf->params));
buf->params.counter_request = cpu_to_be32(0xB1);
buf->params.starting_index = cpu_to_be32(-1); /* local LPAR */
buf->params.counter_info_version_in = 0x5; /* v5+ for score */
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `linux/errno.h`, `linux/proc_fs.h`, `linux/init.h`, `asm/papr-sysparm.h`, `linux/seq_file.h`, `linux/slab.h`.
- Detected declarations: `struct hvcall_ppp_data`, `function Copyright`, `function get_purr`, `function R6`, `function show_gpci_data`, `function h_pic`, `function parse_ppp_data`, `function parse_mpp_data`, `function parse_mpp_x_data`, `function hypervisor`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.