2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2004-2006 Silicon Graphics, Inc. All rights reserved.
8 * SGI Altix topology and hardware performance monitoring API.
9 * Mark Goodwin <markgw@sgi.com>.
11 * Creates /proc/sgi_sn/sn_topology (read-only) to export
12 * info about Altix nodes, routers, CPUs and NumaLink
13 * interconnection/topology.
15 * Also creates a dynamic misc device named "sn_hwperf"
16 * that supports an ioctl interface to call down into SAL
17 * to discover hw objects, topology and to read/write
18 * memory mapped registers, e.g. for performance monitoring.
19 * The "sn_hwperf" device is registered only after the procfs
20 * file is first opened, i.e. only if/when it's needed.
22 * This API is used by SGI Performance Co-Pilot and other
23 * tools, see http://oss.sgi.com/projects/pcp
27 #include <linux/slab.h>
28 #include <linux/vmalloc.h>
29 #include <linux/seq_file.h>
30 #include <linux/miscdevice.h>
31 #include <linux/utsname.h>
32 #include <linux/cpumask.h>
33 #include <linux/smp_lock.h>
34 #include <linux/nodemask.h>
35 #include <linux/smp.h>
36 #include <linux/mutex.h>
38 #include <asm/processor.h>
39 #include <asm/topology.h>
40 #include <asm/uaccess.h>
42 #include <asm/sn/io.h>
43 #include <asm/sn/sn_sal.h>
44 #include <asm/sn/module.h>
45 #include <asm/sn/geo.h>
46 #include <asm/sn/sn2/sn_hwperf.h>
47 #include <asm/sn/addrs.h>
49 static void *sn_hwperf_salheap = NULL;
50 static int sn_hwperf_obj_cnt = 0;
51 static nasid_t sn_hwperf_master_nasid = INVALID_NASID;
52 static int sn_hwperf_init(void);
53 static DEFINE_MUTEX(sn_hwperf_init_mutex);
55 #define cnode_possible(n) ((n) < num_cnodes)
57 static int sn_hwperf_enum_objects(int *nobj, struct sn_hwperf_object_info **ret)
61 struct sn_hwperf_object_info *objbuf = NULL;
63 if ((e = sn_hwperf_init()) < 0) {
64 printk(KERN_ERR "sn_hwperf_init failed: err %d\n", e);
68 sz = sn_hwperf_obj_cnt * sizeof(struct sn_hwperf_object_info);
71 printk("sn_hwperf_enum_objects: vmalloc(%d) failed\n", (int)sz);
76 e = ia64_sn_hwperf_op(sn_hwperf_master_nasid, SN_HWPERF_ENUM_OBJECTS,
77 0, sz, (u64) objbuf, 0, 0, NULL);
78 if (e != SN_HWPERF_OP_OK) {
84 *nobj = sn_hwperf_obj_cnt;
89 static int sn_hwperf_location_to_bpos(char *location,
90 int *rack, int *bay, int *slot, int *slab)
94 /* first scan for an old style geoid string */
95 if (sscanf(location, "%03d%c%02d#%d",
96 rack, &type, bay, slab) == 4)
98 else /* scan for a new bladed geoid string */
99 if (sscanf(location, "%03d%c%02d^%02d#%d",
100 rack, &type, bay, slot, slab) != 5)
106 static int sn_hwperf_geoid_to_cnode(char *location)
110 moduleid_t module_id;
111 int rack, bay, slot, slab;
112 int this_rack, this_bay, this_slot, this_slab;
114 if (sn_hwperf_location_to_bpos(location, &rack, &bay, &slot, &slab))
118 * FIXME: replace with cleaner for_each_XXX macro which addresses
119 * both compute and IO nodes once ACPI3.0 is available.
121 for (cnode = 0; cnode < num_cnodes; cnode++) {
122 geoid = cnodeid_get_geoid(cnode);
123 module_id = geo_module(geoid);
124 this_rack = MODULE_GET_RACK(module_id);
125 this_bay = MODULE_GET_BPOS(module_id);
126 this_slot = geo_slot(geoid);
127 this_slab = geo_slab(geoid);
128 if (rack == this_rack && bay == this_bay &&
129 slot == this_slot && slab == this_slab) {
134 return cnode_possible(cnode) ? cnode : -1;
137 static int sn_hwperf_obj_to_cnode(struct sn_hwperf_object_info * obj)
139 if (!SN_HWPERF_IS_NODE(obj) && !SN_HWPERF_IS_IONODE(obj))
141 if (SN_HWPERF_FOREIGN(obj))
143 return sn_hwperf_geoid_to_cnode(obj->location);
146 static int sn_hwperf_generic_ordinal(struct sn_hwperf_object_info *obj,
147 struct sn_hwperf_object_info *objs)
150 struct sn_hwperf_object_info *p;
152 for (ordinal=0, p=objs; p != obj; p++) {
153 if (SN_HWPERF_FOREIGN(p))
155 if (SN_HWPERF_SAME_OBJTYPE(p, obj))
162 static const char *slabname_node = "node"; /* SHub asic */
163 static const char *slabname_ionode = "ionode"; /* TIO asic */
164 static const char *slabname_router = "router"; /* NL3R or NL4R */
165 static const char *slabname_other = "other"; /* unknown asic */
167 static const char *sn_hwperf_get_slabname(struct sn_hwperf_object_info *obj,
168 struct sn_hwperf_object_info *objs, int *ordinal)
171 const char *slabname = slabname_other;
173 if ((isnode = SN_HWPERF_IS_NODE(obj)) || SN_HWPERF_IS_IONODE(obj)) {
174 slabname = isnode ? slabname_node : slabname_ionode;
175 *ordinal = sn_hwperf_obj_to_cnode(obj);
178 *ordinal = sn_hwperf_generic_ordinal(obj, objs);
179 if (SN_HWPERF_IS_ROUTER(obj))
180 slabname = slabname_router;
186 static void print_pci_topology(struct seq_file *s)
192 for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) {
193 if (!(p = kmalloc(sz, GFP_KERNEL)))
195 e = ia64_sn_ioif_get_pci_topology(__pa(p), sz);
199 if (e == SALRET_OK || e == SALRET_NOT_IMPLEMENTED)
204 static inline int sn_hwperf_has_cpus(cnodeid_t node)
206 return node < MAX_NUMNODES && node_online(node) && nr_cpus_node(node);
209 static inline int sn_hwperf_has_mem(cnodeid_t node)
211 return node < MAX_NUMNODES && node_online(node) && NODE_DATA(node)->node_present_pages;
214 static struct sn_hwperf_object_info *
215 sn_hwperf_findobj_id(struct sn_hwperf_object_info *objbuf,
219 struct sn_hwperf_object_info *p = objbuf;
221 for (i=0; i < nobj; i++, p++) {
230 static int sn_hwperf_get_nearest_node_objdata(struct sn_hwperf_object_info *objbuf,
231 int nobj, cnodeid_t node, cnodeid_t *near_mem_node, cnodeid_t *near_cpu_node)
234 struct sn_hwperf_object_info *nodeobj = NULL;
235 struct sn_hwperf_object_info *op;
236 struct sn_hwperf_object_info *dest;
237 struct sn_hwperf_object_info *router;
238 struct sn_hwperf_port_info ptdata[16];
244 if (!cnode_possible(node))
247 if (sn_hwperf_has_cpus(node)) {
249 *near_cpu_node = node;
253 if (sn_hwperf_has_mem(node)) {
255 *near_mem_node = node;
259 if (found_cpu && found_mem)
260 return 0; /* trivially successful */
262 /* find the argument node object */
263 for (i=0, op=objbuf; i < nobj; i++, op++) {
264 if (!SN_HWPERF_IS_NODE(op) && !SN_HWPERF_IS_IONODE(op))
266 if (node == sn_hwperf_obj_to_cnode(op)) {
276 /* get it's interconnect topology */
277 sz = op->ports * sizeof(struct sn_hwperf_port_info);
278 BUG_ON(sz > sizeof(ptdata));
279 e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
280 SN_HWPERF_ENUM_PORTS, nodeobj->id, sz,
281 (u64)&ptdata, 0, 0, NULL);
282 if (e != SN_HWPERF_OP_OK) {
287 /* find nearest node with cpus and nearest memory */
288 for (router=NULL, j=0; j < op->ports; j++) {
289 dest = sn_hwperf_findobj_id(objbuf, nobj, ptdata[j].conn_id);
290 if (dest && SN_HWPERF_IS_ROUTER(dest))
292 if (!dest || SN_HWPERF_FOREIGN(dest) ||
293 !SN_HWPERF_IS_NODE(dest) || SN_HWPERF_IS_IONODE(dest)) {
296 c = sn_hwperf_obj_to_cnode(dest);
297 if (!found_cpu && sn_hwperf_has_cpus(c)) {
302 if (!found_mem && sn_hwperf_has_mem(c)) {
309 if (router && (!found_cpu || !found_mem)) {
310 /* search for a node connected to the same router */
311 sz = router->ports * sizeof(struct sn_hwperf_port_info);
312 BUG_ON(sz > sizeof(ptdata));
313 e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
314 SN_HWPERF_ENUM_PORTS, router->id, sz,
315 (u64)&ptdata, 0, 0, NULL);
316 if (e != SN_HWPERF_OP_OK) {
320 for (j=0; j < router->ports; j++) {
321 dest = sn_hwperf_findobj_id(objbuf, nobj,
323 if (!dest || dest->id == node ||
324 SN_HWPERF_FOREIGN(dest) ||
325 !SN_HWPERF_IS_NODE(dest) ||
326 SN_HWPERF_IS_IONODE(dest)) {
329 c = sn_hwperf_obj_to_cnode(dest);
330 if (!found_cpu && sn_hwperf_has_cpus(c)) {
335 if (!found_mem && sn_hwperf_has_mem(c)) {
340 if (found_cpu && found_mem)
345 if (!found_cpu || !found_mem) {
346 /* resort to _any_ node with CPUs and memory */
347 for (i=0, op=objbuf; i < nobj; i++, op++) {
348 if (SN_HWPERF_FOREIGN(op) ||
349 SN_HWPERF_IS_IONODE(op) ||
350 !SN_HWPERF_IS_NODE(op)) {
353 c = sn_hwperf_obj_to_cnode(op);
354 if (!found_cpu && sn_hwperf_has_cpus(c)) {
359 if (!found_mem && sn_hwperf_has_mem(c)) {
364 if (found_cpu && found_mem)
369 if (!found_cpu || !found_mem)
377 static int sn_topology_show(struct seq_file *s, void *d)
384 const char *slabname;
387 struct cpuinfo_ia64 *c;
388 struct sn_hwperf_port_info *ptdata;
389 struct sn_hwperf_object_info *p;
390 struct sn_hwperf_object_info *obj = d; /* this object */
391 struct sn_hwperf_object_info *objs = s->private; /* all objects */
403 seq_printf(s, "# sn_topology version 2\n");
404 seq_printf(s, "# objtype ordinal location partition"
405 " [attribute value [, ...]]\n");
407 if (ia64_sn_get_sn_info(0,
408 &shubtype, &nasid_mask, &nasid_shift, &system_size,
409 &sharing_size, &partid, &coher, ®ion_size))
411 for (nasid_msb=63; nasid_msb > 0; nasid_msb--) {
412 if (((u64)nasid_mask << nasid_shift) & (1ULL << nasid_msb))
415 seq_printf(s, "partition %u %s local "
417 "nasid_mask 0x%016lx, "
421 "coherency_domain %d, "
424 partid, utsname()->nodename,
425 shubtype ? "shub2" : "shub1",
426 (u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift,
427 system_size, sharing_size, coher, region_size);
429 print_pci_topology(s);
432 if (SN_HWPERF_FOREIGN(obj)) {
433 /* private in another partition: not interesting */
437 for (i = 0; i < SN_HWPERF_MAXSTRING && obj->name[i]; i++) {
438 if (obj->name[i] == ' ')
442 slabname = sn_hwperf_get_slabname(obj, objs, &ordinal);
443 seq_printf(s, "%s %d %s %s asic %s", slabname, ordinal, obj->location,
444 obj->sn_hwp_this_part ? "local" : "shared", obj->name);
446 if (ordinal < 0 || (!SN_HWPERF_IS_NODE(obj) && !SN_HWPERF_IS_IONODE(obj)))
449 cnodeid_t near_mem = -1;
450 cnodeid_t near_cpu = -1;
452 seq_printf(s, ", nasid 0x%x", cnodeid_to_nasid(ordinal));
454 if (sn_hwperf_get_nearest_node_objdata(objs, sn_hwperf_obj_cnt,
455 ordinal, &near_mem, &near_cpu) == 0) {
456 seq_printf(s, ", near_mem_nodeid %d, near_cpu_nodeid %d",
460 if (!SN_HWPERF_IS_IONODE(obj)) {
461 for_each_online_node(i) {
462 seq_printf(s, i ? ":%d" : ", dist %d",
463 node_distance(ordinal, i));
470 * CPUs on this node, if any
472 if (!SN_HWPERF_IS_IONODE(obj)) {
473 for_each_cpu_and(i, cpu_online_mask,
474 cpumask_of_node(ordinal)) {
475 slice = 'a' + cpuid_to_slice(i);
477 seq_printf(s, "cpu %d %s%c local"
478 " freq %luMHz, arch ia64",
479 i, obj->location, slice,
480 c->proc_freq / 1000000);
481 for_each_online_cpu(j) {
482 seq_printf(s, j ? ":%d" : ", dist %d",
496 sz = obj->ports * sizeof(struct sn_hwperf_port_info);
497 if ((ptdata = kmalloc(sz, GFP_KERNEL)) == NULL)
499 e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
500 SN_HWPERF_ENUM_PORTS, obj->id, sz,
501 (u64) ptdata, 0, 0, NULL);
502 if (e != SN_HWPERF_OP_OK)
504 for (ordinal=0, p=objs; p != obj; p++) {
505 if (!SN_HWPERF_FOREIGN(p))
508 for (pt = 0; pt < obj->ports; pt++) {
509 for (p = objs, i = 0; i < sn_hwperf_obj_cnt; i++, p++) {
510 if (ptdata[pt].conn_id == p->id) {
514 seq_printf(s, "numalink %d %s-%d",
515 ordinal+pt, obj->location, ptdata[pt].port);
517 if (i >= sn_hwperf_obj_cnt) {
519 seq_puts(s, " local endpoint disconnected"
520 ", protocol unknown\n");
524 if (obj->sn_hwp_this_part && p->sn_hwp_this_part)
525 /* both ends local to this partition */
526 seq_puts(s, " local");
527 else if (SN_HWPERF_FOREIGN(p))
528 /* both ends of the link in foreign partiton */
529 seq_puts(s, " foreign");
531 /* link straddles a partition */
532 seq_puts(s, " shared");
535 * Unlikely, but strictly should query the LLP config
536 * registers because an NL4R can be configured to run
537 * NL3 protocol, even when not talking to an NL3 router.
538 * Ditto for node-node.
540 seq_printf(s, " endpoint %s-%d, protocol %s\n",
541 p->location, ptdata[pt].conn_port,
542 (SN_HWPERF_IS_NL3ROUTER(obj) ||
543 SN_HWPERF_IS_NL3ROUTER(p)) ? "LLP3" : "LLP4");
551 static void *sn_topology_start(struct seq_file *s, loff_t * pos)
553 struct sn_hwperf_object_info *objs = s->private;
555 if (*pos < sn_hwperf_obj_cnt)
556 return (void *)(objs + *pos);
561 static void *sn_topology_next(struct seq_file *s, void *v, loff_t * pos)
564 return sn_topology_start(s, pos);
567 static void sn_topology_stop(struct seq_file *m, void *v)
573 * /proc/sgi_sn/sn_topology, read-only using seq_file
575 static const struct seq_operations sn_topology_seq_ops = {
576 .start = sn_topology_start,
577 .next = sn_topology_next,
578 .stop = sn_topology_stop,
579 .show = sn_topology_show
582 struct sn_hwperf_op_info {
584 struct sn_hwperf_ioctl_args *a;
590 static void sn_hwperf_call_sal(void *info)
592 struct sn_hwperf_op_info *op_info = info;
595 r = ia64_sn_hwperf_op(sn_hwperf_master_nasid, op_info->op,
596 op_info->a->arg, op_info->a->sz,
597 (u64) op_info->p, 0, 0, op_info->v0);
601 static int sn_hwperf_op_cpu(struct sn_hwperf_op_info *op_info)
606 cpumask_t save_allowed;
608 cpu = (op_info->a->arg & SN_HWPERF_ARG_CPU_MASK) >> 32;
609 use_ipi = op_info->a->arg & SN_HWPERF_ARG_USE_IPI_MASK;
610 op_info->a->arg &= SN_HWPERF_ARG_OBJID_MASK;
612 if (cpu != SN_HWPERF_ARG_ANY_CPU) {
613 if (cpu >= nr_cpu_ids || !cpu_online(cpu)) {
619 if (cpu == SN_HWPERF_ARG_ANY_CPU || cpu == get_cpu()) {
620 /* don't care, or already on correct cpu */
621 sn_hwperf_call_sal(op_info);
625 /* use an interprocessor interrupt to call SAL */
626 smp_call_function_single(cpu, sn_hwperf_call_sal,
630 /* migrate the task before calling SAL */
631 save_allowed = current->cpus_allowed;
632 set_cpus_allowed(current, cpumask_of_cpu(cpu));
633 sn_hwperf_call_sal(op_info);
634 set_cpus_allowed(current, save_allowed);
643 /* map SAL hwperf error code to system error code */
644 static int sn_hwperf_map_err(int hwperf_err)
649 case SN_HWPERF_OP_OK:
653 case SN_HWPERF_OP_NOMEM:
657 case SN_HWPERF_OP_NO_PERM:
661 case SN_HWPERF_OP_IO_ERROR:
665 case SN_HWPERF_OP_BUSY:
669 case SN_HWPERF_OP_RECONFIGURE:
673 case SN_HWPERF_OP_INVAL:
683 * ioctl for "sn_hwperf" misc device
686 sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, u64 arg)
688 struct sn_hwperf_ioctl_args a;
689 struct cpuinfo_ia64 *cdata;
690 struct sn_hwperf_object_info *objs;
691 struct sn_hwperf_object_info *cpuobj;
692 struct sn_hwperf_op_info op_info;
704 /* only user requests are allowed here */
705 if ((op & SN_HWPERF_OP_MASK) < 10) {
709 r = copy_from_user(&a, (const void __user *)arg,
710 sizeof(struct sn_hwperf_ioctl_args));
717 * Allocate memory to hold a kernel copy of the user buffer. The
718 * buffer contents are either copied in or out (or both) of user
719 * space depending on the flags encoded in the requested operation.
729 if (op & SN_HWPERF_OP_MEM_COPYIN) {
730 r = copy_from_user(p, (const void __user *)a.ptr, a.sz);
738 case SN_HWPERF_GET_CPU_INFO:
739 if (a.sz == sizeof(u64)) {
740 /* special case to get size needed */
741 *(u64 *) p = (u64) num_online_cpus() *
742 sizeof(struct sn_hwperf_object_info);
744 if (a.sz < num_online_cpus() * sizeof(struct sn_hwperf_object_info)) {
748 if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) {
749 int cpuobj_index = 0;
752 for (i = 0; i < nobj; i++) {
753 if (!SN_HWPERF_IS_NODE(objs + i))
755 node = sn_hwperf_obj_to_cnode(objs + i);
756 for_each_online_cpu(j) {
757 if (node != cpu_to_node(j))
759 cpuobj = (struct sn_hwperf_object_info *) p + cpuobj_index++;
760 slice = 'a' + cpuid_to_slice(j);
763 snprintf(cpuobj->name,
764 sizeof(cpuobj->name),
766 cdata->proc_freq / 1000000,
768 snprintf(cpuobj->location,
769 sizeof(cpuobj->location),
770 "%s%c", objs[i].location,
779 case SN_HWPERF_GET_NODE_NASID:
780 if (a.sz != sizeof(u64) ||
781 (node = a.arg) < 0 || !cnode_possible(node)) {
785 *(u64 *)p = (u64)cnodeid_to_nasid(node);
788 case SN_HWPERF_GET_OBJ_NODE:
789 if (a.sz != sizeof(u64) || a.arg < 0) {
793 if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) {
799 if (objs[(i = a.arg)].id != a.arg) {
800 for (i = 0; i < nobj; i++) {
801 if (objs[i].id == a.arg)
811 if (!SN_HWPERF_IS_NODE(objs + i) &&
812 !SN_HWPERF_IS_IONODE(objs + i)) {
818 *(u64 *)p = (u64)sn_hwperf_obj_to_cnode(objs + i);
823 case SN_HWPERF_GET_MMRS:
824 case SN_HWPERF_SET_MMRS:
825 case SN_HWPERF_OBJECT_DISTANCE:
830 r = sn_hwperf_op_cpu(&op_info);
832 r = sn_hwperf_map_err(r);
839 /* all other ops are a direct SAL call */
840 r = ia64_sn_hwperf_op(sn_hwperf_master_nasid, op,
841 a.arg, a.sz, (u64) p, 0, 0, &v0);
843 r = sn_hwperf_map_err(r);
850 if (op & SN_HWPERF_OP_MEM_COPYOUT) {
851 r = copy_to_user((void __user *)a.ptr, p, a.sz);
865 static const struct file_operations sn_hwperf_fops = {
866 .ioctl = sn_hwperf_ioctl,
869 static struct miscdevice sn_hwperf_dev = {
875 static int sn_hwperf_init(void)
881 /* single threaded, once-only initialization */
882 mutex_lock(&sn_hwperf_init_mutex);
884 if (sn_hwperf_salheap) {
885 mutex_unlock(&sn_hwperf_init_mutex);
890 * The PROM code needs a fixed reference node. For convenience the
891 * same node as the console I/O is used.
893 sn_hwperf_master_nasid = (nasid_t) ia64_sn_get_console_nasid();
896 * Request the needed size and install the PROM scratch area.
897 * The PROM keeps various tracking bits in this memory area.
899 salr = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
900 (u64) SN_HWPERF_GET_HEAPSIZE, 0,
901 (u64) sizeof(u64), (u64) &v, 0, 0, NULL);
902 if (salr != SN_HWPERF_OP_OK) {
907 if ((sn_hwperf_salheap = vmalloc(v)) == NULL) {
911 salr = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
912 SN_HWPERF_INSTALL_HEAP, 0, v,
913 (u64) sn_hwperf_salheap, 0, 0, NULL);
914 if (salr != SN_HWPERF_OP_OK) {
919 salr = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
920 SN_HWPERF_OBJECT_COUNT, 0,
921 sizeof(u64), (u64) &v, 0, 0, NULL);
922 if (salr != SN_HWPERF_OP_OK) {
926 sn_hwperf_obj_cnt = (int)v;
929 if (e < 0 && sn_hwperf_salheap) {
930 vfree(sn_hwperf_salheap);
931 sn_hwperf_salheap = NULL;
932 sn_hwperf_obj_cnt = 0;
934 mutex_unlock(&sn_hwperf_init_mutex);
938 int sn_topology_open(struct inode *inode, struct file *file)
941 struct seq_file *seq;
942 struct sn_hwperf_object_info *objbuf;
945 if ((e = sn_hwperf_enum_objects(&nobj, &objbuf)) == 0) {
946 e = seq_open(file, &sn_topology_seq_ops);
947 seq = file->private_data;
948 seq->private = objbuf;
954 int sn_topology_release(struct inode *inode, struct file *file)
956 struct seq_file *seq = file->private_data;
959 return seq_release(inode, file);
962 int sn_hwperf_get_nearest_node(cnodeid_t node,
963 cnodeid_t *near_mem_node, cnodeid_t *near_cpu_node)
967 struct sn_hwperf_object_info *objbuf;
969 if ((e = sn_hwperf_enum_objects(&nobj, &objbuf)) == 0) {
970 e = sn_hwperf_get_nearest_node_objdata(objbuf, nobj,
971 node, near_mem_node, near_cpu_node);
978 static int __devinit sn_hwperf_misc_register_init(void)
982 if (!ia64_platform_is("sn2"))
988 * Register a dynamic misc device for hwperf ioctls. Platforms
989 * supporting hotplug will create /dev/sn_hwperf, else user
990 * can to look up the minor number in /proc/misc.
992 if ((e = misc_register(&sn_hwperf_dev)) != 0) {
993 printk(KERN_ERR "sn_hwperf_misc_register_init: failed to "
994 "register misc device for \"%s\"\n", sn_hwperf_dev.name);
1000 device_initcall(sn_hwperf_misc_register_init); /* after misc_init() */
1001 EXPORT_SYMBOL(sn_hwperf_get_nearest_node);