arm64: Delay ELF HWCAP initialisation until all CPUs are up
authorSuzuki K. Poulose <suzuki.poulose@arm.com>
Mon, 19 Oct 2015 13:24:39 +0000 (14:24 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 21 Oct 2015 14:33:15 +0000 (15:33 +0100)
Delay the ELF HWCAP initialisation until all the (enabled) CPUs are
up, i.e, smp_cpus_done(). This is in preparation for detecting the
common features across the CPUS and creating a consistent ELF HWCAP
for the system.

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Tested-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/cpufeature.h
arch/arm64/kernel/setup.c
arch/arm64/kernel/smp.c

index 171570702bb801431f141f46238eb0d9e1895fe5..b7769f698a750eb1459835d32af36efaf0079329 100644 (file)
@@ -81,6 +81,7 @@ static inline int __attribute_const__ cpuid_feature_extract_field(u64 features,
        return (s64)(features << (64 - 4 - field)) >> (64 - 4);
 }
 
+void __init setup_cpu_features(void);
 
 void check_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
                            const char *info);
index 1d503e2d6957c60b47ec5748d33e5dbb9c623971..4f0408e1df0d11b66bc673c23550af2905f6971d 100644 (file)
@@ -196,20 +196,13 @@ static void __init smp_build_mpidr_hash(void)
        __flush_dcache_area(&mpidr_hash, sizeof(struct mpidr_hash));
 }
 
-static void __init setup_processor(void)
+void __init setup_cpu_features(void)
 {
        u64 features;
        s64 block;
        u32 cwg;
        int cls;
 
-       pr_info("Boot CPU: AArch64 Processor [%08x]\n", read_cpuid_id());
-
-       sprintf(init_utsname()->machine, ELF_PLATFORM);
-       elf_hwcap = 0;
-
-       cpuinfo_store_boot_cpu();
-
        /*
         * Check for sane CTR_EL0.CWG value.
         */
@@ -293,6 +286,13 @@ static void __init setup_processor(void)
 #endif
 }
 
+static void __init setup_processor(void)
+{
+       pr_info("Boot CPU: AArch64 Processor [%08x]\n", read_cpuid_id());
+       sprintf(init_utsname()->machine, ELF_PLATFORM);
+       cpuinfo_store_boot_cpu();
+}
+
 static void __init setup_machine_fdt(phys_addr_t dt_phys)
 {
        void *dt_virt = fixmap_remap_fdt(dt_phys);
index c1d044b52f421d844647d375002e95b59388126a..77763d9cb510029d0b15190137031381e4894b95 100644 (file)
@@ -320,6 +320,7 @@ static void __init hyp_mode_check(void)
 void __init smp_cpus_done(unsigned int max_cpus)
 {
        pr_info("SMP: Total of %d processors activated.\n", num_online_cpus());
+       setup_cpu_features();
        hyp_mode_check();
        apply_alternatives_all();
 }