linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs
@ 2020-11-28  3:42 Mike Travis
  2020-11-28  3:42 ` [PATCH v2 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Mike Travis @ 2020-11-28  3:42 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86


Duplicate the current UV procfs leaves to the uv_sysfs driver so they show
up under /sys/firmware/sgi_uv.  Show a 'deprecated' warning message if
any of the old /proc/sgi_uv leaves are used.

These patches depend on the prior v3 patchset sent by Justin Ernst <justin.ernst@hpe.com>
	x86/platform/uv: Remove existing /sys/firmware/sgi_uv/ interface
	x86/platform/uv: Add and export uv_bios_* functions
	x86/platform/uv: Add new uv_sysfs platform driver
	x86/platform/uv: Update ABI documentation of /sys/firmware/sgi_uv/
	x86/platform/uv: Update MAINTAINERS for uv_sysfs driver

v2: Updated to apply to v3 of dependency patch set listed above.

Mike Travis (5):
  x86/platform/uv: Add kernel interfaces for obtaining system info.
  x86/platform/uv: Add sysfs leaves to replace those in procfs
  x86/platform/uv: Add sysfs hubless leaves
  x86/platform/uv: Add deprecated messages to /proc info leaves
  x86/platform/uv: Update sysfs document file

 .../ABI/testing/sysfs-firmware-sgi_uv         | 16 +++++
 arch/x86/include/asm/uv/bios.h                |  2 +
 arch/x86/kernel/apic/x2apic_uv_x.c            | 26 ++++++-
 drivers/platform/x86/uv_sysfs.c               | 70 ++++++++++++++++++-
 4 files changed, 111 insertions(+), 3 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info.
  2020-11-28  3:42 [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
@ 2020-11-28  3:42 ` Mike Travis
  2020-12-07 22:37   ` [tip: x86/platform] " tip-bot2 for Mike Travis
  2020-11-28  3:42 ` [PATCH v2 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs Mike Travis
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Mike Travis @ 2020-11-28  3:42 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Add kernel interfaces used to obtain info for the uv_sysfs driver
to display.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
---
 arch/x86/include/asm/uv/bios.h     |  2 ++
 arch/x86/kernel/apic/x2apic_uv_x.c | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/arch/x86/include/asm/uv/bios.h b/arch/x86/include/asm/uv/bios.h
index 01ba080887b3..1b6455f881f9 100644
--- a/arch/x86/include/asm/uv/bios.h
+++ b/arch/x86/include/asm/uv/bios.h
@@ -200,6 +200,8 @@ extern long sn_partition_id;
 extern long sn_coherency_id;
 extern long sn_region_size;
 extern long system_serial_number;
+extern ssize_t uv_get_archtype(char *buf, int len);
+extern int uv_get_hubless_system(void);
 
 extern struct kobject *sgi_uv_kobj;	/* /sys/firmware/sgi_uv */
 
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 1b98f8c12b96..48746031b39a 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -502,6 +502,18 @@ enum uv_system_type get_uv_system_type(void)
 	return uv_system_type;
 }
 
+int uv_get_hubless_system(void)
+{
+	return uv_hubless_system;
+}
+EXPORT_SYMBOL_GPL(uv_get_hubless_system);
+
+ssize_t uv_get_archtype(char *buf, int len)
+{
+	return scnprintf(buf, len, "%s/%s", uv_archtype, oem_table_id);
+}
+EXPORT_SYMBOL_GPL(uv_get_archtype);
+
 int is_uv_system(void)
 {
 	return uv_system_type != UV_NONE;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs
  2020-11-28  3:42 [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
  2020-11-28  3:42 ` [PATCH v2 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
@ 2020-11-28  3:42 ` Mike Travis
  2020-12-07 22:37   ` [tip: x86/platform] " tip-bot2 for Mike Travis
  2020-11-28  3:42 ` [PATCH v2 3/5] x86/platform/uv: Add sysfs hubless leaves Mike Travis
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Mike Travis @ 2020-11-28  3:42 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Add uv_sysfs leaves to display the info.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
---
 drivers/platform/x86/uv_sysfs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
index 54c342579f1c..115754cdcd89 100644
--- a/drivers/platform/x86/uv_sysfs.c
+++ b/drivers/platform/x86/uv_sysfs.c
@@ -735,17 +735,35 @@ static ssize_t uv_type_show(struct kobject *kobj,
 	return scnprintf(buf, PAGE_SIZE, "%s\n", uv_type_string());
 }
 
+static ssize_t uv_archtype_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return uv_get_archtype(buf, PAGE_SIZE);
+}
+
+static ssize_t uv_hub_type_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_hub_type());
+}
+
 static struct kobj_attribute partition_id_attr =
 	__ATTR(partition_id, 0444, partition_id_show, NULL);
 static struct kobj_attribute coherence_id_attr =
 	__ATTR(coherence_id, 0444, coherence_id_show, NULL);
 static struct kobj_attribute uv_type_attr =
 	__ATTR(uv_type, 0444, uv_type_show, NULL);
+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 attribute *base_attrs[] = {
 	&partition_id_attr.attr,
 	&coherence_id_attr.attr,
 	&uv_type_attr.attr,
+	&uv_archtype_attr.attr,
+	&uv_hub_type_attr.attr,
 	NULL,
 };
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/5] x86/platform/uv: Add sysfs hubless leaves
  2020-11-28  3:42 [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
  2020-11-28  3:42 ` [PATCH v2 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
  2020-11-28  3:42 ` [PATCH v2 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs Mike Travis
@ 2020-11-28  3:42 ` Mike Travis
  2020-12-07 22:37   ` [tip: x86/platform] " tip-bot2 for Mike Travis
  2020-11-28  3:42 ` [PATCH v2 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves Mike Travis
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Mike Travis @ 2020-11-28  3:42 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Add uv_sysfs hubless leaves for UV hubless systems.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.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 115754cdcd89..913559797ba4 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";
 }
@@ -747,6 +749,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 coherence_id_attr =
@@ -757,6 +765,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,
@@ -804,11 +814,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();
@@ -819,6 +854,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");
@@ -856,10 +895,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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves
  2020-11-28  3:42 [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
                   ` (2 preceding siblings ...)
  2020-11-28  3:42 ` [PATCH v2 3/5] x86/platform/uv: Add sysfs hubless leaves Mike Travis
@ 2020-11-28  3:42 ` Mike Travis
  2020-12-07 22:37   ` [tip: x86/platform] " tip-bot2 for Mike Travis
  2020-11-28  3:42 ` [PATCH v2 5/5] x86/platform/uv: Update sysfs document file Mike Travis
  2020-11-28 10:57 ` [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Hans de Goede
  5 siblings, 1 reply; 13+ messages in thread
From: Mike Travis @ 2020-11-28  3:42 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Add "deprecated" message to any access to old /proc/sgi_uv/* leaves.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
---
 arch/x86/kernel/apic/x2apic_uv_x.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 48746031b39a..4248579825fb 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -1615,21 +1615,33 @@ static void check_efi_reboot(void)
 		reboot_type = BOOT_ACPI;
 }
 
-/* Setup user proc fs files */
+/*
+ * User proc fs file handling now deprecated.
+ * Recommend using /sys/firmware/sgi_uv/... instead.
+ */
 static int __maybe_unused proc_hubbed_show(struct seq_file *file, void *data)
 {
+	pr_notice_once(
+		"%s: using deprecated /proc/sgi_uv/hubbed, use /sys/firmware/sgi_uv/hub_type\n",
+		current->comm);
 	seq_printf(file, "0x%x\n", uv_hubbed_system);
 	return 0;
 }
 
 static int __maybe_unused proc_hubless_show(struct seq_file *file, void *data)
 {
+	pr_notice_once(
+		"%s: using deprecated /proc/sgi_uv/hubless, use /sys/firmware/sgi_uv/hubless\n",
+		current->comm);
 	seq_printf(file, "0x%x\n", uv_hubless_system);
 	return 0;
 }
 
 static int __maybe_unused proc_archtype_show(struct seq_file *file, void *data)
 {
+	pr_notice_once(
+		"%s: using deprecated /proc/sgi_uv/archtype, use /sys/firmware/sgi_uv/archtype\n",
+		current->comm);
 	seq_printf(file, "%s/%s\n", uv_archtype, oem_table_id);
 	return 0;
 }
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/5] x86/platform/uv: Update sysfs document file
  2020-11-28  3:42 [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
                   ` (3 preceding siblings ...)
  2020-11-28  3:42 ` [PATCH v2 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves Mike Travis
@ 2020-11-28  3:42 ` Mike Travis
  2020-11-28 16:59   ` Randy Dunlap
  2020-12-07 22:37   ` [tip: x86/platform] x86/platform/uv: Update sysfs documentation tip-bot2 for Mike Travis
  2020-11-28 10:57 ` [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Hans de Goede
  5 siblings, 2 replies; 13+ messages in thread
From: Mike Travis @ 2020-11-28  3:42 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Update sysfs Document file to include moved /proc leaves.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
---
 Documentation/ABI/testing/sysfs-firmware-sgi_uv | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-firmware-sgi_uv b/Documentation/ABI/testing/sysfs-firmware-sgi_uv
index 50e25ce80fa2..b377f1470ba2 100644
--- a/Documentation/ABI/testing/sysfs-firmware-sgi_uv
+++ b/Documentation/ABI/testing/sysfs-firmware-sgi_uv
@@ -7,10 +7,25 @@ Description:
 
 		Under that directory are a number of read-only attributes:
 
+			archtype
+			hub_type
+			hubless
 			partition_id
 			coherence_id
 			uv_type
 
+		The archtype entry contains the UV architecture type that
+		is used to select arch-dependent addresses and features.
+		If can be set via the OEM_ID in the ACPI MADT table or by
+		UVsystab entry both passed from UV BIOS.
+
+		The hub_type entry is used to select the type of hub which is
+		similar to uv_type but encoded in a binary format.  Include
+		the file uv_hub.h to get the definitions.
+
+		The hubless entry basically is present and set only if there
+		is no hub.  In this case the hub_type entry is not present.
+
 		The partition_id entry contains the partition id.
 		UV systems can be partitioned into multiple physical
 		machines, which each partition running a unique copy
@@ -24,6 +39,7 @@ Description:
 
 		The uv_type entry contains the hub revision number.
 		This value can be used to identify the UV system version:
+			"0.*" = Hubless UV ('*' is subtype)
 			"3.0" = UV2
 			"5.0" = UV3
 			"7.0" = UV4
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs
  2020-11-28  3:42 [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
                   ` (4 preceding siblings ...)
  2020-11-28  3:42 ` [PATCH v2 5/5] x86/platform/uv: Update sysfs document file Mike Travis
@ 2020-11-28 10:57 ` Hans de Goede
  5 siblings, 0 replies; 13+ messages in thread
From: Hans de Goede @ 2020-11-28 10:57 UTC (permalink / raw)
  To: Mike Travis, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Hi,

On 11/28/20 4:42 AM, Mike Travis wrote:
> 
> Duplicate the current UV procfs leaves to the uv_sysfs driver so they show
> up under /sys/firmware/sgi_uv.  Show a 'deprecated' warning message if
> any of the old /proc/sgi_uv leaves are used.
> 
> These patches depend on the prior v3 patchset sent by Justin Ernst <justin.ernst@hpe.com>
> 	x86/platform/uv: Remove existing /sys/firmware/sgi_uv/ interface
> 	x86/platform/uv: Add and export uv_bios_* functions
> 	x86/platform/uv: Add new uv_sysfs platform driver
> 	x86/platform/uv: Update ABI documentation of /sys/firmware/sgi_uv/
> 	x86/platform/uv: Update MAINTAINERS for uv_sysfs driver

AS with the previous series this series touches files under both
x86/platform and drivers/platform/x86. Like last time this is best merged
in its entirety through the x86/tip tree (which also has the previous set).
Here is my ack for the drivers/platform/x86 bits being merged through the
x86/tip tree:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans





> 
> v2: Updated to apply to v3 of dependency patch set listed above.
> 
> Mike Travis (5):
>   x86/platform/uv: Add kernel interfaces for obtaining system info.
>   x86/platform/uv: Add sysfs leaves to replace those in procfs
>   x86/platform/uv: Add sysfs hubless leaves
>   x86/platform/uv: Add deprecated messages to /proc info leaves
>   x86/platform/uv: Update sysfs document file
> 
>  .../ABI/testing/sysfs-firmware-sgi_uv         | 16 +++++
>  arch/x86/include/asm/uv/bios.h                |  2 +
>  arch/x86/kernel/apic/x2apic_uv_x.c            | 26 ++++++-
>  drivers/platform/x86/uv_sysfs.c               | 70 ++++++++++++++++++-
>  4 files changed, 111 insertions(+), 3 deletions(-)
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 5/5] x86/platform/uv: Update sysfs document file
  2020-11-28  3:42 ` [PATCH v2 5/5] x86/platform/uv: Update sysfs document file Mike Travis
@ 2020-11-28 16:59   ` Randy Dunlap
  2020-12-07 22:37   ` [tip: x86/platform] x86/platform/uv: Update sysfs documentation tip-bot2 for Mike Travis
  1 sibling, 0 replies; 13+ messages in thread
From: Randy Dunlap @ 2020-11-28 16:59 UTC (permalink / raw)
  To: Mike Travis, Hans de Goede, Justin Ernst, Mark Gross,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

On 11/27/20 7:42 PM, Mike Travis wrote:
> Update sysfs Document file to include moved /proc leaves.
> 
> Signed-off-by: Mike Travis <mike.travis@hpe.com>
> ---
>  Documentation/ABI/testing/sysfs-firmware-sgi_uv | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-firmware-sgi_uv b/Documentation/ABI/testing/sysfs-firmware-sgi_uv
> index 50e25ce80fa2..b377f1470ba2 100644
> --- a/Documentation/ABI/testing/sysfs-firmware-sgi_uv
> +++ b/Documentation/ABI/testing/sysfs-firmware-sgi_uv
> @@ -7,10 +7,25 @@ Description:
>  
>  		Under that directory are a number of read-only attributes:
>  
> +			archtype
> +			hub_type
> +			hubless
>  			partition_id
>  			coherence_id
>  			uv_type
>  
> +		The archtype entry contains the UV architecture type that
> +		is used to select arch-dependent addresses and features.
> +		If can be set via the OEM_ID in the ACPI MADT table or by

		It

> +		UVsystab entry both passed from UV BIOS.
> +


thanks.
-- 
~Randy


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [tip: x86/platform] x86/platform/uv: Update sysfs documentation
  2020-11-28  3:42 ` [PATCH v2 5/5] x86/platform/uv: Update sysfs document file Mike Travis
  2020-11-28 16:59   ` Randy Dunlap
@ 2020-12-07 22:37   ` tip-bot2 for Mike Travis
  1 sibling, 0 replies; 13+ messages in thread
From: tip-bot2 for Mike Travis @ 2020-12-07 22:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Mike Travis, Borislav Petkov, Hans de Goede, x86, linux-kernel

The following commit has been merged into the x86/platform branch of tip:

Commit-ID:     c9624cb7db1c418cbdc8fd2cde6835f83cd0f8a2
Gitweb:        https://git.kernel.org/tip/c9624cb7db1c418cbdc8fd2cde6835f83cd0f8a2
Author:        Mike Travis <mike.travis@hpe.com>
AuthorDate:    Fri, 27 Nov 2020 21:42:27 -06:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 07 Dec 2020 21:19:20 +01:00

x86/platform/uv: Update sysfs documentation

Update sysfs documentation file to include moved /proc leaves.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/20201128034227.120869-6-mike.travis@hpe.com
---
 Documentation/ABI/testing/sysfs-firmware-sgi_uv | 16 ++++++++++++++++-
 1 file changed, 16 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-firmware-sgi_uv b/Documentation/ABI/testing/sysfs-firmware-sgi_uv
index 351b1f4..637c668 100644
--- a/Documentation/ABI/testing/sysfs-firmware-sgi_uv
+++ b/Documentation/ABI/testing/sysfs-firmware-sgi_uv
@@ -7,10 +7,25 @@ Description:
 
 		Under that directory are a number of read-only attributes::
 
+			archtype
+			hub_type
+			hubless
 			partition_id
 			coherence_id
 			uv_type
 
+		The archtype entry contains the UV architecture type that
+		is used to select arch-dependent addresses and features.
+		It can be set via the OEM_ID in the ACPI MADT table or by
+		UVsystab entry both passed from UV BIOS.
+
+		The hub_type entry is used to select the type of hub which is
+		similar to uv_type but encoded in a binary format.  Include
+		the file uv_hub.h to get the definitions.
+
+		The hubless entry basically is present and set only if there
+		is no hub.  In this case the hub_type entry is not present.
+
 		The partition_id entry contains the partition id.
 		UV systems can be partitioned into multiple physical
 		machines, which each partition running a unique copy
@@ -24,6 +39,7 @@ Description:
 
 		The uv_type entry contains the hub revision number.
 		This value can be used to identify the UV system version::
+			"0.*" = Hubless UV ('*' is subtype)
 
 			"3.0" = UV2
 			"5.0" = UV3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [tip: x86/platform] x86/platform/uv: Add deprecated messages to /proc info leaves
  2020-11-28  3:42 ` [PATCH v2 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves Mike Travis
@ 2020-12-07 22:37   ` tip-bot2 for Mike Travis
  0 siblings, 0 replies; 13+ messages in thread
From: tip-bot2 for Mike Travis @ 2020-12-07 22:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Mike Travis, Borislav Petkov, Steve Wahl, Hans de Goede, x86,
	linux-kernel

The following commit has been merged into the x86/platform branch of tip:

Commit-ID:     148c277165cdc72d97d1711b9a1e566d66521828
Gitweb:        https://git.kernel.org/tip/148c277165cdc72d97d1711b9a1e566d66521828
Author:        Mike Travis <mike.travis@hpe.com>
AuthorDate:    Fri, 27 Nov 2020 21:42:26 -06:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 07 Dec 2020 20:03:09 +01:00

x86/platform/uv: Add deprecated messages to /proc info leaves

Add "deprecated" message to any access to old /proc/sgi_uv/* leaves.

 [ bp: Do not have a trailing function opening brace and the arguments
   continuing on the next line and align them on the opening brace. ]

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/20201128034227.120869-5-mike.travis@hpe.com
---
 arch/x86/kernel/apic/x2apic_uv_x.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 4874603..d75e1d9 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -1615,21 +1615,30 @@ static void check_efi_reboot(void)
 		reboot_type = BOOT_ACPI;
 }
 
-/* Setup user proc fs files */
+/*
+ * User proc fs file handling now deprecated.
+ * Recommend using /sys/firmware/sgi_uv/... instead.
+ */
 static int __maybe_unused proc_hubbed_show(struct seq_file *file, void *data)
 {
+	pr_notice_once("%s: using deprecated /proc/sgi_uv/hubbed, use /sys/firmware/sgi_uv/hub_type\n",
+		       current->comm);
 	seq_printf(file, "0x%x\n", uv_hubbed_system);
 	return 0;
 }
 
 static int __maybe_unused proc_hubless_show(struct seq_file *file, void *data)
 {
+	pr_notice_once("%s: using deprecated /proc/sgi_uv/hubless, use /sys/firmware/sgi_uv/hubless\n",
+		       current->comm);
 	seq_printf(file, "0x%x\n", uv_hubless_system);
 	return 0;
 }
 
 static int __maybe_unused proc_archtype_show(struct seq_file *file, void *data)
 {
+	pr_notice_once("%s: using deprecated /proc/sgi_uv/archtype, use /sys/firmware/sgi_uv/archtype\n",
+		       current->comm);
 	seq_printf(file, "%s/%s\n", uv_archtype, oem_table_id);
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [tip: x86/platform] x86/platform/uv: Add sysfs leaves to replace those in procfs
  2020-11-28  3:42 ` [PATCH v2 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs Mike Travis
@ 2020-12-07 22:37   ` tip-bot2 for Mike Travis
  0 siblings, 0 replies; 13+ messages in thread
From: tip-bot2 for Mike Travis @ 2020-12-07 22:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Mike Travis, Borislav Petkov, Steve Wahl, Hans de Goede, x86,
	linux-kernel

The following commit has been merged into the x86/platform branch of tip:

Commit-ID:     612a0063c9ba3aba79b9006faa0edad5f9d41162
Gitweb:        https://git.kernel.org/tip/612a0063c9ba3aba79b9006faa0edad5f9d41162
Author:        Mike Travis <mike.travis@hpe.com>
AuthorDate:    Fri, 27 Nov 2020 21:42:24 -06:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 07 Dec 2020 19:49:01 +01:00

x86/platform/uv: Add sysfs leaves to replace those in procfs

Add uv_sysfs leaves to display the info.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/20201128034227.120869-3-mike.travis@hpe.com
---
 drivers/platform/x86/uv_sysfs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
index c27f5ff..922d32f 100644
--- a/drivers/platform/x86/uv_sysfs.c
+++ b/drivers/platform/x86/uv_sysfs.c
@@ -736,17 +736,35 @@ static ssize_t uv_type_show(struct kobject *kobj,
 	return scnprintf(buf, PAGE_SIZE, "%s\n", uv_type_string());
 }
 
+static ssize_t uv_archtype_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return uv_get_archtype(buf, PAGE_SIZE);
+}
+
+static ssize_t uv_hub_type_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_hub_type());
+}
+
 static struct kobj_attribute partition_id_attr =
 	__ATTR(partition_id, 0444, partition_id_show, NULL);
 static struct kobj_attribute coherence_id_attr =
 	__ATTR(coherence_id, 0444, coherence_id_show, NULL);
 static struct kobj_attribute uv_type_attr =
 	__ATTR(uv_type, 0444, uv_type_show, NULL);
+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 attribute *base_attrs[] = {
 	&partition_id_attr.attr,
 	&coherence_id_attr.attr,
 	&uv_type_attr.attr,
+	&uv_archtype_attr.attr,
+	&uv_hub_type_attr.attr,
 	NULL,
 };
 

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [tip: x86/platform] x86/platform/uv: Add sysfs hubless leaves
  2020-11-28  3:42 ` [PATCH v2 3/5] x86/platform/uv: Add sysfs hubless leaves Mike Travis
@ 2020-12-07 22:37   ` tip-bot2 for Mike Travis
  0 siblings, 0 replies; 13+ messages in thread
From: tip-bot2 for Mike Travis @ 2020-12-07 22:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Mike Travis, Borislav Petkov, Steve Wahl, Hans de Goede, x86,
	linux-kernel

The following commit has been merged into the x86/platform branch of tip:

Commit-ID:     433e817ae157479844d84b186dd4d165a3f2b06e
Gitweb:        https://git.kernel.org/tip/433e817ae157479844d84b186dd4d165a3f2b06e
Author:        Mike Travis <mike.travis@hpe.com>
AuthorDate:    Fri, 27 Nov 2020 21:42:25 -06:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 07 Dec 2020 19:51:05 +01:00

x86/platform/uv: Add sysfs hubless leaves

Add uv_sysfs hubless leaves for UV hubless systems.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/20201128034227.120869-4-mike.travis@hpe.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 922d32f..7badcfa 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";
 }
@@ -748,6 +750,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 coherence_id_attr =
@@ -758,6 +766,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,
@@ -805,11 +815,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();
@@ -820,6 +855,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");
@@ -857,10 +896,19 @@ err_create_group:
 	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();

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [tip: x86/platform] x86/platform/uv: Add kernel interfaces for obtaining system info
  2020-11-28  3:42 ` [PATCH v2 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
@ 2020-12-07 22:37   ` tip-bot2 for Mike Travis
  0 siblings, 0 replies; 13+ messages in thread
From: tip-bot2 for Mike Travis @ 2020-12-07 22:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Mike Travis, Borislav Petkov, Steve Wahl, Hans de Goede, x86,
	linux-kernel

The following commit has been merged into the x86/platform branch of tip:

Commit-ID:     a67fffb017aed93fca42ce7aa5b6aaf54ff912ad
Gitweb:        https://git.kernel.org/tip/a67fffb017aed93fca42ce7aa5b6aaf54ff912ad
Author:        Mike Travis <mike.travis@hpe.com>
AuthorDate:    Fri, 27 Nov 2020 21:42:23 -06:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 07 Dec 2020 19:44:54 +01:00

x86/platform/uv: Add kernel interfaces for obtaining system info

Add kernel interfaces used to obtain info for the uv_sysfs driver
to display.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/20201128034227.120869-2-mike.travis@hpe.com
---
 arch/x86/include/asm/uv/bios.h     |  2 ++
 arch/x86/kernel/apic/x2apic_uv_x.c | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/arch/x86/include/asm/uv/bios.h b/arch/x86/include/asm/uv/bios.h
index 01ba080..1b6455f 100644
--- a/arch/x86/include/asm/uv/bios.h
+++ b/arch/x86/include/asm/uv/bios.h
@@ -200,6 +200,8 @@ extern long sn_partition_id;
 extern long sn_coherency_id;
 extern long sn_region_size;
 extern long system_serial_number;
+extern ssize_t uv_get_archtype(char *buf, int len);
+extern int uv_get_hubless_system(void);
 
 extern struct kobject *sgi_uv_kobj;	/* /sys/firmware/sgi_uv */
 
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 1b98f8c..4874603 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -502,6 +502,18 @@ enum uv_system_type get_uv_system_type(void)
 	return uv_system_type;
 }
 
+int uv_get_hubless_system(void)
+{
+	return uv_hubless_system;
+}
+EXPORT_SYMBOL_GPL(uv_get_hubless_system);
+
+ssize_t uv_get_archtype(char *buf, int len)
+{
+	return scnprintf(buf, len, "%s/%s", uv_archtype, oem_table_id);
+}
+EXPORT_SYMBOL_GPL(uv_get_archtype);
+
 int is_uv_system(void)
 {
 	return uv_system_type != UV_NONE;

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-12-07 22:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28  3:42 [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
2020-11-28  3:42 ` [PATCH v2 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
2020-12-07 22:37   ` [tip: x86/platform] " tip-bot2 for Mike Travis
2020-11-28  3:42 ` [PATCH v2 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs Mike Travis
2020-12-07 22:37   ` [tip: x86/platform] " tip-bot2 for Mike Travis
2020-11-28  3:42 ` [PATCH v2 3/5] x86/platform/uv: Add sysfs hubless leaves Mike Travis
2020-12-07 22:37   ` [tip: x86/platform] " tip-bot2 for Mike Travis
2020-11-28  3:42 ` [PATCH v2 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves Mike Travis
2020-12-07 22:37   ` [tip: x86/platform] " tip-bot2 for Mike Travis
2020-11-28  3:42 ` [PATCH v2 5/5] x86/platform/uv: Update sysfs document file Mike Travis
2020-11-28 16:59   ` Randy Dunlap
2020-12-07 22:37   ` [tip: x86/platform] x86/platform/uv: Update sysfs documentation tip-bot2 for Mike Travis
2020-11-28 10:57 ` [PATCH v2 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).