Skip to contentSkip to conversation

x86/platform/uv: Updates for UV5 Architecture

PATCH Superseded Mike Travis 2 participants 19 messages Oct 2, 2020 – Oct 5, 2020

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover x86/platform/uv: Updates for UV5 Architecture

Changes included in this patch set:

* Add changes needed for new UV5 UV architecture. Chief among the changes are 52 bits of physical memory address and 57 bits of virtual address space.

* Remove the BAU TLB code cuurently being replaced by BAU APIC driver.

* Remove System Controller (monitoring) code

* Updated UV mmrs.h file removing UV1, adding UVY class, optimizing the arch selection of the MMR address/field, and trimming down MMR selection list reducing number of MMRs being defined.

* Process UV ArchType in UV BIOS generated UVsystab allowing OEMs to use OEM_ID for their own purposes.

* Update various mapping functions (MMIOH, MMR, GRU) to accommodate UV5 differences.

* Update node present counting for change in MMRs.

* Update TSC sync check of BIOS sync status.

* Update NMI handler for UV5 MMR changes.

* Update copyrights to conform to HPE standards.

This is version 2 with these changes since version 1:

* Added diffstats to p-intro.

* Updated Copyrights to be in one file and only include the year the code was modified.

* Updated to use git format-patch to construct patch email and git send-email to send the patches.

This is version 3 with these changes since version 2:

* Changes made to .gitconfig so no internal (unreachable) systems are referenced.

Mike Travis (13):
x86/platform/uv: Remove UV BAU TLB Shootdown Handler x86/platform/uv: Remove SCIR MMR references for UVY systems. x86/platform/uv: Adjust references in UV kernel modules x86/platform/uv: Update UV MMRs for UV5 x86/platform/uv: Add UV5 direct references x86/platform/uv: Add and Decode Arch Type in UVsystab x86/platform/uv: Update MMIOH references based on new UV5 MMRs. x86/platform/uv: Adjust GAM MMR references affected by UV5 updates x86/platform/uv: Update UV5 MMR references in UV GRU x86/platform/uv: Update Node Present Counting x86/platform/uv: Update UV5 TSC Checking x86/platform/uv: Update for UV5 NMI MMR changes x86/platform/uv: Update Copyrights to conform to HPE standards

 arch/x86/include/asm/idtentry.h     |    4 -
 arch/x86/include/asm/uv/bios.h      |   17 +-
 arch/x86/include/asm/uv/uv.h        |    4 +-
 arch/x86/include/asm/uv/uv_bau.h    |  755 ---
 arch/x86/include/asm/uv/uv_hub.h    |  165 +-
 arch/x86/include/asm/uv/uv_mmrs.h   | 7646 ++++++++++++++-------------
 arch/x86/kernel/apic/x2apic_uv_x.c  |  817 ++-
 arch/x86/kernel/idt.c               |    3 -
 arch/x86/mm/tlb.c                   |   24 -
 arch/x86/platform/uv/Makefile       |    2 +-
 arch/x86/platform/uv/bios_uv.c      |   28 +-
 arch/x86/platform/uv/tlb_uv.c       | 2097 --------
 arch/x86/platform/uv/uv_nmi.c       |   65 +-
 arch/x86/platform/uv/uv_time.c      |   11 +-
 drivers/misc/sgi-gru/grufile.c      |    3 +-
 drivers/misc/sgi-xp/xp.h            |    9 +-
 drivers/misc/sgi-xp/xp_main.c       |    5 +-
 drivers/misc/sgi-xp/xp_uv.c         |    7 +-
 drivers/misc/sgi-xp/xpc_main.c      |    7 +-
 drivers/misc/sgi-xp/xpc_partition.c |    3 +-
 drivers/misc/sgi-xp/xpnet.c         |    3 +-
 21 files changed, 4797 insertions(+), 6878 deletions(-)
 delete mode 100644 arch/x86/include/asm/uv/uv_bau.h
 delete mode 100644 arch/x86/platform/uv/tlb_uv.c
Signature · 1 line
2.21.0
#1 lore raw

PATCH v3 1/13 x86/platform/uv: Remove UV BAU TLB Shootdown Handler

The Broadcast Assist Unit (BAU) TLB shootdown handler is being rewritten to become the UV BAU APIC driver. It is designed to speed up sending IPI's to selective CPUs within the system. Remove the current TLB shutdown handler (tlb_uv.c) file and a couple of kernel hooks in the interim.

---
 arch/x86/include/asm/idtentry.h  |    4 -
 arch/x86/include/asm/uv/uv.h     |    4 +-
 arch/x86/include/asm/uv/uv_bau.h |  755 -----------
 arch/x86/kernel/idt.c            |    3 -
 arch/x86/mm/tlb.c                |   24 -
 arch/x86/platform/uv/Makefile    |    2 +-
 arch/x86/platform/uv/tlb_uv.c    | 2097 ------------------------------
 7 files changed, 2 insertions(+), 2887 deletions(-)
 delete mode 100644 arch/x86/include/asm/uv/uv_bau.h
 delete mode 100644 arch/x86/platform/uv/tlb_uv.c
arch/x86/include/asm/idtentry.h +0 -4
index a43366191212..27485af16008 100644
@@ -591,10 +591,6 @@ DECLARE_IDTENTRY_SYSVEC(CALL_FUNCTION_VECTOR,		sysvec_call_function);
 #endif
 
 #ifdef CONFIG_X86_LOCAL_APIC
-# ifdef CONFIG_X86_UV
-DECLARE_IDTENTRY_SYSVEC(UV_BAU_MESSAGE,			sysvec_uv_bau_message);
-# endif
-
 # ifdef CONFIG_X86_MCE_THRESHOLD
 DECLARE_IDTENTRY_SYSVEC(THRESHOLD_APIC_VECTOR,		sysvec_threshold);
 # endif
arch/x86/include/asm/uv/uv.h +1 -3
index e48aea9ba47d..172d3e4a9e4b 100644
@@ -35,10 +35,8 @@ extern int is_uv_hubbed(int uvtype);
 extern void uv_cpu_init(void);
 extern void uv_nmi_init(void);
 extern void uv_system_init(void);
-extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
-						 const struct flush_tlb_info *info);
 
-#else	/* X86_UV */
+#else	/* !X86_UV */
 
 static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
 static inline bool is_early_uv_system(void)	{ return 0; }
arch/x86/include/asm/uv/uv_bau.h deleted +0 -755

755 lines not on this page · raw message

arch/x86/kernel/idt.c +0 -3
index 7ecf9babf0cb..1bffb87dcfdc 100644
@@ -148,9 +148,6 @@ static const __initconst struct idt_data apic_idts[] = {
 # endif
 # ifdef CONFIG_IRQ_WORK
 	INTG(IRQ_WORK_VECTOR,			asm_sysvec_irq_work),
-# endif
-# ifdef CONFIG_X86_UV
-	INTG(UV_BAU_MESSAGE,			asm_sysvec_uv_bau_message),
 # endif
 	INTG(SPURIOUS_APIC_VECTOR,		asm_sysvec_spurious_apic_interrupt),
 	INTG(ERROR_APIC_VECTOR,			asm_sysvec_error_interrupt),
arch/x86/mm/tlb.c +0 -24
index 0951b47e64c1..11666ba19b62 100644
@@ -14,7 +14,6 @@
 #include <asm/nospec-branch.h>
 #include <asm/cache.h>
 #include <asm/apic.h>
-#include <asm/uv/uv.h>
 
 #include "mm_internal.h"
 
@@ -800,29 +799,6 @@ STATIC_NOPV void native_flush_tlb_others(const struct cpumask *cpumask,
 		trace_tlb_flush(TLB_REMOTE_SEND_IPI,
 				(info->end - info->start) >> PAGE_SHIFT);
 
-	if (is_uv_system()) {
-		/*
-		 * This whole special case is confused.  UV has a "Broadcast
-		 * Assist Unit", which seems to be a fancy way to send IPIs.
-		 * Back when x86 used an explicit TLB flush IPI, UV was
-		 * optimized to use its own mechanism.  These days, x86 uses
-		 * smp_call_function_many(), but UV still uses a manual IPI,
-		 * and that IPI's action is out of date -- it does a manual
-		 * flush instead of calling flush_tlb_func_remote().  This
-		 * means that the percpu tlb_gen variables won't be updated
-		 * and we'll do pointless flushes on future context switches.
-		 *
-		 * Rather than hooking native_flush_tlb_others() here, I think
-		 * that UV should be updated so that smp_call_function_many(),
-		 * etc, are optimal on UV.
-		 */
-		cpumask = uv_flush_tlb_others(cpumask, info);
-		if (cpumask)
-			smp_call_function_many(cpumask, flush_tlb_func_remote,
-					       (void *)info, 1);
-		return;
-	}
-
 	/*
 	 * If no page tables were freed, we can skip sending IPIs to
 	 * CPUs in lazy TLB mode. They will flush the CPU themselves
arch/x86/platform/uv/Makefile +1 -1
index a3693c829e2e..224ff0504890 100644
@@ -1,2 +1,2 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_X86_UV)		+= tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o uv_time.o uv_nmi.o
+obj-$(CONFIG_X86_UV)		+= bios_uv.o uv_irq.o uv_sysfs.o uv_time.o uv_nmi.o
arch/x86/platform/uv/tlb_uv.c deleted +0 -2097

2,097 lines not on this page · raw message

Signature · 1 line
2.21.0
#2 lore raw

PATCH v3 2/13 x86/platform/uv: Remove SCIR MMR references for UVY systems.

In reply to Mike Travis

UV class systems no longer use System Controller for monitoring of CPU activity provided by this driver. Other methods have been developed for BIOS and the management controller (BMC). This patch removes that supporting code.

---
 arch/x86/include/asm/uv/uv_hub.h   | 43 ++--------------
 arch/x86/kernel/apic/x2apic_uv_x.c | 82 ------------------------------
 2 files changed, 3 insertions(+), 122 deletions(-)
arch/x86/include/asm/uv/uv_hub.h +3 -40
index 100d66806503..b21228db75bf 100644
@@ -129,17 +129,6 @@
  */
 #define UV_MAX_NASID_VALUE	(UV_MAX_NUMALINK_BLADES * 2)
 
-/* System Controller Interface Reg info */
-struct uv_scir_s {
-	struct timer_list timer;
-	unsigned long	offset;
-	unsigned long	last;
-	unsigned long	idle_on;
-	unsigned long	idle_off;
-	unsigned char	state;
-	unsigned char	enabled;
-};
-
 /* GAM (globally addressed memory) range table */
 struct uv_gam_range_s {
 	u32	limit;		/* PA bits 56:26 (GAM_RANGE_SHFT) */
@@ -191,16 +180,13 @@ struct uv_hub_info_s {
 struct uv_cpu_info_s {
 	void			*p_uv_hub_info;
 	unsigned char		blade_cpu_id;
-	struct uv_scir_s	scir;
+	void			*reserved;
 };
 DECLARE_PER_CPU(struct uv_cpu_info_s, __uv_cpu_info);
 
 #define uv_cpu_info		this_cpu_ptr(&__uv_cpu_info)
 #define uv_cpu_info_per(cpu)	(&per_cpu(__uv_cpu_info, cpu))
 
-#define	uv_scir_info		(&uv_cpu_info->scir)
-#define	uv_cpu_scir_info(cpu)	(&uv_cpu_info_per(cpu)->scir)
-
 /* Node specific hub common info struct */
 extern void **__uv_hub_info_list;
 static inline struct uv_hub_info_s *uv_hub_info_list(int node)
@@ -297,9 +283,9 @@ union uvh_apicid {
 #define UV3_GLOBAL_MMR32_SIZE		(32UL * 1024 * 1024)
 
 #define UV4_LOCAL_MMR_BASE		0xfa000000UL
-#define UV4_GLOBAL_MMR32_BASE		0xfc000000UL
+#define UV4_GLOBAL_MMR32_BASE		0
 #define UV4_LOCAL_MMR_SIZE		(32UL * 1024 * 1024)
-#define UV4_GLOBAL_MMR32_SIZE		(16UL * 1024 * 1024)
+#define UV4_GLOBAL_MMR32_SIZE		0
 
 #define UV_LOCAL_MMR_BASE		(				\
 					is_uv2_hub() ? UV2_LOCAL_MMR_BASE : \
@@ -772,29 +758,6 @@ DECLARE_PER_CPU(struct uv_cpu_nmi_s, uv_cpu_nmi);
 #define	UV_NMI_STATE_DUMP		2
 #define	UV_NMI_STATE_DUMP_DONE		3
 
-/* Update SCIR state */
-static inline void uv_set_scir_bits(unsigned char value)
-{
-	if (uv_scir_info->state != value) {
-		uv_scir_info->state = value;
-		uv_write_local_mmr8(uv_scir_info->offset, value);
-	}
-}
-
-static inline unsigned long uv_scir_offset(int apicid)
-{
-	return SCIR_LOCAL_MMR_BASE | (apicid & 0x3f);
-}
-
-static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value)
-{
-	if (uv_cpu_scir_info(cpu)->state != value) {
-		uv_write_global_mmr8(uv_cpu_to_pnode(cpu),
-				uv_cpu_scir_info(cpu)->offset, value);
-		uv_cpu_scir_info(cpu)->state = value;
-	}
-}
-
 /*
  * Get the minimum revision number of the hub chips within the partition.
  * (See UVx_HUB_REVISION_BASE above for specific values.)
arch/x86/kernel/apic/x2apic_uv_x.c +0 -82

100 lines not on this page · raw message

Signature · 1 line
2.21.0
#3 lore raw

PATCH v3 3/13 x86/platform/uv: Adjust references in UV kernel modules

In reply to Mike Travis

Make a small symbol change (is_uv() ==> is_uv_sys()) to accommodate a change in the uv_mmrs.h file (is_uv() is the new arch selector function).

---
 drivers/misc/sgi-xp/xp.h            | 8 ++++----
 drivers/misc/sgi-xp/xp_main.c       | 4 ++--
 drivers/misc/sgi-xp/xp_uv.c         | 6 ++++--
 drivers/misc/sgi-xp/xpc_main.c      | 6 +++---
 drivers/misc/sgi-xp/xpc_partition.c | 2 +-
 drivers/misc/sgi-xp/xpnet.c         | 2 +-
 6 files changed, 15 insertions(+), 13 deletions(-)
drivers/misc/sgi-xp/xp.h +4 -4
index 06469b12aced..0af267baf031 100644
@@ -17,11 +17,11 @@
 
 #if defined CONFIG_X86_UV || defined CONFIG_IA64_SGI_UV
 #include <asm/uv/uv.h>
-#define is_uv()		is_uv_system()
+#define is_uv_sys()		is_uv_system()
 #endif
 
-#ifndef is_uv
-#define is_uv()		0
+#ifndef is_uv_sys
+#define is_uv_sys()		0
 #endif
 
 #ifdef USE_DBUG_ON
@@ -79,7 +79,7 @@
 
 #define XPC_MSG_SIZE(_payload_size) \
 				ALIGN(XPC_MSG_HDR_MAX_SIZE + (_payload_size), \
-				      is_uv() ? 64 : 128)
+				      is_uv_sys() ? 64 : 128)
 
 
 /*
drivers/misc/sgi-xp/xp_main.c +2 -2
index 61b03fcefb13..33558555820d 100644
@@ -233,7 +233,7 @@ xp_init(void)
 	for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++)
 		mutex_init(&xpc_registrations[ch_number].mutex);
 
-	if (is_uv())
+	if (is_uv_sys())
 		ret = xp_init_uv();
 	else
 		ret = 0;
@@ -249,7 +249,7 @@ module_init(xp_init);
 static void __exit
 xp_exit(void)
 {
-	if (is_uv())
+	if (is_uv_sys())
 		xp_exit_uv();
 }
 
drivers/misc/sgi-xp/xp_uv.c +4 -2
index f15a9f2ac1dd..118aef64518d 100644
@@ -148,7 +148,9 @@ xp_restrict_memprotect_uv(unsigned long phys_addr, unsigned long size)
 enum xp_retval
 xp_init_uv(void)
 {
-	BUG_ON(!is_uv());
+	WARN_ON(!is_uv_sys());
+	if (!is_uv_sys())
+		return xpUnsupported;
 
 	xp_max_npartitions = XP_MAX_NPARTITIONS_UV;
 #ifdef CONFIG_X86
@@ -168,5 +170,5 @@ xp_init_uv(void)
 void
 xp_exit_uv(void)
 {
-	BUG_ON(!is_uv());
+	WARN_ON(!is_uv_sys());
 }
drivers/misc/sgi-xp/xpc_main.c +3 -3
index 8a495dc82f16..f533ded72941 100644
@@ -1043,7 +1043,7 @@ xpc_do_exit(enum xp_retval reason)
 
 	xpc_teardown_partitions();
 
-	if (is_uv())
+	if (is_uv_sys())
 		xpc_exit_uv();
 }
 
@@ -1226,7 +1226,7 @@ xpc_init(void)
 	dev_set_name(xpc_part, "part");
 	dev_set_name(xpc_chan, "chan");
 
-	if (is_uv()) {
+	if (is_uv_sys()) {
 		ret = xpc_init_uv();
 
 	} else {
@@ -1312,7 +1312,7 @@ xpc_init(void)
 
 	xpc_teardown_partitions();
 out_1:
-	if (is_uv())
+	if (is_uv_sys())
 		xpc_exit_uv();
 	return ret;
 }
drivers/misc/sgi-xp/xpc_partition.c +1 -1
index 099a53bdbb7d..c21d48fd65cd 100644
@@ -433,7 +433,7 @@ xpc_discovery(void)
 	 */
 	region_size = xp_region_size;
 
-	if (is_uv())
+	if (is_uv_sys())
 		max_regions = 256;
 	else {
 		max_regions = 64;
drivers/misc/sgi-xp/xpnet.c +1 -1
index 837d6c3fe69c..fc5cd83f21f2 100644
@@ -515,7 +515,7 @@ xpnet_init(void)
 {
 	int result;
 
-	if (!is_uv())
+	if (!is_uv_sys())
 		return -ENODEV;
 
 	dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME);
Signature · 1 line
2.21.0
#4 lore raw

PATCH v3 4/13 x86/platform/uv: Update UV MMRs for UV5

In reply to Mike Travis

Update UV MMRs in uv_mmrs.h for UV5 based on Verilog output from the UV Hub hardware design files. This is the next UV architecture with a new class (UVY) being defined for 52 bit physical address masks. Uses a bitmask for UV arch identification so a single test can cover multiple versions. Includes other adjustments to match the uv_mmrs.h file to keep from encountering compile errors. New UV5 functionality is added in the patches that follow.

---
 arch/x86/include/asm/uv/uv_hub.h   |   61 +-
 arch/x86/include/asm/uv/uv_mmrs.h  | 7645 +++++++++++++++-------------
 arch/x86/kernel/apic/x2apic_uv_x.c |  260 +-
 arch/x86/platform/uv/uv_time.c     |   10 +-
 drivers/misc/sgi-gru/grufile.c     |    2 +-
 5 files changed, 4277 insertions(+), 3701 deletions(-)
arch/x86/include/asm/uv/uv_hub.h +32 -29
index b21228db75bf..76969be09660 100644
@@ -144,6 +144,8 @@ struct uv_gam_range_s {
  * available in the L3 cache on the cpu socket for the node.
  */
 struct uv_hub_info_s {
+	unsigned int		hub_type;
+	unsigned char		hub_revision;
 	unsigned long		global_mmr_base;
 	unsigned long		global_mmr_shift;
 	unsigned long		gpa_mask;
@@ -156,7 +158,6 @@ struct uv_hub_info_s {
 	unsigned char		m_val;
 	unsigned char		n_val;
 	unsigned char		gr_table_len;
-	unsigned char		hub_revision;
 	unsigned char		apic_pnode_shift;
 	unsigned char		gpa_shift;
 	unsigned char		m_shift;
@@ -205,6 +206,17 @@ static inline struct uv_hub_info_s *uv_cpu_hub_info(int cpu)
 	return (struct uv_hub_info_s *)uv_cpu_info_per(cpu)->p_uv_hub_info;
 }
 
+static inline int uv_hub_type(void)
+{
+	return uv_hub_info->hub_type;
+}
+
+static inline __init void uv_hub_type_set(int uvmask)
+{
+	uv_hub_info->hub_type = uvmask;
+}
+
+
 /*
  * HUB revision ranges for each UV HUB architecture.
  * This is a software convention - NOT the hardware revision numbers in
@@ -215,38 +227,29 @@ static inline struct uv_hub_info_s *uv_cpu_hub_info(int cpu)
 #define UV4_HUB_REVISION_BASE		7
 #define UV4A_HUB_REVISION_BASE		8	/* UV4 (fixed) rev 2 */
 
-static inline int is_uv2_hub(void)
-{
-	return is_uv_hubbed(uv(2));
-}
-
-static inline int is_uv3_hub(void)
-{
-	return is_uv_hubbed(uv(3));
-}
+static inline int is_uv(int uvmask) { return uv_hub_type() & uvmask; }
+static inline int is_uv1_hub(void) { return 0; }
+static inline int is_uv2_hub(void) { return is_uv(UV2); }
+static inline int is_uv3_hub(void) { return is_uv(UV3); }
+static inline int is_uv4a_hub(void) { return is_uv(UV4A); }
+static inline int is_uv4_hub(void) { return is_uv(UV4); }
+static inline int is_uv5_hub(void) { return 0; }
 
-/* First test "is UV4A", then "is UV4" */
-static inline int is_uv4a_hub(void)
-{
-	if (is_uv_hubbed(uv(4)))
-		return (uv_hub_info->hub_revision == UV4A_HUB_REVISION_BASE);
-	return 0;
-}
+/*
+ * UV4A is a revision of UV4.  So on UV4A, both is_uv4_hub() and
+ * is_uv4a_hub() return true, While on UV4, only is_uv4_hub()
+ * returns true.  So to get true results, first test if is UV4A,
+ * then test if is UV4.
+ */
 
-static inline int is_uv4_hub(void)
-{
-	return is_uv_hubbed(uv(4));
-}
+/* UVX class: UV2,3,4 */
+static inline int is_uvx_hub(void) { return is_uv(UVX); }
 
-static inline int is_uvx_hub(void)
-{
-	return (is_uv_hubbed(-2) >= uv(2));
-}
+/* UVY class: UV5,..? */
+static inline int is_uvy_hub(void) { return 0; }
 
-static inline int is_uv_hub(void)
-{
-	return is_uvx_hub();
-}
+/* Any UV Hubbed System */
+static inline int is_uv_hub(void) { return is_uv(UV_ANY); }
 
 union uvh_apicid {
     unsigned long       v;
arch/x86/include/asm/uv/uv_mmrs.h +4086 -3559

2,911 lines not on this page · raw message

arch/x86/kernel/apic/x2apic_uv_x.c +154 -106

260 lines not on this page · raw message

arch/x86/platform/uv/uv_time.c +4 -6
index f82a1337a608..e94436ba3022 100644

Lines of this file are not shown. View the raw message.

drivers/misc/sgi-gru/grufile.c +1 -1
index 93bb49ddda1f..18aa8c877bf8 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.21.0

Part of the diff is not shown here. View the raw message.

#5 lore raw

Re: [PATCH v3 04/13] x86/platform/uv: Update UV MMRs for UV5

Thank you for the patch! Perhaps something to improve:

Hi Mike,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on tip/master v5.9-rc7 next-20201001] [cannot apply to tip/x86/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mike-Travis/x86-platform-uv-Updates-for-UV5-Architecture/20201002-085248
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 4cb1a880e7f774e59c2ebb68187d4811ad9d0c4e
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/ee300e616c45bd051cf959dd5e10b0168d178988
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mike-Travis/x86-platform-uv-Updates-for-UV5-Architecture/20201002-085248
        git checkout ee300e616c45bd051cf959dd5e10b0168d178988
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_set_system_type':
arch/x86/kernel/apic/x2apic_uv_x.c:258:6: warning: variable 'pnodeid' set but not used [-Wunused-but-set-variable]

     258 |  int pnodeid;
         |      ^~~~~~~
   arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_init_hub_info':
>> arch/x86/kernel/apic/x2apic_uv_x.c:1027:22: warning: variable 'node_id' set but not used [-Wunused-but-set-variable]
    1027 |  union uvh_node_id_u node_id;
         |                      ^~~~~~~

vim +/node_id +1027 arch/x86/kernel/apic/x2apic_uv_x.c

c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1024  
ad3bc25a320742f arch/x86/kernel/apic/x2apic_uv_x.c Borislav Petkov 2018-12-05  1025  static void __init uv_init_hub_info(struct uv_hub_info_s *hi)
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1026  {
9f5314fb4d556d3 arch/x86/kernel/genx2apic_uv_x.c   Jack Steiner    2008-05-28 @1027  	union uvh_node_id_u node_id;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1028  	struct mn mn;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1029  
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1030  	get_mn(&mn);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1031  	hi->gpa_mask = mn.m_val ?
405422d88c686e8 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1032  		(1UL << (mn.m_val + mn.n_val)) - 1 :
405422d88c686e8 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1033  		(1UL << uv_cpuid.gpa_shift) - 1;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1034  
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1035  	hi->m_val		= mn.m_val;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1036  	hi->n_val		= mn.n_val;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1037  	hi->m_shift		= mn.m_shift;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1038  	hi->n_lshift		= mn.n_lshift ? mn.n_lshift : 0;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1039  	hi->hub_revision	= uv_hub_info->hub_revision;
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1040  	hi->hub_type		= uv_hub_info->hub_type;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1041  	hi->pnode_mask		= uv_cpuid.pnode_mask;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1042  	hi->min_pnode		= _min_pnode;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1043  	hi->min_socket		= _min_socket;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1044  	hi->pnode_to_socket	= _pnode_to_socket;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1045  	hi->socket_to_node	= _socket_to_node;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1046  	hi->socket_to_pnode	= _socket_to_pnode;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1047  	hi->gr_table_len	= _gr_table_len;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1048  	hi->gr_table		= _gr_table;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1049  
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1050  	node_id.v		= uv_read_local_mmr(UVH_NODE_ID);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1051  	uv_cpuid.gnode_shift	= max_t(unsigned int, uv_cpuid.gnode_shift, mn.n_val);
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1052  	hi->gnode_extra		= (uv_node_id & ~((1 << uv_cpuid.gnode_shift) - 1)) >> 1;
ad4830051aac0b9 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2017-03-21  1053  	if (mn.m_val)
ad4830051aac0b9 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2017-03-21  1054  		hi->gnode_upper	= (u64)hi->gnode_extra << mn.m_val;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1055  
1de329c10d9fbac arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1056  	if (uv_gp_table) {
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1057  		hi->global_mmr_base	= uv_gp_table->mmr_base;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1058  		hi->global_mmr_shift	= uv_gp_table->mmr_shift;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1059  		hi->global_gru_base	= uv_gp_table->gru_base;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1060  		hi->global_gru_shift	= uv_gp_table->gru_shift;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1061  		hi->gpa_shift		= uv_gp_table->gpa_shift;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1062  		hi->gpa_mask		= (1UL << hi->gpa_shift) - 1;
1de329c10d9fbac arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1063  	} else {
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1064  		hi->global_mmr_base	=
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1065  			uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG) &
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1066  			~UV_MMR_ENABLE;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1067  		hi->global_mmr_shift	= _UV_GLOBAL_MMR64_PNODE_SHIFT;
1de329c10d9fbac arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1068  	}
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1069  
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1070  	get_lowmem_redirect(&hi->lowmem_remap_base, &hi->lowmem_remap_top);
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1071  
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1072  	hi->apic_pnode_shift = uv_cpuid.socketid_shift;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1073  
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1074  	/* Show system specific info: */
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1075  	pr_info("UV: N:%d M:%d m_shift:%d n_lshift:%d\n", hi->n_val, hi->m_val, hi->m_shift, hi->n_lshift);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1076  	pr_info("UV: gpa_mask/shift:0x%lx/%d pnode_mask:0x%x apic_pns:%d\n", hi->gpa_mask, hi->gpa_shift, hi->pnode_mask, hi->apic_pnode_shift);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1077  	pr_info("UV: mmr_base/shift:0x%lx/%ld gru_base/shift:0x%lx/%ld\n", hi->global_mmr_base, hi->global_mmr_shift, hi->global_gru_base, hi->global_gru_shift);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1078  	pr_info("UV: gnode_upper:0x%lx gnode_extra:0x%x\n", hi->gnode_upper, hi->gnode_extra);
1de329c10d9fbac arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1079  }
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1080  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#6 lore raw

Re: [PATCH v3 04/13] x86/platform/uv: Update UV MMRs for UV5

Quoted 8 lines · kernel test robot

Hi Mike,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on tip/master v5.9-rc7 next-20201001] [cannot apply to tip/x86/core]
[If your patch is applied to the wrong git tree, kindly drop us a note.

Hi, Yes, the original patches were applied against v5.9-rc4 and I didn't think they changed that much. But I will look at this one and the following two as well as the reference. Thanks, Mike

Quoted 93 lines

And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch ]

url:    https://github.com/0day-ci/linux/commits/Mike-Travis/x86-platform-uv-Updates-for-UV5-Architecture/20201002-085248
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 4cb1a880e7f774e59c2ebb68187d4811ad9d0c4e
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
         # https://github.com/0day-ci/linux/commit/ee300e616c45bd051cf959dd5e10b0168d178988
         git remote add linux-review https://github.com/0day-ci/linux
         git fetch --no-tags linux-review Mike-Travis/x86-platform-uv-Updates-for-UV5-Architecture/20201002-085248
         git checkout ee300e616c45bd051cf959dd5e10b0168d178988
         # save the attached .config to linux build tree
         make W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

    arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_set_system_type':
    arch/x86/kernel/apic/x2apic_uv_x.c:258:6: warning: variable 'pnodeid' set but not used [-Wunused-but-set-variable]
      258 |  int pnodeid;
          |      ^~~~~~~
    arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_init_hub_info':
Quoted 1 line
Quoted 1 line

arch/x86/kernel/apic/x2apic_uv_x.c:1027:22: warning: variable 'node_id' set but not used [-Wunused-but-set-variable]

     1027 |  union uvh_node_id_u node_id;
          |                      ^~~~~~~

vim +/node_id +1027 arch/x86/kernel/apic/x2apic_uv_x.c

c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1024
ad3bc25a320742f arch/x86/kernel/apic/x2apic_uv_x.c Borislav Petkov 2018-12-05  1025  static void __init uv_init_hub_info(struct uv_hub_info_s *hi)
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1026  {
9f5314fb4d556d3 arch/x86/kernel/genx2apic_uv_x.c   Jack Steiner    2008-05-28 @1027  	union uvh_node_id_u node_id;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1028  	struct mn mn;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1029
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1030  	get_mn(&mn);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1031  	hi->gpa_mask = mn.m_val ?
405422d88c686e8 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1032  		(1UL << (mn.m_val + mn.n_val)) - 1 :
405422d88c686e8 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1033  		(1UL << uv_cpuid.gpa_shift) - 1;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1034
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1035  	hi->m_val		= mn.m_val;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1036  	hi->n_val		= mn.n_val;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1037  	hi->m_shift		= mn.m_shift;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1038  	hi->n_lshift		= mn.n_lshift ? mn.n_lshift : 0;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1039  	hi->hub_revision	= uv_hub_info->hub_revision;
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1040  	hi->hub_type		= uv_hub_info->hub_type;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1041  	hi->pnode_mask		= uv_cpuid.pnode_mask;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1042  	hi->min_pnode		= _min_pnode;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1043  	hi->min_socket		= _min_socket;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1044  	hi->pnode_to_socket	= _pnode_to_socket;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1045  	hi->socket_to_node	= _socket_to_node;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1046  	hi->socket_to_pnode	= _socket_to_pnode;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1047  	hi->gr_table_len	= _gr_table_len;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1048  	hi->gr_table		= _gr_table;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1049
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1050  	node_id.v		= uv_read_local_mmr(UVH_NODE_ID);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1051  	uv_cpuid.gnode_shift	= max_t(unsigned int, uv_cpuid.gnode_shift, mn.n_val);
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1052  	hi->gnode_extra		= (uv_node_id & ~((1 << uv_cpuid.gnode_shift) - 1)) >> 1;
ad4830051aac0b9 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2017-03-21  1053  	if (mn.m_val)
ad4830051aac0b9 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2017-03-21  1054  		hi->gnode_upper	= (u64)hi->gnode_extra << mn.m_val;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1055
1de329c10d9fbac arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1056  	if (uv_gp_table) {
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1057  		hi->global_mmr_base	= uv_gp_table->mmr_base;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1058  		hi->global_mmr_shift	= uv_gp_table->mmr_shift;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1059  		hi->global_gru_base	= uv_gp_table->gru_base;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1060  		hi->global_gru_shift	= uv_gp_table->gru_shift;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1061  		hi->gpa_shift		= uv_gp_table->gpa_shift;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1062  		hi->gpa_mask		= (1UL << hi->gpa_shift) - 1;
1de329c10d9fbac arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1063  	} else {
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1064  		hi->global_mmr_base	=
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1065  			uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG) &
ee300e616c45bd0 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2020-10-01  1066  			~UV_MMR_ENABLE;
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1067  		hi->global_mmr_shift	= _UV_GLOBAL_MMR64_PNODE_SHIFT;
1de329c10d9fbac arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1068  	}
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1069
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1070  	get_lowmem_redirect(&hi->lowmem_remap_base, &hi->lowmem_remap_top);
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1071
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1072  	hi->apic_pnode_shift = uv_cpuid.socketid_shift;
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1073
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1074  	/* Show system specific info: */
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1075  	pr_info("UV: N:%d M:%d m_shift:%d n_lshift:%d\n", hi->n_val, hi->m_val, hi->m_shift, hi->n_lshift);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1076  	pr_info("UV: gpa_mask/shift:0x%lx/%d pnode_mask:0x%x apic_pns:%d\n", hi->gpa_mask, hi->gpa_shift, hi->pnode_mask, hi->apic_pnode_shift);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1077  	pr_info("UV: mmr_base/shift:0x%lx/%ld gru_base/shift:0x%lx/%ld\n", hi->global_mmr_base, hi->global_mmr_shift, hi->global_gru_base, hi->global_gru_shift);
7243e10689fd17a arch/x86/kernel/apic/x2apic_uv_x.c Ingo Molnar     2017-01-14  1078  	pr_info("UV: gnode_upper:0x%lx gnode_extra:0x%x\n", hi->gnode_upper, hi->gnode_extra);
1de329c10d9fbac arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1079  }
c443c03dd0d9762 arch/x86/kernel/apic/x2apic_uv_x.c Mike Travis     2016-04-29  1080

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#7 lore raw

PATCH v3 5/13 x86/platform/uv: Add UV5 direct references

In reply to Mike Travis

Add new references to UV5 (and UVY class) system MMR addresses and fields primarily caused by the expansion from 46 to 52 bits of physical memory address.

---
 arch/x86/include/asm/uv/uv_hub.h   |  49 +++++++++-----
 arch/x86/kernel/apic/x2apic_uv_x.c | 100 +++++++++++++++++++++--------
 2 files changed, 105 insertions(+), 44 deletions(-)
arch/x86/include/asm/uv/uv_hub.h +33 -16
index 76969be09660..ecf5c93e7ae8 100644
@@ -160,6 +160,7 @@ struct uv_hub_info_s {
 	unsigned char		gr_table_len;
 	unsigned char		apic_pnode_shift;
 	unsigned char		gpa_shift;
+	unsigned char		nasid_shift;
 	unsigned char		m_shift;
 	unsigned char		n_lshift;
 	unsigned int		gnode_extra;
@@ -226,6 +227,7 @@ static inline __init void uv_hub_type_set(int uvmask)
 #define UV3_HUB_REVISION_BASE		5
 #define UV4_HUB_REVISION_BASE		7
 #define UV4A_HUB_REVISION_BASE		8	/* UV4 (fixed) rev 2 */
+#define UV5_HUB_REVISION_BASE		9
 
 static inline int is_uv(int uvmask) { return uv_hub_type() & uvmask; }
 static inline int is_uv1_hub(void) { return 0; }
@@ -233,7 +235,7 @@ static inline int is_uv2_hub(void) { return is_uv(UV2); }
 static inline int is_uv3_hub(void) { return is_uv(UV3); }
 static inline int is_uv4a_hub(void) { return is_uv(UV4A); }
 static inline int is_uv4_hub(void) { return is_uv(UV4); }
-static inline int is_uv5_hub(void) { return 0; }
+static inline int is_uv5_hub(void) { return is_uv(UV5); }
 
 /*
  * UV4A is a revision of UV4.  So on UV4A, both is_uv4_hub() and
@@ -246,7 +248,7 @@ static inline int is_uv5_hub(void) { return 0; }
 static inline int is_uvx_hub(void) { return is_uv(UVX); }
 
 /* UVY class: UV5,..? */
-static inline int is_uvy_hub(void) { return 0; }
+static inline int is_uvy_hub(void) { return is_uv(UVY); }
 
 /* Any UV Hubbed System */
 static inline int is_uv_hub(void) { return is_uv(UV_ANY); }
@@ -271,9 +273,11 @@ union uvh_apicid {
  *		g -  GNODE (full 15-bit global nasid, right shifted 1)
  *		p -  PNODE (local part of nsids, right shifted 1)
  */
-#define UV_NASID_TO_PNODE(n)		(((n) >> 1) & uv_hub_info->pnode_mask)
+#define UV_NASID_TO_PNODE(n)		\
+		(((n) >> uv_hub_info->nasid_shift) & uv_hub_info->pnode_mask)
 #define UV_PNODE_TO_GNODE(p)		((p) |uv_hub_info->gnode_extra)
-#define UV_PNODE_TO_NASID(p)		(UV_PNODE_TO_GNODE(p) << 1)
+#define UV_PNODE_TO_NASID(p)		\
+		(UV_PNODE_TO_GNODE(p) << uv_hub_info->nasid_shift)
 
 #define UV2_LOCAL_MMR_BASE		0xfa000000UL
 #define UV2_GLOBAL_MMR32_BASE		0xfc000000UL
@@ -290,25 +294,38 @@ union uvh_apicid {
 #define UV4_LOCAL_MMR_SIZE		(32UL * 1024 * 1024)
 #define UV4_GLOBAL_MMR32_SIZE		0
 
+#define UV5_LOCAL_MMR_BASE		0xfa000000UL
+#define UV5_GLOBAL_MMR32_BASE		0
+#define UV5_LOCAL_MMR_SIZE		(32UL * 1024 * 1024)
+#define UV5_GLOBAL_MMR32_SIZE		0
+
 #define UV_LOCAL_MMR_BASE		(				\
-					is_uv2_hub() ? UV2_LOCAL_MMR_BASE : \
-					is_uv3_hub() ? UV3_LOCAL_MMR_BASE : \
-					/*is_uv4_hub*/ UV4_LOCAL_MMR_BASE)
+					is_uv(UV2) ? UV2_LOCAL_MMR_BASE : \
+					is_uv(UV3) ? UV3_LOCAL_MMR_BASE : \
+					is_uv(UV4) ? UV4_LOCAL_MMR_BASE : \
+					is_uv(UV5) ? UV5_LOCAL_MMR_BASE : \
+					0)
 
 #define UV_GLOBAL_MMR32_BASE		(				\
-					is_uv2_hub() ? UV2_GLOBAL_MMR32_BASE : \
-					is_uv3_hub() ? UV3_GLOBAL_MMR32_BASE : \
-					/*is_uv4_hub*/ UV4_GLOBAL_MMR32_BASE)
+					is_uv(UV2) ? UV2_GLOBAL_MMR32_BASE : \
+					is_uv(UV3) ? UV3_GLOBAL_MMR32_BASE : \
+					is_uv(UV4) ? UV4_GLOBAL_MMR32_BASE : \
+					is_uv(UV5) ? UV5_GLOBAL_MMR32_BASE : \
+					0)
 
 #define UV_LOCAL_MMR_SIZE		(				\
-					is_uv2_hub() ? UV2_LOCAL_MMR_SIZE : \
-					is_uv3_hub() ? UV3_LOCAL_MMR_SIZE : \
-					/*is_uv4_hub*/ UV4_LOCAL_MMR_SIZE)
+					is_uv(UV2) ? UV2_LOCAL_MMR_SIZE : \
+					is_uv(UV3) ? UV3_LOCAL_MMR_SIZE : \
+					is_uv(UV4) ? UV4_LOCAL_MMR_SIZE : \
+					is_uv(UV5) ? UV5_LOCAL_MMR_SIZE : \
+					0)
 
 #define UV_GLOBAL_MMR32_SIZE		(				\
-					is_uv2_hub() ? UV2_GLOBAL_MMR32_SIZE : \
-					is_uv3_hub() ? UV3_GLOBAL_MMR32_SIZE : \
-					/*is_uv4_hub*/ UV4_GLOBAL_MMR32_SIZE)
+					is_uv(UV2) ? UV2_GLOBAL_MMR32_SIZE : \
+					is_uv(UV3) ? UV3_GLOBAL_MMR32_SIZE : \
+					is_uv(UV4) ? UV4_GLOBAL_MMR32_SIZE : \
+					is_uv(UV5) ? UV5_GLOBAL_MMR32_SIZE : \
+					0)
 
 #define UV_GLOBAL_MMR64_BASE		(uv_hub_info->global_mmr_base)
 
arch/x86/kernel/apic/x2apic_uv_x.c +72 -28

193 lines not on this page · raw message

Signature · 1 line
2.21.0
#8 lore raw

PATCH v3 6/13 x86/platform/uv: Add and Decode Arch Type in UVsystab

In reply to Mike Travis

A patch to add and process the UV Arch Type field in the UVsystab passed from UV BIOS to the kernel. This allows the system to be recognized without relying on the OEM_ID which OEMs want to change.

---
 arch/x86/include/asm/uv/bios.h     |  16 +++-
 arch/x86/kernel/apic/x2apic_uv_x.c | 135 +++++++++++++++++++++++++----
 arch/x86/platform/uv/bios_uv.c     |  27 ++++--
 3 files changed, 148 insertions(+), 30 deletions(-)
arch/x86/include/asm/uv/bios.h +13 -3
index 70050d0136c3..97ac595ebc6a 100644
@@ -5,8 +5,8 @@
 /*
  * UV BIOS layer definitions.
  *
- *  Copyright (c) 2008-2009 Silicon Graphics, Inc.  All Rights Reserved.
- *  Copyright (c) Russ Anderson <[email protected]>
+ * Copyright (C) 2007-2017 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (c) Russ Anderson <[email protected]>
  */
 
 #include <linux/rtc.h>
@@ -71,6 +71,11 @@ struct uv_gam_range_entry {
 	u32	limit;		/* PA bits 56:26 (UV_GAM_RANGE_SHFT) */
 };
 
+#define	UV_AT_SIZE	8	/* 7 character arch type + NULL char */
+struct uv_arch_type_entry {
+	char	archtype[UV_AT_SIZE];
+};
+
 #define	UV_SYSTAB_SIG			"UVST"
 #define	UV_SYSTAB_VERSION_1		1	/* UV2/3 BIOS version */
 #define	UV_SYSTAB_VERSION_UV4		0x400	/* UV4 BIOS base version */
@@ -79,10 +84,14 @@ struct uv_gam_range_entry {
 #define	UV_SYSTAB_VERSION_UV4_3		0x403	/* - GAM Range PXM Value */
 #define	UV_SYSTAB_VERSION_UV4_LATEST	UV_SYSTAB_VERSION_UV4_3
 
+#define	UV_SYSTAB_VERSION_UV5		0x500	/* UV5 GAM base version */
+#define	UV_SYSTAB_VERSION_UV5_LATEST	UV_SYSTAB_VERSION_UV5
+
 #define	UV_SYSTAB_TYPE_UNUSED		0	/* End of table (offset == 0) */
 #define	UV_SYSTAB_TYPE_GAM_PARAMS	1	/* GAM PARAM conversions */
 #define	UV_SYSTAB_TYPE_GAM_RNG_TBL	2	/* GAM entry table */
-#define	UV_SYSTAB_TYPE_MAX		3
+#define	UV_SYSTAB_TYPE_ARCH_TYPE	3	/* UV arch type */
+#define	UV_SYSTAB_TYPE_MAX		4
 
 /*
  * The UV system table describes specific firmware
@@ -133,6 +142,7 @@ 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 int uv_bios_init(void);
+extern unsigned long get_uv_systab_phys(bool msg);
 
 extern unsigned long sn_rtc_cycles_per_second;
 extern int uv_type;
arch/x86/kernel/apic/x2apic_uv_x.c +116 -19

215 lines not on this page · raw message

arch/x86/platform/uv/bios_uv.c +19 -8
index a2f447dffea6..b148b4c8c2ec 100644
@@ -2,8 +2,8 @@
 /*
  * BIOS run time interface routines.
  *
- *  Copyright (c) 2008-2009 Silicon Graphics, Inc.  All Rights Reserved.
- *  Copyright (c) Russ Anderson <[email protected]>
+ * Copyright (C) 2007-2017 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (c) Russ Anderson <[email protected]>
  */
 
 #include <linux/efi.h>
@@ -170,16 +170,27 @@ int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus)
 				(u64)decode, (u64)domain, (u64)bus, 0, 0);
 }
 
-int uv_bios_init(void)
+unsigned long get_uv_systab_phys(bool msg)
 {
-	uv_systab = NULL;
 	if ((uv_systab_phys == EFI_INVALID_TABLE_ADDR) ||
 	    !uv_systab_phys || efi_runtime_disabled()) {
-		pr_crit("UV: UVsystab: missing\n");
-		return -EEXIST;
+		if (msg)
+			pr_crit("UV: UVsystab: missing\n");
+		return 0;
 	}
+	return uv_systab_phys;
+}
+
+int uv_bios_init(void)
+{
+	unsigned long uv_systab_phys_addr;
+
+	uv_systab = NULL;
+	uv_systab_phys_addr = get_uv_systab_phys(1);
+	if (!uv_systab_phys_addr)
+		return -EEXIST;
 
-	uv_systab = ioremap(uv_systab_phys, sizeof(struct uv_systab));
+	uv_systab = ioremap(uv_systab_phys_addr, sizeof(struct uv_systab));
 	if (!uv_systab || strncmp(uv_systab->signature, UV_SYSTAB_SIG, 4)) {
 		pr_err("UV: UVsystab: bad signature!\n");
 		iounmap(uv_systab);
@@ -191,7 +202,7 @@ int uv_bios_init(void)
 		int size = uv_systab->size;
 
 		iounmap(uv_systab);
-		uv_systab = ioremap(uv_systab_phys, size);
+		uv_systab = ioremap(uv_systab_phys_addr, size);
 		if (!uv_systab) {
 			pr_err("UV: UVsystab: ioremap(%d) failed!\n", size);
 			return -EFAULT;
Signature · 1 line
2.21.0
#9 lore raw

Re: [PATCH v3 06/13] x86/platform/uv: Add and Decode Arch Type in UVsystab

Thank you for the patch! Perhaps something to improve:

Hi Mike,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on tip/master v5.9-rc7 next-20201001] [cannot apply to tip/x86/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mike-Travis/x86-platform-uv-Updates-for-UV5-Architecture/20201002-085248
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 4cb1a880e7f774e59c2ebb68187d4811ad9d0c4e
config: x86_64-rhel (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/cc7436be5847f8bedccc6e397f23967799046c1b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mike-Travis/x86-platform-uv-Updates-for-UV5-Architecture/20201002-085248
        git checkout cc7436be5847f8bedccc6e397f23967799046c1b
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_set_system_type':
arch/x86/kernel/apic/x2apic_uv_x.c:366:6: warning: variable 'pnodeid' set but not used [-Wunused-but-set-variable]

     366 |  int pnodeid;
         |      ^~~~~~~
   arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_init_hub_info':
   arch/x86/kernel/apic/x2apic_uv_x.c:1150:22: warning: variable 'node_id' set but not used [-Wunused-but-set-variable]
    1150 |  union uvh_node_id_u node_id;
         |                      ^~~~~~~
   In function 'uv_stringify',
       inlined from 'decode_arch_type' at arch/x86/kernel/apic/x2apic_uv_x.c:315:3,
       inlined from 'early_get_arch_type' at arch/x86/kernel/apic/x2apic_uv_x.c:359:8,
       inlined from 'uv_set_system_type' at arch/x86/kernel/apic/x2apic_uv_x.c:372:7,
       inlined from 'uv_acpi_madt_oem_check' at arch/x86/kernel/apic/x2apic_uv_x.c:456:6:
>> arch/x86/kernel/apic/x2apic_uv_x.c:287:2: warning: 'strncpy' output may be truncated copying 7 bytes from a string of length 7 [-Wstringop-truncation]
     287 |  strncpy(to, from, len-1);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~

vim +/strncpy +287 arch/x86/kernel/apic/x2apic_uv_x.c

c8f730b1ab825f0 Russ Anderson 2010-10-26  283  
61e5ddca9c2a312 Mike Travis   2019-09-10  284  static void __init uv_stringify(int len, char *to, char *from)
61e5ddca9c2a312 Mike Travis   2019-09-10  285  {
61e5ddca9c2a312 Mike Travis   2019-09-10  286  	/* Relies on 'to' being NULL chars so result will be NULL terminated */
61e5ddca9c2a312 Mike Travis   2019-09-10 @287  	strncpy(to, from, len-1);
61e5ddca9c2a312 Mike Travis   2019-09-10  288  }
61e5ddca9c2a312 Mike Travis   2019-09-10  289  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#10 lore raw

Re: [PATCH v3 06/13] x86/platform/uv: Add and Decode Arch Type in UVsystab

Hi, I'm not sure I understand this one. I've tried a number of ways to trick the compiler into not giving an error but to no avail. The premise is it always copies one less bytes to a null filled character list. This insures that a copy of N chars will still be in an N+1 list with a NULL at the end.

But the complaint is about copying 7 chars from a string of 7 chars. This should work fine since the target will have 8 chars with a NULL at the end.

Thanks for any explanation,
Mike

Quoted 22 lines · kernel test robot
    In function 'uv_stringify',
        inlined from 'decode_arch_type' at arch/x86/kernel/apic/x2apic_uv_x.c:315:3,
        inlined from 'early_get_arch_type' at arch/x86/kernel/apic/x2apic_uv_x.c:359:8,
        inlined from 'uv_set_system_type' at arch/x86/kernel/apic/x2apic_uv_x.c:372:7,
        inlined from 'uv_acpi_madt_oem_check' at arch/x86/kernel/apic/x2apic_uv_x.c:456:6:
Quoted 1 line
Quoted 1 line

arch/x86/kernel/apic/x2apic_uv_x.c:287:2: warning: 'strncpy' output may be truncated copying 7 bytes from a string of length 7 [-Wstringop-truncation]

      287 |  strncpy(to, from, len-1);
          |  ^~~~~~~~~~~~~~~~~~~~~~~~

vim +/strncpy +287 arch/x86/kernel/apic/x2apic_uv_x.c

c8f730b1ab825f0 Russ Anderson 2010-10-26  283
61e5ddca9c2a312 Mike Travis   2019-09-10  284  static void __init uv_stringify(int len, char *to, char *from)
61e5ddca9c2a312 Mike Travis   2019-09-10  285  {
61e5ddca9c2a312 Mike Travis   2019-09-10  286  	/* Relies on 'to' being NULL chars so result will be NULL terminated */
61e5ddca9c2a312 Mike Travis   2019-09-10 @287  	strncpy(to, from, len-1);
61e5ddca9c2a312 Mike Travis   2019-09-10  288  }
61e5ddca9c2a312 Mike Travis   2019-09-10  289

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#11 lore raw

PATCH v3 7/13 x86/platform/uv: Update MMIOH references based on new UV5 MMRs.

In reply to Mike Travis

Make modifications to the MMIOH mappings to accommodate changes for UV5.

---
 arch/x86/kernel/apic/x2apic_uv_x.c | 211 +++++++++++++++++++----------
 1 file changed, 143 insertions(+), 68 deletions(-)
arch/x86/kernel/apic/x2apic_uv_x.c +143 -68
index 353825a0b327..746a56466066 100644
@@ -228,6 +228,13 @@ static void __init uv_tsc_check_sync(void)
 		mark_tsc_unstable("UV BIOS");
 }
 
+/* Selector for (4|4A|5) structs */
+#define uvxy_field(sname, field, undef) (	\
+	is_uv(UV4A) ? sname.s4a.field :		\
+	is_uv(UV4) ? sname.s4.field :		\
+	is_uv(UV3) ? sname.s3.field :		\
+	undef)
+
 /* [Copied from arch/x86/kernel/cpu/topology.c:detect_extended_topology()] */
 
 #define SMT_LEVEL			0	/* Leaf 0xb SMT level */
@@ -882,6 +889,7 @@ static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
 }
 
 enum map_type {map_wb, map_uc};
+static const char * const mt[] = { "WB", "UC" };
 
 static __init void map_high(char *id, unsigned long base, int pshift, int bshift, int max_pnode, enum map_type map_type)
 {
@@ -893,11 +901,13 @@ static __init void map_high(char *id, unsigned long base, int pshift, int bshift
 		pr_info("UV: Map %s_HI base address NULL\n", id);
 		return;
 	}
-	pr_debug("UV: Map %s_HI 0x%lx - 0x%lx\n", id, paddr, paddr + bytes);
 	if (map_type == map_uc)
 		init_extra_mapping_uc(paddr, bytes);
 	else
 		init_extra_mapping_wb(paddr, bytes);
+
+	pr_info("UV: Map %s_HI 0x%lx - 0x%lx %s (%d segments)\n",
+		id, paddr, paddr + bytes, mt[map_type], max_pnode + 1);
 }
 
 static __init void map_gru_high(int max_pnode)
@@ -931,52 +941,73 @@ static __init void map_mmr_high(int max_pnode)
 		pr_info("UV: MMR disabled\n");
 }
 
-/* UV3/4 have identical MMIOH overlay configs, UV4A is slightly different */
-static __init void map_mmioh_high_uv34(int index, int min_pnode, int max_pnode)
-{
-	unsigned long overlay;
-	unsigned long mmr;
-	unsigned long base;
-	unsigned long nasid_mask;
-	unsigned long m_overlay;
-	int i, n, shift, m_io, max_io;
-	int nasid, lnasid, fi, li;
-	char *id;
-
-	if (index == 0) {
-		id = "MMIOH0";
-		m_overlay = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0;
-		overlay = uv_read_local_mmr(m_overlay);
-		base = overlay & UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_BASE_MASK;
+/* Arch specific ENUM cases */
+enum mmioh_arch {
+	UV2_MMIOH = -1,
+	UVY_MMIOH0, UVY_MMIOH1,
+	UVX_MMIOH0, UVX_MMIOH1,
+};
+
+/* Calculate and Map MMIOH Regions */
+void __init calc_mmioh_map(enum mmioh_arch index, int min_pnode, int max_pnode,
+	int shift, unsigned long base, int m_io, int n_io)
+{
+	unsigned long mmr, nasid_mask;
+	int nasid, min_nasid, max_nasid, lnasid, mapped;
+	int i, fi, li, n, max_io;
+	char id[8];
+
+	/* One (UV2) mapping */
+	if (index == UV2_MMIOH) {
+		strncpy(id, "MMIOH", sizeof(id));
+		max_io = max_pnode;
+		mapped = 0;
+		goto map_exit;
+	}
+
+	/* small and large MMIOH mappings */
+	switch (index) {
+	case UVY_MMIOH0:
+		mmr = UVH_RH10_GAM_MMIOH_REDIRECT_CONFIG0;
+		nasid_mask = UVH_RH10_GAM_MMIOH_OVERLAY_CONFIG0_BASE_MASK;
+		n = UVH_RH10_GAM_MMIOH_REDIRECT_CONFIG0_DEPTH;
+		min_nasid = min_pnode;
+		max_nasid = max_pnode;
+		mapped = 1;
+		break;
+	case UVY_MMIOH1:
+		mmr = UVH_RH10_GAM_MMIOH_REDIRECT_CONFIG1;
+		nasid_mask = UVH_RH10_GAM_MMIOH_OVERLAY_CONFIG1_BASE_MASK;
+		n = UVH_RH10_GAM_MMIOH_REDIRECT_CONFIG1_DEPTH;
+		min_nasid = min_pnode;
+		max_nasid = max_pnode;
+		mapped = 1;
+		break;
+	case UVX_MMIOH0:
 		mmr = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0;
-		m_io = (overlay & UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_M_IO_MASK)
-			>> UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_M_IO_SHFT;
-		shift = UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_M_IO_SHFT;
+		nasid_mask = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_BASE_MASK;
 		n = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0_DEPTH;
-		nasid_mask = UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK;
-	} else {
-		id = "MMIOH1";
-		m_overlay = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1;
-		overlay = uv_read_local_mmr(m_overlay);
-		base = overlay & UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG1_BASE_MASK;
+		min_nasid = min_pnode * 2;
+		max_nasid = max_pnode * 2;
+		mapped = 1;
+		break;
+	case UVX_MMIOH1:
 		mmr = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1;
-		m_io = (overlay & UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG1_M_IO_MASK)
-			>> UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG1_M_IO_SHFT;
-		shift = UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG1_M_IO_SHFT;
+		nasid_mask = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1_BASE_MASK;
 		n = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1_DEPTH;
-		nasid_mask = UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK;
-	}
-	pr_info("UV: %s overlay 0x%lx base:0x%lx m_io:%d\n", id, overlay, base, m_io);
-	if (!(overlay & UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_ENABLE_MASK)) {
-		pr_info("UV: %s disabled\n", id);
+		min_nasid = min_pnode * 2;
+		max_nasid = max_pnode * 2;
+		mapped = 1;
+		break;
+	default:
+		pr_err("UV:%s:Invalid mapping type:%d\n", __func__, index);
 		return;
 	}
 
-	/* Convert to NASID: */
-	min_pnode *= 2;
-	max_pnode *= 2;
-	max_io = lnasid = fi = li = -1;
+	/* enum values chosen so (index mod 2) is MMIOH 0/1 (low/high) */
+	snprintf(id, sizeof(id), "MMIOH%d", index%2);
 
+	max_io = lnasid = fi = li = -1;
 	for (i = 0; i < n; i++) {
 		unsigned long m_redirect = mmr + i * 8;
 		unsigned long redirect = uv_read_local_mmr(m_redirect);
@@ -986,9 +1017,12 @@ static __init void map_mmioh_high_uv34(int index, int min_pnode, int max_pnode)
 			pr_info("UV: %s redirect base 0x%lx(@0x%lx) 0x%04x\n",
 				id, redirect, m_redirect, nasid);
 
-		/* Invalid NASID: */
-		if (nasid < min_pnode || max_pnode < nasid)
+		/* Invalid NASID check */
+		if (nasid < min_nasid || max_nasid < nasid) {
+			pr_err("UV:%s:Invalid NASID:%x (range:%x..%x)\n",
+				__func__, index, min_nasid, max_nasid );
 			nasid = -1;
+		}
 
 		if (nasid == lnasid) {
 			li = i;
@@ -1011,7 +1045,8 @@ static __init void map_mmioh_high_uv34(int index, int min_pnode, int max_pnode)
 			}
 			addr1 = (base << shift) + f * (1ULL << m_io);
 			addr2 = (base << shift) + (l + 1) * (1ULL << m_io);
-			pr_info("UV: %s[%03d..%03d] NASID 0x%04x ADDR 0x%016lx - 0x%016lx\n", id, fi, li, lnasid, addr1, addr2);
+			pr_info("UV: %s[%03d..%03d] NASID 0x%04x ADDR 0x%016lx - 0x%016lx\n",
+				id, fi, li, lnasid, addr1, addr2);
 			if (max_io < l)
 				max_io = l;
 		}
@@ -1019,43 +1054,83 @@ static __init void map_mmioh_high_uv34(int index, int min_pnode, int max_pnode)
 		lnasid = nasid;
 	}
 
-	pr_info("UV: %s base:0x%lx shift:%d M_IO:%d MAX_IO:%d\n", id, base, shift, m_io, max_io);
+map_exit:
+	pr_info("UV: %s base:0x%lx shift:%d m_io:%d max_io:%d max_pnode:0x%x\n",
+		id, base, shift, m_io, max_io, max_pnode);
 
-	if (max_io >= 0)
+	if (max_io >= 0 && !mapped)
 		map_high(id, base, shift, m_io, max_io, map_uc);
 }
 
 static __init void map_mmioh_high(int min_pnode, int max_pnode)
 {
-	union uvh_rh_gam_mmioh_overlay_config_u mmioh;
-	unsigned long mmr, base;
-	int shift, enable, m_io, n_io;
+	/* UVY flavor */
+	if (UVH_RH10_GAM_MMIOH_OVERLAY_CONFIG0) {
+		union uvh_rh10_gam_mmioh_overlay_config0_u mmioh0;
+		union uvh_rh10_gam_mmioh_overlay_config1_u mmioh1;
+
+		mmioh0.v = uv_read_local_mmr(UVH_RH10_GAM_MMIOH_OVERLAY_CONFIG0);
+		if (unlikely(mmioh0.s.enable == 0))
+			pr_info("UV: MMIOH0 disabled\n");
+		else
+			calc_mmioh_map(UVY_MMIOH0, min_pnode, max_pnode,
+				UVH_RH10_GAM_MMIOH_OVERLAY_CONFIG0_BASE_SHFT,
+				mmioh0.s.base, mmioh0.s.m_io, mmioh0.s.n_io);
 
-	if (is_uv3_hub() || is_uv4_hub()) {
-		/* Map both MMIOH regions: */
-		map_mmioh_high_uv34(0, min_pnode, max_pnode);
-		map_mmioh_high_uv34(1, min_pnode, max_pnode);
+		mmioh1.v = uv_read_local_mmr(UVH_RH10_GAM_MMIOH_OVERLAY_CONFIG1);
+		if (unlikely(mmioh1.s.enable == 0))
+			pr_info("UV: MMIOH1 disabled\n");
+		else
+			calc_mmioh_map(UVY_MMIOH1, min_pnode, max_pnode,
+				UVH_RH10_GAM_MMIOH_OVERLAY_CONFIG1_BASE_SHFT,
+				mmioh1.s.base, mmioh1.s.m_io, mmioh1.s.n_io);
 		return;
 	}
+	/* UVX flavor */
+	if (UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0) {
+		union uvh_rh_gam_mmioh_overlay_config0_u mmioh0;
+		union uvh_rh_gam_mmioh_overlay_config1_u mmioh1;
+
+		mmioh0.v = uv_read_local_mmr(UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0);
+		if (unlikely(mmioh0.s.enable == 0))
+			pr_info("UV: MMIOH0 disabled\n");
+		else {
+			unsigned long base = uvxy_field(mmioh0, base, 0);
+			int m_io = uvxy_field(mmioh0, m_io, 0);
+			int n_io = uvxy_field(mmioh0, n_io, 0);
+
+			calc_mmioh_map(UVX_MMIOH0, min_pnode, max_pnode,
+				UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_BASE_SHFT,
+				base, m_io, n_io);
+		}
 
-	if (is_uv2_hub()) {
-		mmr	= UVH_RH_GAM_MMIOH_OVERLAY_CONFIG;
-		shift	= UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_BASE_SHFT;
-		mmioh.v	= uv_read_local_mmr(mmr);
-		enable	= !!mmioh.s2.enable;
-		base	= mmioh.s2.base;
-		m_io	= mmioh.s2.m_io;
-		n_io	= mmioh.s2.n_io;
-
-		if (enable) {
-			max_pnode &= (1 << n_io) - 1;
-			pr_info(
-			"UV: base:0x%lx shift:%d N_IO:%d M_IO:%d max_pnode:0x%x\n",
-				base, shift, m_io, n_io, max_pnode);
-			map_high("MMIOH", base, shift, m_io, max_pnode, map_uc);
-		} else {
-			pr_info("UV: MMIOH disabled\n");
+		mmioh1.v = uv_read_local_mmr(UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1);
+		if (unlikely(mmioh1.s.enable == 0))
+			pr_info("UV: MMIOH1 disabled\n");
+		else {
+			unsigned long base = uvxy_field(mmioh1, base, 0);
+			int m_io = uvxy_field(mmioh1, m_io, 0);
+			int n_io = uvxy_field(mmioh1, n_io, 0);
+
+			calc_mmioh_map(UVX_MMIOH1, min_pnode, max_pnode,
+				UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1_BASE_SHFT,
+				base, m_io, n_io);
 		}
+		return;
+	}
+
+	/* UV2 flavor */
+	if (UVH_RH_GAM_MMIOH_OVERLAY_CONFIG) {
+		union uvh_rh_gam_mmioh_overlay_config_u mmioh;
+
+		mmioh.v	= uv_read_local_mmr(UVH_RH_GAM_MMIOH_OVERLAY_CONFIG);
+		if (unlikely(mmioh.s2.enable == 0))
+			pr_info("UV: MMIOH disabled\n");
+		else
+			calc_mmioh_map(UV2_MMIOH, min_pnode, max_pnode,
+				UV2H_RH_GAM_MMIOH_OVERLAY_CONFIG_BASE_SHFT,
+				mmioh.s2.base, mmioh.s2.m_io, mmioh.s2.n_io);
+		return;
 	}
 }
 
Signature · 1 line
2.21.0
#12 lore raw

Re: [PATCH v3 07/13] x86/platform/uv: Update MMIOH references based on new UV5 MMRs.

Thank you for the patch! Perhaps something to improve:

Hi Mike,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on tip/master v5.9-rc7 next-20201001] [cannot apply to tip/x86/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mike-Travis/x86-platform-uv-Updates-for-UV5-Architecture/20201002-085248
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 4cb1a880e7f774e59c2ebb68187d4811ad9d0c4e
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/37f27df779790b7f3b648d18c2236c92b6a95f9e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mike-Travis/x86-platform-uv-Updates-for-UV5-Architecture/20201002-085248
        git checkout 37f27df779790b7f3b648d18c2236c92b6a95f9e
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_set_system_type':
arch/x86/kernel/apic/x2apic_uv_x.c:373:6: warning: variable 'pnodeid' set but not used [-Wunused-but-set-variable]

     373 |  int pnodeid;
         |      ^~~~~~~
   arch/x86/kernel/apic/x2apic_uv_x.c: At top level:
>> arch/x86/kernel/apic/x2apic_uv_x.c:952:13: warning: no previous prototype for 'calc_mmioh_map' [-Wmissing-prototypes]
     952 | void __init calc_mmioh_map(enum mmioh_arch index, int min_pnode, int max_pnode,
         |             ^~~~~~~~~~~~~~
   arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_init_hub_info':
   arch/x86/kernel/apic/x2apic_uv_x.c:1225:22: warning: variable 'node_id' set but not used [-Wunused-but-set-variable]
    1225 |  union uvh_node_id_u node_id;
         |                      ^~~~~~~

vim +/calc_mmioh_map +952 arch/x86/kernel/apic/x2apic_uv_x.c

950
951 /* Calculate and Map MMIOH Regions */

 > 952	void __init calc_mmioh_map(enum mmioh_arch index, int min_pnode, int max_pnode,

953 int shift, unsigned long base, int m_io, int n_io)
954 {
955 unsigned long mmr, nasid_mask;
956 int nasid, min_nasid, max_nasid, lnasid, mapped;
957 int i, fi, li, n, max_io;
958 char id[8];
959
960 /* One (UV2) mapping */
961 if (index == UV2_MMIOH) {
962 strncpy(id, "MMIOH", sizeof(id));
963 max_io = max_pnode;
964 mapped = 0;
965 goto map_exit;
966 }
967
968 /* small and large MMIOH mappings */
969 switch (index) {
970 case UVY_MMIOH0:
971 mmr = UVH_RH10_GAM_MMIOH_REDIRECT_CONFIG0;
972 nasid_mask = UVH_RH10_GAM_MMIOH_OVERLAY_CONFIG0_BASE_MASK;
973 n = UVH_RH10_GAM_MMIOH_REDIRECT_CONFIG0_DEPTH;
974 min_nasid = min_pnode;
975 max_nasid = max_pnode;
976 mapped = 1;
977 break;
978 case UVY_MMIOH1:
979 mmr = UVH_RH10_GAM_MMIOH_REDIRECT_CONFIG1;
980 nasid_mask = UVH_RH10_GAM_MMIOH_OVERLAY_CONFIG1_BASE_MASK;
981 n = UVH_RH10_GAM_MMIOH_REDIRECT_CONFIG1_DEPTH;
982 min_nasid = min_pnode;
983 max_nasid = max_pnode;
984 mapped = 1;
985 break;
986 case UVX_MMIOH0:
987 mmr = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0;
988 nasid_mask = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_BASE_MASK;
989 n = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0_DEPTH;
990 min_nasid = min_pnode * 2;
991 max_nasid = max_pnode * 2;
992 mapped = 1;
993 break;
994 case UVX_MMIOH1:
995 mmr = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1;
996 nasid_mask = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1_BASE_MASK;
997 n = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1_DEPTH;
998 min_nasid = min_pnode * 2;
999 max_nasid = max_pnode * 2;
1000 mapped = 1;
1001 break;
1002 default:
1003 pr_err("UV:%s:Invalid mapping type:%d\n", __func__, index);
1004 return;
1005 }
1006
1007 /* enum values chosen so (index mod 2) is MMIOH 0/1 (low/high) */
1008 snprintf(id, sizeof(id), "MMIOH%d", index%2);
1009
1010 max_io = lnasid = fi = li = -1;
1011 for (i = 0; i < n; i++) {
1012 unsigned long m_redirect = mmr + i * 8;
1013 unsigned long redirect = uv_read_local_mmr(m_redirect);
1014
1015 nasid = redirect & nasid_mask;
1016 if (i == 0)
1017 pr_info("UV: %s redirect base 0x%lx(@0x%lx) 0x%04x\n",
1018 id, redirect, m_redirect, nasid);
1019
1020 /* Invalid NASID check */
1021 if (nasid < min_nasid || max_nasid < nasid) {
1022 pr_err("UV:%s:Invalid NASID:%x (range:%x..%x)\n",
1023 __func__, index, min_nasid, max_nasid );
1024 nasid = -1;
1025 }
1026
1027 if (nasid == lnasid) {
1028 li = i;
1029 /* Last entry check: */
1030 if (i != n-1)
1031 continue;
1032 }
1033
1034 /* Check if we have a cached (or last) redirect to print: */
1035 if (lnasid != -1 || (i == n-1 && nasid != -1)) {
1036 unsigned long addr1, addr2;
1037 int f, l;
1038
1039 if (lnasid == -1) {
1040 f = l = i;
1041 lnasid = nasid;
1042 } else {
1043 f = fi;
1044 l = li;
1045 }
1046 addr1 = (base << shift) + f * (1ULL << m_io);
1047 addr2 = (base << shift) + (l + 1) * (1ULL << m_io);
1048 pr_info("UV: %s[%03d..%03d] NASID 0x%04x ADDR 0x%016lx - 0x%016lx\n",
1049 id, fi, li, lnasid, addr1, addr2);
1050 if (max_io < l)
1051 max_io = l;
1052 }
1053 fi = li = i;
1054 lnasid = nasid;
1055 }
1056
1057 map_exit:
1058 pr_info("UV: %s base:0x%lx shift:%d m_io:%d max_io:%d max_pnode:0x%x\n",
1059 id, base, shift, m_io, max_io, max_pnode);
1060
1061 if (max_io >= 0 && !mapped)
1062 map_high(id, base, shift, m_io, max_io, map_uc);
1063 }
1064

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#13 lore raw

PATCH v3 8/13 x86/platform/uv: Adjust GAM MMR references affected by UV5 updates

In reply to Mike Travis

Make modifications to the GAM MMR mappings to accommodate changes for UV5.

---
 arch/x86/kernel/apic/x2apic_uv_x.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/x2apic_uv_x.c +25 -5
index 746a56466066..9f89c1e82df0 100644
@@ -931,12 +931,32 @@ static __init void map_gru_high(int max_pnode)
 
 static __init void map_mmr_high(int max_pnode)
 {
-	union uvh_rh_gam_mmr_overlay_config_u mmr;
-	int shift = UVH_RH_GAM_MMR_OVERLAY_CONFIG_BASE_SHFT;
+	unsigned long base;
+	int shift;
+	bool enable;
+
+	if (UVH_RH10_GAM_MMR_OVERLAY_CONFIG) {
+		union uvh_rh10_gam_mmr_overlay_config_u mmr;
+
+		mmr.v = uv_read_local_mmr(UVH_RH10_GAM_MMR_OVERLAY_CONFIG);
+		enable = mmr.s.enable;
+		base = mmr.s.base;
+		shift = UVH_RH10_GAM_MMR_OVERLAY_CONFIG_BASE_SHFT;
+	} else if (UVH_RH_GAM_MMR_OVERLAY_CONFIG) {
+		union uvh_rh_gam_mmr_overlay_config_u mmr;
+
+		mmr.v = uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG);
+		enable = mmr.s.enable;
+		base = mmr.s.base;
+		shift = UVH_RH_GAM_MMR_OVERLAY_CONFIG_BASE_SHFT;
+	} else {
+		pr_err("UV:%s:RH_GAM_MMR_OVERLAY_CONFIG MMR undefined?\n",
+			__func__);
+		return;
+	}
 
-	mmr.v = uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG);
-	if (mmr.s.enable)
-		map_high("MMR", mmr.s.base, shift, shift, max_pnode, map_uc);
+	if (enable)
+		map_high("MMR", base, shift, shift, max_pnode, map_uc);
 	else
 		pr_info("UV: MMR disabled\n");
 }
Signature · 1 line
2.21.0
#14 lore raw

PATCH v3 9/13 x86/platform/uv: Update UV5 MMR references in UV GRU

In reply to Mike Travis

Make modifications to the GRU mappings to accommodate changes for UV5.

---
 arch/x86/kernel/apic/x2apic_uv_x.c | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)
arch/x86/kernel/apic/x2apic_uv_x.c +24 -6
index 9f89c1e82df0..678001ff789d 100644
@@ -82,6 +82,9 @@ static unsigned long __init uv_early_read_mmr(unsigned long addr)
 
 static inline bool is_GRU_range(u64 start, u64 end)
 {
+	if (!gru_start_paddr)
+		return false;
+
 	return start >= gru_start_paddr && end <= gru_end_paddr;
 }
 
@@ -913,13 +916,24 @@ static __init void map_high(char *id, unsigned long base, int pshift, int bshift
 static __init void map_gru_high(int max_pnode)
 {
 	union uvh_rh_gam_gru_overlay_config_u gru;
-	int shift = UVH_RH_GAM_GRU_OVERLAY_CONFIG_BASE_SHFT;
-	unsigned long mask = UVH_RH_GAM_GRU_OVERLAY_CONFIG_BASE_MASK;
-	unsigned long base;
+	unsigned long mask, base;
+	int shift;
+
+	if (UVH_RH_GAM_GRU_OVERLAY_CONFIG) {
+		gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG);
+		shift = UVH_RH_GAM_GRU_OVERLAY_CONFIG_BASE_SHFT;
+		mask = UVH_RH_GAM_GRU_OVERLAY_CONFIG_BASE_MASK;
+	} else if (UVH_RH10_GAM_GRU_OVERLAY_CONFIG) {
+		gru.v = uv_read_local_mmr(UVH_RH10_GAM_GRU_OVERLAY_CONFIG);
+		shift = UVH_RH10_GAM_GRU_OVERLAY_CONFIG_BASE_SHFT;
+		mask = UVH_RH10_GAM_GRU_OVERLAY_CONFIG_BASE_MASK;
+	} else {
+		pr_err("UV: GRU unavailable (no MMR)\n");
+		return;
+	}
 
-	gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG);
 	if (!gru.s.enable) {
-		pr_info("UV: GRU disabled\n");
+		pr_info("UV: GRU disabled (by BIOS)\n");
 		return;
 	}
 
@@ -1293,7 +1307,11 @@ static void __init uv_init_hub_info(struct uv_hub_info_s *hi)
 	/* Show system specific info: */
 	pr_info("UV: N:%d M:%d m_shift:%d n_lshift:%d\n", hi->n_val, hi->m_val, hi->m_shift, hi->n_lshift);
 	pr_info("UV: gpa_mask/shift:0x%lx/%d pnode_mask:0x%x apic_pns:%d\n", hi->gpa_mask, hi->gpa_shift, hi->pnode_mask, hi->apic_pnode_shift);
-	pr_info("UV: mmr_base/shift:0x%lx/%ld gru_base/shift:0x%lx/%ld\n", hi->global_mmr_base, hi->global_mmr_shift, hi->global_gru_base, hi->global_gru_shift);
+	pr_info("UV: mmr_base/shift:0x%lx/%ld\n", hi->global_mmr_base, hi->global_mmr_shift);
+	if (hi->global_gru_base)
+		pr_info("UV: gru_base/shift:0x%lx/%ld\n",
+			hi->global_gru_base, hi->global_gru_shift);
+
 	pr_info("UV: gnode_upper:0x%lx gnode_extra:0x%x\n", hi->gnode_upper, hi->gnode_extra);
 }
 
Signature · 1 line
2.21.0
#15 lore raw

PATCH v3 10/13 x86/platform/uv: Update Node Present Counting

In reply to Mike Travis

The changes in the UV5 arch shrunk the NODE PRESENT table to just 2x64 entries (128 total) so are in to 64 bit MMRs instead of a depth of 64 bits in an array. Adjust references when counting up the nodes present.

---
 arch/x86/kernel/apic/x2apic_uv_x.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
arch/x86/kernel/apic/x2apic_uv_x.c +19 -7
index 678001ff789d..0e40f4866bc3 100644
@@ -1441,20 +1441,32 @@ static int __init decode_uv_systab(void)
 /* Set up physical blade translations from UVH_NODE_PRESENT_TABLE */
 static __init void boot_init_possible_blades(struct uv_hub_info_s *hub_info)
 {
+	unsigned long np;
 	int i, uv_pb = 0;
 
-	pr_info("UV: NODE_PRESENT_DEPTH = %d\n", UVH_NODE_PRESENT_TABLE_DEPTH);
-	for (i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++) {
-		unsigned long np;
-
-		np = uv_read_local_mmr(UVH_NODE_PRESENT_TABLE + i * 8);
-		if (np)
+	if (UVH_NODE_PRESENT_TABLE) {
+		pr_info("UV: NODE_PRESENT_DEPTH = %d\n",
+			UVH_NODE_PRESENT_TABLE_DEPTH);
+		for (i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++) {
+			np = uv_read_local_mmr(UVH_NODE_PRESENT_TABLE + i * 8);
 			pr_info("UV: NODE_PRESENT(%d) = 0x%016lx\n", i, np);
-
+			uv_pb += hweight64(np);
+		}
+	}
+	if (UVH_NODE_PRESENT_0) {
+		np = uv_read_local_mmr(UVH_NODE_PRESENT_0);
+		pr_info("UV: NODE_PRESENT_0 = 0x%016lx\n", np);
+		uv_pb += hweight64(np);
+	}
+	if (UVH_NODE_PRESENT_1) {
+		np = uv_read_local_mmr(UVH_NODE_PRESENT_1);
+		pr_info("UV: NODE_PRESENT_1 = 0x%016lx\n", np);
 		uv_pb += hweight64(np);
 	}
 	if (uv_possible_blades != uv_pb)
 		uv_possible_blades = uv_pb;
+
+	pr_info("UV: number nodes/possible blades %d\n", uv_pb);
 }
 
 static void __init build_socket_tables(void)
Signature · 1 line
2.21.0
#16 lore raw

PATCH v3 11/13 x86/platform/uv: Update UV5 TSC Checking

In reply to Mike Travis

Update check of BIOS TSC sync status to include both possible "invalid" states provided by newer UV5 BIOS.

---
 arch/x86/include/asm/uv/uv_hub.h   |  2 +-
 arch/x86/kernel/apic/x2apic_uv_x.c | 24 ++++++++++--------------
 2 files changed, 11 insertions(+), 15 deletions(-)
arch/x86/include/asm/uv/uv_hub.h +1 -1
index ecf5c93e7ae8..07079b59824d 100644
@@ -726,7 +726,7 @@ extern void uv_nmi_setup_hubless(void);
 #define UVH_TSC_SYNC_SHIFT_UV2K	16	/* UV2/3k have different bits */
 #define UVH_TSC_SYNC_MASK	3	/* 0011 */
 #define UVH_TSC_SYNC_VALID	3	/* 0011 */
-#define UVH_TSC_SYNC_INVALID	2	/* 0010 */
+#define UVH_TSC_SYNC_UNKNOWN	0	/* 0000 */
 
 /* BMC sets a bit this MMR non-zero before sending an NMI */
 #define UVH_NMI_MMR		UVH_BIOS_KERNEL_MMR
arch/x86/kernel/apic/x2apic_uv_x.c +10 -14
index 0e40f4866bc3..0c97315bf864 100644
@@ -199,36 +199,32 @@ static void __init uv_tsc_check_sync(void)
 	int sync_state;
 	int mmr_shift;
 	char *state;
-	bool valid;
 
-	/* Accommodate different UV arch BIOSes */
+	/* Different returns from different UV BIOS versions */
 	mmr = uv_early_read_mmr(UVH_TSC_SYNC_MMR);
 	mmr_shift =
 		is_uv2_hub() ? UVH_TSC_SYNC_SHIFT_UV2K : UVH_TSC_SYNC_SHIFT;
 	sync_state = (mmr >> mmr_shift) & UVH_TSC_SYNC_MASK;
 
+	/* Check if TSC is valid for all sockets */
 	switch (sync_state) {
 	case UVH_TSC_SYNC_VALID:
 		state = "in sync";
-		valid = true;
+		mark_tsc_async_resets("UV BIOS");
 		break;
 
-	case UVH_TSC_SYNC_INVALID:
-		state = "unstable";
-		valid = false;
+	/* If BIOS state unknown, don't do anything */
+	case UVH_TSC_SYNC_UNKNOWN:
+		state = "unknown";
 		break;
+
+	/* Otherwise, BIOS indicates problem with TSC */
 	default:
-		state = "unknown: assuming valid";
-		valid = true;
+		state = "unstable";
+		mark_tsc_unstable("UV BIOS");
 		break;
 	}
 	pr_info("UV: TSC sync state from BIOS:0%d(%s)\n", sync_state, state);
-
-	/* Mark flag that says TSC != 0 is valid for socket 0 */
-	if (valid)
-		mark_tsc_async_resets("UV BIOS");
-	else
-		mark_tsc_unstable("UV BIOS");
 }
 
 /* Selector for (4|4A|5) structs */
Signature · 1 line
2.21.0
#17 lore raw

PATCH v3 12/13 x86/platform/uv: Update for UV5 NMI MMR changes

In reply to Mike Travis

The UV NMI MMR addresses and fields moved between UV4 and UV5 necessitating a rewrite of the UV NMI handler. Adjust references to accommodate those changes.

---
 arch/x86/include/asm/uv/uv_hub.h | 13 -------
 arch/x86/platform/uv/uv_nmi.c    | 64 +++++++++++++++++++++++++++-----
 2 files changed, 54 insertions(+), 23 deletions(-)
arch/x86/include/asm/uv/uv_hub.h +0 -13
index 07079b59824d..610bda21a8d9 100644
@@ -734,19 +734,6 @@ extern void uv_nmi_setup_hubless(void);
 #define UVH_NMI_MMR_SHIFT	63
 #define UVH_NMI_MMR_TYPE	"SCRATCH5"
 
-/* Newer SMM NMI handler, not present in all systems */
-#define UVH_NMI_MMRX		UVH_EVENT_OCCURRED0
-#define UVH_NMI_MMRX_CLEAR	UVH_EVENT_OCCURRED0_ALIAS
-#define UVH_NMI_MMRX_SHIFT	UVH_EVENT_OCCURRED0_EXTIO_INT0_SHFT
-#define UVH_NMI_MMRX_TYPE	"EXTIO_INT0"
-
-/* Non-zero indicates newer SMM NMI handler present */
-#define UVH_NMI_MMRX_SUPPORTED	UVH_EXTIO_INT0_BROADCAST
-
-/* Indicates to BIOS that we want to use the newer SMM NMI handler */
-#define UVH_NMI_MMRX_REQ	UVH_BIOS_KERNEL_MMR_ALIAS_2
-#define UVH_NMI_MMRX_REQ_SHIFT	62
-
 struct uv_hub_nmi_s {
 	raw_spinlock_t	nmi_lock;
 	atomic_t	in_nmi;		/* flag this node in UV NMI IRQ */
arch/x86/platform/uv/uv_nmi.c +54 -10

86 lines not on this page · raw message

Signature · 1 line
2.21.0
#18 lore raw

PATCH v3 13/13 x86/platform/uv: Update Copyrights to conform to HPE standards

In reply to Mike Travis

Add Copyrights to those files that have been updated for UV5 changes.

---
 arch/x86/include/asm/uv/bios.h      | 1 +
 arch/x86/include/asm/uv/uv_hub.h    | 1 +
 arch/x86/include/asm/uv/uv_mmrs.h   | 1 +
 arch/x86/kernel/apic/x2apic_uv_x.c  | 1 +
 arch/x86/platform/uv/bios_uv.c      | 1 +
 arch/x86/platform/uv/uv_nmi.c       | 1 +
 arch/x86/platform/uv/uv_time.c      | 1 +
 drivers/misc/sgi-gru/grufile.c      | 1 +
 drivers/misc/sgi-xp/xp.h            | 1 +
 drivers/misc/sgi-xp/xp_main.c       | 1 +
 drivers/misc/sgi-xp/xp_uv.c         | 1 +
 drivers/misc/sgi-xp/xpc_main.c      | 1 +
 drivers/misc/sgi-xp/xpc_partition.c | 1 +
 drivers/misc/sgi-xp/xpnet.c         | 1 +
 14 files changed, 14 insertions(+)
arch/x86/include/asm/uv/bios.h +1 -0
index 97ac595ebc6a..08b3d810dfba 100644
@@ -5,6 +5,7 @@
 /*
  * UV BIOS layer definitions.
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (C) 2007-2017 Silicon Graphics, Inc. All rights reserved.
  * Copyright (c) Russ Anderson <[email protected]>
  */
arch/x86/include/asm/uv/uv_hub.h +1 -0
index 610bda21a8d9..5002f52be332 100644
@@ -5,6 +5,7 @@
  *
  * SGI UV architectural definitions
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved.
  */
 
arch/x86/include/asm/uv/uv_mmrs.h +1 -0
index 06ea2d1aaa3e..57fa67373262 100644
@@ -5,6 +5,7 @@
  *
  * HPE UV MMR definitions
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (C) 2007-2016 Silicon Graphics, Inc. All rights reserved.
  */
 
arch/x86/kernel/apic/x2apic_uv_x.c +1 -0
index 0c97315bf864..7c895991389c 100644
@@ -5,6 +5,7 @@
  *
  * SGI UV APIC functions (note: not an Intel compatible APIC)
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved.
  */
 #include <linux/crash_dump.h>
arch/x86/platform/uv/bios_uv.c +1 -0
index b148b4c8c2ec..54511eaccf4d 100644
@@ -2,6 +2,7 @@
 /*
  * BIOS run time interface routines.
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (C) 2007-2017 Silicon Graphics, Inc. All rights reserved.
  * Copyright (c) Russ Anderson <[email protected]>
  */
arch/x86/platform/uv/uv_nmi.c +1 -0
index eac26feb0461..0f5cbcf0da63 100644
@@ -2,6 +2,7 @@
 /*
  * SGI NMI support routines
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (C) 2007-2017 Silicon Graphics, Inc. All rights reserved.
  * Copyright (c) Mike Travis
  */
arch/x86/platform/uv/uv_time.c +1 -0
index e94436ba3022..a39e0f394c0e 100644
@@ -2,6 +2,7 @@
 /*
  * SGI RTC clock/timer routines.
  *
+ *  (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  *  Copyright (c) 2009-2013 Silicon Graphics, Inc.  All Rights Reserved.
  *  Copyright (c) Dimitri Sivanich
  */
drivers/misc/sgi-gru/grufile.c +1 -0
index 18aa8c877bf8..7ffcfc0bb587 100644
@@ -7,6 +7,7 @@
  * This file supports the user system call for file open, close, mmap, etc.
  * This also incudes the driver initialization code.
  *
+ *  (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  *  Copyright (c) 2008-2014 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
drivers/misc/sgi-xp/xp.h +1 -0
index 0af267baf031..7d839d844847 100644
@@ -3,6 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (C) 2004-2008 Silicon Graphics, Inc. All rights reserved.
  */
 
drivers/misc/sgi-xp/xp_main.c +1 -0
index 33558555820d..049c9aef0559 100644
@@ -3,6 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (c) 2004-2008 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
drivers/misc/sgi-xp/xp_uv.c +1 -0
index 118aef64518d..d28ffb1c7ade 100644
@@ -3,6 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
drivers/misc/sgi-xp/xpc_main.c +1 -0
index f533ded72941..5a8097e717ae 100644
@@ -3,6 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (c) 2004-2009 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
drivers/misc/sgi-xp/xpc_partition.c +1 -0
index c21d48fd65cd..615aa731053b 100644
@@ -3,6 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (c) 2004-2008 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
drivers/misc/sgi-xp/xpnet.c +1 -0
index fc5cd83f21f2..d19d2ab848cf 100644
@@ -3,6 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
+ * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
  * Copyright (C) 1999-2009 Silicon Graphics, Inc. All rights reserved.
  */
 
Signature · 1 line
2.21.0