Skip to content

Commit 2d10d87

Browse files
committed
Merge branches 'x86-fixes-for-linus' and 'x86-uv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86, alternative: Call stop_machine_text_poke() on all cpus x86-32: Restore irq stacks NUMA-aware allocations x86, memblock: Fix early_node_mem with big reserved region. * 'x86-uv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86, uv: More Westmere support on SGI UV x86, uv: Enable Westmere support on SGI UV
3 parents c0f62ed + 404ba5d + 0520bd8 commit 2d10d87

5 files changed

Lines changed: 50 additions & 13 deletions

File tree

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

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

1111
#ifndef _ASM_X86_UV_UV_HUB_H
@@ -77,7 +77,8 @@
7777
*
7878
* 1111110000000000
7979
* 5432109876543210
80-
* pppppppppplc0cch
80+
* pppppppppplc0cch Nehalem-EX
81+
* ppppppppplcc0cch Westmere-EX
8182
* sssssssssss
8283
*
8384
* p = pnode bits
@@ -148,12 +149,25 @@ struct uv_hub_info_s {
148149
unsigned char m_val;
149150
unsigned char n_val;
150151
struct uv_scir_s scir;
152+
unsigned char apic_pnode_shift;
151153
};
152154

153155
DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
154156
#define uv_hub_info (&__get_cpu_var(__uv_hub_info))
155157
#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu))
156158

159+
union uvh_apicid {
160+
unsigned long v;
161+
struct uvh_apicid_s {
162+
unsigned long local_apic_mask : 24;
163+
unsigned long local_apic_shift : 5;
164+
unsigned long unused1 : 3;
165+
unsigned long pnode_mask : 24;
166+
unsigned long pnode_shift : 5;
167+
unsigned long unused2 : 3;
168+
} s;
169+
};
170+
157171
/*
158172
* Local & Global MMR space macros.
159173
* Note: macros are intended to be used ONLY by inline functions
@@ -182,6 +196,7 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
182196
#define UV_GLOBAL_MMR64_PNODE_BITS(p) \
183197
(((unsigned long)(p)) << UV_GLOBAL_MMR64_PNODE_SHIFT)
184198

199+
#define UVH_APICID 0x002D0E00L
185200
#define UV_APIC_PNODE_SHIFT 6
186201

187202
/* Local Bus from cpu's perspective */
@@ -280,7 +295,7 @@ static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
280295
*/
281296
static inline int uv_apicid_to_pnode(int apicid)
282297
{
283-
return (apicid >> UV_APIC_PNODE_SHIFT);
298+
return (apicid >> uv_hub_info->apic_pnode_shift);
284299
}
285300

286301
/*

‎arch/x86/kernel/alternative.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ void *__kprobes text_poke_smp(void *addr, const void *opcode, size_t len)
638638
atomic_set(&stop_machine_first, 1);
639639
wrote_text = 0;
640640
/* Use __stop_machine() because the caller already got online_cpus. */
641-
__stop_machine(stop_machine_text_poke, (void *)&tpp, NULL);
641+
__stop_machine(stop_machine_text_poke, (void *)&tpp, cpu_online_mask);
642642
return addr;
643643
}
644644

‎arch/x86/kernel/apic/x2apic_uv_x.c‎

Lines changed: 22 additions & 2 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-2009 Silicon Graphics, Inc. All rights reserved.
8+
* Copyright (C) 2007-2010 Silicon Graphics, Inc. All rights reserved.
99
*/
1010
#include <linux/cpumask.h>
1111
#include <linux/hardirq.h>
@@ -41,6 +41,7 @@ DEFINE_PER_CPU(int, x2apic_extra_bits);
4141

4242
static enum uv_system_type uv_system_type;
4343
static u64 gru_start_paddr, gru_end_paddr;
44+
static union uvh_apicid uvh_apicid;
4445
int uv_min_hub_revision_id;
4546
EXPORT_SYMBOL_GPL(uv_min_hub_revision_id);
4647
static DEFINE_SPINLOCK(uv_nmi_lock);
@@ -70,12 +71,27 @@ static int early_get_nodeid(void)
7071
return node_id.s.node_id;
7172
}
7273

74+
static void __init early_get_apic_pnode_shift(void)
75+
{
76+
unsigned long *mmr;
77+
78+
mmr = early_ioremap(UV_LOCAL_MMR_BASE | UVH_APICID, sizeof(*mmr));
79+
uvh_apicid.v = *mmr;
80+
early_iounmap(mmr, sizeof(*mmr));
81+
if (!uvh_apicid.v)
82+
/*
83+
* Old bios, use default value
84+
*/
85+
uvh_apicid.s.pnode_shift = UV_APIC_PNODE_SHIFT;
86+
}
87+
7388
static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
7489
{
7590
int nodeid;
7691

7792
if (!strcmp(oem_id, "SGI")) {
7893
nodeid = early_get_nodeid();
94+
early_get_apic_pnode_shift();
7995
x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range;
8096
x86_platform.nmi_init = uv_nmi_init;
8197
if (!strcmp(oem_table_id, "UVL"))
@@ -84,7 +100,7 @@ static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
84100
uv_system_type = UV_X2APIC;
85101
else if (!strcmp(oem_table_id, "UVH")) {
86102
__get_cpu_var(x2apic_extra_bits) =
87-
nodeid << (UV_APIC_PNODE_SHIFT - 1);
103+
nodeid << (uvh_apicid.s.pnode_shift - 1);
88104
uv_system_type = UV_NON_UNIQUE_APIC;
89105
return 1;
90106
}
@@ -716,6 +732,10 @@ void __init uv_system_init(void)
716732
int apicid = per_cpu(x86_cpu_to_apicid, cpu);
717733

718734
nid = cpu_to_node(cpu);
735+
/*
736+
* apic_pnode_shift must be set before calling uv_apicid_to_pnode();
737+
*/
738+
uv_cpu_hub_info(cpu)->apic_pnode_shift = uvh_apicid.s.pnode_shift;
719739
pnode = uv_apicid_to_pnode(apicid);
720740
blade = boot_pnode_to_blade(pnode);
721741
lcpu = uv_blade_info[blade].nr_possible_cpus;

‎arch/x86/kernel/irq_32.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/delay.h>
1818
#include <linux/uaccess.h>
1919
#include <linux/percpu.h>
20+
#include <linux/mm.h>
2021

2122
#include <asm/apic.h>
2223

@@ -125,7 +126,9 @@ void __cpuinit irq_ctx_init(int cpu)
125126
if (per_cpu(hardirq_ctx, cpu))
126127
return;
127128

128-
irqctx = (union irq_ctx *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER);
129+
irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
130+
THREAD_FLAGS,
131+
THREAD_ORDER));
129132
irqctx->tinfo.task = NULL;
130133
irqctx->tinfo.exec_domain = NULL;
131134
irqctx->tinfo.cpu = cpu;
@@ -134,7 +137,9 @@ void __cpuinit irq_ctx_init(int cpu)
134137

135138
per_cpu(hardirq_ctx, cpu) = irqctx;
136139

137-
irqctx = (union irq_ctx *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER);
140+
irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
141+
THREAD_FLAGS,
142+
THREAD_ORDER));
138143
irqctx->tinfo.task = NULL;
139144
irqctx->tinfo.exec_domain = NULL;
140145
irqctx->tinfo.cpu = cpu;

‎arch/x86/mm/numa_64.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,8 @@ static void * __init early_node_mem(int nodeid, unsigned long start,
178178

179179
/* extend the search scope */
180180
end = max_pfn_mapped << PAGE_SHIFT;
181-
if (end > (MAX_DMA32_PFN<<PAGE_SHIFT))
182-
start = MAX_DMA32_PFN<<PAGE_SHIFT;
183-
else
184-
start = MAX_DMA_PFN<<PAGE_SHIFT;
185-
mem = memblock_x86_find_in_range_node(nodeid, start, end, size, align);
181+
start = MAX_DMA_PFN << PAGE_SHIFT;
182+
mem = memblock_find_in_range(start, end, size, align);
186183
if (mem != MEMBLOCK_ERROR)
187184
return __va(mem);
188185

0 commit comments

Comments
 (0)