Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / arch / powerpc / platforms / pseries / lparcfg.c
blobc9fecf09b8fada71dec94e9833c35be524b498e4
1 /*
2 * PowerPC64 LPAR Configuration Information Driver
4 * Dave Engebretsen engebret@us.ibm.com
5 * Copyright (c) 2003 Dave Engebretsen
6 * Will Schmidt willschm@us.ibm.com
7 * SPLPAR updates, Copyright (c) 2003 Will Schmidt IBM Corporation.
8 * seq_file updates, Copyright (c) 2004 Will Schmidt IBM Corporation.
9 * Nathan Lynch nathanl@austin.ibm.com
10 * Added lparcfg_write, Copyright (C) 2004 Nathan Lynch IBM Corporation.
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
17 * This driver creates a proc file at /proc/ppc64/lparcfg which contains
18 * keyword - value pairs that specify the configuration of the partition.
21 #include <linux/module.h>
22 #include <linux/types.h>
23 #include <linux/errno.h>
24 #include <linux/proc_fs.h>
25 #include <linux/init.h>
26 #include <linux/seq_file.h>
27 #include <linux/slab.h>
28 #include <asm/uaccess.h>
29 #include <asm/lppaca.h>
30 #include <asm/hvcall.h>
31 #include <asm/firmware.h>
32 #include <asm/rtas.h>
33 #include <asm/time.h>
34 #include <asm/prom.h>
35 #include <asm/vdso_datapage.h>
36 #include <asm/vio.h>
37 #include <asm/mmu.h>
38 #include <asm/machdep.h>
42 * This isn't a module but we expose that to userspace
43 * via /proc so leave the definitions here
45 #define MODULE_VERS "1.9"
46 #define MODULE_NAME "lparcfg"
48 /* #define LPARCFG_DEBUG */
51 * Track sum of all purrs across all processors. This is used to further
52 * calculate usage values by different applications
54 static unsigned long get_purr(void)
56 unsigned long sum_purr = 0;
57 int cpu;
59 for_each_possible_cpu(cpu) {
60 struct cpu_usage *cu;
62 cu = &per_cpu(cpu_usage_array, cpu);
63 sum_purr += cu->current_tb;
65 return sum_purr;
69 * Methods used to fetch LPAR data when running on a pSeries platform.
72 struct hvcall_ppp_data {
73 u64 entitlement;
74 u64 unallocated_entitlement;
75 u16 group_num;
76 u16 pool_num;
77 u8 capped;
78 u8 weight;
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).
95 * XXXX - reserved (0)
96 * XXXX - reserved (0)
97 * XXXX - Group Number
98 * XXXX - Pool Number.
99 * R7 (IIJJKKLLMMNNOOPP).
100 * XX - reserved. (0)
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
110 * partitions pool.
112 static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
114 unsigned long rc;
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;
135 return rc;
138 static unsigned h_pic(unsigned long *pool_idle_time,
139 unsigned long *num_procs)
141 unsigned long rc;
142 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
144 rc = plpar_hcall(H_PIC, retbuf);
146 *pool_idle_time = retbuf[0];
147 *num_procs = retbuf[1];
149 return rc;
153 * parse_ppp_data
154 * Parse out the data returned from h_get_ppp and h_pic
156 static void parse_ppp_data(struct seq_file *m)
158 struct hvcall_ppp_data ppp_data;
159 struct device_node *root;
160 const __be32 *perf_level;
161 int rc;
163 rc = h_get_ppp(&ppp_data);
164 if (rc)
165 return;
167 seq_printf(m, "partition_entitled_capacity=%lld\n",
168 ppp_data.entitlement);
169 seq_printf(m, "group=%d\n", ppp_data.group_num);
170 seq_printf(m, "system_active_processors=%d\n",
171 ppp_data.active_system_procs);
173 /* pool related entries are appropriate for shared configs */
174 if (lppaca_shared_proc(get_lppaca())) {
175 unsigned long pool_idle_time, pool_procs;
177 seq_printf(m, "pool=%d\n", ppp_data.pool_num);
179 /* report pool_capacity in percentage */
180 seq_printf(m, "pool_capacity=%d\n",
181 ppp_data.active_procs_in_pool * 100);
183 h_pic(&pool_idle_time, &pool_procs);
184 seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time);
185 seq_printf(m, "pool_num_procs=%ld\n", pool_procs);
188 seq_printf(m, "unallocated_capacity_weight=%d\n",
189 ppp_data.unallocated_weight);
190 seq_printf(m, "capacity_weight=%d\n", ppp_data.weight);
191 seq_printf(m, "capped=%d\n", ppp_data.capped);
192 seq_printf(m, "unallocated_capacity=%lld\n",
193 ppp_data.unallocated_entitlement);
195 /* The last bits of information returned from h_get_ppp are only
196 * valid if the ibm,partition-performance-parameters-level
197 * property is >= 1.
199 root = of_find_node_by_path("/");
200 if (root) {
201 perf_level = of_get_property(root,
202 "ibm,partition-performance-parameters-level",
203 NULL);
204 if (perf_level && (be32_to_cpup(perf_level) >= 1)) {
205 seq_printf(m,
206 "physical_procs_allocated_to_virtualization=%d\n",
207 ppp_data.phys_platform_procs);
208 seq_printf(m, "max_proc_capacity_available=%d\n",
209 ppp_data.max_proc_cap_avail);
210 seq_printf(m, "entitled_proc_capacity_available=%d\n",
211 ppp_data.entitled_proc_cap_avail);
214 of_node_put(root);
219 * parse_mpp_data
220 * Parse out data returned from h_get_mpp
222 static void parse_mpp_data(struct seq_file *m)
224 struct hvcall_mpp_data mpp_data;
225 int rc;
227 rc = h_get_mpp(&mpp_data);
228 if (rc)
229 return;
231 seq_printf(m, "entitled_memory=%ld\n", mpp_data.entitled_mem);
233 if (mpp_data.mapped_mem != -1)
234 seq_printf(m, "mapped_entitled_memory=%ld\n",
235 mpp_data.mapped_mem);
237 seq_printf(m, "entitled_memory_group_number=%d\n", mpp_data.group_num);
238 seq_printf(m, "entitled_memory_pool_number=%d\n", mpp_data.pool_num);
240 seq_printf(m, "entitled_memory_weight=%d\n", mpp_data.mem_weight);
241 seq_printf(m, "unallocated_entitled_memory_weight=%d\n",
242 mpp_data.unallocated_mem_weight);
243 seq_printf(m, "unallocated_io_mapping_entitlement=%ld\n",
244 mpp_data.unallocated_entitlement);
246 if (mpp_data.pool_size != -1)
247 seq_printf(m, "entitled_memory_pool_size=%ld bytes\n",
248 mpp_data.pool_size);
250 seq_printf(m, "entitled_memory_loan_request=%ld\n",
251 mpp_data.loan_request);
253 seq_printf(m, "backing_memory=%ld bytes\n", mpp_data.backing_mem);
257 * parse_mpp_x_data
258 * Parse out data returned from h_get_mpp_x
260 static void parse_mpp_x_data(struct seq_file *m)
262 struct hvcall_mpp_x_data mpp_x_data;
264 if (!firmware_has_feature(FW_FEATURE_XCMO))
265 return;
266 if (h_get_mpp_x(&mpp_x_data))
267 return;
269 seq_printf(m, "coalesced_bytes=%ld\n", mpp_x_data.coalesced_bytes);
271 if (mpp_x_data.pool_coalesced_bytes)
272 seq_printf(m, "pool_coalesced_bytes=%ld\n",
273 mpp_x_data.pool_coalesced_bytes);
274 if (mpp_x_data.pool_purr_cycles)
275 seq_printf(m, "coalesce_pool_purr=%ld\n", mpp_x_data.pool_purr_cycles);
276 if (mpp_x_data.pool_spurr_cycles)
277 seq_printf(m, "coalesce_pool_spurr=%ld\n", mpp_x_data.pool_spurr_cycles);
280 #define SPLPAR_CHARACTERISTICS_TOKEN 20
281 #define SPLPAR_MAXLENGTH 1026*(sizeof(char))
284 * parse_system_parameter_string()
285 * Retrieve the potential_processors, max_entitled_capacity and friends
286 * through the get-system-parameter rtas call. Replace keyword strings as
287 * necessary.
289 static void parse_system_parameter_string(struct seq_file *m)
291 int call_status;
293 unsigned char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
294 if (!local_buffer) {
295 printk(KERN_ERR "%s %s kmalloc failure at line %d\n",
296 __FILE__, __func__, __LINE__);
297 return;
300 spin_lock(&rtas_data_buf_lock);
301 memset(rtas_data_buf, 0, SPLPAR_MAXLENGTH);
302 call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1,
303 NULL,
304 SPLPAR_CHARACTERISTICS_TOKEN,
305 __pa(rtas_data_buf),
306 RTAS_DATA_BUF_SIZE);
307 memcpy(local_buffer, rtas_data_buf, SPLPAR_MAXLENGTH);
308 local_buffer[SPLPAR_MAXLENGTH - 1] = '\0';
309 spin_unlock(&rtas_data_buf_lock);
311 if (call_status != 0) {
312 printk(KERN_INFO
313 "%s %s Error calling get-system-parameter (0x%x)\n",
314 __FILE__, __func__, call_status);
315 } else {
316 int splpar_strlen;
317 int idx, w_idx;
318 char *workbuffer = kzalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
319 if (!workbuffer) {
320 printk(KERN_ERR "%s %s kmalloc failure at line %d\n",
321 __FILE__, __func__, __LINE__);
322 kfree(local_buffer);
323 return;
325 #ifdef LPARCFG_DEBUG
326 printk(KERN_INFO "success calling get-system-parameter\n");
327 #endif
328 splpar_strlen = local_buffer[0] * 256 + local_buffer[1];
329 local_buffer += 2; /* step over strlen value */
331 w_idx = 0;
332 idx = 0;
333 while ((*local_buffer) && (idx < splpar_strlen)) {
334 workbuffer[w_idx++] = local_buffer[idx++];
335 if ((local_buffer[idx] == ',')
336 || (local_buffer[idx] == '\0')) {
337 workbuffer[w_idx] = '\0';
338 if (w_idx) {
339 /* avoid the empty string */
340 seq_printf(m, "%s\n", workbuffer);
342 memset(workbuffer, 0, SPLPAR_MAXLENGTH);
343 idx++; /* skip the comma */
344 w_idx = 0;
345 } else if (local_buffer[idx] == '=') {
346 /* code here to replace workbuffer contents
347 with different keyword strings */
348 if (0 == strcmp(workbuffer, "MaxEntCap")) {
349 strcpy(workbuffer,
350 "partition_max_entitled_capacity");
351 w_idx = strlen(workbuffer);
353 if (0 == strcmp(workbuffer, "MaxPlatProcs")) {
354 strcpy(workbuffer,
355 "system_potential_processors");
356 w_idx = strlen(workbuffer);
360 kfree(workbuffer);
361 local_buffer -= 2; /* back up over strlen value */
363 kfree(local_buffer);
366 /* Return the number of processors in the system.
367 * This function reads through the device tree and counts
368 * the virtual processors, this does not include threads.
370 static int lparcfg_count_active_processors(void)
372 struct device_node *cpus_dn = NULL;
373 int count = 0;
375 while ((cpus_dn = of_find_node_by_type(cpus_dn, "cpu"))) {
376 #ifdef LPARCFG_DEBUG
377 printk(KERN_ERR "cpus_dn %p\n", cpus_dn);
378 #endif
379 count++;
381 return count;
384 static void pseries_cmo_data(struct seq_file *m)
386 int cpu;
387 unsigned long cmo_faults = 0;
388 unsigned long cmo_fault_time = 0;
390 seq_printf(m, "cmo_enabled=%d\n", firmware_has_feature(FW_FEATURE_CMO));
392 if (!firmware_has_feature(FW_FEATURE_CMO))
393 return;
395 for_each_possible_cpu(cpu) {
396 cmo_faults += be64_to_cpu(lppaca_of(cpu).cmo_faults);
397 cmo_fault_time += be64_to_cpu(lppaca_of(cpu).cmo_fault_time);
400 seq_printf(m, "cmo_faults=%lu\n", cmo_faults);
401 seq_printf(m, "cmo_fault_time_usec=%lu\n",
402 cmo_fault_time / tb_ticks_per_usec);
403 seq_printf(m, "cmo_primary_psp=%d\n", cmo_get_primary_psp());
404 seq_printf(m, "cmo_secondary_psp=%d\n", cmo_get_secondary_psp());
405 seq_printf(m, "cmo_page_size=%lu\n", cmo_get_page_size());
408 static void splpar_dispatch_data(struct seq_file *m)
410 int cpu;
411 unsigned long dispatches = 0;
412 unsigned long dispatch_dispersions = 0;
414 for_each_possible_cpu(cpu) {
415 dispatches += be32_to_cpu(lppaca_of(cpu).yield_count);
416 dispatch_dispersions +=
417 be32_to_cpu(lppaca_of(cpu).dispersion_count);
420 seq_printf(m, "dispatches=%lu\n", dispatches);
421 seq_printf(m, "dispatch_dispersions=%lu\n", dispatch_dispersions);
424 static void parse_em_data(struct seq_file *m)
426 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
428 if (firmware_has_feature(FW_FEATURE_LPAR) &&
429 plpar_hcall(H_GET_EM_PARMS, retbuf) == H_SUCCESS)
430 seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]);
433 static int pseries_lparcfg_data(struct seq_file *m, void *v)
435 int partition_potential_processors;
436 int partition_active_processors;
437 struct device_node *rtas_node;
438 const __be32 *lrdrp = NULL;
440 rtas_node = of_find_node_by_path("/rtas");
441 if (rtas_node)
442 lrdrp = of_get_property(rtas_node, "ibm,lrdr-capacity", NULL);
444 if (lrdrp == NULL) {
445 partition_potential_processors = vdso_data->processorCount;
446 } else {
447 partition_potential_processors = be32_to_cpup(lrdrp + 4);
449 of_node_put(rtas_node);
451 partition_active_processors = lparcfg_count_active_processors();
453 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
454 /* this call handles the ibm,get-system-parameter contents */
455 parse_system_parameter_string(m);
456 parse_ppp_data(m);
457 parse_mpp_data(m);
458 parse_mpp_x_data(m);
459 pseries_cmo_data(m);
460 splpar_dispatch_data(m);
462 seq_printf(m, "purr=%ld\n", get_purr());
463 } else { /* non SPLPAR case */
465 seq_printf(m, "system_active_processors=%d\n",
466 partition_potential_processors);
468 seq_printf(m, "system_potential_processors=%d\n",
469 partition_potential_processors);
471 seq_printf(m, "partition_max_entitled_capacity=%d\n",
472 partition_potential_processors * 100);
474 seq_printf(m, "partition_entitled_capacity=%d\n",
475 partition_active_processors * 100);
478 seq_printf(m, "partition_active_processors=%d\n",
479 partition_active_processors);
481 seq_printf(m, "partition_potential_processors=%d\n",
482 partition_potential_processors);
484 seq_printf(m, "shared_processor_mode=%d\n",
485 lppaca_shared_proc(get_lppaca()));
487 seq_printf(m, "slb_size=%d\n", mmu_slb_size);
489 parse_em_data(m);
491 return 0;
494 static ssize_t update_ppp(u64 *entitlement, u8 *weight)
496 struct hvcall_ppp_data ppp_data;
497 u8 new_weight;
498 u64 new_entitled;
499 ssize_t retval;
501 /* Get our current parameters */
502 retval = h_get_ppp(&ppp_data);
503 if (retval)
504 return retval;
506 if (entitlement) {
507 new_weight = ppp_data.weight;
508 new_entitled = *entitlement;
509 } else if (weight) {
510 new_weight = *weight;
511 new_entitled = ppp_data.entitlement;
512 } else
513 return -EINVAL;
515 pr_debug("%s: current_entitled = %llu, current_weight = %u\n",
516 __func__, ppp_data.entitlement, ppp_data.weight);
518 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
519 __func__, new_entitled, new_weight);
521 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight);
522 return retval;
526 * update_mpp
528 * Update the memory entitlement and weight for the partition. Caller must
529 * specify either a new entitlement or weight, not both, to be updated
530 * since the h_set_mpp call takes both entitlement and weight as parameters.
532 static ssize_t update_mpp(u64 *entitlement, u8 *weight)
534 struct hvcall_mpp_data mpp_data;
535 u64 new_entitled;
536 u8 new_weight;
537 ssize_t rc;
539 if (entitlement) {
540 /* Check with vio to ensure the new memory entitlement
541 * can be handled.
543 rc = vio_cmo_entitlement_update(*entitlement);
544 if (rc)
545 return rc;
548 rc = h_get_mpp(&mpp_data);
549 if (rc)
550 return rc;
552 if (entitlement) {
553 new_weight = mpp_data.mem_weight;
554 new_entitled = *entitlement;
555 } else if (weight) {
556 new_weight = *weight;
557 new_entitled = mpp_data.entitled_mem;
558 } else
559 return -EINVAL;
561 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
562 __func__, mpp_data.entitled_mem, mpp_data.mem_weight);
564 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
565 __func__, new_entitled, new_weight);
567 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight);
568 return rc;
572 * Interface for changing system parameters (variable capacity weight
573 * and entitled capacity). Format of input is "param_name=value";
574 * anything after value is ignored. Valid parameters at this time are
575 * "partition_entitled_capacity" and "capacity_weight". We use
576 * H_SET_PPP to alter parameters.
578 * This function should be invoked only on systems with
579 * FW_FEATURE_SPLPAR.
581 static ssize_t lparcfg_write(struct file *file, const char __user * buf,
582 size_t count, loff_t * off)
584 int kbuf_sz = 64;
585 char kbuf[kbuf_sz];
586 char *tmp;
587 u64 new_entitled, *new_entitled_ptr = &new_entitled;
588 u8 new_weight, *new_weight_ptr = &new_weight;
589 ssize_t retval;
591 if (!firmware_has_feature(FW_FEATURE_SPLPAR))
592 return -EINVAL;
594 if (count > kbuf_sz)
595 return -EINVAL;
597 if (copy_from_user(kbuf, buf, count))
598 return -EFAULT;
600 kbuf[count - 1] = '\0';
601 tmp = strchr(kbuf, '=');
602 if (!tmp)
603 return -EINVAL;
605 *tmp++ = '\0';
607 if (!strcmp(kbuf, "partition_entitled_capacity")) {
608 char *endp;
609 *new_entitled_ptr = (u64) simple_strtoul(tmp, &endp, 10);
610 if (endp == tmp)
611 return -EINVAL;
613 retval = update_ppp(new_entitled_ptr, NULL);
614 } else if (!strcmp(kbuf, "capacity_weight")) {
615 char *endp;
616 *new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10);
617 if (endp == tmp)
618 return -EINVAL;
620 retval = update_ppp(NULL, new_weight_ptr);
621 } else if (!strcmp(kbuf, "entitled_memory")) {
622 char *endp;
623 *new_entitled_ptr = (u64) simple_strtoul(tmp, &endp, 10);
624 if (endp == tmp)
625 return -EINVAL;
627 retval = update_mpp(new_entitled_ptr, NULL);
628 } else if (!strcmp(kbuf, "entitled_memory_weight")) {
629 char *endp;
630 *new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10);
631 if (endp == tmp)
632 return -EINVAL;
634 retval = update_mpp(NULL, new_weight_ptr);
635 } else
636 return -EINVAL;
638 if (retval == H_SUCCESS || retval == H_CONSTRAINED) {
639 retval = count;
640 } else if (retval == H_BUSY) {
641 retval = -EBUSY;
642 } else if (retval == H_HARDWARE) {
643 retval = -EIO;
644 } else if (retval == H_PARAMETER) {
645 retval = -EINVAL;
648 return retval;
651 static int lparcfg_data(struct seq_file *m, void *v)
653 struct device_node *rootdn;
654 const char *model = "";
655 const char *system_id = "";
656 const char *tmp;
657 const __be32 *lp_index_ptr;
658 unsigned int lp_index = 0;
660 seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS);
662 rootdn = of_find_node_by_path("/");
663 if (rootdn) {
664 tmp = of_get_property(rootdn, "model", NULL);
665 if (tmp)
666 model = tmp;
667 tmp = of_get_property(rootdn, "system-id", NULL);
668 if (tmp)
669 system_id = tmp;
670 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
671 NULL);
672 if (lp_index_ptr)
673 lp_index = be32_to_cpup(lp_index_ptr);
674 of_node_put(rootdn);
676 seq_printf(m, "serial_number=%s\n", system_id);
677 seq_printf(m, "system_type=%s\n", model);
678 seq_printf(m, "partition_id=%d\n", (int)lp_index);
680 return pseries_lparcfg_data(m, v);
683 static int lparcfg_open(struct inode *inode, struct file *file)
685 return single_open(file, lparcfg_data, NULL);
688 static const struct file_operations lparcfg_fops = {
689 .read = seq_read,
690 .write = lparcfg_write,
691 .open = lparcfg_open,
692 .release = single_release,
693 .llseek = seq_lseek,
696 static int __init lparcfg_init(void)
698 umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
700 /* Allow writing if we have FW_FEATURE_SPLPAR */
701 if (firmware_has_feature(FW_FEATURE_SPLPAR))
702 mode |= S_IWUSR;
704 if (!proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops)) {
705 printk(KERN_ERR "Failed to create powerpc/lparcfg\n");
706 return -EIO;
708 return 0;
710 machine_device_initcall(pseries, lparcfg_init);