]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Jack Steiner <steiner@sgi.com> |
2 | Subject: Delete hacks that were necessary while waiting for x2apic code. | |
3 | References: bnc#429984 | |
4 | Patch-Mainline: should be in 2.6.28 | |
5 | ||
6 | Bug fixes related to mapping UV memory MMRs. | |
7 | ||
8 | Fix large APIC ids in SRAT. | |
9 | ||
10 | Use the correct memory allocator. Originally, uv_system_init was | |
11 | called early & used the boot memory allocation. Community restructuring | |
12 | move the call later - use kmalloc. | |
13 | ||
14 | These fixes were posted as: | |
15 | http://marc.info/?l=linux-kernel&m=122217746109578&w=2 | |
16 | http://marc.info/?l=linux-kernel&m=122234718018066&w=2 | |
17 | http://marc.info/?l=linux-kernel&m=122480249023345&w=2 | |
18 | http://lkml.org/lkml/2008/7/18/384 | |
19 | ||
20 | The fixes were commited to linux-2.6 with: | |
21 | d2f904bb9a1ba88a58a03612abd8c6c54bdaf73a genx2apic_uv_x.c | |
22 | 8da077d6f31da291ee3a7dd559671cb8ca48cbe2 genx2apic_uv_x.c | |
23 | 2e42060c19cb79adacc48beb5e9ec5361df976a2 srat_64.c | |
24 | ||
25 | The last fix (http://lkml.org/lkml/2008/7/18/384) has not yet been accepted into | |
26 | linux-2.6. I'll post the commit id when it is available. | |
27 | ||
28 | Signed-off-by: Thomas Renninger <trenn@suse.de> | |
29 | ||
30 | --- | |
31 | arch/x86/kernel/genx2apic_uv_x.c | 57 +++++++++++++++++++-------------------- | |
32 | arch/x86/mm/srat_64.c | 2 - | |
33 | 2 files changed, 29 insertions(+), 30 deletions(-) | |
34 | ||
35 | --- a/arch/x86/kernel/genx2apic_uv_x.c | |
36 | +++ b/arch/x86/kernel/genx2apic_uv_x.c | |
37 | @@ -17,7 +17,6 @@ | |
38 | #include <linux/ctype.h> | |
39 | #include <linux/init.h> | |
40 | #include <linux/sched.h> | |
41 | -#include <linux/bootmem.h> | |
42 | #include <linux/module.h> | |
43 | #include <linux/hardirq.h> | |
44 | #include <linux/timer.h> | |
45 | @@ -212,12 +211,10 @@ static unsigned int phys_pkg_id(int inde | |
46 | return uv_read_apic_id() >> index_msb; | |
47 | } | |
48 | ||
49 | -#ifdef ZZZ /* Needs x2apic patch */ | |
50 | static void uv_send_IPI_self(int vector) | |
51 | { | |
52 | apic_write(APIC_SELF_IPI, vector); | |
53 | } | |
54 | -#endif | |
55 | ||
56 | struct genapic apic_x2apic_uv_x = { | |
57 | .name = "UV large system", | |
58 | @@ -232,7 +229,7 @@ struct genapic apic_x2apic_uv_x = { | |
59 | .send_IPI_allbutself = uv_send_IPI_allbutself, | |
60 | .send_IPI_mask_allbutself = uv_send_IPI_mask_allbutself, | |
61 | .send_IPI_mask = uv_send_IPI_mask, | |
62 | - /* ZZZ.send_IPI_self = uv_send_IPI_self, */ | |
63 | + .send_IPI_self = uv_send_IPI_self, | |
64 | .cpu_mask_to_apicid = uv_cpu_mask_to_apicid, | |
65 | .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */ | |
66 | .get_apic_id = get_apic_id, | |
67 | @@ -297,12 +294,13 @@ static __init void map_low_mmrs(void) | |
68 | ||
69 | enum map_type {map_wb, map_uc}; | |
70 | ||
71 | -static __init void map_high(char *id, unsigned long base, int shift, enum map_type map_type) | |
72 | +static __init void map_high(char *id, unsigned long base, int shift, | |
73 | + int max_pnode, enum map_type map_type) | |
74 | { | |
75 | unsigned long bytes, paddr; | |
76 | ||
77 | paddr = base << shift; | |
78 | - bytes = (1UL << shift); | |
79 | + bytes = (1UL << shift) * (max_pnode + 1); | |
80 | printk(KERN_INFO "UV: Map %s_HI 0x%lx - 0x%lx\n", id, paddr, | |
81 | paddr + bytes); | |
82 | if (map_type == map_uc) | |
83 | @@ -318,7 +316,7 @@ static __init void map_gru_high(int max_ | |
84 | ||
85 | gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR); | |
86 | if (gru.s.enable) | |
87 | - map_high("GRU", gru.s.base, shift, map_wb); | |
88 | + map_high("GRU", gru.s.base, shift, max_pnode, map_wb); | |
89 | } | |
90 | ||
91 | static __init void map_config_high(int max_pnode) | |
92 | @@ -328,7 +326,7 @@ static __init void map_config_high(int m | |
93 | ||
94 | cfg.v = uv_read_local_mmr(UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR); | |
95 | if (cfg.s.enable) | |
96 | - map_high("CONFIG", cfg.s.base, shift, map_uc); | |
97 | + map_high("CONFIG", cfg.s.base, shift, max_pnode, map_uc); | |
98 | } | |
99 | ||
100 | static __init void map_mmr_high(int max_pnode) | |
101 | @@ -338,7 +336,7 @@ static __init void map_mmr_high(int max_ | |
102 | ||
103 | mmr.v = uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR); | |
104 | if (mmr.s.enable) | |
105 | - map_high("MMR", mmr.s.base, shift, map_uc); | |
106 | + map_high("MMR", mmr.s.base, shift, max_pnode, map_uc); | |
107 | } | |
108 | ||
109 | static __init void map_mmioh_high(int max_pnode) | |
110 | @@ -348,7 +346,7 @@ static __init void map_mmioh_high(int ma | |
111 | ||
112 | mmioh.v = uv_read_local_mmr(UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR); | |
113 | if (mmioh.s.enable) | |
114 | - map_high("MMIOH", mmioh.s.base, shift, map_uc); | |
115 | + map_high("MMIOH", mmioh.s.base, shift, max_pnode, map_uc); | |
116 | } | |
117 | ||
118 | static __init void uv_rtc_init(void) | |
119 | @@ -466,7 +464,22 @@ late_initcall(uv_init_heartbeat); | |
120 | ||
121 | #endif /* !CONFIG_HOTPLUG_CPU */ | |
122 | ||
123 | -static bool uv_system_inited; | |
124 | +/* | |
125 | + * Called on each cpu to initialize the per_cpu UV data area. | |
126 | + * ZZZ hotplug not supported yet | |
127 | + */ | |
128 | +void __cpuinit uv_cpu_init(void) | |
129 | +{ | |
130 | + /* CPU 0 initilization will be done via uv_system_init. */ | |
131 | + if (!uv_blade_info) | |
132 | + return; | |
133 | + | |
134 | + uv_blade_info[uv_numa_blade_id()].nr_online_cpus++; | |
135 | + | |
136 | + if (get_uv_system_type() == UV_NON_UNIQUE_APIC) | |
137 | + set_x2apic_extra_bits(uv_hub_info->pnode); | |
138 | +} | |
139 | + | |
140 | ||
141 | void __init uv_system_init(void) | |
142 | { | |
143 | @@ -493,16 +506,16 @@ void __init uv_system_init(void) | |
144 | printk(KERN_DEBUG "UV: Found %d blades\n", uv_num_possible_blades()); | |
145 | ||
146 | bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades(); | |
147 | - uv_blade_info = alloc_bootmem_pages(bytes); | |
148 | + uv_blade_info = kmalloc(bytes, GFP_KERNEL); | |
149 | ||
150 | get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size); | |
151 | ||
152 | bytes = sizeof(uv_node_to_blade[0]) * num_possible_nodes(); | |
153 | - uv_node_to_blade = alloc_bootmem_pages(bytes); | |
154 | + uv_node_to_blade = kmalloc(bytes, GFP_KERNEL); | |
155 | memset(uv_node_to_blade, 255, bytes); | |
156 | ||
157 | bytes = sizeof(uv_cpu_to_blade[0]) * num_possible_cpus(); | |
158 | - uv_cpu_to_blade = alloc_bootmem_pages(bytes); | |
159 | + uv_cpu_to_blade = kmalloc(bytes, GFP_KERNEL); | |
160 | memset(uv_cpu_to_blade, 255, bytes); | |
161 | ||
162 | blade = 0; | |
163 | @@ -561,22 +574,8 @@ void __init uv_system_init(void) | |
164 | map_mmr_high(max_pnode); | |
165 | map_config_high(max_pnode); | |
166 | map_mmioh_high(max_pnode); | |
167 | - uv_system_inited = true; | |
168 | uv_scir_register_cpu_notifier(); | |
169 | -} | |
170 | ||
171 | -/* | |
172 | - * Called on each cpu to initialize the per_cpu UV data area. | |
173 | - * ZZZ hotplug not supported yet | |
174 | - */ | |
175 | -void __cpuinit uv_cpu_init(void) | |
176 | -{ | |
177 | - BUG_ON(!uv_system_inited); | |
178 | - | |
179 | - uv_blade_info[uv_numa_blade_id()].nr_online_cpus++; | |
180 | - | |
181 | - if (get_uv_system_type() == UV_NON_UNIQUE_APIC) | |
182 | - set_x2apic_extra_bits(uv_hub_info->pnode); | |
183 | + uv_cpu_init(); | |
184 | } | |
185 | ||
186 | - | |
187 | --- a/arch/x86/mm/srat_64.c | |
188 | +++ b/arch/x86/mm/srat_64.c | |
189 | @@ -142,7 +142,7 @@ acpi_numa_processor_affinity_init(struct | |
190 | return; | |
191 | } | |
192 | ||
193 | - if (is_uv_system()) | |
194 | + if (get_uv_system_type() >= UV_X2APIC) | |
195 | apic_id = (pa->apic_id << 8) | pa->local_sapic_eid; | |
196 | else | |
197 | apic_id = pa->apic_id; |