x86/platform/UV: Fix GAM Range Table entries less than 1GB

"Linux Kernel Mailing List" <[email protected]> Thu, 15 Feb 2018 01:48:52 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/c25d99d20ba69824a1e2cc118e04b877cd427afc
Commit:     c25d99d20ba69824a1e2cc118e04b877cd427afc
Parent:     74eb816b21d520ce37ce8aaf03128ca6067bbe22
Refname:    refs/heads/master
Author:     [email protected] <[email protected]>
AuthorDate: Mon Feb 5 16:15:04 2018 -0600
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 13 14:15:45 2018 +0100

    x86/platform/UV: Fix GAM Range Table entries less than 1GB
    
    The latest UV platforms include the new ApachePass NVDIMMs into the
    UV address space.  This has introduced address ranges in the Global
    Address Map Table that are less than the previous lowest range, which
    was 2GB.  Fix the address calculation so it accommodates address ranges
    from bytes to exabytes.
    
    Signed-off-by: Mike Travis <[email protected]>
    Reviewed-by: Andrew Banman <[email protected]>
    Reviewed-by: Dimitri Sivanich <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Russ Anderson <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
---
 arch/x86/kernel/apic/x2apic_uv_x.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 46b675aaf20b..f11910b44638 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -1176,16 +1176,25 @@ static void __init decode_gam_rng_tbl(unsigned long ptr)
 
 	uv_gre_table = gre;
 	for (; gre->type != UV_GAM_RANGE_TYPE_UNUSED; gre++) {
+		unsigned long size = ((unsigned long)(gre->limit - lgre)
+					<< UV_GAM_RANGE_SHFT);
+		int order = 0;
+		char suffix[] = " KMGTPE";
+
+		while (size > 9999 && order < sizeof(suffix)) {
+			size /= 1024;
+			order++;
+		}
+
 		if (!index) {
 			pr_info("UV: GAM Range Table...\n");
 			pr_info("UV:  # %20s %14s %5s %4s %5s %3s %2s\n", "Range", "", "Size", "Type", "NASID", "SID", "PN");
 		}
-		pr_info("UV: %2d: 0x%014lx-0x%014lx %5luG %3d   %04x  %02x %02x\n",
+		pr_info("UV: %2d: 0x%014lx-0x%014lx %5lu%c %3d   %04x  %02x %02x\n",
 			index++,
 			(unsigned long)lgre << UV_GAM_RANGE_SHFT,
 			(unsigned long)gre->limit << UV_GAM_RANGE_SHFT,
-			((unsigned long)(gre->limit - lgre)) >>
-				(30 - UV_GAM_RANGE_SHFT), /* 64M -> 1G */
+			size, suffix[order],
 			gre->type, gre->nasid, gre->sockid, gre->pnode);
 
 		lgre = gre->limit;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html