]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
arm64: introduce CPU_OF_TABLES for cpu ops selection
authorAbhimanyu Kapur <abhimany@codeaurora.org>
Thu, 23 Jan 2014 20:24:33 +0000 (12:24 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 13 Apr 2018 14:00:13 +0000 (16:00 +0200)
Add support to arm64 to provide a dt-based method to allow soc-vendors to
supply cpu_ops. Also move psci and smp_spin_table ops to use CPU_OF_TABLES.

Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
Signed-off-by: Kumar Gala <galak@codeaurora.org>
arch/arm64/include/asm/cpu_ops.h
arch/arm64/kernel/cpu_ops.c
arch/arm64/kernel/psci.c
arch/arm64/kernel/smp_spin_table.c

index 8f03446cf89f111e3cd9c573514797c8420abd3e..41bf609206ed62a204c61a981a134462dba9980c 100644 (file)
@@ -71,4 +71,9 @@ static inline void __init cpu_read_bootcpu_ops(void)
        cpu_read_ops(0);
 }
 
+#define CPU_METHOD_OF_DECLARE(name, __ops)                             \
+       static const struct cpu_operations *__cpu_method_table_##name   \
+       __used __section(__cpu_method_of_table)                         \
+       = __ops;
+
 #endif /* ifndef __ASM_CPU_OPS_H */
index b6bd7d4477683393fb34dc6b055b07382e8ab050..3c63506b6437e2075df8c88fe3a70286dfe0576a 100644 (file)
@@ -35,16 +35,18 @@ static const struct cpu_operations *supported_cpu_ops[] __initconst = {
        NULL,
 };
 
+extern struct cpu_operations __cpu_method_of_table[];
+static const struct cpu_operations *__cpu_method_of_table_sentinel
+       __used __section(__cpu_method_of_table_end);
+
 static const struct cpu_operations * __init cpu_get_ops(const char *name)
 {
-       const struct cpu_operations **ops = supported_cpu_ops;
-
-       while (*ops) {
-               if (!strcmp(name, (*ops)->name))
-                       return *ops;
+       const struct cpu_operations **start = (void *)__cpu_method_of_table;
 
-               ops++;
-       }
+       for (; *start; start++) {
+               if (!strcmp((*start)->name, name))
+                       return *start;
+       };
 
        return NULL;
 }
index f67f35b6edb12e4d34e1db17750b07a0bec72e39..60b1a1d1a3d81b924493fdf63da0ebeb3dca95e2 100644 (file)
@@ -221,3 +221,4 @@ const struct cpu_operations cpu_psci_ops = {
 #endif
 };
 
+CPU_METHOD_OF_DECLARE(psci, &cpu_psci_ops);
index aef3605a8c47845ce2ce2d32f75e0fd59a8e4405..06eae9db546921ecfcbb01b3cbbf2cd189ae162b 100644 (file)
@@ -125,9 +125,10 @@ static int smp_spin_table_cpu_boot(unsigned int cpu)
        return 0;
 }
 
-const struct cpu_operations smp_spin_table_ops = {
+static const struct cpu_operations smp_spin_table_ops = {
        .name           = "spin-table",
        .cpu_init       = smp_spin_table_cpu_init,
        .cpu_prepare    = smp_spin_table_cpu_prepare,
        .cpu_boot       = smp_spin_table_cpu_boot,
 };
+CPU_METHOD_OF_DECLARE(spin_table, &smp_spin_table_ops);