aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Nowicki <tomasz.nowicki@linaro.org>2014-02-13 18:20:55 +0100
committerGraeme Gregory <graeme.gregory@linaro.org>2014-06-03 09:24:23 +0100
commitbb2f806be2f8a3c35a822472a0c44e969ff926cf (patch)
tree727487a67a882164d139195eaf78e78df1a40af7
parent7bf086c5589d8a0b58a17580609b833beb448b31 (diff)
downloadleg-kernel-bb2f806be2f8a3c35a822472a0c44e969ff926cf.tar.gz
ARM64: Read enable-method for given CPU in the ACPI way too.
Listed changes: 1. Find out enable method for CPU0 (similar to OF way). 2. It seems like acpi_get_enable_method() belongs to cpu_ops.c, simplify and rename to cpu_acpi_get_enable_method() while we are here. 3. Use new features during acpi_smp_init_cpus() as well. Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
-rw-r--r--arch/arm64/include/asm/acpi.h9
-rw-r--r--arch/arm64/include/asm/cpu_ops.h3
-rw-r--r--arch/arm64/kernel/cpu_ops.c52
-rw-r--r--arch/arm64/kernel/smp.c10
-rw-r--r--drivers/acpi/plat/arm-core.c26
5 files changed, 54 insertions, 46 deletions
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 409a8892d9ea..9f0029d6d082 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -89,10 +89,9 @@ extern int (*acpi_suspend_lowlevel)(void);
extern int arm_cpu_to_apicid[NR_CPUS];
#define cpu_physical_id(cpu) arm_cpu_to_apicid[cpu]
-extern const char *acpi_get_enable_method(int cpu);
-
extern int acpi_get_cpu_release_address(int cpu, u64 *release_address);
extern int gic_acpi_init(void);
+extern int cpu_acpi_read_ops(int cpu);
#else /* !CONFIG_ACPI */
#define acpi_disabled 1 /* ACPI sometimes enabled on ARM */
@@ -105,12 +104,12 @@ static inline int gic_acpi_init(void)
return -ENODEV;
}
-static inline const char *acpi_get_enable_method(int cpu)
+static inline int acpi_get_cpu_release_address(int cpu, u64 *release_address)
{
- return NULL;
+ return -ENODEV;
}
-static inline int acpi_get_cpu_release_address(int cpu, u64 *release_address)
+static inline int cpu_acpi_read_ops(int cpu)
{
return -ENODEV;
}
diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h
index 338ea3594a8f..14e5fc71f25e 100644
--- a/arch/arm64/include/asm/cpu_ops.h
+++ b/arch/arm64/include/asm/cpu_ops.h
@@ -59,8 +59,7 @@ struct cpu_operations {
};
extern const struct cpu_operations *cpu_ops[NR_CPUS];
-extern const struct cpu_operations * __init cpu_get_ops(const char *name);
-extern int __init cpu_read_ops(struct device_node *dn, int cpu);
+extern int __init cpu_of_read_ops(struct device_node *dn, int cpu);
extern void __init cpu_read_bootcpu_ops(void);
#endif /* ifndef __ASM_CPU_OPS_H */
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index 531f2cca59b9..c93ae18c4fa2 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -35,7 +35,7 @@ static const struct cpu_operations *supported_cpu_ops[] __initconst = {
NULL,
};
-const struct cpu_operations * __init cpu_get_ops(const char *name)
+static const struct cpu_operations * __init cpu_get_ops(const char *name)
{
const struct cpu_operations **ops = supported_cpu_ops;
@@ -52,7 +52,7 @@ const struct cpu_operations * __init cpu_get_ops(const char *name)
/*
* Read a cpu's enable method from the device tree and record it in cpu_ops.
*/
-int __init cpu_read_ops(struct device_node *dn, int cpu)
+int __init cpu_of_read_ops(struct device_node *dn, int cpu)
{
const char *enable_method = of_get_property(dn, "enable-method", NULL);
if (!enable_method) {
@@ -76,12 +76,54 @@ int __init cpu_read_ops(struct device_node *dn, int cpu)
return 0;
}
+#ifdef CONFIG_ACPI
+/*
+ * This is place holder for code which investigates bootup method for
+ * a given CPU.
+ * FIXME: Since PSCI is not available for ACPI 5.0 and we support FVP base model
+ * only we hardcode PSCI method here.
+ */
+
+static const char *cpu_acpi_get_enable_method(int cpu)
+{
+ return "psci";
+}
+
+/*
+ * Read a cpu's enable method in the ACPI way and record it in cpu_ops.
+ */
+int __init cpu_acpi_read_ops(int cpu)
+{
+ const char *enable_method = cpu_acpi_get_enable_method(cpu);
+ if (!enable_method) {
+ /*
+ * The boot CPU may not have an enable method (e.g. when
+ * spin-table is used for secondaries). Don't warn spuriously.
+ */
+ if (cpu != 0)
+ pr_err("Missing enable-method property for boot cpu\n");
+ return -ENOENT;
+ }
+
+ cpu_ops[cpu] = cpu_get_ops(enable_method);
+ if (!cpu_ops[cpu]) {
+ pr_warn("CPU %d: unsupported enable-method property: %s\n",
+ cpu, enable_method);
+ return -EOPNOTSUPP;
+ }
+
+ return 0;
+}
+#endif
+
+
void __init cpu_read_bootcpu_ops(void)
{
struct device_node *dn = of_get_cpu_node(0, NULL);
- if (!dn) {
- pr_err("Failed to find device node for boot cpu\n");
+ if (dn) {
+ cpu_of_read_ops(dn, 0);
return;
}
- cpu_read_ops(dn, 0);
+
+ cpu_acpi_read_ops(0);
}
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index be4694c2ab31..2673120f46aa 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -363,7 +363,7 @@ static int __init of_smp_init_cpus(void)
if (cpu >= NR_CPUS)
goto next;
- if (cpu_read_ops(dn, cpu) != 0)
+ if (cpu_of_read_ops(dn, cpu) != 0)
goto next;
if (cpu_ops[cpu]->cpu_init(dn, cpu))
@@ -408,15 +408,9 @@ next:
static void __init acpi_smp_init_cpus(void)
{
int cpu;
- const char *enable_method;
for_each_possible_cpu(cpu) {
- enable_method = acpi_get_enable_method(cpu);
- if (!enable_method)
- continue;
-
- cpu_ops[cpu] = cpu_get_ops(enable_method);
- if (!cpu_ops[cpu])
+ if (cpu_acpi_read_ops(cpu) != 0)
continue;
cpu_ops[cpu]->cpu_init(NULL, cpu);
diff --git a/drivers/acpi/plat/arm-core.c b/drivers/acpi/plat/arm-core.c
index b825a9601515..4f3c41c136c7 100644
--- a/drivers/acpi/plat/arm-core.c
+++ b/drivers/acpi/plat/arm-core.c
@@ -365,32 +365,6 @@ static void __init acpi_process_madt(void)
}
/*
- * To see PCSI is enabled or not.
- *
- * PSCI is not available for ACPI 5.0, return FALSE for now.
- *
- * FIXME: should we introduce early_param("psci", func) for test purpose?
- */
-static bool acpi_psci_smp_available(int cpu)
-{
- return FALSE;
-}
-
-static const char *enable_method[] = {
- "psci",
- "spin-table",
- NULL
-};
-
-const char *acpi_get_enable_method(int cpu)
-{
- if (acpi_psci_smp_available(cpu))
- return enable_method[0];
- else
- return enable_method[1];
-}
-
-/*
* acpi_boot_table_init() and acpi_boot_init()
* called from setup_arch(), always.
* 1. checksums all tables