static void shx3_smp_setup(void) { unsigned int cpu = 0; int i, num; init_cpu_possible(cpumask_of(cpu)); /* Enable light sleep for the boot CPU */ __raw_writel(__raw_readl(STBCR_REG(cpu)) | STBCR_LTSLP, STBCR_REG(cpu)); __cpu_number_map[0] = 0; __cpu_logical_map[0] = 0; /* * Do this stupidly for now.. we don't have an easy way to probe * for the total number of cores. */ for (i = 1, num = 0; i < NR_CPUS; i++) { set_cpu_possible(i, true); __cpu_number_map[i] = ++num; __cpu_logical_map[num] = i; } printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num); }
/* * Cycle through the APs sending Wakeup IPIs to boot each. */ void __init smp_prepare_cpus (unsigned int max_cpus) { int boot_cpu_id = hard_smp_processor_id(); /* * Initialize the per-CPU profiling counter/multiplier */ smp_setup_percpu_timer(); cpu_set(0, cpu_callin_map); local_cpu_data->loops_per_jiffy = loops_per_jiffy; ia64_cpu_to_sapicid[0] = boot_cpu_id; printk(KERN_INFO "Boot processor id 0x%x/0x%x\n", 0, boot_cpu_id); current_thread_info()->cpu = 0; /* * If SMP should be disabled, then really disable it! */ if (!max_cpus) { printk(KERN_INFO "SMP mode deactivated.\n"); init_cpu_online(cpumask_of(0)); init_cpu_present(cpumask_of(0)); init_cpu_possible(cpumask_of(0)); return; } }
static void shx3_smp_setup(void) { unsigned int cpu = 0; int i, num; init_cpu_possible(cpumask_of(cpu)); /* */ __raw_writel(__raw_readl(STBCR_REG(cpu)) | STBCR_LTSLP, STBCR_REG(cpu)); __cpu_number_map[0] = 0; __cpu_logical_map[0] = 0; /* */ for (i = 1, num = 0; i < NR_CPUS; i++) { set_cpu_possible(i, true); __cpu_number_map[i] = ++num; __cpu_logical_map[num] = i; } printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num); }
void __init platform_init_cpus(void) { struct cpumask mask; cpumask_set_cpu(0, &mask); /* CoreA */ cpumask_set_cpu(1, &mask); /* CoreB */ init_cpu_possible(&mask); }
/* Update board cpu maps */ static void __init eznps_set_maps(void) { struct cpumask cpumask_possible, cpumask_present; unsigned long dt_root = of_get_flat_dt_root(); if (eznps_get_map("present-cpus", &cpumask_present)) { pr_err("Failed to get present-cpus from dtb"); return; } init_cpu_present(&cpumask_present); if (eznps_get_map("possible-cpus", &cpumask_possible)) { pr_err("Failed to get possible-cpus from dtb"); return; } init_cpu_possible(&cpumask_possible); cpumask_copy(&_cpu_possible_mask, &cpumask_possible); if (of_get_flat_dt_prop(dt_root, "init-possible-as-present", NULL)) init_cpu_possible(&cpumask_present); }
/* * Detect available CPUs, populate cpu_possible_mask before smp_init * * We don't want to start the secondary CPU yet nor do we have a nice probing * feature in PMON so we just assume presence of the secondary core. */ static void __init yos_smp_setup(void) { int i; init_cpu_possible(cpu_none_mask); for (i = 0; i < 2; i++) { set_cpu_possible(i, true); __cpu_number_map[i] = i; __cpu_logical_map[i] = i; } }
/* Update board cpu maps */ static void __init eznps_init_cpumasks(void) { struct cpumask cpumask; if (eznps_get_map("present-cpus", &cpumask)) { pr_err("Failed to get present-cpus from dtb"); return; } init_cpu_present(&cpumask); if (eznps_get_map("possible-cpus", &cpumask)) { pr_err("Failed to get possible-cpus from dtb"); return; } init_cpu_possible(&cpumask); }
static void sh_of_smp_probe(void) { struct device_node *np = 0; const char *method = 0; const struct of_cpu_method *m = __cpu_method_of_table; pr_info("SH generic board support: scanning for cpus\n"); init_cpu_possible(cpumask_of(0)); while ((np = of_find_node_by_type(np, "cpu"))) { const __be32 *cell = of_get_property(np, "reg", NULL); u64 id = -1; if (cell) id = of_read_number(cell, of_n_addr_cells(np)); if (id < NR_CPUS) { if (!method) of_property_read_string(np, "enable-method", &method); set_cpu_possible(id, true); set_cpu_present(id, true); __cpu_number_map[id] = id; __cpu_logical_map[id] = id; } } if (!method) { np = of_find_node_by_name(NULL, "cpus"); of_property_read_string(np, "enable-method", &method); } pr_info("CPU enable method: %s\n", method); if (method) for (; m->method; m++) if (!strcmp(m->method, method)) { register_smp_ops(m->ops); return; } register_smp_ops(&dummy_smp_ops); }