···10791079 return 0;10801080}1081108110821082+/* Constrain the number of cpus to max_cpus. */10821083void __init smp_prepare_cpus(unsigned int max_cpus)10831084{10841084- int instance, mid;10851085-10861086- instance = 0;10871087- while (!cpu_find_by_instance(instance, NULL, &mid)) {10881088- if (mid < max_cpus)10891089- cpu_set(mid, phys_cpu_present_map);10901090- instance++;10911091- }10921092-10931085 if (num_possible_cpus() > max_cpus) {10861086+ int instance, mid;10871087+10941088 instance = 0;10951089 while (!cpu_find_by_instance(instance, NULL, &mid)) {10961090 if (mid != boot_cpu_id) {···10971103 }1098110410991105 smp_store_cpu_info(boot_cpu_id);11061106+}11071107+11081108+/* Set this up early so that things like the scheduler can init11091109+ * properly. We use the same cpu mask for both the present and11101110+ * possible cpu map.11111111+ */11121112+void __init smp_setup_cpu_possible_map(void)11131113+{11141114+ int instance, mid;11151115+11161116+ instance = 0;11171117+ while (!cpu_find_by_instance(instance, NULL, &mid)) {11181118+ if (mid < NR_CPUS)11191119+ cpu_set(mid, phys_cpu_present_map);11201120+ instance++;11211121+ }11001122}1101112311021124void __devinit smp_prepare_boot_cpu(void)
+84-4
include/asm-sparc64/futex.h
···11-#ifndef _ASM_FUTEX_H22-#define _ASM_FUTEX_H11+#ifndef _SPARC64_FUTEX_H22+#define _SPARC64_FUTEX_H3344-#include <asm-generic/futex.h>44+#include <linux/futex.h>55+#include <asm/errno.h>66+#include <asm/system.h>77+#include <asm/uaccess.h>5866-#endif99+#define __futex_cas_op(insn, ret, oldval, uaddr, oparg) \1010+ __asm__ __volatile__( \1111+ "\n1: lduwa [%3] %%asi, %2\n" \1212+ " " insn "\n" \1313+ "2: casa [%3] %%asi, %2, %1\n" \1414+ " cmp %2, %1\n" \1515+ " bne,pn %%icc, 1b\n" \1616+ " mov 0, %0\n" \1717+ "3:\n" \1818+ " .section .fixup,#alloc,#execinstr\n" \1919+ " .align 4\n" \2020+ "4: ba 3b\n" \2121+ " mov %5, %0\n" \2222+ " .previous\n" \2323+ " .section __ex_table,#alloc\n" \2424+ " .align 4\n" \2525+ " .word 1b, 4b\n" \2626+ " .word 2b, 4b\n" \2727+ " .previous\n" \2828+ : "=&r" (ret), "=&r" (oldval), "=&r" (tem) \2929+ : "r" (uaddr), "r" (oparg), "i" (-EFAULT) \3030+ : "memory")3131+3232+static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)3333+{3434+ int op = (encoded_op >> 28) & 7;3535+ int cmp = (encoded_op >> 24) & 15;3636+ int oparg = (encoded_op << 8) >> 20;3737+ int cmparg = (encoded_op << 20) >> 20;3838+ int oldval = 0, ret, tem;3939+4040+ if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(int))))4141+ return -EFAULT;4242+ if (unlikely((((unsigned long) uaddr) & 0x3UL)))4343+ return -EINVAL;4444+4545+ if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))4646+ oparg = 1 << oparg;4747+4848+ inc_preempt_count();4949+5050+ switch (op) {5151+ case FUTEX_OP_SET:5252+ __futex_cas_op("mov\t%4, %1", ret, oldval, uaddr, oparg);5353+ break;5454+ case FUTEX_OP_ADD:5555+ __futex_cas_op("add\t%2, %4, %1", ret, oldval, uaddr, oparg);5656+ break;5757+ case FUTEX_OP_OR:5858+ __futex_cas_op("or\t%2, %4, %1", ret, oldval, uaddr, oparg);5959+ break;6060+ case FUTEX_OP_ANDN:6161+ __futex_cas_op("and\t%2, %4, %1", ret, oldval, uaddr, oparg);6262+ break;6363+ case FUTEX_OP_XOR:6464+ __futex_cas_op("xor\t%2, %4, %1", ret, oldval, uaddr, oparg);6565+ break;6666+ default:6767+ ret = -ENOSYS;6868+ }6969+7070+ dec_preempt_count();7171+7272+ if (!ret) {7373+ switch (cmp) {7474+ case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;7575+ case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;7676+ case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;7777+ case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;7878+ case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;7979+ case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;8080+ default: ret = -ENOSYS;8181+ }8282+ }8383+ return ret;8484+}8585+8686+#endif /* !(_SPARC64_FUTEX_H) */
+6
include/asm-sparc64/smp.h
···66666767#define raw_smp_processor_id() (current_thread_info()->cpu)68686969+extern void smp_setup_cpu_possible_map(void);7070+6971#endif /* !(__ASSEMBLY__) */7272+7373+#else7474+7575+#define smp_setup_cpu_possible_map() do { } while (0)70767177#endif /* !(CONFIG_SMP) */7278