* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6: [SPARC64]: Fix D-cache corruption in mremap [SPARC64]: Make smp_processor_id() functional before start_kernel()
···1010#include <linux/config.h>1111#include <linux/version.h>1212#include <linux/errno.h>1313+#include <linux/threads.h>1314#include <asm/thread_info.h>1415#include <asm/asi.h>1516#include <asm/pstate.h>···493492 mov %l6, %o1 ! OpenPROM stack494493 call prom_init495494 mov %l7, %o0 ! OpenPROM cif handler495495+496496+ /* Initialize current_thread_info()->cpu as early as possible.497497+ * In order to do that accurately we have to patch up the get_cpuid()498498+ * assembler sequences. And that, in turn, requires that we know499499+ * if we are on a Starfire box or not. While we're here, patch up500500+ * the sun4v sequences as well.501501+ */502502+ call check_if_starfire503503+ nop504504+ call per_cpu_patch505505+ nop506506+ call sun4v_patch507507+ nop508508+509509+#ifdef CONFIG_SMP510510+ call hard_smp_processor_id511511+ nop512512+ cmp %o0, NR_CPUS513513+ blu,pt %xcc, 1f514514+ nop515515+ call boot_cpu_id_too_large516516+ nop517517+ /* Not reached... */518518+519519+1:520520+#else521521+ mov 0, %o0522522+#endif523523+ stb %o0, [%g6 + TI_CPU]496524497525 /* Off we go.... */498526 call start_kernel
+11-12
arch/sparc64/kernel/setup.c
···220220221221static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 };222222223223-static void __init per_cpu_patch(void)223223+void __init per_cpu_patch(void)224224{225225 struct cpuid_patch_entry *p;226226 unsigned long ver;···280280 }281281}282282283283-static void __init sun4v_patch(void)283283+void __init sun4v_patch(void)284284{285285 struct sun4v_1insn_patch_entry *p1;286286 struct sun4v_2insn_patch_entry *p2;···315315 }316316}317317318318+#ifdef CONFIG_SMP319319+void __init boot_cpu_id_too_large(int cpu)320320+{321321+ prom_printf("Serious problem, boot cpu id (%d) >= NR_CPUS (%d)\n",322322+ cpu, NR_CPUS);323323+ prom_halt();324324+}325325+#endif326326+318327void __init setup_arch(char **cmdline_p)319328{320329 /* Initialize PROM console and command line. */···340331#elif defined(CONFIG_PROM_CONSOLE)341332 conswitchp = &prom_con;342333#endif343343-344344- /* Work out if we are starfire early on */345345- check_if_starfire();346346-347347- /* Now we know enough to patch the get_cpuid sequences348348- * used by trap code.349349- */350350- per_cpu_patch();351351-352352- sun4v_patch();353334354335 boot_flags_init(*cmdline_p);355336
+3-13
arch/sparc64/kernel/smp.c
···12641264 boot_cpu_id = hard_smp_processor_id();12651265 current_tick_offset = timer_tick_offset;1266126612671267- cpu_set(boot_cpu_id, cpu_online_map);12681267 prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1;12691268}12701269···1344134513451346void __devinit smp_prepare_boot_cpu(void)13461347{13471347- int cpu = hard_smp_processor_id();13481348-13491349- if (cpu >= NR_CPUS) {13501350- prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");13511351- prom_halt();13521352- }13531353-13541354- current_thread_info()->cpu = cpu;13551355- __local_per_cpu_offset = __per_cpu_offset(cpu);13561356-13571357- cpu_set(smp_processor_id(), cpu_online_map);13581358- cpu_set(smp_processor_id(), phys_cpu_present_map);13591348}1360134913611350int __devinit __cpu_up(unsigned int cpu)···1420143314211434 for (i = 0; i < NR_CPUS; i++, ptr += size)14221435 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);14361436+14371437+ /* Setup %g5 for the boot cpu. */14381438+ __local_per_cpu_offset = __per_cpu_offset(smp_processor_id());14231439}