Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: SGI-IP27: Use specific get_region_shift

IP35 has a different way to find out regions, so we move the IP27
implementation to IP27 specific file.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

authored by

Thomas Bogendoerfer and committed by
Paul Burton
524c4e1f 2c616e9f

+20 -24
+8
arch/mips/include/asm/sn/sn0/hubni.h
··· 250 250 #define NI_LLP_CB_MAX 0xff 251 251 #define NI_LLP_SN_MAX 0xff 252 252 253 + static inline int get_region_shift(void) 254 + { 255 + if (LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK) 256 + return NASID_TO_FINEREG_SHFT; 257 + 258 + return NASID_TO_COARSEREG_SHFT; 259 + } 260 + 253 261 #endif /* !__ASSEMBLY__ */ 254 262 255 263 #endif /* _ASM_SGI_SN0_HUBNI_H */
+12 -24
arch/mips/sgi-ip27/ip27-memory.c
··· 25 25 #include <asm/sections.h> 26 26 27 27 #include <asm/sn/arch.h> 28 + #include <asm/sn/agent.h> 28 29 #include <asm/sn/klconfig.h> 29 30 #include <asm/sn/sn_private.h> 30 31 ··· 37 36 38 37 EXPORT_SYMBOL(__node_data); 39 38 40 - static int fine_mode; 41 - 42 - static int is_fine_dirmode(void) 39 + static u64 gen_region_mask(void) 43 40 { 44 - return ((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK) >> NSRI_REGIONSIZE_SHFT) & REGIONSIZE_FINE; 45 - } 46 - 47 - static u64 get_region(nasid_t nasid) 48 - { 49 - if (fine_mode) 50 - return nasid >> NASID_TO_FINEREG_SHFT; 51 - else 52 - return nasid >> NASID_TO_COARSEREG_SHFT; 53 - } 54 - 55 - static u64 region_mask; 56 - 57 - static void gen_region_mask(u64 *region_mask) 58 - { 41 + int region_shift; 42 + u64 region_mask; 59 43 nasid_t nasid; 60 44 61 - (*region_mask) = 0; 62 - for_each_online_node(nasid) { 63 - (*region_mask) |= 1ULL << get_region(nasid); 64 - } 45 + region_shift = get_region_shift(); 46 + region_mask = 0; 47 + for_each_online_node(nasid) 48 + region_mask |= BIT_ULL(nasid >> region_shift); 49 + 50 + return region_mask; 65 51 } 66 52 67 53 #define rou_rflag rou_flags ··· 268 280 269 281 static void __init mlreset(void) 270 282 { 283 + u64 region_mask; 271 284 nasid_t nasid; 272 285 273 286 master_nasid = get_nasid(); 274 - fine_mode = is_fine_dirmode(); 275 287 276 288 /* 277 289 * Probe for all CPUs - this creates the cpumask and sets up the ··· 284 296 init_topology_matrix(); 285 297 dump_topology(); 286 298 287 - gen_region_mask(&region_mask); 299 + region_mask = gen_region_mask(); 288 300 289 301 setup_replication_mask(); 290 302