+++ /dev/null
-From: Jack Steiner <steiner@sgi.com>
-Subject: Delete hacks that were necessary while waiting for x2apic code.
-References: bnc#429984
-Patch-Mainline: should be in 2.6.28
-
-Bug fixes related to mapping UV memory MMRs.
-
-Fix large APIC ids in SRAT.
-
-Use the correct memory allocator. Originally, uv_system_init was
-called early & used the boot memory allocation. Community restructuring
-move the call later - use kmalloc.
-
-These fixes were posted as:
- http://marc.info/?l=linux-kernel&m=122217746109578&w=2
- http://marc.info/?l=linux-kernel&m=122234718018066&w=2
- http://marc.info/?l=linux-kernel&m=122480249023345&w=2
- http://lkml.org/lkml/2008/7/18/384
-
-The fixes were commited to linux-2.6 with:
- d2f904bb9a1ba88a58a03612abd8c6c54bdaf73a genx2apic_uv_x.c
- 8da077d6f31da291ee3a7dd559671cb8ca48cbe2 genx2apic_uv_x.c
- 2e42060c19cb79adacc48beb5e9ec5361df976a2 srat_64.c
-
-The last fix (http://lkml.org/lkml/2008/7/18/384) has not yet been accepted into
-linux-2.6. I'll post the commit id when it is available.
-
-Signed-off-by: Thomas Renninger <trenn@suse.de>
-
----
- arch/x86/kernel/genx2apic_uv_x.c | 57 +++++++++++++++++++--------------------
- arch/x86/mm/srat_64.c | 2 -
- 2 files changed, 29 insertions(+), 30 deletions(-)
-
---- a/arch/x86/kernel/genx2apic_uv_x.c
-+++ b/arch/x86/kernel/genx2apic_uv_x.c
-@@ -17,7 +17,6 @@
- #include <linux/ctype.h>
- #include <linux/init.h>
- #include <linux/sched.h>
--#include <linux/bootmem.h>
- #include <linux/module.h>
- #include <linux/hardirq.h>
- #include <linux/timer.h>
-@@ -212,12 +211,10 @@ static unsigned int phys_pkg_id(int inde
- return uv_read_apic_id() >> index_msb;
- }
-
--#ifdef ZZZ /* Needs x2apic patch */
- static void uv_send_IPI_self(int vector)
- {
- apic_write(APIC_SELF_IPI, vector);
- }
--#endif
-
- struct genapic apic_x2apic_uv_x = {
- .name = "UV large system",
-@@ -232,7 +229,7 @@ struct genapic apic_x2apic_uv_x = {
- .send_IPI_allbutself = uv_send_IPI_allbutself,
- .send_IPI_mask_allbutself = uv_send_IPI_mask_allbutself,
- .send_IPI_mask = uv_send_IPI_mask,
-- /* ZZZ.send_IPI_self = uv_send_IPI_self, */
-+ .send_IPI_self = uv_send_IPI_self,
- .cpu_mask_to_apicid = uv_cpu_mask_to_apicid,
- .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */
- .get_apic_id = get_apic_id,
-@@ -297,12 +294,13 @@ static __init void map_low_mmrs(void)
-
- enum map_type {map_wb, map_uc};
-
--static __init void map_high(char *id, unsigned long base, int shift, enum map_type map_type)
-+static __init void map_high(char *id, unsigned long base, int shift,
-+ int max_pnode, enum map_type map_type)
- {
- unsigned long bytes, paddr;
-
- paddr = base << shift;
-- bytes = (1UL << shift);
-+ bytes = (1UL << shift) * (max_pnode + 1);
- printk(KERN_INFO "UV: Map %s_HI 0x%lx - 0x%lx\n", id, paddr,
- paddr + bytes);
- if (map_type == map_uc)
-@@ -318,7 +316,7 @@ static __init void map_gru_high(int max_
-
- gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR);
- if (gru.s.enable)
-- map_high("GRU", gru.s.base, shift, map_wb);
-+ map_high("GRU", gru.s.base, shift, max_pnode, map_wb);
- }
-
- static __init void map_config_high(int max_pnode)
-@@ -328,7 +326,7 @@ static __init void map_config_high(int m
-
- cfg.v = uv_read_local_mmr(UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR);
- if (cfg.s.enable)
-- map_high("CONFIG", cfg.s.base, shift, map_uc);
-+ map_high("CONFIG", cfg.s.base, shift, max_pnode, map_uc);
- }
-
- static __init void map_mmr_high(int max_pnode)
-@@ -338,7 +336,7 @@ static __init void map_mmr_high(int max_
-
- mmr.v = uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR);
- if (mmr.s.enable)
-- map_high("MMR", mmr.s.base, shift, map_uc);
-+ map_high("MMR", mmr.s.base, shift, max_pnode, map_uc);
- }
-
- static __init void map_mmioh_high(int max_pnode)
-@@ -348,7 +346,7 @@ static __init void map_mmioh_high(int ma
-
- mmioh.v = uv_read_local_mmr(UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR);
- if (mmioh.s.enable)
-- map_high("MMIOH", mmioh.s.base, shift, map_uc);
-+ map_high("MMIOH", mmioh.s.base, shift, max_pnode, map_uc);
- }
-
- static __init void uv_rtc_init(void)
-@@ -466,7 +464,22 @@ late_initcall(uv_init_heartbeat);
-
- #endif /* !CONFIG_HOTPLUG_CPU */
-
--static bool uv_system_inited;
-+/*
-+ * Called on each cpu to initialize the per_cpu UV data area.
-+ * ZZZ hotplug not supported yet
-+ */
-+void __cpuinit uv_cpu_init(void)
-+{
-+ /* CPU 0 initilization will be done via uv_system_init. */
-+ if (!uv_blade_info)
-+ return;
-+
-+ uv_blade_info[uv_numa_blade_id()].nr_online_cpus++;
-+
-+ if (get_uv_system_type() == UV_NON_UNIQUE_APIC)
-+ set_x2apic_extra_bits(uv_hub_info->pnode);
-+}
-+
-
- void __init uv_system_init(void)
- {
-@@ -493,16 +506,16 @@ void __init uv_system_init(void)
- printk(KERN_DEBUG "UV: Found %d blades\n", uv_num_possible_blades());
-
- bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades();
-- uv_blade_info = alloc_bootmem_pages(bytes);
-+ uv_blade_info = kmalloc(bytes, GFP_KERNEL);
-
- get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size);
-
- bytes = sizeof(uv_node_to_blade[0]) * num_possible_nodes();
-- uv_node_to_blade = alloc_bootmem_pages(bytes);
-+ uv_node_to_blade = kmalloc(bytes, GFP_KERNEL);
- memset(uv_node_to_blade, 255, bytes);
-
- bytes = sizeof(uv_cpu_to_blade[0]) * num_possible_cpus();
-- uv_cpu_to_blade = alloc_bootmem_pages(bytes);
-+ uv_cpu_to_blade = kmalloc(bytes, GFP_KERNEL);
- memset(uv_cpu_to_blade, 255, bytes);
-
- blade = 0;
-@@ -561,22 +574,8 @@ void __init uv_system_init(void)
- map_mmr_high(max_pnode);
- map_config_high(max_pnode);
- map_mmioh_high(max_pnode);
-- uv_system_inited = true;
- uv_scir_register_cpu_notifier();
--}
-
--/*
-- * Called on each cpu to initialize the per_cpu UV data area.
-- * ZZZ hotplug not supported yet
-- */
--void __cpuinit uv_cpu_init(void)
--{
-- BUG_ON(!uv_system_inited);
--
-- uv_blade_info[uv_numa_blade_id()].nr_online_cpus++;
--
-- if (get_uv_system_type() == UV_NON_UNIQUE_APIC)
-- set_x2apic_extra_bits(uv_hub_info->pnode);
-+ uv_cpu_init();
- }
-
--
---- a/arch/x86/mm/srat_64.c
-+++ b/arch/x86/mm/srat_64.c
-@@ -142,7 +142,7 @@ acpi_numa_processor_affinity_init(struct
- return;
- }
-
-- if (is_uv_system())
-+ if (get_uv_system_type() >= UV_X2APIC)
- apic_id = (pa->apic_id << 8) | pa->local_sapic_eid;
- else
- apic_id = pa->apic_id;