···641641 /* Not reached... */6426426436431:644644- /* If we boot on a non-zero cpu, all of the per-cpu645645- * variable references we make before setting up the646646- * per-cpu areas will use a bogus offset. Put a647647- * compensating factor into __per_cpu_base to handle648648- * this cleanly.649649- *650650- * What the per-cpu code calculates is:651651- *652652- * __per_cpu_base + (cpu << __per_cpu_shift)653653- *654654- * These two variables are zero initially, so to655655- * make it all cancel out to zero we need to put656656- * "0 - (cpu << 0)" into __per_cpu_base so that the657657- * above formula evaluates to zero.658658- *659659- * We cannot even perform a printk() until this stuff660660- * is setup as that calls cpu_clock() which uses661661- * per-cpu variables.662662- */663663- sub %g0, %o0, %o1664664- sethi %hi(__per_cpu_base), %o2665665- stx %o1, [%o2 + %lo(__per_cpu_base)]666644#else667645 mov 0, %o0668646#endif
+7-11
arch/sparc/kernel/smp_64.c
···13711371{13721372}1373137313741374-unsigned long __per_cpu_base __read_mostly;13751375-unsigned long __per_cpu_shift __read_mostly;13761376-13771377-EXPORT_SYMBOL(__per_cpu_base);13781378-EXPORT_SYMBOL(__per_cpu_shift);13791379-13801374void __init real_setup_per_cpu_areas(void)13811375{13821382- unsigned long paddr, goal, size, i;13761376+ unsigned long base, shift, paddr, goal, size, i;13831377 char *ptr;1384137813851379 /* Copy section for each CPU (we discard the original) */13861380 goal = PERCPU_ENOUGH_ROOM;1387138113881388- __per_cpu_shift = PAGE_SHIFT;13821382+ shift = PAGE_SHIFT;13891383 for (size = PAGE_SIZE; size < goal; size <<= 1UL)13901390- __per_cpu_shift++;13841384+ shift++;1391138513921386 paddr = lmb_alloc(size * NR_CPUS, PAGE_SIZE);13931387 if (!paddr) {···13901396 }1391139713921398 ptr = __va(paddr);13931393- __per_cpu_base = ptr - __per_cpu_start;13991399+ base = ptr - __per_cpu_start;1394140013951395- for (i = 0; i < NR_CPUS; i++, ptr += size)14011401+ for (i = 0; i < NR_CPUS; i++, ptr += size) {14021402+ __per_cpu_offset(i) = base + (i * size);13961403 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);14041404+ }1397140513981406 /* Setup %g5 for the boot cpu. */13991407 __local_per_cpu_offset = __per_cpu_offset(smp_processor_id());
+4-1
arch/sparc/kernel/traps_64.c
···25092509}2510251025112511struct trap_per_cpu trap_block[NR_CPUS];25122512+EXPORT_SYMBOL(trap_block);2512251325132514/* This can get invoked before sched_init() so play it super safe25142515 * and use hard_smp_processor_id().···25932592 (TRAP_PER_CPU_RESUM_QMASK !=25942593 offsetof(struct trap_per_cpu, resum_qmask)) ||25952594 (TRAP_PER_CPU_NONRESUM_QMASK !=25962596- offsetof(struct trap_per_cpu, nonresum_qmask)))25952595+ offsetof(struct trap_per_cpu, nonresum_qmask)) ||25962596+ (TRAP_PER_CPU_PER_CPU_BASE !=25972597+ offsetof(struct trap_per_cpu, __per_cpu_base)))25972598 trap_per_cpu_offsets_are_bolixed_dave();2598259925992600 if ((TSB_CONFIG_TSB !=