Skip to content

Commit ad48300

Browse files
mike-travisIngo Molnar
authored andcommitted
x86/platform/uv: Fix calculation of Global Physical Address
The calculation of the global physical address (GPA) on UV4 is incorrect. The gnode_extra/upper global offset should only be applied for fixed address space systems (UV1..3). Tested-by: John Estabrook <john.estabrook@hpe.com> Signed-off-by: Mike Travis <mike.travis@hpe.com> Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com> Cc: John Estabrook <estabrook@sgi.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russ Anderson <russ.anderson@hpe.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20170321231646.667689538@asylum.americas.sgi.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 97da385 commit ad48300

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,15 +485,17 @@ static inline unsigned long uv_soc_phys_ram_to_gpa(unsigned long paddr)
485485

486486
if (paddr < uv_hub_info->lowmem_remap_top)
487487
paddr |= uv_hub_info->lowmem_remap_base;
488-
paddr |= uv_hub_info->gnode_upper;
489-
if (m_val)
488+
489+
if (m_val) {
490+
paddr |= uv_hub_info->gnode_upper;
490491
paddr = ((paddr << uv_hub_info->m_shift)
491492
>> uv_hub_info->m_shift) |
492493
((paddr >> uv_hub_info->m_val)
493494
<< uv_hub_info->n_lshift);
494-
else
495+
} else {
495496
paddr |= uv_soc_phys_ram_to_nasid(paddr)
496497
<< uv_hub_info->gpa_shift;
498+
}
497499
return paddr;
498500
}
499501

arch/x86/kernel/apic/x2apic_uv_x.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,8 @@ void __init uv_init_hub_info(struct uv_hub_info_s *hi)
11051105
node_id.v = uv_read_local_mmr(UVH_NODE_ID);
11061106
uv_cpuid.gnode_shift = max_t(unsigned int, uv_cpuid.gnode_shift, mn.n_val);
11071107
hi->gnode_extra = (node_id.s.node_id & ~((1 << uv_cpuid.gnode_shift) - 1)) >> 1;
1108-
hi->gnode_upper = (unsigned long)hi->gnode_extra << mn.m_val;
1108+
if (mn.m_val)
1109+
hi->gnode_upper = (u64)hi->gnode_extra << mn.m_val;
11091110

11101111
if (uv_gp_table) {
11111112
hi->global_mmr_base = uv_gp_table->mmr_base;

0 commit comments

Comments
 (0)