Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2117970ybl; Thu, 9 Jan 2020 07:12:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzRdexxwzpXtKOpvpM/E1ZzfxCuCFS49WKhU1FuhJHdw+bEJ2uiPlWSJmyY7lqc6JuSfWG9 X-Received: by 2002:aca:1e11:: with SMTP id m17mr3540889oic.5.1578582731848; Thu, 09 Jan 2020 07:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578582731; cv=none; d=google.com; s=arc-20160816; b=UxRbXzKOUgRdGsWCnn6xJdWZjPAT1jDicbYt93Zh+749yyMOtfVbesRJXwxlw5pufx p/nsLdiyM5OyLpY8RlFZSytELthgJEawpfzI6kVGShlLsflNcM5eMGbcYP+VQ3kjH0Tb sqTAG2+O2mByQAkLPRpiVkmxilVpjWuxZcVu8NoLwF3DmtRLU+0zOLF0bWu4JRR5UWeN l2vp8KY9SolPHqI9QMdE6EcgwLHUSfS2VxhlBkTkMblyFWF8wbH+7aze1bRRh8GxrnfS 4IfIzNW3SJP6nlKHYPQGab1PhbbzZEqzivDM8V/xDMBDLY5hEPd0afaEXeibcpwNF3nK E5aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=AZ0r0+gmbOdjEPK21NDbOUM5jToDxfbveVCjk9mPIIE=; b=qvtCv4mUwjNOQSZD1RYGYekA5VRNF7WQYq53v3X32gRJZ5DbUBT+6qfrrgjeLbEGbK aQkEzEHnrabhPMClbf+Jdb2YYV1T69szq9CM3yBWD2E/zdY8UwnLe6bvbE96LUjvHbeL iOOYlFabhe4jenAYbsjtHJtv1hO/N2GbrS/IKkaLHv+aCj+lBnf/MEPfb0ApYSg0QLR1 cVN/yRGqFGUuTEyXvJ6EdKmUAmEI5wGTBDd/PnvHysgolvxso7ADxjC14sTzQNRtLynm e9vULUew6KUIx0YFdW1o+GxyuxOn3tXdtzy1iidMvws6wd5/lBPFtjrZi4KbEfYbnV+T pB3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s74si3538506oie.109.2020.01.09.07.11.59; Thu, 09 Jan 2020 07:12:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731009AbgAIMeP (ORCPT + 99 others); Thu, 9 Jan 2020 07:34:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:38030 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730969AbgAIMeL (ORCPT ); Thu, 9 Jan 2020 07:34:11 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5152DB2210; Thu, 9 Jan 2020 12:34:06 +0000 (UTC) From: Thomas Bogendoerfer To: Paul Burton Cc: Ralf Baechle , James Hogan , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/14] MIPS: SGI-IP27: Use specific get_region_shift Date: Thu, 9 Jan 2020 13:33:47 +0100 Message-Id: <20200109123353.5656-11-tbogendoerfer@suse.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200109123353.5656-1-tbogendoerfer@suse.de> References: <20200109123353.5656-1-tbogendoerfer@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IP35 has a different way to find out regions, so we move the IP27 implementation to IP27 specific file. Signed-off-by: Thomas Bogendoerfer --- arch/mips/include/asm/sn/sn0/hubni.h | 8 +++++++ arch/mips/sgi-ip27/ip27-memory.c | 36 ++++++++++------------------ 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/arch/mips/include/asm/sn/sn0/hubni.h b/arch/mips/include/asm/sn/sn0/hubni.h index b73c4bee65f2..b8253142cb83 100644 --- a/arch/mips/include/asm/sn/sn0/hubni.h +++ b/arch/mips/include/asm/sn/sn0/hubni.h @@ -250,6 +250,14 @@ typedef union hubni_port_error_u { #define NI_LLP_CB_MAX 0xff #define NI_LLP_SN_MAX 0xff +static inline int get_region_shift(void) +{ + if (LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK) + return NASID_TO_FINEREG_SHFT; + + return NASID_TO_COARSEREG_SHFT; +} + #endif /* !__ASSEMBLY__ */ #endif /* _ASM_SGI_SN0_HUBNI_H */ diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index 0ef2181db8d0..db3759e551b3 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -36,31 +37,18 @@ struct node_data *__node_data[MAX_NUMNODES]; EXPORT_SYMBOL(__node_data); -static int fine_mode; - -static int is_fine_dirmode(void) -{ - return ((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK) >> NSRI_REGIONSIZE_SHFT) & REGIONSIZE_FINE; -} - -static u64 get_region(nasid_t nasid) -{ - if (fine_mode) - return nasid >> NASID_TO_FINEREG_SHFT; - else - return nasid >> NASID_TO_COARSEREG_SHFT; -} - -static u64 region_mask; - -static void gen_region_mask(u64 *region_mask) +static u64 gen_region_mask(void) { + int region_shift; + u64 region_mask; nasid_t nasid; - (*region_mask) = 0; - for_each_online_node(nasid) { - (*region_mask) |= 1ULL << get_region(nasid); - } + region_shift = get_region_shift(); + region_mask = 0; + for_each_online_node(nasid) + region_mask |= BIT_ULL(nasid >> region_shift); + + return region_mask; } #define rou_rflag rou_flags @@ -280,10 +268,10 @@ static unsigned long __init slot_psize_compute(nasid_t nasid, int slot) static void __init mlreset(void) { + u64 region_mask; nasid_t nasid; master_nasid = get_nasid(); - fine_mode = is_fine_dirmode(); /* * Probe for all CPUs - this creates the cpumask and sets up the @@ -296,7 +284,7 @@ static void __init mlreset(void) init_topology_matrix(); dump_topology(); - gen_region_mask(®ion_mask); + region_mask = gen_region_mask(); setup_replication_mask(); -- 2.24.1