static int __init msm_cpu_prepare(unsigned int cpu) { u64 mpidr_el1 = cpu_logical_map(cpu); if (scm_is_mc_boot_available()) { if (mpidr_el1 & ~MPIDR_HWID_BITMASK) { pr_err("CPU%d:Failed to set boot address\n", cpu); return -ENOSYS; } if (scm_set_boot_addr_mc(virt_to_phys(secondary_holding_pen), BIT(MPIDR_AFFINITY_LEVEL(mpidr_el1, 0)), BIT(MPIDR_AFFINITY_LEVEL(mpidr_el1, 1)), BIT(MPIDR_AFFINITY_LEVEL(mpidr_el1, 2)), SCM_FLAG_COLDBOOT_MC)) { pr_warn("CPU%d:Failed to set boot address\n", cpu); return -ENOSYS; } } else { if (scm_set_boot_addr(virt_to_phys(secondary_holding_pen), cold_boot_flags[cpu])) { pr_warn("Failed to set CPU %u boot address\n", cpu); return -ENOSYS; } } /* Mark CPU0 cold boot flag as done */ if (per_cpu(cold_boot_done, 0) == false) per_cpu(cold_boot_done, 0) = true; return 0; }
static void __init msm_platform_smp_prepare_cpus(unsigned int max_cpus) { int cpu, map; unsigned int flags = 0; if (scm_is_mc_boot_available()) return msm_platform_smp_prepare_cpus_mc(max_cpus); for_each_present_cpu(cpu) { map = cpu_logical_map(cpu); if (map > ARRAY_SIZE(cold_boot_flags)) { set_cpu_present(cpu, false); __WARN(); continue; } flags |= cold_boot_flags[map]; } #ifdef CONFIG_HTC_DEBUG_FOOTPRINT init_cpu_debug_counter_for_cold_boot(); #endif if (scm_set_boot_addr(virt_to_phys(msm_secondary_startup), flags)) pr_warn("Failed to set CPU boot address\n"); }
static int msm_pm_tz_boot_init(void) { phys_addr_t warmboot_addr = virt_to_phys(msm_pm_boot_entry); if (scm_is_mc_boot_available()) { return scm_set_warm_boot_addr_mc_for_all(warmboot_addr); } else { unsigned int flag = 0; if (num_possible_cpus() == 1) flag = SCM_FLAG_WARMBOOT_CPU0; else if (num_possible_cpus() == 2) flag = SCM_FLAG_WARMBOOT_CPU0 | SCM_FLAG_WARMBOOT_CPU1; else if (num_possible_cpus() == 4) flag = SCM_FLAG_WARMBOOT_CPU0 | SCM_FLAG_WARMBOOT_CPU1 | SCM_FLAG_WARMBOOT_CPU2 | SCM_FLAG_WARMBOOT_CPU3; else __WARN(); return scm_set_boot_addr(virt_to_phys(msm_pm_boot_entry), flag); } }
static void __init msm_platform_smp_prepare_cpus(unsigned int max_cpus) { int cpu, map; unsigned int flags = 0; if (scm_is_mc_boot_available()) return msm_platform_smp_prepare_cpus_mc(max_cpus); for_each_present_cpu(cpu) { map = cpu_logical_map(cpu); if (map >= ARRAY_SIZE(cold_boot_flags)) { set_cpu_present(cpu, false); __WARN(); continue; } flags |= cold_boot_flags[map]; } if (scm_set_boot_addr(virt_to_phys(msm_secondary_startup), flags)) pr_warn("Failed to set CPU boot address\n"); /* Mark CPU0 cold boot flag as done */ per_cpu(cold_boot_done, 0) = true; }