From patchwork Sun May 24 09:05:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Neukirchen X-Patchwork-Id: 475953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4602B14010F for ; Sun, 24 May 2015 19:05:33 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 18DE728B738; Sun, 24 May 2015 11:04:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id E37ED280660 for ; Sun, 24 May 2015 11:03:57 +0200 (CEST) X-policyd-weight: using cached result; rate: -8.5 Received: from mout.web.de (mout.web.de [212.227.17.11]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sun, 24 May 2015 11:03:57 +0200 (CEST) Received: from [192.168.3.157] ([91.64.206.248]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0M8iLA-1YqzHB3hZU-00CE0r for ; Sun, 24 May 2015 11:05:22 +0200 Message-ID: <55619442.5080300@web.de> Date: Sun, 24 May 2015 11:05:06 +0200 From: Dirk Neukirchen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: OpenWrt Development List X-Provags-ID: V03:K0:ywiD9GO/VcgxbOi7wFfOzepmRgpE3ByMK8m3DpFv5BUELVoBEKP BzXZyv+rfXzmo3mie2Bd3oje4z0klvq/muFiWdPv5ryxkSUGd3iy2uMrVZ3XqQEd5qb0+Ud ZwRx+EsV+0PJrIZciPEuj2q54ZaKpisZxii0TKy5J6pYkMz+SfHs5XkrsXUTLR9mlm+VJwL Y9w8KjVTeyWLOwCrLl0dw== X-UI-Out-Filterresults: notjunk:1; Subject: [OpenWrt-Devel] [PATCH] kernel: arm64: psci: move psci firmware calls out of line X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" - fixes build error on arm64 with FTRACE enabled - upstream ticket says gcc5 but both linaro gcc variants OpenWrt is using seem to be affected backport upstream change f5e0a12ca2d939e47995f73428d9bf1ad372b289 for Kernel 3.18 only compile tested Signed-off-by: Dirk Neukirchen --- ...psci_move_psci_firmware_calls_out_of_line.patch | 124 +++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 target/linux/generic/patches-3.18/090-from_4.0_arm64_psci_move_psci_firmware_calls_out_of_line.patch diff --git a/target/linux/generic/patches-3.18/090-from_4.0_arm64_psci_move_psci_firmware_calls_out_of_line.patch b/target/linux/generic/patches-3.18/090-from_4.0_arm64_psci_move_psci_firmware_calls_out_of_line.patch new file mode 100644 index 0000000..1db9d5f --- /dev/null +++ b/target/linux/generic/patches-3.18/090-from_4.0_arm64_psci_move_psci_firmware_calls_out_of_line.patch @@ -0,0 +1,124 @@ +From f5e0a12ca2d939e47995f73428d9bf1ad372b289 Mon Sep 17 00:00:00 2001 +From: Will Deacon +Date: Wed, 25 Feb 2015 12:10:35 +0000 +Subject: arm64: psci: move psci firmware calls out of line + +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 +Signed-off-by: Will Deacon +Signed-off-by: Catalin Marinas + +--- /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 ++ */ ++ ++#include ++ ++/* 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) +--- 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 + 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; +--- a/arch/arm64/kernel/Makefile ++++ b/arch/arm64/kernel/Makefile +@@ -14,8 +14,9 @@ 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