Commit ae1c1a8f authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'x86_platform_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 platform updates from Borislav Petkov:

 - add a new uv_sysfs driver and expose read-only information from UV
   BIOS (Justin Ernst and Mike Travis)

 - the usual set of small fixes

* tag 'x86_platform_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/platform/uv: Update sysfs documentation
  x86/platform/uv: Add deprecated messages to /proc info leaves
  x86/platform/uv: Add sysfs hubless leaves
  x86/platform/uv: Add sysfs leaves to replace those in procfs
  x86/platform/uv: Add kernel interfaces for obtaining system info
  x86/platform/uv: Make uv_pcibus_kset and uv_hubs_kset static
  x86/platform/uv: Fix an error code in uv_hubs_init()
  x86/platform/uv: Update MAINTAINERS for uv_sysfs driver
  x86/platform/uv: Update ABI documentation of /sys/firmware/sgi_uv/
  x86/platform/uv: Add new uv_sysfs platform driver
  x86/platform/uv: Add and export uv_bios_* functions
  x86/platform/uv: Remove existing /sys/firmware/sgi_uv/ interface
parents 0d712978 c9624cb7
Loading
Loading
Loading
Loading
+146 −14
Original line number Diff line number Diff line
What:		/sys/firmware/sgi_uv/
Date:		August 2008
Contact:	Russ Anderson <rja@sgi.com>
Date:		September 2020
Contact:	Justin Ernst <justin.ernst@hpe.com>
Description:
		The /sys/firmware/sgi_uv directory contains information
		about the SGI UV platform.
		about the UV platform.

		Under that directory are a number of files::
		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.
		SGI UV systems can be partitioned into multiple physical
		UV systems can be partitioned into multiple physical
		machines, which each partition running a unique copy
		of the operating system. Each partition will have a unique
		partition id.  To display the partition id, use the command::

			cat /sys/firmware/sgi_uv/partition_id
		partition id.

		The coherence_id entry contains the coherence id.
		A partitioned SGI UV system can have one or more coherence
		domain.  The coherence id indicates which coherence domain
		this partition is in.  To display the coherence id, use the
		command::
		A partitioned UV system can have one or more coherence
		domains. The coherence id indicates which coherence domain
		this partition is in.

		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
			"7.1" = UV4a
			"9.0" = UV5

		The /sys/firmware/sgi_uv directory also contains two directories::

			hubs/
			pcibuses/

		The hubs directory contains a number of hub objects, each representing
		a UV Hub visible to the BIOS. Each hub object's name is appended by a
		unique ordinal value (ex. /sys/firmware/sgi_uv/hubs/hub_5)

		Each hub object directory contains a number of read-only attributes::

			cnode
			location
			name
			nasid
			shared
			this_partition

		The cnode entry contains the cnode number of the corresponding hub.
		If a cnode value is not applicable, the value returned will be -1.

		The location entry contains the location string of the corresponding hub.
		This value is used to physically identify a hub within a system.

		The name entry contains the name of the corresponding hub. This name can
		be two variants::

			"UVHub x.x" = A 'node' ASIC, connecting a CPU to the interconnect
			fabric. The 'x.x' value represents the ASIC revision.
			(ex. 'UVHub 5.0')

			"NLxRouter" = A 'router ASIC, only connecting other ASICs to
			the interconnect fabric. The 'x' value representing
			the fabric technology version. (ex. 'NL8Router')

		The nasid entry contains the nasid number of the corresponding hub.
		If a nasid value is not applicable, the value returned will be -1.

		The shared entry contains a boolean value describing whether the
		corresponding hub is shared between system partitions.

		The this_partition entry contains a boolean value describing whether
		the corresponding hub is local to the current partition.

		Each hub object directory also contains a number of port objects,
		each representing a fabric port on the corresponding hub.
		A port object's name is appended by a unique ordinal value
		(ex. /sys/firmware/sgi_uv/hubs/hub_5/port_3)

		Each port object directory contains a number of read-only attributes::

			conn_hub
			conn_port

		The conn_hub entry contains a value representing the unique
		oridinal value of the hub on the other end of the fabric
		cable plugged into the port. If the port is disconnected,
		the value returned will be -1.

		The conn_port entry contains a value representing the unique
		oridinal value of the port on the other end of the fabric cable
		plugged into the port. If the port is disconnected, the value
		returned will be -1.

		Ex:
			A value of '3' is read from:
				/sys/firmware/sgi_uv/hubs/hub_5/port_3/conn_hub

			and a value of '6' is read from:
				/sys/firmware/sgi_uv/hubs/hub_5/port_3/conn_port

			representing that this port is connected to:
				/sys/firmware/sgi_uv/hubs/hub_3/port_6

		The pcibuses directory contains a number of PCI bus objects.
		Each PCI bus object's name is appended by its PCI bus address.
		(ex. pcibus_0003:80)

		Each pcibus object has a number of possible read-only attributes::

			type
			location
			slot
			ppb_addr
			iio_stack

		The type entry contains a value describing the type of IO at
		the corresponding PCI bus address. Known possible values
		across all UV versions are::

			BASE IO
			PCIe IO
			PCIe SLOT
			NODE IO
			Riser
			PPB

		The location entry contains the location string of the UV Hub
		of the CPU physically connected to the corresponding PCI bus.

		The slot entry contains the physical slot number of the
		corresponding PCI bus. This value is used to physically locate
		PCI cards within a system.

		The ppb_addr entry contains the PCI address string of the
		bridged PCI bus. This entry is only present when the PCI bus
		object type is 'PPB'.

			cat /sys/firmware/sgi_uv/coherence_id
		The iio_stack entry contains a value describing the IIO stack
		number that the corresponding PCI bus object is connected to.
+6 −0
Original line number Diff line number Diff line
@@ -18454,6 +18454,12 @@ F: include/uapi/linux/uuid.h
F:	lib/test_uuid.c
F:	lib/uuid.c
UV SYSFS DRIVER
M:	Justin Ernst <justin.ernst@hpe.com>
L:	platform-driver-x86@vger.kernel.org
S:	Maintained
F:	drivers/platform/x86/uv_sysfs.c
UVESAFB DRIVER
M:	Michal Januszewski <spock@gentoo.org>
L:	linux-fbdev@vger.kernel.org
+51 −0
Original line number Diff line number Diff line
@@ -28,6 +28,20 @@ enum uv_bios_cmd {
	UV_BIOS_SET_LEGACY_VGA_TARGET
};

#define UV_BIOS_EXTRA			    0x10000
#define UV_BIOS_GET_PCI_TOPOLOGY	    0x10001
#define UV_BIOS_GET_GEOINFO		    0x10003

#define UV_BIOS_EXTRA_OP_MEM_COPYIN	    0x1000
#define UV_BIOS_EXTRA_OP_MEM_COPYOUT	    0x2000
#define UV_BIOS_EXTRA_OP_MASK		    0x0fff
#define UV_BIOS_EXTRA_GET_HEAPSIZE	    1
#define UV_BIOS_EXTRA_INSTALL_HEAP	    2
#define UV_BIOS_EXTRA_MASTER_NASID	    3
#define UV_BIOS_EXTRA_OBJECT_COUNT	    (10|UV_BIOS_EXTRA_OP_MEM_COPYOUT)
#define UV_BIOS_EXTRA_ENUM_OBJECTS	    (12|UV_BIOS_EXTRA_OP_MEM_COPYOUT)
#define UV_BIOS_EXTRA_ENUM_PORTS	    (13|UV_BIOS_EXTRA_OP_MEM_COPYOUT)

/*
 * Status values returned from a BIOS call.
 */
@@ -109,6 +123,32 @@ struct uv_systab {
	} entry[1];		/* additional entries follow */
};
extern struct uv_systab *uv_systab;

#define UV_BIOS_MAXSTRING	      128
struct uv_bios_hub_info {
	unsigned int id;
	union {
		struct {
			unsigned long long this_part:1;
			unsigned long long is_shared:1;
			unsigned long long is_disabled:1;
		} fields;
		struct {
			unsigned long long flags;
			unsigned long long reserved;
		} b;
	} f;
	char name[UV_BIOS_MAXSTRING];
	char location[UV_BIOS_MAXSTRING];
	unsigned int ports;
};

struct uv_bios_port_info {
	unsigned int port;
	unsigned int conn_id;
	unsigned int conn_port;
};

/* (... end of definitions from UV BIOS ...) */

enum {
@@ -142,6 +182,15 @@ extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect);
extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *);
extern int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus);

extern s64 uv_bios_get_master_nasid(u64 sz, u64 *nasid);
extern s64 uv_bios_get_heapsize(u64 nasid, u64 sz, u64 *heap_sz);
extern s64 uv_bios_install_heap(u64 nasid, u64 sz, u64 *heap);
extern s64 uv_bios_obj_count(u64 nasid, u64 sz, u64 *objcnt);
extern s64 uv_bios_enum_objs(u64 nasid, u64 sz, u64 *objbuf);
extern s64 uv_bios_enum_ports(u64 nasid, u64 obj_id, u64 sz, u64 *portbuf);
extern s64 uv_bios_get_geoinfo(u64 nasid, u64 sz, u64 *geo);
extern s64 uv_bios_get_pci_topology(u64 sz, u64 *buf);

extern int uv_bios_init(void);
extern unsigned long get_uv_systab_phys(bool msg);

@@ -151,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 */

+103 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-or-later
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2020 Hewlett Packard Enterprise Development LP. All rights reserved.
 */

#ifndef _ASM_UV_GEO_H
#define _ASM_UV_GEO_H

/* Type declaractions */

/* Size of a geoid_s structure (must be before decl. of geoid_u) */
#define GEOID_SIZE	8

/* Fields common to all substructures */
struct geo_common_s {
	unsigned char type;		/* What type of h/w is named by this geoid_s */
	unsigned char blade;
	unsigned char slot;		/* slot is IRU */
	unsigned char upos;
	unsigned char rack;
};

/* Additional fields for particular types of hardware */
struct geo_node_s {
	struct geo_common_s common;		/* No additional fields needed */
};

struct geo_rtr_s {
	struct geo_common_s common;		/* No additional fields needed */
};

struct geo_iocntl_s {
	struct geo_common_s common;		/* No additional fields needed */
};

struct geo_pcicard_s {
	struct geo_iocntl_s common;
	char bus;				/* Bus/widget number */
	char slot;				/* PCI slot number */
};

/* Subcomponents of a node */
struct geo_cpu_s {
	struct geo_node_s node;
	unsigned char	socket:4,	/* Which CPU on the node */
			thread:4;
	unsigned char	core;
};

struct geo_mem_s {
	struct geo_node_s node;
	char membus;			/* The memory bus on the node */
	char memslot;			/* The memory slot on the bus */
};

union geoid_u {
	struct geo_common_s common;
	struct geo_node_s node;
	struct geo_iocntl_s iocntl;
	struct geo_pcicard_s pcicard;
	struct geo_rtr_s rtr;
	struct geo_cpu_s cpu;
	struct geo_mem_s mem;
	char padsize[GEOID_SIZE];
};

/* Defined constants */

#define GEO_MAX_LEN	48

#define GEO_TYPE_INVALID	0
#define GEO_TYPE_MODULE		1
#define GEO_TYPE_NODE		2
#define GEO_TYPE_RTR		3
#define GEO_TYPE_IOCNTL		4
#define GEO_TYPE_IOCARD		5
#define GEO_TYPE_CPU		6
#define GEO_TYPE_MEM		7
#define GEO_TYPE_MAX		(GEO_TYPE_MEM+1)

static inline int geo_rack(union geoid_u g)
{
	return (g.common.type == GEO_TYPE_INVALID) ?
		-1 : g.common.rack;
}

static inline int geo_slot(union geoid_u g)
{
	return (g.common.type == GEO_TYPE_INVALID) ?
		-1 : g.common.upos;
}

static inline int geo_blade(union geoid_u g)
{
	return (g.common.type == GEO_TYPE_INVALID) ?
		-1 : g.common.blade * 2 + g.common.slot;
}

#endif /* _ASM_UV_GEO_H */
+22 −1
Original line number Diff line number Diff line
@@ -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;
@@ -1603,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;
}
Loading