* [PATCH] arm64: psci: move psci firmware calls out of line
@ 2015-05-15 17:30 Kevin Hilman
2015-05-15 17:51 ` Kevin Hilman
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Hilman @ 2015-05-15 17:30 UTC (permalink / raw)
To: stable, Sasha Levin; +Cc: Will Deacon, Catalin Marinas, Kevin Hilman
From: Will Deacon <will.deacon@arm.com>
An arm64 allmodconfig fails to build with GCC 5 due to __asmeq
assertions in the PSCI firmware calling code firing due to mcount
preambles breaking our assumptions about register allocation of function
arguments:
/tmp/ccDqJsJ6.s: Assembler messages:
/tmp/ccDqJsJ6.s:60: Error: .err encountered
/tmp/ccDqJsJ6.s:61: Error: .err encountered
/tmp/ccDqJsJ6.s:62: Error: .err encountered
/tmp/ccDqJsJ6.s:99: Error: .err encountered
/tmp/ccDqJsJ6.s:100: Error: .err encountered
/tmp/ccDqJsJ6.s:101: Error: .err encountered
This patch fixes the issue by moving the PSCI calls out-of-line into
their own assembly files, which are safe from the compiler's meddling
fingers.
Reported-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: <stable@vger.kernel.org> # v3.18
(cherry picked from commit f5e0a12ca2d939e47995f73428d9bf1ad372b289)
Signed-off-by: Kevin Hilman <khilman@linaro.org>
---
This commit is already applied to v3.19+ stable trees, but is also
needed in v3.18, but didn't apply cleanly. This patch is a backport
which fixed up a minor conflict in the Makefile so that it applies
cleanly to v3.18.
arch/arm64/kernel/Makefile | 4 ++--
arch/arm64/kernel/psci-call.S | 28 ++++++++++++++++++++++++++++
arch/arm64/kernel/psci.c | 37 +++----------------------------------
3 files changed, 33 insertions(+), 36 deletions(-)
create mode 100644 arch/arm64/kernel/psci-call.S
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index da2272811a31..eccb8c7cb30f 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -14,8 +14,8 @@ CFLAGS_REMOVE_return_address.o = -pg
arm64-obj-y := cputable.o debug-monitors.o entry.o irq.o fpsimd.o \
entry-fpsimd.o process.o ptrace.o setup.o signal.o \
sys.o stacktrace.o time.o traps.o io.o vdso.o \
- hyp-stub.o psci.o cpu_ops.o insn.o return_address.o \
- cpuinfo.o cpu_errata.o alternative.o
+ hyp-stub.o psci.o psci-call.o cpu_ops.o insn.o \
+ return_address.o cpuinfo.o cpu_errata.o alternative.o
arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \
sys_compat.o
diff --git a/arch/arm64/kernel/psci-call.S b/arch/arm64/kernel/psci-call.S
new file mode 100644
index 000000000000..cf83e61cd3b5
--- /dev/null
+++ b/arch/arm64/kernel/psci-call.S
@@ -0,0 +1,28 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Copyright (C) 2015 ARM Limited
+ *
+ * Author: Will Deacon <will.deacon@arm.com>
+ */
+
+#include <linux/linkage.h>
+
+/* int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */
+ENTRY(__invoke_psci_fn_hvc)
+ hvc #0
+ ret
+ENDPROC(__invoke_psci_fn_hvc)
+
+/* int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */
+ENTRY(__invoke_psci_fn_smc)
+ smc #0
+ ret
+ENDPROC(__invoke_psci_fn_smc)
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 663da771580a..81c081eaca42 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -57,6 +57,9 @@ static struct psci_operations psci_ops;
static int (*invoke_psci_fn)(u64, u64, u64, u64);
typedef int (*psci_initcall_t)(const struct device_node *);
+asmlinkage int __invoke_psci_fn_hvc(u64, u64, u64, u64);
+asmlinkage int __invoke_psci_fn_smc(u64, u64, u64, u64);
+
enum psci_function {
PSCI_FN_CPU_SUSPEND,
PSCI_FN_CPU_ON,
@@ -109,40 +112,6 @@ static void psci_power_state_unpack(u32 power_state,
PSCI_0_2_POWER_STATE_AFFL_SHIFT;
}
-/*
- * The following two functions are invoked via the invoke_psci_fn pointer
- * and will not be inlined, allowing us to piggyback on the AAPCS.
- */
-static noinline int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1,
- u64 arg2)
-{
- asm volatile(
- __asmeq("%0", "x0")
- __asmeq("%1", "x1")
- __asmeq("%2", "x2")
- __asmeq("%3", "x3")
- "hvc #0\n"
- : "+r" (function_id)
- : "r" (arg0), "r" (arg1), "r" (arg2));
-
- return function_id;
-}
-
-static noinline int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1,
- u64 arg2)
-{
- asm volatile(
- __asmeq("%0", "x0")
- __asmeq("%1", "x1")
- __asmeq("%2", "x2")
- __asmeq("%3", "x3")
- "smc #0\n"
- : "+r" (function_id)
- : "r" (arg0), "r" (arg1), "r" (arg2));
-
- return function_id;
-}
-
static int psci_get_version(void)
{
int err;
--
2.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] arm64: psci: move psci firmware calls out of line
2015-05-15 17:30 [PATCH] arm64: psci: move psci firmware calls out of line Kevin Hilman
@ 2015-05-15 17:51 ` Kevin Hilman
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2015-05-15 17:51 UTC (permalink / raw)
To: Kevin Hilman
Cc: stable, Sasha Levin, Will Deacon, Catalin Marinas, Kevin Hilman
On Fri, May 15, 2015 at 10:30 AM, Kevin Hilman <khilman@kernel.org> wrote:
> From: Will Deacon <will.deacon@arm.com>
>
> An arm64 allmodconfig fails to build with GCC 5 due to __asmeq
> assertions in the PSCI firmware calling code firing due to mcount
> preambles breaking our assumptions about register allocation of function
> arguments:
>
> /tmp/ccDqJsJ6.s: Assembler messages:
> /tmp/ccDqJsJ6.s:60: Error: .err encountered
> /tmp/ccDqJsJ6.s:61: Error: .err encountered
> /tmp/ccDqJsJ6.s:62: Error: .err encountered
> /tmp/ccDqJsJ6.s:99: Error: .err encountered
> /tmp/ccDqJsJ6.s:100: Error: .err encountered
> /tmp/ccDqJsJ6.s:101: Error: .err encountered
>
> This patch fixes the issue by moving the PSCI calls out-of-line into
> their own assembly files, which are safe from the compiler's meddling
> fingers.
>
> Reported-by: Andy Whitcroft <apw@canonical.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: <stable@vger.kernel.org> # v3.18
> (cherry picked from commit f5e0a12ca2d939e47995f73428d9bf1ad372b289)
> Signed-off-by: Kevin Hilman <khilman@linaro.org>
> ---
> This commit is already applied to v3.19+ stable trees, but is also
> needed in v3.18, but didn't apply cleanly. This patch is a backport
> which fixed up a minor conflict in the Makefile so that it applies
> cleanly to v3.18.
Oops, please ignore this one. It was the wrong backport and will not
apply cleanly to v3.18. I'll resend the right one shortly.
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-15 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-15 17:30 [PATCH] arm64: psci: move psci firmware calls out of line Kevin Hilman
2015-05-15 17:51 ` Kevin Hilman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.