Skip to content

Commit d8850ba

Browse files
Jack SteinerIngo Molnar
authored andcommitted
x86, UV: Fix the effect of extra bits in the hub nodeid register
UV systems can be partitioned into multiple independent SSIs. Large partitioned systems may have extra bits in the node_id register. These bits are used when the total memory on all SSIs exceeds 16TB. These extra bits need to be ignored when calculating x2apic_extra_bits. Signed-off-by: Jack Steiner <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent e681041 commit d8850ba

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

arch/x86/kernel/apic/x2apic_uv_x.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,19 @@ static bool uv_is_untracked_pat_range(u64 start, u64 end)
6868
return is_ISA_range(start, end) || is_GRU_range(start, end);
6969
}
7070

71-
static int __init early_get_nodeid(void)
71+
static int __init early_get_pnodeid(void)
7272
{
7373
union uvh_node_id_u node_id;
74+
union uvh_rh_gam_config_mmr_u m_n_config;
75+
int pnode;
7476

7577
/* Currently, all blades have same revision number */
7678
node_id.v = uv_early_read_mmr(UVH_NODE_ID);
79+
m_n_config.v = uv_early_read_mmr(UVH_RH_GAM_CONFIG_MMR);
7780
uv_min_hub_revision_id = node_id.s.revision;
7881

79-
return node_id.s.node_id;
82+
pnode = (node_id.s.node_id >> 1) & ((1 << m_n_config.s.n_skt) - 1);
83+
return pnode;
8084
}
8185

8286
static void __init early_get_apic_pnode_shift(void)
@@ -104,10 +108,10 @@ static void __init uv_set_apicid_hibit(void)
104108

105109
static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
106110
{
107-
int nodeid;
111+
int pnodeid;
108112

109113
if (!strcmp(oem_id, "SGI")) {
110-
nodeid = early_get_nodeid();
114+
pnodeid = early_get_pnodeid();
111115
early_get_apic_pnode_shift();
112116
x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range;
113117
x86_platform.nmi_init = uv_nmi_init;
@@ -117,7 +121,7 @@ static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
117121
uv_system_type = UV_X2APIC;
118122
else if (!strcmp(oem_table_id, "UVH")) {
119123
__get_cpu_var(x2apic_extra_bits) =
120-
nodeid << (uvh_apicid.s.pnode_shift - 1);
124+
pnodeid << uvh_apicid.s.pnode_shift;
121125
uv_system_type = UV_NON_UNIQUE_APIC;
122126
uv_set_apicid_hibit();
123127
return 1;
@@ -680,27 +684,32 @@ void uv_nmi_init(void)
680684
void __init uv_system_init(void)
681685
{
682686
union uvh_rh_gam_config_mmr_u m_n_config;
687+
union uvh_rh_gam_mmioh_overlay_config_mmr_u mmioh;
683688
union uvh_node_id_u node_id;
684689
unsigned long gnode_upper, lowmem_redir_base, lowmem_redir_size;
685-
int bytes, nid, cpu, lcpu, pnode, blade, i, j, m_val, n_val;
690+
int bytes, nid, cpu, lcpu, pnode, blade, i, j, m_val, n_val, n_io;
686691
int gnode_extra, max_pnode = 0;
687692
unsigned long mmr_base, present, paddr;
688-
unsigned short pnode_mask;
693+
unsigned short pnode_mask, pnode_io_mask;
689694

690695
map_low_mmrs();
691696

692697
m_n_config.v = uv_read_local_mmr(UVH_RH_GAM_CONFIG_MMR );
693698
m_val = m_n_config.s.m_skt;
694699
n_val = m_n_config.s.n_skt;
700+
mmioh.v = uv_read_local_mmr(UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR);
701+
n_io = mmioh.s.n_io;
695702
mmr_base =
696703
uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) &
697704
~UV_MMR_ENABLE;
698705
pnode_mask = (1 << n_val) - 1;
706+
pnode_io_mask = (1 << n_io) - 1;
707+
699708
node_id.v = uv_read_local_mmr(UVH_NODE_ID);
700709
gnode_extra = (node_id.s.node_id & ~((1 << n_val) - 1)) >> 1;
701710
gnode_upper = ((unsigned long)gnode_extra << m_val);
702-
printk(KERN_DEBUG "UV: N %d, M %d, gnode_upper 0x%lx, gnode_extra 0x%x\n",
703-
n_val, m_val, gnode_upper, gnode_extra);
711+
printk(KERN_INFO "UV: N %d, M %d, N_IO: %d, gnode_upper 0x%lx, gnode_extra 0x%x, pnode_mask 0x%x, pnode_io_mask 0x%x\n",
712+
n_val, m_val, n_io, gnode_upper, gnode_extra, pnode_mask, pnode_io_mask);
704713

705714
printk(KERN_DEBUG "UV: global MMR base 0x%lx\n", mmr_base);
706715

@@ -733,7 +742,7 @@ void __init uv_system_init(void)
733742
for (j = 0; j < 64; j++) {
734743
if (!test_bit(j, &present))
735744
continue;
736-
pnode = (i * 64 + j);
745+
pnode = (i * 64 + j) & pnode_mask;
737746
uv_blade_info[blade].pnode = pnode;
738747
uv_blade_info[blade].nr_possible_cpus = 0;
739748
uv_blade_info[blade].nr_online_cpus = 0;
@@ -754,6 +763,7 @@ void __init uv_system_init(void)
754763
/*
755764
* apic_pnode_shift must be set before calling uv_apicid_to_pnode();
756765
*/
766+
uv_cpu_hub_info(cpu)->pnode_mask = pnode_mask;
757767
uv_cpu_hub_info(cpu)->apic_pnode_shift = uvh_apicid.s.pnode_shift;
758768
pnode = uv_apicid_to_pnode(apicid);
759769
blade = boot_pnode_to_blade(pnode);
@@ -770,7 +780,6 @@ void __init uv_system_init(void)
770780
uv_cpu_hub_info(cpu)->numa_blade_id = blade;
771781
uv_cpu_hub_info(cpu)->blade_processor_id = lcpu;
772782
uv_cpu_hub_info(cpu)->pnode = pnode;
773-
uv_cpu_hub_info(cpu)->pnode_mask = pnode_mask;
774783
uv_cpu_hub_info(cpu)->gpa_mask = (1UL << (m_val + n_val)) - 1;
775784
uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
776785
uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra;
@@ -794,7 +803,7 @@ void __init uv_system_init(void)
794803

795804
map_gru_high(max_pnode);
796805
map_mmr_high(max_pnode);
797-
map_mmioh_high(max_pnode);
806+
map_mmioh_high(max_pnode & pnode_io_mask);
798807

799808
uv_cpu_init();
800809
uv_scir_register_cpu_notifier();

0 commit comments

Comments
 (0)