Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ffdf50a authored by Abhimanyu Kapur's avatar Abhimanyu Kapur
Browse files

arm64: introduce CPU_OF_TABLES for cpu ops selection



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.

Change-Id: I4fd5b330fa3a7436fb88fff385deeb80a90548d6
Signed-off-by: default avatarAbhimanyu Kapur <abhimany@codeaurora.org>
parent 0e1e6dd9
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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 */
+10 −19
Original line number Diff line number Diff line
@@ -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;
}
+2 −1
Original line number Diff line number Diff line
@@ -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,
@@ -293,4 +293,5 @@ const struct cpu_operations cpu_psci_ops = {
#endif
};

CPU_METHOD_OF_DECLARE(psci, &cpu_psci_ops);
#endif
+2 −1
Original line number Diff line number Diff line
@@ -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);
+10 −0
Original line number Diff line number Diff line
@@ -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) = .;				\
@@ -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()