[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201125172907.240996-4-mike.travis@hpe.com>
Date: Wed, 25 Nov 2020 11:29:05 -0600
From: Mike Travis <mike.travis@....com>
To: Hans de Goede <hdegoede@...hat.com>,
Justin Ernst <justin.ernst@....com>,
Mark Gross <mgross@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, Steve Wahl <steve.wahl@....com>
Cc: Mike Travis <mike.travis@....com>,
Dimitri Sivanich <dimitri.sivanich@....com>,
Russ Anderson <russ.anderson@....com>,
"H. Peter Anvin" <hpa@...or.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Ilya Dryomov <idryomov@...il.com>,
linux-kernel@...r.kernel.org, platform-driver-x86@...r.kernel.org
Subject: [PATCH 3/5] x86/platform/uv: Add sysfs hubless leaves
Add uv_sysfs hubless leaves for UV hubless systems.
Signed-off-by: Mike Travis <mike.travis@....com>
Reviewed-by: Steve Wahl <steve.wahl@....com>
---
drivers/platform/x86/uv_sysfs.c | 52 +++++++++++++++++++++++++++++++--
1 file changed, 50 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
index 6729ea8b63d2..5aa1addf3598 100644
--- a/drivers/platform/x86/uv_sysfs.c
+++ b/drivers/platform/x86/uv_sysfs.c
@@ -44,6 +44,8 @@ static const char *uv_type_string(void)
return "5.0";
else if (is_uv2_hub())
return "3.0";
+ else if (uv_get_hubless_system())
+ return "0.1";
else
return "unknown";
}
@@ -741,6 +743,12 @@ static ssize_t uv_hub_type_show(struct kobject *kobj,
return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_hub_type());
}
+static ssize_t uv_hubless_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_get_hubless_system());
+}
+
static struct kobj_attribute partition_id_attr =
__ATTR(partition_id, 0444, partition_id_show, NULL);
static struct kobj_attribute uv_type_attr =
@@ -749,6 +757,8 @@ static struct kobj_attribute uv_archtype_attr =
__ATTR(archtype, 0444, uv_archtype_show, NULL);
static struct kobj_attribute uv_hub_type_attr =
__ATTR(hub_type, 0444, uv_hub_type_show, NULL);
+static struct kobj_attribute uv_hubless_attr =
+ __ATTR(hubless, 0444, uv_hubless_show, NULL);
static struct attribute *base_attrs[] = {
&partition_id_attr.attr,
@@ -795,11 +805,36 @@ static int initial_bios_setup(void)
return 0;
}
+static struct attribute *hubless_base_attrs[] = {
+ &partition_id_attr.attr,
+ &uv_type_attr.attr,
+ &uv_archtype_attr.attr,
+ &uv_hubless_attr.attr,
+ NULL,
+};
+
+static struct attribute_group hubless_base_attr_group = {
+ .attrs = hubless_base_attrs
+};
+
+
+static int __init uv_sysfs_hubless_init(void)
+{
+ int ret;
+
+ ret = sysfs_create_group(sgi_uv_kobj, &hubless_base_attr_group);
+ if (ret) {
+ pr_warn("sysfs_create_group hubless_base_attr_group failed\n");
+ kobject_put(sgi_uv_kobj);
+ }
+ return ret;
+}
+
static int __init uv_sysfs_init(void)
{
int ret = 0;
- if (!is_uv_system())
+ if (!is_uv_system() && !uv_get_hubless_system())
return -ENODEV;
num_cnodes = uv_num_possible_blades();
@@ -810,6 +845,10 @@ static int __init uv_sysfs_init(void)
pr_warn("kobject_create_and_add sgi_uv failed\n");
return -EINVAL;
}
+
+ if (uv_get_hubless_system())
+ return uv_sysfs_hubless_init();
+
ret = sysfs_create_group(sgi_uv_kobj, &base_attr_group);
if (ret) {
pr_warn("sysfs_create_group base_attr_group failed\n");
@@ -847,10 +886,19 @@ static int __init uv_sysfs_init(void)
return ret;
}
+static void __exit uv_sysfs_hubless_exit(void)
+{
+ sysfs_remove_group(sgi_uv_kobj, &hubless_base_attr_group);
+ kobject_put(sgi_uv_kobj);
+}
+
static void __exit uv_sysfs_exit(void)
{
- if (!is_uv_system())
+ if (!is_uv_system()) {
+ if (uv_get_hubless_system())
+ uv_sysfs_hubless_exit();
return;
+ }
pci_topology_exit();
uv_ports_exit();
--
2.21.0
Powered by blists - more mailing lists