Skip to content

Commit 5f40f7d

Browse files
Dimitri SivanichIngo Molnar
authored andcommitted
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 <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 176ab02 commit 5f40f7d

File tree

3 files changed

+63
-17
lines changed

3 files changed

+63
-17
lines changed

arch/x86/include/asm/uv/uv_hub.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* SGI UV architectural definitions
77
*
8-
* Copyright (C) 2007-2013 Silicon Graphics, Inc. All rights reserved.
8+
* Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved.
99
*/
1010

1111
#ifndef _ASM_X86_UV_UV_HUB_H
@@ -204,16 +204,6 @@ static inline int is_uvx_hub(void)
204204
return uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE;
205205
}
206206

207-
static inline int is_uv2_1_hub(void)
208-
{
209-
return uv_hub_info->hub_revision == UV2_HUB_REVISION_BASE;
210-
}
211-
212-
static inline int is_uv2_2_hub(void)
213-
{
214-
return uv_hub_info->hub_revision == UV2_HUB_REVISION_BASE + 1;
215-
}
216-
217207
union uvh_apicid {
218208
unsigned long v;
219209
struct uvh_apicid_s {

arch/x86/include/asm/uv/uv_mmrs.h

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* SGI UV MMR definitions
77
*
8-
* Copyright (C) 2007-2013 Silicon Graphics, Inc. All rights reserved.
8+
* Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved.
99
*/
1010

1111
#ifndef _ASM_X86_UV_UV_MMRS_H
@@ -2802,6 +2802,46 @@ union uv1h_lb_target_physical_apic_id_mask_u {
28022802
} s1;
28032803
};
28042804

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+
2815+
union 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+
2835+
union 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+
28052845
/* ========================================================================= */
28062846
/* UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR */
28072847
/* ========================================================================= */

arch/x86/kernel/apic/x2apic_uv_x.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* SGI UV APIC functions (note: not an Intel compatible APIC)
77
*
8-
* Copyright (C) 2007-2013 Silicon Graphics, Inc. All rights reserved.
8+
* Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved.
99
*/
1010
#include <linux/cpumask.h>
1111
#include <linux/hardirq.h>
@@ -440,6 +440,20 @@ static __initdata struct redir_addr redir_addrs[] = {
440440
{UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR, UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR},
441441
};
442442

443+
static 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+
443457
static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
444458
{
445459
union uvh_rh_gam_alias210_overlay_config_2_mmr_u alias;
@@ -849,6 +863,7 @@ void __init uv_system_init(void)
849863
int gnode_extra, min_pnode = 999999, max_pnode = -1;
850864
unsigned long mmr_base, present, paddr;
851865
unsigned short pnode_mask;
866+
unsigned char n_lshift;
852867
char *hub = (is_uv1_hub() ? "UV1" :
853868
(is_uv2_hub() ? "UV2" :
854869
"UV3"));
@@ -860,15 +875,17 @@ void __init uv_system_init(void)
860875
m_val = m_n_config.s.m_skt;
861876
n_val = m_n_config.s.n_skt;
862877
pnode_mask = (1 << n_val) - 1;
878+
n_lshift = get_n_lshift(m_val);
863879
mmr_base =
864880
uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) &
865881
~UV_MMR_ENABLE;
866882

867883
node_id.v = uv_read_local_mmr(UVH_NODE_ID);
868884
gnode_extra = (node_id.s.node_id & ~((1 << n_val) - 1)) >> 1;
869885
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",
871-
n_val, m_val, pnode_mask, gnode_upper, gnode_extra);
886+
pr_info("UV: N:%d M:%d pnode_mask:0x%x gnode_upper/extra:0x%lx/0x%x n_lshift 0x%x\n",
887+
n_val, m_val, pnode_mask, gnode_upper, gnode_extra,
888+
n_lshift);
872889

873890
pr_info("UV: global MMR base 0x%lx\n", mmr_base);
874891

@@ -935,8 +952,7 @@ void __init uv_system_init(void)
935952
uv_cpu_hub_info(cpu)->hub_revision = uv_hub_info->hub_revision;
936953

937954
uv_cpu_hub_info(cpu)->m_shift = 64 - m_val;
938-
uv_cpu_hub_info(cpu)->n_lshift = is_uv2_1_hub() ?
939-
(m_val == 40 ? 40 : 39) : m_val;
955+
uv_cpu_hub_info(cpu)->n_lshift = n_lshift;
940956

941957
pnode = uv_apicid_to_pnode(apicid);
942958
blade = boot_pnode_to_blade(pnode);

0 commit comments

Comments
 (0)