aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Sivanich <sivanich@sgi.com>2014-03-31 10:37:00 -0400
committerIngo Molnar <mingo@kernel.org>2014-04-01 06:10:44 -0400
commit5f40f7d93898a473eb222aa8064144c1d6835470 (patch)
tree03ffd2723ffda81060d7361d217646080f28565d
parent176ab02d4916f09d5d8cb63372d142df4378cdea (diff)
x86/UV: Set n_lshift based on GAM_GR_CONFIG MMR for UV3
The value of n_lshift for UV is currently set based on the socket m_val. For UV3, set the n_lshift value based on the GAM_GR_CONFIG MMR. This will allow bios to control the n_lshift value independent of the socket m_val. Then n_lshift can be assigned a fixed value across a multi-partition system, allowing for a fixed common global physical address format that is independent of socket m_val. Cleanup unneeded macros. Signed-off-by: Dimitri Sivanich <sivanich@sgi.com> Link: http://lkml.kernel.org/r/20140331143700.GB29916@sgi.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h12
-rw-r--r--arch/x86/include/asm/uv/uv_mmrs.h42
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c26
3 files changed, 63 insertions, 17 deletions
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index a30836c8ac4d..c63e925fd6b7 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * SGI UV architectural definitions 6 * SGI UV architectural definitions
7 * 7 *
8 * Copyright (C) 2007-2013 Silicon Graphics, Inc. All rights reserved. 8 * Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved.
9 */ 9 */
10 10
11#ifndef _ASM_X86_UV_UV_HUB_H 11#ifndef _ASM_X86_UV_UV_HUB_H
@@ -204,16 +204,6 @@ static inline int is_uvx_hub(void)
204 return uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE; 204 return uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE;
205} 205}
206 206
207static inline int is_uv2_1_hub(void)
208{
209 return uv_hub_info->hub_revision == UV2_HUB_REVISION_BASE;
210}
211
212static inline int is_uv2_2_hub(void)
213{
214 return uv_hub_info->hub_revision == UV2_HUB_REVISION_BASE + 1;
215}
216
217union uvh_apicid { 207union uvh_apicid {
218 unsigned long v; 208 unsigned long v;
219 struct uvh_apicid_s { 209 struct uvh_apicid_s {
diff --git a/arch/x86/include/asm/uv/uv_mmrs.h b/arch/x86/include/asm/uv/uv_mmrs.h
index e42249bcf7e1..ddd8db6b6e70 100644
--- a/arch/x86/include/asm/uv/uv_mmrs.h
+++ b/arch/x86/include/asm/uv/uv_mmrs.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * SGI UV MMR definitions 6 * SGI UV MMR definitions
7 * 7 *
8 * Copyright (C) 2007-2013 Silicon Graphics, Inc. All rights reserved. 8 * Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved.
9 */ 9 */
10 10
11#ifndef _ASM_X86_UV_UV_MMRS_H 11#ifndef _ASM_X86_UV_UV_MMRS_H
@@ -2803,6 +2803,46 @@ union uv1h_lb_target_physical_apic_id_mask_u {
2803}; 2803};
2804 2804
2805/* ========================================================================= */ 2805/* ========================================================================= */
2806/* UV3H_GR0_GAM_GR_CONFIG */
2807/* ========================================================================= */
2808#define UV3H_GR0_GAM_GR_CONFIG 0xc00028UL
2809
2810#define UV3H_GR0_GAM_GR_CONFIG_M_SKT_SHFT 0
2811#define UV3H_GR0_GAM_GR_CONFIG_SUBSPACE_SHFT 10
2812#define UV3H_GR0_GAM_GR_CONFIG_M_SKT_MASK 0x000000000000003fUL
2813#define UV3H_GR0_GAM_GR_CONFIG_SUBSPACE_MASK 0x0000000000000400UL
2814
2815union uv3h_gr0_gam_gr_config_u {
2816 unsigned long v;
2817 struct uv3h_gr0_gam_gr_config_s {
2818 unsigned long m_skt:6; /* RW */
2819 unsigned long undef_6_9:4; /* Undefined */
2820 unsigned long subspace:1; /* RW */
2821 unsigned long reserved:53;
2822 } s3;
2823};
2824
2825/* ========================================================================= */
2826/* UV3H_GR1_GAM_GR_CONFIG */
2827/* ========================================================================= */
2828#define UV3H_GR1_GAM_GR_CONFIG 0x1000028UL
2829
2830#define UV3H_GR1_GAM_GR_CONFIG_M_SKT_SHFT 0
2831#define UV3H_GR1_GAM_GR_CONFIG_SUBSPACE_SHFT 10
2832#define UV3H_GR1_GAM_GR_CONFIG_M_SKT_MASK 0x000000000000003fUL
2833#define UV3H_GR1_GAM_GR_CONFIG_SUBSPACE_MASK 0x0000000000000400UL
2834
2835union uv3h_gr1_gam_gr_config_u {
2836 unsigned long v;
2837 struct uv3h_gr1_gam_gr_config_s {
2838 unsigned long m_skt:6; /* RW */
2839 unsigned long undef_6_9:4; /* Undefined */
2840 unsigned long subspace:1; /* RW */
2841 unsigned long reserved:53;
2842 } s3;
2843};
2844
2845/* ========================================================================= */
2806/* UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR */ 2846/* UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR */
2807/* ========================================================================= */ 2847/* ========================================================================= */
2808#define UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR 0x1603000UL 2848#define UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR 0x1603000UL
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 7834389ba5be..293b41df54ef 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * SGI UV APIC functions (note: not an Intel compatible APIC) 6 * SGI UV APIC functions (note: not an Intel compatible APIC)
7 * 7 *
8 * Copyright (C) 2007-2013 Silicon Graphics, Inc. All rights reserved. 8 * Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved.
9 */ 9 */
10#include <linux/cpumask.h> 10#include <linux/cpumask.h>
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
@@ -440,6 +440,20 @@ static __initdata struct redir_addr redir_addrs[] = {
440 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR, UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR}, 440 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR, UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR},
441}; 441};
442 442
443static unsigned char get_n_lshift(int m_val)
444{
445 union uv3h_gr0_gam_gr_config_u m_gr_config;
446
447 if (is_uv1_hub())
448 return m_val;
449
450 if (is_uv2_hub())
451 return m_val == 40 ? 40 : 39;
452
453 m_gr_config.v = uv_read_local_mmr(UV3H_GR0_GAM_GR_CONFIG);
454 return m_gr_config.s3.m_skt;
455}
456
443static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size) 457static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
444{ 458{
445 union uvh_rh_gam_alias210_overlay_config_2_mmr_u alias; 459 union uvh_rh_gam_alias210_overlay_config_2_mmr_u alias;
@@ -849,6 +863,7 @@ void __init uv_system_init(void)
849 int gnode_extra, min_pnode = 999999, max_pnode = -1; 863 int gnode_extra, min_pnode = 999999, max_pnode = -1;
850 unsigned long mmr_base, present, paddr; 864 unsigned long mmr_base, present, paddr;
851 unsigned short pnode_mask; 865 unsigned short pnode_mask;
866 unsigned char n_lshift;
852 char *hub = (is_uv1_hub() ? "UV1" : 867 char *hub = (is_uv1_hub() ? "UV1" :
853 (is_uv2_hub() ? "UV2" : 868 (is_uv2_hub() ? "UV2" :
854 "UV3")); 869 "UV3"));
@@ -860,6 +875,7 @@ void __init uv_system_init(void)
860 m_val = m_n_config.s.m_skt; 875 m_val = m_n_config.s.m_skt;
861 n_val = m_n_config.s.n_skt; 876 n_val = m_n_config.s.n_skt;
862 pnode_mask = (1 << n_val) - 1; 877 pnode_mask = (1 << n_val) - 1;
878 n_lshift = get_n_lshift(m_val);
863 mmr_base = 879 mmr_base =
864 uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) & 880 uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) &
865 ~UV_MMR_ENABLE; 881 ~UV_MMR_ENABLE;
@@ -867,8 +883,9 @@ void __init uv_system_init(void)
867 node_id.v = uv_read_local_mmr(UVH_NODE_ID); 883 node_id.v = uv_read_local_mmr(UVH_NODE_ID);
868 gnode_extra = (node_id.s.node_id & ~((1 << n_val) - 1)) >> 1; 884 gnode_extra = (node_id.s.node_id & ~((1 << n_val) - 1)) >> 1;
869 gnode_upper = ((unsigned long)gnode_extra << m_val); 885 gnode_upper = ((unsigned long)gnode_extra << m_val);
870 pr_info("UV: N:%d M:%d pnode_mask:0x%x gnode_upper/extra:0x%lx/0x%x\n", 886 pr_info("UV: N:%d M:%d pnode_mask:0x%x gnode_upper/extra:0x%lx/0x%x n_lshift 0x%x\n",
871 n_val, m_val, pnode_mask, gnode_upper, gnode_extra); 887 n_val, m_val, pnode_mask, gnode_upper, gnode_extra,
888 n_lshift);
872 889
873 pr_info("UV: global MMR base 0x%lx\n", mmr_base); 890 pr_info("UV: global MMR base 0x%lx\n", mmr_base);
874 891
@@ -935,8 +952,7 @@ void __init uv_system_init(void)
935 uv_cpu_hub_info(cpu)->hub_revision = uv_hub_info->hub_revision; 952 uv_cpu_hub_info(cpu)->hub_revision = uv_hub_info->hub_revision;
936 953
937 uv_cpu_hub_info(cpu)->m_shift = 64 - m_val; 954 uv_cpu_hub_info(cpu)->m_shift = 64 - m_val;
938 uv_cpu_hub_info(cpu)->n_lshift = is_uv2_1_hub() ? 955 uv_cpu_hub_info(cpu)->n_lshift = n_lshift;
939 (m_val == 40 ? 40 : 39) : m_val;
940 956
941 pnode = uv_apicid_to_pnode(apicid); 957 pnode = uv_apicid_to_pnode(apicid);
942 blade = boot_pnode_to_blade(pnode); 958 blade = boot_pnode_to_blade(pnode);