Loading arch/arm64/include/asm/cpu_ops.h +5 −0 Original line number Diff line number Diff line Loading @@ -62,4 +62,9 @@ extern const struct cpu_operations *cpu_ops[NR_CPUS]; extern int __init cpu_read_ops(struct device_node *dn, int cpu); extern void __init cpu_read_bootcpu_ops(void); #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 */ arch/arm64/kernel/cpu_ops.c +10 −19 Original line number Diff line number Diff line Loading @@ -22,29 +22,20 @@ #include <linux/of.h> #include <linux/string.h> extern const struct cpu_operations smp_spin_table_ops; extern const struct cpu_operations cpu_psci_ops; const struct cpu_operations *cpu_ops[NR_CPUS]; extern struct cpu_operations *__cpu_method_of_table[]; extern struct cpu_operations *__cpu_method_of_table_end[]; static const struct cpu_operations *supported_cpu_ops[] __initconst = { #ifdef CONFIG_SMP &smp_spin_table_ops, &cpu_psci_ops, #endif NULL, }; static const struct cpu_operations * __init cpu_get_ops(const char *name) const struct cpu_operations * __init cpu_get_ops(const char *name) { const struct cpu_operations **ops = supported_cpu_ops; const struct cpu_operations **start = (void *)__cpu_method_of_table; const struct cpu_operations **end = (void *)__cpu_method_of_table_end; while (*ops) { if (!strcmp(name, (*ops)->name)) return *ops; ops++; } while (start < end) { if (!strcmp((*start)->name, name)) return *start; start++; }; return NULL; } Loading arch/arm64/kernel/psci.c +2 −1 Original line number Diff line number Diff line Loading @@ -282,7 +282,7 @@ static void cpu_psci_cpu_die(unsigned int cpu) } #endif const struct cpu_operations cpu_psci_ops = { static const struct cpu_operations cpu_psci_ops = { .name = "psci", .cpu_init = cpu_psci_cpu_init, .cpu_prepare = cpu_psci_cpu_prepare, Loading @@ -293,4 +293,5 @@ const struct cpu_operations cpu_psci_ops = { #endif }; CPU_METHOD_OF_DECLARE(psci, &cpu_psci_ops); #endif arch/arm64/kernel/smp_spin_table.c +2 −1 Original line number Diff line number Diff line Loading @@ -142,10 +142,11 @@ void smp_spin_table_cpu_postboot(void) raw_spin_unlock(&boot_lock); } 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_postboot = smp_spin_table_cpu_postboot, }; CPU_METHOD_OF_DECLARE(spin_table, &smp_spin_table_ops); include/asm-generic/vmlinux.lds.h +10 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,15 @@ #define CLK_OF_TABLES() #endif #ifdef CONFIG_OF #define CPU_METHOD_OF_TABLES() . = ALIGN(8); \ VMLINUX_SYMBOL(__cpu_method_of_table) = .; \ *(__cpu_method_of_table) \ VMLINUX_SYMBOL(__cpu_method_of_table_end) = .; #else #define CPU_METHOD_OF_TABLES() #endif #define KERNEL_DTB() \ STRUCT_ALIGN(); \ VMLINUX_SYMBOL(__dtb_start) = .; \ Loading Loading @@ -515,6 +524,7 @@ CPU_DISCARD(init.rodata) \ MEM_DISCARD(init.rodata) \ CLK_OF_TABLES() \ CPU_METHOD_OF_TABLES() \ CLKSRC_OF_TABLES() \ KERNEL_DTB() \ IRQCHIP_OF_MATCH_TABLE() Loading Loading
arch/arm64/include/asm/cpu_ops.h +5 −0 Original line number Diff line number Diff line Loading @@ -62,4 +62,9 @@ extern const struct cpu_operations *cpu_ops[NR_CPUS]; extern int __init cpu_read_ops(struct device_node *dn, int cpu); extern void __init cpu_read_bootcpu_ops(void); #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 */
arch/arm64/kernel/cpu_ops.c +10 −19 Original line number Diff line number Diff line Loading @@ -22,29 +22,20 @@ #include <linux/of.h> #include <linux/string.h> extern const struct cpu_operations smp_spin_table_ops; extern const struct cpu_operations cpu_psci_ops; const struct cpu_operations *cpu_ops[NR_CPUS]; extern struct cpu_operations *__cpu_method_of_table[]; extern struct cpu_operations *__cpu_method_of_table_end[]; static const struct cpu_operations *supported_cpu_ops[] __initconst = { #ifdef CONFIG_SMP &smp_spin_table_ops, &cpu_psci_ops, #endif NULL, }; static const struct cpu_operations * __init cpu_get_ops(const char *name) const struct cpu_operations * __init cpu_get_ops(const char *name) { const struct cpu_operations **ops = supported_cpu_ops; const struct cpu_operations **start = (void *)__cpu_method_of_table; const struct cpu_operations **end = (void *)__cpu_method_of_table_end; while (*ops) { if (!strcmp(name, (*ops)->name)) return *ops; ops++; } while (start < end) { if (!strcmp((*start)->name, name)) return *start; start++; }; return NULL; } Loading
arch/arm64/kernel/psci.c +2 −1 Original line number Diff line number Diff line Loading @@ -282,7 +282,7 @@ static void cpu_psci_cpu_die(unsigned int cpu) } #endif const struct cpu_operations cpu_psci_ops = { static const struct cpu_operations cpu_psci_ops = { .name = "psci", .cpu_init = cpu_psci_cpu_init, .cpu_prepare = cpu_psci_cpu_prepare, Loading @@ -293,4 +293,5 @@ const struct cpu_operations cpu_psci_ops = { #endif }; CPU_METHOD_OF_DECLARE(psci, &cpu_psci_ops); #endif
arch/arm64/kernel/smp_spin_table.c +2 −1 Original line number Diff line number Diff line Loading @@ -142,10 +142,11 @@ void smp_spin_table_cpu_postboot(void) raw_spin_unlock(&boot_lock); } 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_postboot = smp_spin_table_cpu_postboot, }; CPU_METHOD_OF_DECLARE(spin_table, &smp_spin_table_ops);
include/asm-generic/vmlinux.lds.h +10 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,15 @@ #define CLK_OF_TABLES() #endif #ifdef CONFIG_OF #define CPU_METHOD_OF_TABLES() . = ALIGN(8); \ VMLINUX_SYMBOL(__cpu_method_of_table) = .; \ *(__cpu_method_of_table) \ VMLINUX_SYMBOL(__cpu_method_of_table_end) = .; #else #define CPU_METHOD_OF_TABLES() #endif #define KERNEL_DTB() \ STRUCT_ALIGN(); \ VMLINUX_SYMBOL(__dtb_start) = .; \ Loading Loading @@ -515,6 +524,7 @@ CPU_DISCARD(init.rodata) \ MEM_DISCARD(init.rodata) \ CLK_OF_TABLES() \ CPU_METHOD_OF_TABLES() \ CLKSRC_OF_TABLES() \ KERNEL_DTB() \ IRQCHIP_OF_MATCH_TABLE() Loading