From patchwork Sun Aug 23 12:55:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Neukirchen X-Patchwork-Id: 509850 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 451441402A6 for ; Sun, 23 Aug 2015 22:56:53 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 5BE6C28BFD2; Sun, 23 Aug 2015 14:55:52 +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 14DB528BFC5 for ; Sun, 23 Aug 2015 14:55:43 +0200 (CEST) X-policyd-weight: using cached result; rate:hard: -8.5 Received: from mout.web.de (mout.web.de [212.227.17.12]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sun, 23 Aug 2015 14:55:42 +0200 (CEST) Received: from tenchi-htpc.lan ([91.64.206.38]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MGzjq-1ZYUmQ1LrG-00Dkhd for ; Sun, 23 Aug 2015 14:56:32 +0200 From: Dirk Neukirchen To: openwrt-devel@lists.openwrt.org Date: Sun, 23 Aug 2015 14:55:02 +0200 Message-Id: <1440334502-27357-1-git-send-email-dirkneukirchen@web.de> X-Mailer: git-send-email 2.5.0 X-Provags-ID: V03:K0:b+UF6gUP8U6eHHztm7JiYDgVFfAdOtLz86a9AyYa/JeD1dVKmhi VtmQycrtPXC6RZmhLbk0W14JdiH4q1fJGy9+tSUUWI6Puvn8zEfA32PkVyfD1OvdRLtXgAo 3W0riT+PSAxAiIw7v+BTB6pOZ9l1LmtPq7h9Xi0uj7jQzQk0r8DB5qBlSJMjysCvgqqX4QQ Uf4XxehqnHBM8s99AXFaQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:mvXlP4eMjGg=:+TdD7aWOgVyRqqxmiaSw4N n2RaX2y0jS8wvDSj7qLE5q91PKH0Ly/Tc3e7j9D+rsLQzyZTDSvvZlRkKo1tfRg6bgHyhTuw/ 8gUSeMoNIqSW9qNVpysY/KOhjrs3N/ie4Qa2HMU4jyl28AK5FrcrwEMQ3+eX8GeEPxn31eqLU Xvk0hFaTQXqEEJLXuNtY0HTTb5pRlVUb+D9axfsUdKFFRx/KoAXC0ipIR57p3usyJx+GDOShm fpsAPq4MDWYlJgrYPbwk2XNNmq/VNnt/cqmMlG7gr1AtiLMP9Qehs4SX1Gvef6ynzSnvxzGqn AQq6x0l8PLy0XMypPfZ8D3pGo6+12Y1HoDSedyk3yEtGi5JzMpewemvd0ZoXIVbKic9KMtHhQ UoKGv+bNSaDKvSi3gDvq96e8OJXG2G92He06DA16LcR9V4k7bSSGHCd+qRv3YGcPIACVQa0ho 2vFDwqx10OLu3rgJp8gnsvFZTn8Oyg8VSGR2jMaX5PksXL4uqMgCaWFcK2GuIzX/ELfgHVO54 UMbpMjHp8vJssaM0LCZMGRnJUz6rkACpsIpw2lxnj+ltvtYhPpY2Iikh2N6DcXwvW4BaSyBEl +PSiQcqPFsgZNR/9djdl20Hr5D/rMGW54R1/2SeivwNrY8PEfdTGXT5zDPYIiUdRmaef9pqkK UirWfzDKXoIv8j4xDs3hWor6RiePeJcYjokT7/LwLGECQirKOvWjlv0w3kn3aiWb1HrrLDK8K rtAW6DNOyv/kQy9J 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: , MIME-Version: 1.0 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 Signed-off-by: Dirk Neukirchen --- found this in my local tree, diffconfig to replicate: CONFIG_TARGET_arm64=y CONFIG_TARGET_arm64_Default=y CONFIG_TARGET_BOARD="arm64" CONFIG_DEVEL=y CONFIG_BUILD_LOG=y CONFIG_KERNEL_DYNAMIC_FTRACE=y CONFIG_KERNEL_ENABLE_DEFAULT_TRACERS=y CONFIG_KERNEL_FTRACE=y CONFIG_KERNEL_FTRACE_SYSCALLS=y CONFIG_KERNEL_FUNCTION_GRAPH_TRACER=y CONFIG_KERNEL_FUNCTION_PROFILER=y CONFIG_KERNEL_FUNCTION_TRACER=y ...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