* [PATCH 4/4] x86: Add sysfs entries for UV
@ 2008-08-22 21:55 Russ Anderson
2008-08-23 2:41 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Russ Anderson @ 2008-08-22 21:55 UTC (permalink / raw)
To: linux-kernel, mingo, tglx; +Cc: Russ Anderson, Jack Steiner
[PATCH 4/4] x86: Add sysfs entries for UV
Create /sys/firmware/sgi_uv sysfs entries for partition_id and coherence_id.
Signed-off-by: Russ Anderson <rja@sgi.com>
---
arch/x86/kernel/Makefile | 2 -
arch/x86/kernel/uv_sysfs.c | 61 +++++++++++++++++++++++++++++++++++++++++++++
include/asm-x86/uv/bios.h | 2 +
3 files changed, 64 insertions(+), 1 deletion(-)
Index: linux/arch/x86/kernel/Makefile
===================================================================
--- linux.orig/arch/x86/kernel/Makefile 2008-08-22 14:49:44.000000000 -0500
+++ linux/arch/x86/kernel/Makefile 2008-08-22 14:52:48.000000000 -0500
@@ -106,7 +106,7 @@ obj-$(CONFIG_OLPC) += olpc.o
# 64 bit specific files
ifeq ($(CONFIG_X86_64),y)
obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o
- obj-y += bios_uv.o
+ obj-y += bios_uv.o uv_sysfs.o
obj-y += genx2apic_cluster.o
obj-y += genx2apic_phys.o
obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o
Index: linux/arch/x86/kernel/uv_sysfs.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux/arch/x86/kernel/uv_sysfs.c 2008-08-22 14:52:48.000000000 -0500
@@ -0,0 +1,61 @@
+/*
+ * This file supports the /sys/firmware/sgi_uv interfaces for SGI UV.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) Russ Anderson
+ */
+
+#include <linux/sysdev.h>
+#include <asm/uv/bios.h>
+
+struct kobject *sgi_uv_kobj;
+
+static ssize_t partition_id_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return snprintf(buf, PAGE_SIZE, "%d\n", sn_partition_id);
+}
+
+static ssize_t coherence_id_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return snprintf(buf, PAGE_SIZE, "%d\n", partition_coherence_id());
+}
+
+static struct kobj_attribute partition_id_attr =
+ __ATTR(partition_id, S_IRUGO, partition_id_show, NULL);
+
+static struct kobj_attribute coherence_id_attr =
+ __ATTR(coherence_id, S_IRUGO, coherence_id_show, NULL);
+
+
+static int __init sgi_uv_sysfs_init(void)
+{
+ if (!sgi_uv_kobj)
+ sgi_uv_kobj = kobject_create_and_add("sgi_uv", firmware_kobj);
+ if (!sgi_uv_kobj) {
+ printk(KERN_WARNING "kobject_create_and_add sgi_uv failed \n");
+ return -EINVAL;
+ }
+
+ sysfs_create_file(sgi_uv_kobj, &partition_id_attr.attr);
+ sysfs_create_file(sgi_uv_kobj, &coherence_id_attr.attr);
+
+ return 0;
+}
+
+device_initcall(sgi_uv_sysfs_init);
Index: linux/include/asm-x86/uv/bios.h
===================================================================
--- linux.orig/include/asm-x86/uv/bios.h 2008-08-22 14:52:08.000000000 -0500
+++ linux/include/asm-x86/uv/bios.h 2008-08-22 14:52:48.000000000 -0500
@@ -79,6 +79,8 @@ extern u8 uv_coherency_id;
#define partition_coherence_id() (uv_coherency_id)
+extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */
+
#ifndef CONFIG_EFI
extern u64 efi_call6(void *, u64, u64, u64, u64, u64, u64);
#endif
--
Russ Anderson, OS RAS/Partitioning Project Lead
SGI - Silicon Graphics Inc rja@sgi.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4/4] x86: Add sysfs entries for UV
2008-08-22 21:55 Russ Anderson
@ 2008-08-23 2:41 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2008-08-23 2:41 UTC (permalink / raw)
To: Russ Anderson; +Cc: linux-kernel, mingo, tglx, Jack Steiner
On Fri, Aug 22, 2008 at 04:55:09PM -0500, Russ Anderson wrote:
> [PATCH 4/4] x86: Add sysfs entries for UV
>
> Create /sys/firmware/sgi_uv sysfs entries for partition_id and coherence_id.
>
> Signed-off-by: Russ Anderson <rja@sgi.com>
As you adding new sysfs files, please document them in Documentation/ABI
as well.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] x86: Add sysfs entries for UV
@ 2008-09-22 21:10 Russ Anderson
2008-09-23 11:03 ` Ingo Molnar
2008-09-23 18:11 ` Greg KH
0 siblings, 2 replies; 5+ messages in thread
From: Russ Anderson @ 2008-09-22 21:10 UTC (permalink / raw)
To: linux-kernel, mingo, tglx; +Cc: H. Peter Anvin, Jack Steiner, Russ Anderson
[PATCH 4/4] Add sysfs entries for UV
Create /sys/firmware/sgi_uv sysfs entries for partition_id and coherence_id.
Signed-off-by: Russ Anderson <rja@sgi.com>
---
arch/x86/kernel/Makefile | 2 -
arch/x86/kernel/uv_sysfs.c | 61 +++++++++++++++++++++++++++++++++++++++++++++
include/asm-x86/uv/bios.h | 2 +
3 files changed, 64 insertions(+), 1 deletion(-)
Index: linux/arch/x86/kernel/Makefile
===================================================================
--- linux.orig/arch/x86/kernel/Makefile 2008-09-22 16:01:00.000000000 -0500
+++ linux/arch/x86/kernel/Makefile 2008-09-22 16:01:21.000000000 -0500
@@ -107,7 +107,7 @@ obj-$(CONFIG_OLPC) += olpc.o
# 64 bit specific files
ifeq ($(CONFIG_X86_64),y)
obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o
- obj-y += bios_uv.o
+ obj-y += bios_uv.o uv_sysfs.o
obj-y += genx2apic_cluster.o
obj-y += genx2apic_phys.o
obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o
Index: linux/arch/x86/kernel/uv_sysfs.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux/arch/x86/kernel/uv_sysfs.c 2008-09-22 16:01:21.000000000 -0500
@@ -0,0 +1,61 @@
+/*
+ * This file supports the /sys/firmware/sgi_uv interfaces for SGI UV.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) Russ Anderson
+ */
+
+#include <linux/sysdev.h>
+#include <asm/uv/bios.h>
+
+struct kobject *sgi_uv_kobj;
+
+static ssize_t partition_id_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return snprintf(buf, PAGE_SIZE, "%d\n", sn_partition_id);
+}
+
+static ssize_t coherence_id_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return snprintf(buf, PAGE_SIZE, "%d\n", partition_coherence_id());
+}
+
+static struct kobj_attribute partition_id_attr =
+ __ATTR(partition_id, S_IRUGO, partition_id_show, NULL);
+
+static struct kobj_attribute coherence_id_attr =
+ __ATTR(coherence_id, S_IRUGO, coherence_id_show, NULL);
+
+
+static int __init sgi_uv_sysfs_init(void)
+{
+ if (!sgi_uv_kobj)
+ sgi_uv_kobj = kobject_create_and_add("sgi_uv", firmware_kobj);
+ if (!sgi_uv_kobj) {
+ printk(KERN_WARNING "kobject_create_and_add sgi_uv failed \n");
+ return -EINVAL;
+ }
+
+ sysfs_create_file(sgi_uv_kobj, &partition_id_attr.attr);
+ sysfs_create_file(sgi_uv_kobj, &coherence_id_attr.attr);
+
+ return 0;
+}
+
+device_initcall(sgi_uv_sysfs_init);
Index: linux/include/asm-x86/uv/bios.h
===================================================================
--- linux.orig/include/asm-x86/uv/bios.h 2008-09-22 16:01:16.000000000 -0500
+++ linux/include/asm-x86/uv/bios.h 2008-09-22 16:01:21.000000000 -0500
@@ -79,6 +79,8 @@ extern u8 uv_coherency_id;
#define partition_coherence_id() (uv_coherency_id)
+extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */
+
#ifndef CONFIG_EFI
extern u64 efi_call6(void *, u64, u64, u64, u64, u64, u64);
#endif
--
Russ Anderson, OS RAS/Partitioning Project Lead
SGI - Silicon Graphics Inc rja@sgi.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4/4] x86: Add sysfs entries for UV
2008-09-22 21:10 [PATCH 4/4] x86: Add sysfs entries for UV Russ Anderson
@ 2008-09-23 11:03 ` Ingo Molnar
2008-09-23 18:11 ` Greg KH
1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2008-09-23 11:03 UTC (permalink / raw)
To: Russ Anderson; +Cc: linux-kernel, tglx, H. Peter Anvin, Jack Steiner
* Russ Anderson <rja@sgi.com> wrote:
> +struct kobject *sgi_uv_kobj;
should be static?
> +static int __init sgi_uv_sysfs_init(void)
> +{
> + if (!sgi_uv_kobj)
> + sgi_uv_kobj = kobject_create_and_add("sgi_uv", firmware_kobj);
> + if (!sgi_uv_kobj) {
> + printk(KERN_WARNING "kobject_create_and_add sgi_uv failed \n");
> + return -EINVAL;
> + }
> +
> + sysfs_create_file(sgi_uv_kobj, &partition_id_attr.attr);
> + sysfs_create_file(sgi_uv_kobj, &coherence_id_attr.attr);
missing checks for failure?
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4/4] x86: Add sysfs entries for UV
2008-09-22 21:10 [PATCH 4/4] x86: Add sysfs entries for UV Russ Anderson
2008-09-23 11:03 ` Ingo Molnar
@ 2008-09-23 18:11 ` Greg KH
1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2008-09-23 18:11 UTC (permalink / raw)
To: Russ Anderson; +Cc: linux-kernel, mingo, tglx, H. Peter Anvin, Jack Steiner
On Mon, Sep 22, 2008 at 04:10:51PM -0500, Russ Anderson wrote:
> [PATCH 4/4] Add sysfs entries for UV
>
> Create /sys/firmware/sgi_uv sysfs entries for partition_id and coherence_id.
Please add the proper entries to Documentation/ABI/ for when you add new
sysfs files.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-09-23 18:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22 21:10 [PATCH 4/4] x86: Add sysfs entries for UV Russ Anderson
2008-09-23 11:03 ` Ingo Molnar
2008-09-23 18:11 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2008-08-22 21:55 Russ Anderson
2008-08-23 2:41 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox