From patchwork Wed Oct 1 15:26:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 38247 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 126BA202E7 for ; Wed, 1 Oct 2014 15:26:50 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id b13sf777329wgh.8 for ; Wed, 01 Oct 2014 08:26:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=wRchpAU3aY88oC98Fs/HxYCtablOOzmNTsSLPBt2Wfo=; b=dHB87fBdeEJTK2yJYTWNF6gQ5j6IJsqvIuHbVM3wT04JoxikZbHxg9/nLj8WMlZT+i vNdkXeclvkGPiByLVlzgexkuOgdA8JXLmpyfEHLF8Ov267FKXZ64ZjFN1zQ/jBGn2XbJ gQ7TVDCD9VbjqK2MBzDc490Ab2gzSDInL1DpzQVgXYMQofobsWwJov3kYElI8AM8E7Wq u8bm6CWjIXTP3uIOOOa1IRVfNuGaKZdJAbQ10QIW+JuQ6dSejAtKszy1gORVmM0LA8iW ez1UtEDnJfG3JfGwoiyoij1WgYL17M7ivq6j1jT6EWZlXxLad2sY85DIXRlNdYoNOmiJ q6Sw== X-Gm-Message-State: ALoCoQno+2c8ruHXs/XnaLZ5yUo9d+B1gv+5AvVzfXEJO/INOnz6BCYDiuzpINYEyujBkfp3iTRf X-Received: by 10.112.189.69 with SMTP id gg5mr548153lbc.14.1412177210116; Wed, 01 Oct 2014 08:26:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.227 with SMTP id z3ls173796lad.44.gmail; Wed, 01 Oct 2014 08:26:50 -0700 (PDT) X-Received: by 10.112.143.34 with SMTP id sb2mr5616974lbb.18.1412177210005; Wed, 01 Oct 2014 08:26:50 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id of9si2132187lbb.124.2014.10.01.08.26.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 Oct 2014 08:26:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id mc6so586411lab.30 for ; Wed, 01 Oct 2014 08:26:49 -0700 (PDT) X-Received: by 10.112.134.229 with SMTP id pn5mr27037582lbb.22.1412177209650; Wed, 01 Oct 2014 08:26:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp553310lbb; Wed, 1 Oct 2014 08:26:48 -0700 (PDT) X-Received: by 10.69.31.1 with SMTP id ki1mr35041950pbd.100.1412177207974; Wed, 01 Oct 2014 08:26:47 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ah2si1082956pbd.191.2014.10.01.08.26.47 for ; Wed, 01 Oct 2014 08:26:47 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752037AbaJAP0p (ORCPT + 1 other); Wed, 1 Oct 2014 11:26:45 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:54088 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751487AbaJAP0o (ORCPT ); Wed, 1 Oct 2014 11:26:44 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.83) (envelope-from ) id 1XZLnd-0002K0-62; Wed, 01 Oct 2014 17:26:41 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: Dave Martin , Dave Martin , Russell King , Jiri Slaby Subject: [patch added to the 3.12 stable tree] ARM: 7897/1: kexec: Use the right ISA for relocate_new_kernel Date: Wed, 1 Oct 2014 17:26:41 +0200 Message-Id: <1412177201-8890-1-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 2.1.0 Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Dave Martin This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== commit e2ccba49085ab5d71b092de2a5176eb9b19cc876 upstream. Copying a function with memcpy() and then trying to execute the result isn't trivially portable to Thumb. This patch modifies the kexec soft restart code to copy its assembler trampoline relocate_new_kernel() using fncpy() instead, so that relocate_new_kernel can be in the same ISA as the rest of the kernel without problems. Signed-off-by: Dave Martin Acked-by: Will Deacon Reported-by: Taras Kondratiuk Tested-by: Taras Kondratiuk Signed-off-by: Russell King Signed-off-by: Jiri Slaby --- arch/arm/kernel/machine_kexec.c | 17 ++++++++++------- arch/arm/kernel/relocate_kernel.S | 8 ++++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index faa3d4c41ece..8cf0996aa1a8 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c @@ -14,11 +14,12 @@ #include #include #include +#include #include #include #include -extern const unsigned char relocate_new_kernel[]; +extern void relocate_new_kernel(void); extern const unsigned int relocate_new_kernel_size; extern unsigned long kexec_start_address; @@ -142,6 +143,8 @@ void machine_kexec(struct kimage *image) { unsigned long page_list; unsigned long reboot_code_buffer_phys; + unsigned long reboot_entry = (unsigned long)relocate_new_kernel; + unsigned long reboot_entry_phys; void *reboot_code_buffer; /* @@ -168,18 +171,18 @@ void machine_kexec(struct kimage *image) /* copy our kernel relocation code to the control code page */ - memcpy(reboot_code_buffer, - relocate_new_kernel, relocate_new_kernel_size); + reboot_entry = fncpy(reboot_code_buffer, + reboot_entry, + relocate_new_kernel_size); + reboot_entry_phys = (unsigned long)reboot_entry + + (reboot_code_buffer_phys - (unsigned long)reboot_code_buffer); - - flush_icache_range((unsigned long) reboot_code_buffer, - (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE); printk(KERN_INFO "Bye!\n"); if (kexec_reinit) kexec_reinit(); - soft_restart(reboot_code_buffer_phys); + soft_restart(reboot_entry_phys); } void arch_crash_save_vmcoreinfo(void) diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S index d0cdedf4864d..95858966d84e 100644 --- a/arch/arm/kernel/relocate_kernel.S +++ b/arch/arm/kernel/relocate_kernel.S @@ -2,10 +2,12 @@ * relocate_kernel.S - put the kernel image in place to boot */ +#include #include - .globl relocate_new_kernel -relocate_new_kernel: + .align 3 /* not needed for this code, but keeps fncpy() happy */ + +ENTRY(relocate_new_kernel) ldr r0,kexec_indirection_page ldr r1,kexec_start_address @@ -79,6 +81,8 @@ kexec_mach_type: kexec_boot_atags: .long 0x0 +ENDPROC(relocate_new_kernel) + relocate_new_kernel_end: .globl relocate_new_kernel_size