1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * PowerPC64 LPAR Configuration Information Driver
5 * Dave Engebretsen engebret@us.ibm.com
6 * Copyright (c) 2003 Dave Engebretsen
7 * Will Schmidt willschm@us.ibm.com
8 * SPLPAR updates, Copyright (c) 2003 Will Schmidt IBM Corporation.
9 * seq_file updates, Copyright (c) 2004 Will Schmidt IBM Corporation.
10 * Nathan Lynch nathanl@austin.ibm.com
11 * Added lparcfg_write, Copyright (C) 2004 Nathan Lynch IBM Corporation.
13 * This driver creates a proc file at /proc/ppc64/lparcfg which contains
14 * keyword - value pairs that specify the configuration of the partition.
17 #include <linux/module.h>
18 #include <linux/types.h>
19 #include <linux/errno.h>
20 #include <linux/proc_fs.h>
21 #include <linux/init.h>
22 #include <linux/seq_file.h>
23 #include <linux/slab.h>
24 #include <linux/uaccess.h>
25 #include <linux/hugetlb.h>
26 #include <asm/lppaca.h>
27 #include <asm/hvcall.h>
28 #include <asm/firmware.h>
31 #include <asm/vdso_datapage.h>
34 #include <asm/machdep.h>
35 #include <asm/drmem.h>
40 * This isn't a module but we expose that to userspace
41 * via /proc so leave the definitions here
43 #define MODULE_VERS "1.9"
44 #define MODULE_NAME "lparcfg"
46 /* #define LPARCFG_DEBUG */
49 * Track sum of all purrs across all processors. This is used to further
50 * calculate usage values by different applications
52 static void cpu_get_purr(void *arg)
54 atomic64_t *sum = arg;
56 atomic64_add(mfspr(SPRN_PURR), sum);
59 static unsigned long get_purr(void)
61 atomic64_t purr = ATOMIC64_INIT(0);
63 on_each_cpu(cpu_get_purr, &purr, 1);
65 return atomic64_read(&purr);
69 * Methods used to fetch LPAR data when running on a pSeries platform.
72 struct hvcall_ppp_data {
74 u64 unallocated_entitlement;
79 u8 unallocated_weight;
80 u16 active_procs_in_pool;
81 u16 active_system_procs;
82 u16 phys_platform_procs;
83 u32 max_proc_cap_avail;
84 u32 entitled_proc_cap_avail;
88 * H_GET_PPP hcall returns info in 4 parms.
89 * entitled_capacity,unallocated_capacity,
90 * aggregation, resource_capability).
92 * R4 = Entitled Processor Capacity Percentage.
93 * R5 = Unallocated Processor Capacity Percentage.
94 * R6 (AABBCCDDEEFFGGHH).
99 * R7 (IIJJKKLLMMNNOOPP).
101 * XX - bit 0-6 reserved (0). bit 7 is Capped indicator.
102 * XX - variable processor Capacity Weight
103 * XX - Unallocated Variable Processor Capacity Weight.
104 * XXXX - Active processors in Physical Processor Pool.
105 * XXXX - Processors active on platform.
106 * R8 (QQQQRRRRRRSSSSSS). if ibm,partition-performance-parameters-level >= 1
107 * XXXX - Physical platform procs allocated to virtualization.
108 * XXXXXX - Max procs capacity % available to the partitions pool.
109 * XXXXXX - Entitled procs capacity % available to the
112 static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
115 unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
117 rc = plpar_hcall9(H_GET_PPP, retbuf);
119 ppp_data->entitlement = retbuf[0];
120 ppp_data->unallocated_entitlement = retbuf[1];
122 ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff;
123 ppp_data->pool_num = retbuf[2] & 0xffff;
125 ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01;
126 ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff;
127 ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff;
128 ppp_data->active_procs_in_pool = (retbuf[3] >> 2 * 8) & 0xffff;
129 ppp_data->active_system_procs = retbuf[3] & 0xffff;
131 ppp_data->phys_platform_procs = retbuf[4] >> 6 * 8;
132 ppp_data->max_proc_cap_avail = (retbuf[4] >> 3 * 8) & 0xffffff;
133 ppp_data->entitled_proc_cap_avail = retbuf[4] & 0xffffff;
138 static void show_gpci_data(struct seq_file *m)
140 struct hv_gpci_request_buffer *buf;
141 unsigned int affinity_score;
144 buf = kmalloc(sizeof(*buf), GFP_KERNEL);
149 * Show the local LPAR's affinity score.
151 * 0xB1 selects the Affinity_Domain_Info_By_Partition subcall.
152 * The score is at byte 0xB in the output buffer.
154 memset(&buf->params, 0, sizeof(buf->params));
155 buf->params.counter_request = cpu_to_be32(0xB1);
156 buf->params.starting_index = cpu_to_be32(-1); /* local LPAR */
157 buf->params.counter_info_version_in = 0x5; /* v5+ for score */
158 ret = plpar_hcall_norets(H_GET_PERF_COUNTER_INFO, virt_to_phys(buf),
160 if (ret != H_SUCCESS) {
161 pr_debug("hcall failed: H_GET_PERF_COUNTER_INFO: %ld, %x\n",
162 ret, be32_to_cpu(buf->params.detail_rc));
165 affinity_score = buf->bytes[0xB];
166 seq_printf(m, "partition_affinity_score=%u\n", affinity_score);
171 static unsigned h_pic(unsigned long *pool_idle_time,
172 unsigned long *num_procs)
175 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
177 rc = plpar_hcall(H_PIC, retbuf);
179 *pool_idle_time = retbuf[0];
180 *num_procs = retbuf[1];
187 * Parse out the data returned from h_get_ppp and h_pic
189 static void parse_ppp_data(struct seq_file *m)
191 struct hvcall_ppp_data ppp_data;
192 struct device_node *root;
193 const __be32 *perf_level;
196 rc = h_get_ppp(&ppp_data);
200 seq_printf(m, "partition_entitled_capacity=%lld\n",
201 ppp_data.entitlement);
202 seq_printf(m, "group=%d\n", ppp_data.group_num);
203 seq_printf(m, "system_active_processors=%d\n",
204 ppp_data.active_system_procs);
206 /* pool related entries are appropriate for shared configs */
207 if (lppaca_shared_proc(get_lppaca())) {
208 unsigned long pool_idle_time, pool_procs;
210 seq_printf(m, "pool=%d\n", ppp_data.pool_num);
212 /* report pool_capacity in percentage */
213 seq_printf(m, "pool_capacity=%d\n",
214 ppp_data.active_procs_in_pool * 100);
216 h_pic(&pool_idle_time, &pool_procs);
217 seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time);
218 seq_printf(m, "pool_num_procs=%ld\n", pool_procs);
221 seq_printf(m, "unallocated_capacity_weight=%d\n",
222 ppp_data.unallocated_weight);
223 seq_printf(m, "capacity_weight=%d\n", ppp_data.weight);
224 seq_printf(m, "capped=%d\n", ppp_data.capped);
225 seq_printf(m, "unallocated_capacity=%lld\n",
226 ppp_data.unallocated_entitlement);
228 /* The last bits of information returned from h_get_ppp are only
229 * valid if the ibm,partition-performance-parameters-level
232 root = of_find_node_by_path("/");
234 perf_level = of_get_property(root,
235 "ibm,partition-performance-parameters-level",
237 if (perf_level && (be32_to_cpup(perf_level) >= 1)) {
239 "physical_procs_allocated_to_virtualization=%d\n",
240 ppp_data.phys_platform_procs);
241 seq_printf(m, "max_proc_capacity_available=%d\n",
242 ppp_data.max_proc_cap_avail);
243 seq_printf(m, "entitled_proc_capacity_available=%d\n",
244 ppp_data.entitled_proc_cap_avail);
253 * Parse out data returned from h_get_mpp
255 static void parse_mpp_data(struct seq_file *m)
257 struct hvcall_mpp_data mpp_data;
260 rc = h_get_mpp(&mpp_data);
264 seq_printf(m, "entitled_memory=%ld\n", mpp_data.entitled_mem);
266 if (mpp_data.mapped_mem != -1)
267 seq_printf(m, "mapped_entitled_memory=%ld\n",
268 mpp_data.mapped_mem);
270 seq_printf(m, "entitled_memory_group_number=%d\n", mpp_data.group_num);
271 seq_printf(m, "entitled_memory_pool_number=%d\n", mpp_data.pool_num);
273 seq_printf(m, "entitled_memory_weight=%d\n", mpp_data.mem_weight);
274 seq_printf(m, "unallocated_entitled_memory_weight=%d\n",
275 mpp_data.unallocated_mem_weight);
276 seq_printf(m, "unallocated_io_mapping_entitlement=%ld\n",
277 mpp_data.unallocated_entitlement);
279 if (mpp_data.pool_size != -1)
280 seq_printf(m, "entitled_memory_pool_size=%ld bytes\n",
283 seq_printf(m, "entitled_memory_loan_request=%ld\n",
284 mpp_data.loan_request);
286 seq_printf(m, "backing_memory=%ld bytes\n", mpp_data.backing_mem);
291 * Parse out data returned from h_get_mpp_x
293 static void parse_mpp_x_data(struct seq_file *m)
295 struct hvcall_mpp_x_data mpp_x_data;
297 if (!firmware_has_feature(FW_FEATURE_XCMO))
299 if (h_get_mpp_x(&mpp_x_data))
302 seq_printf(m, "coalesced_bytes=%ld\n", mpp_x_data.coalesced_bytes);
304 if (mpp_x_data.pool_coalesced_bytes)
305 seq_printf(m, "pool_coalesced_bytes=%ld\n",
306 mpp_x_data.pool_coalesced_bytes);
307 if (mpp_x_data.pool_purr_cycles)
308 seq_printf(m, "coalesce_pool_purr=%ld\n", mpp_x_data.pool_purr_cycles);
309 if (mpp_x_data.pool_spurr_cycles)
310 seq_printf(m, "coalesce_pool_spurr=%ld\n", mpp_x_data.pool_spurr_cycles);
314 * PAPR defines, in section "7.3.16 System Parameters Option", the token 55 to
315 * read the LPAR name, and the largest output data to 4000 + 2 bytes length.
317 #define SPLPAR_LPAR_NAME_TOKEN 55
318 #define GET_SYS_PARM_BUF_SIZE 4002
319 #if GET_SYS_PARM_BUF_SIZE > RTAS_DATA_BUF_SIZE
320 #error "GET_SYS_PARM_BUF_SIZE is larger than RTAS_DATA_BUF_SIZE"
324 * Read the lpar name using the RTAS ibm,get-system-parameter call.
326 * The name read through this call is updated if changes are made by the end
327 * user on the hypervisor side.
329 * Some hypervisor (like Qemu) may not provide this value. In that case, a non
330 * null value is returned.
332 static int read_rtas_lpar_name(struct seq_file *m)
336 char raw_buffer[GET_SYS_PARM_BUF_SIZE];
339 char name[GET_SYS_PARM_BUF_SIZE-2];
343 token = rtas_token("ibm,get-system-parameter");
344 if (token == RTAS_UNKNOWN_SERVICE)
347 local_buffer = kmalloc(sizeof(*local_buffer), GFP_KERNEL);
352 spin_lock(&rtas_data_buf_lock);
353 memset(rtas_data_buf, 0, sizeof(*local_buffer));
354 rc = rtas_call(token, 3, 1, NULL, SPLPAR_LPAR_NAME_TOKEN,
355 __pa(rtas_data_buf), sizeof(*local_buffer));
357 memcpy(local_buffer->raw_buffer, rtas_data_buf,
358 sizeof(local_buffer->raw_buffer));
359 spin_unlock(&rtas_data_buf_lock);
360 } while (rtas_busy_delay(rc));
363 /* Force end of string */
364 len = min((int) be16_to_cpu(local_buffer->len),
365 (int) sizeof(local_buffer->name)-1);
366 local_buffer->name[len] = '\0';
368 seq_printf(m, "partition_name=%s\n", local_buffer->name);
377 * Read the LPAR name from the Device Tree.
379 * The value read in the DT is not updated if the end-user is touching the LPAR
380 * name on the hypervisor side.
382 static int read_dt_lpar_name(struct seq_file *m)
386 if (of_property_read_string(of_root, "ibm,partition-name", &name))
389 seq_printf(m, "partition_name=%s\n", name);
393 static void read_lpar_name(struct seq_file *m)
395 if (read_rtas_lpar_name(m) && read_dt_lpar_name(m))
396 pr_err_once("Error can't get the LPAR name");
399 #define SPLPAR_CHARACTERISTICS_TOKEN 20
400 #define SPLPAR_MAXLENGTH 1026*(sizeof(char))
403 * parse_system_parameter_string()
404 * Retrieve the potential_processors, max_entitled_capacity and friends
405 * through the get-system-parameter rtas call. Replace keyword strings as
408 static void parse_system_parameter_string(struct seq_file *m)
412 unsigned char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
414 printk(KERN_ERR "%s %s kmalloc failure at line %d\n",
415 __FILE__, __func__, __LINE__);
419 spin_lock(&rtas_data_buf_lock);
420 memset(rtas_data_buf, 0, SPLPAR_MAXLENGTH);
421 call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1,
423 SPLPAR_CHARACTERISTICS_TOKEN,
426 memcpy(local_buffer, rtas_data_buf, SPLPAR_MAXLENGTH);
427 local_buffer[SPLPAR_MAXLENGTH - 1] = '\0';
428 spin_unlock(&rtas_data_buf_lock);
430 if (call_status != 0) {
432 "%s %s Error calling get-system-parameter (0x%x)\n",
433 __FILE__, __func__, call_status);
437 char *workbuffer = kzalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
439 printk(KERN_ERR "%s %s kmalloc failure at line %d\n",
440 __FILE__, __func__, __LINE__);
445 printk(KERN_INFO "success calling get-system-parameter\n");
447 splpar_strlen = local_buffer[0] * 256 + local_buffer[1];
448 local_buffer += 2; /* step over strlen value */
452 while ((*local_buffer) && (idx < splpar_strlen)) {
453 workbuffer[w_idx++] = local_buffer[idx++];
454 if ((local_buffer[idx] == ',')
455 || (local_buffer[idx] == '\0')) {
456 workbuffer[w_idx] = '\0';
458 /* avoid the empty string */
459 seq_printf(m, "%s\n", workbuffer);
461 memset(workbuffer, 0, SPLPAR_MAXLENGTH);
462 idx++; /* skip the comma */
464 } else if (local_buffer[idx] == '=') {
465 /* code here to replace workbuffer contents
466 with different keyword strings */
467 if (0 == strcmp(workbuffer, "MaxEntCap")) {
469 "partition_max_entitled_capacity");
470 w_idx = strlen(workbuffer);
472 if (0 == strcmp(workbuffer, "MaxPlatProcs")) {
474 "system_potential_processors");
475 w_idx = strlen(workbuffer);
480 local_buffer -= 2; /* back up over strlen value */
485 /* Return the number of processors in the system.
486 * This function reads through the device tree and counts
487 * the virtual processors, this does not include threads.
489 static int lparcfg_count_active_processors(void)
491 struct device_node *cpus_dn;
494 for_each_node_by_type(cpus_dn, "cpu") {
496 printk(KERN_ERR "cpus_dn %p\n", cpus_dn);
503 static void pseries_cmo_data(struct seq_file *m)
506 unsigned long cmo_faults = 0;
507 unsigned long cmo_fault_time = 0;
509 seq_printf(m, "cmo_enabled=%d\n", firmware_has_feature(FW_FEATURE_CMO));
511 if (!firmware_has_feature(FW_FEATURE_CMO))
514 for_each_possible_cpu(cpu) {
515 cmo_faults += be64_to_cpu(lppaca_of(cpu).cmo_faults);
516 cmo_fault_time += be64_to_cpu(lppaca_of(cpu).cmo_fault_time);
519 seq_printf(m, "cmo_faults=%lu\n", cmo_faults);
520 seq_printf(m, "cmo_fault_time_usec=%lu\n",
521 cmo_fault_time / tb_ticks_per_usec);
522 seq_printf(m, "cmo_primary_psp=%d\n", cmo_get_primary_psp());
523 seq_printf(m, "cmo_secondary_psp=%d\n", cmo_get_secondary_psp());
524 seq_printf(m, "cmo_page_size=%lu\n", cmo_get_page_size());
527 static void splpar_dispatch_data(struct seq_file *m)
530 unsigned long dispatches = 0;
531 unsigned long dispatch_dispersions = 0;
533 for_each_possible_cpu(cpu) {
534 dispatches += be32_to_cpu(lppaca_of(cpu).yield_count);
535 dispatch_dispersions +=
536 be32_to_cpu(lppaca_of(cpu).dispersion_count);
539 seq_printf(m, "dispatches=%lu\n", dispatches);
540 seq_printf(m, "dispatch_dispersions=%lu\n", dispatch_dispersions);
543 static void parse_em_data(struct seq_file *m)
545 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
547 if (firmware_has_feature(FW_FEATURE_LPAR) &&
548 plpar_hcall(H_GET_EM_PARMS, retbuf) == H_SUCCESS)
549 seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]);
552 static void maxmem_data(struct seq_file *m)
554 unsigned long maxmem = 0;
556 maxmem += (unsigned long)drmem_info->n_lmbs * drmem_info->lmb_size;
557 maxmem += hugetlb_total_pages() * PAGE_SIZE;
559 seq_printf(m, "MaxMem=%lu\n", maxmem);
562 static int pseries_lparcfg_data(struct seq_file *m, void *v)
564 int partition_potential_processors;
565 int partition_active_processors;
566 struct device_node *rtas_node;
567 const __be32 *lrdrp = NULL;
569 rtas_node = of_find_node_by_path("/rtas");
571 lrdrp = of_get_property(rtas_node, "ibm,lrdr-capacity", NULL);
574 partition_potential_processors = vdso_data->processorCount;
576 partition_potential_processors = be32_to_cpup(lrdrp + 4);
578 of_node_put(rtas_node);
580 partition_active_processors = lparcfg_count_active_processors();
582 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
583 /* this call handles the ibm,get-system-parameter contents */
585 parse_system_parameter_string(m);
590 splpar_dispatch_data(m);
592 seq_printf(m, "purr=%ld\n", get_purr());
593 seq_printf(m, "tbr=%ld\n", mftb());
594 } else { /* non SPLPAR case */
596 seq_printf(m, "system_active_processors=%d\n",
597 partition_potential_processors);
599 seq_printf(m, "system_potential_processors=%d\n",
600 partition_potential_processors);
602 seq_printf(m, "partition_max_entitled_capacity=%d\n",
603 partition_potential_processors * 100);
605 seq_printf(m, "partition_entitled_capacity=%d\n",
606 partition_active_processors * 100);
611 seq_printf(m, "partition_active_processors=%d\n",
612 partition_active_processors);
614 seq_printf(m, "partition_potential_processors=%d\n",
615 partition_potential_processors);
617 seq_printf(m, "shared_processor_mode=%d\n",
618 lppaca_shared_proc(get_lppaca()));
620 #ifdef CONFIG_PPC_64S_HASH_MMU
621 if (!radix_enabled())
622 seq_printf(m, "slb_size=%d\n", mmu_slb_size);
627 seq_printf(m, "security_flavor=%u\n", pseries_security_flavor);
632 static ssize_t update_ppp(u64 *entitlement, u8 *weight)
634 struct hvcall_ppp_data ppp_data;
639 /* Get our current parameters */
640 retval = h_get_ppp(&ppp_data);
645 new_weight = ppp_data.weight;
646 new_entitled = *entitlement;
648 new_weight = *weight;
649 new_entitled = ppp_data.entitlement;
653 pr_debug("%s: current_entitled = %llu, current_weight = %u\n",
654 __func__, ppp_data.entitlement, ppp_data.weight);
656 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
657 __func__, new_entitled, new_weight);
659 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight);
666 * Update the memory entitlement and weight for the partition. Caller must
667 * specify either a new entitlement or weight, not both, to be updated
668 * since the h_set_mpp call takes both entitlement and weight as parameters.
670 static ssize_t update_mpp(u64 *entitlement, u8 *weight)
672 struct hvcall_mpp_data mpp_data;
678 /* Check with vio to ensure the new memory entitlement
681 rc = vio_cmo_entitlement_update(*entitlement);
686 rc = h_get_mpp(&mpp_data);
691 new_weight = mpp_data.mem_weight;
692 new_entitled = *entitlement;
694 new_weight = *weight;
695 new_entitled = mpp_data.entitled_mem;
699 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
700 __func__, mpp_data.entitled_mem, mpp_data.mem_weight);
702 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
703 __func__, new_entitled, new_weight);
705 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight);
710 * Interface for changing system parameters (variable capacity weight
711 * and entitled capacity). Format of input is "param_name=value";
712 * anything after value is ignored. Valid parameters at this time are
713 * "partition_entitled_capacity" and "capacity_weight". We use
714 * H_SET_PPP to alter parameters.
716 * This function should be invoked only on systems with
719 static ssize_t lparcfg_write(struct file *file, const char __user * buf,
720 size_t count, loff_t * off)
724 u64 new_entitled, *new_entitled_ptr = &new_entitled;
725 u8 new_weight, *new_weight_ptr = &new_weight;
728 if (!firmware_has_feature(FW_FEATURE_SPLPAR))
731 if (count > sizeof(kbuf))
734 if (copy_from_user(kbuf, buf, count))
737 kbuf[count - 1] = '\0';
738 tmp = strchr(kbuf, '=');
744 if (!strcmp(kbuf, "partition_entitled_capacity")) {
746 *new_entitled_ptr = (u64) simple_strtoul(tmp, &endp, 10);
750 retval = update_ppp(new_entitled_ptr, NULL);
751 } else if (!strcmp(kbuf, "capacity_weight")) {
753 *new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10);
757 retval = update_ppp(NULL, new_weight_ptr);
758 } else if (!strcmp(kbuf, "entitled_memory")) {
760 *new_entitled_ptr = (u64) simple_strtoul(tmp, &endp, 10);
764 retval = update_mpp(new_entitled_ptr, NULL);
765 } else if (!strcmp(kbuf, "entitled_memory_weight")) {
767 *new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10);
771 retval = update_mpp(NULL, new_weight_ptr);
775 if (retval == H_SUCCESS || retval == H_CONSTRAINED) {
777 } else if (retval == H_BUSY) {
779 } else if (retval == H_HARDWARE) {
781 } else if (retval == H_PARAMETER) {
788 static int lparcfg_data(struct seq_file *m, void *v)
790 struct device_node *rootdn;
791 const char *model = "";
792 const char *system_id = "";
794 const __be32 *lp_index_ptr;
795 unsigned int lp_index = 0;
797 seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS);
799 rootdn = of_find_node_by_path("/");
801 tmp = of_get_property(rootdn, "model", NULL);
804 tmp = of_get_property(rootdn, "system-id", NULL);
807 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
810 lp_index = be32_to_cpup(lp_index_ptr);
813 seq_printf(m, "serial_number=%s\n", system_id);
814 seq_printf(m, "system_type=%s\n", model);
815 seq_printf(m, "partition_id=%d\n", (int)lp_index);
817 return pseries_lparcfg_data(m, v);
820 static int lparcfg_open(struct inode *inode, struct file *file)
822 return single_open(file, lparcfg_data, NULL);
825 static const struct proc_ops lparcfg_proc_ops = {
826 .proc_read = seq_read,
827 .proc_write = lparcfg_write,
828 .proc_open = lparcfg_open,
829 .proc_release = single_release,
830 .proc_lseek = seq_lseek,
833 static int __init lparcfg_init(void)
837 /* Allow writing if we have FW_FEATURE_SPLPAR */
838 if (firmware_has_feature(FW_FEATURE_SPLPAR))
841 if (!proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_proc_ops)) {
842 printk(KERN_ERR "Failed to create powerpc/lparcfg\n");
847 machine_device_initcall(pseries, lparcfg_init);