From patchwork Wed Jul 8 03:29:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 492705 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E436F1402BD for ; Wed, 8 Jul 2015 13:31:18 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id CA2621A1E64 for ; Wed, 8 Jul 2015 13:31:18 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id F3D8E1A1A37 for ; Wed, 8 Jul 2015 13:30:23 +1000 (AEST) Received: by ozlabs.org (Postfix) id E09D5140D24; Wed, 8 Jul 2015 13:30:23 +1000 (AEST) Delivered-To: linuxppc-dev@ozlabs.org Received: from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C480D1402BD for ; Wed, 8 Jul 2015 13:30:23 +1000 (AEST) Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 8 Jul 2015 13:30:22 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 8 Jul 2015 13:30:20 +1000 X-Helo: d23dlp03.au.ibm.com X-MailFrom: sam.mj@au1.ibm.com X-RcptTo: linuxppc-dev@ozlabs.org Received: from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id B38793578052 for ; Wed, 8 Jul 2015 13:30:19 +1000 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t683UBeG50856112 for ; Wed, 8 Jul 2015 13:30:19 +1000 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t683Tlv6029951 for ; Wed, 8 Jul 2015 13:29:47 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t683TkmD029378; Wed, 8 Jul 2015 13:29:47 +1000 Received: from skellige.ozlabs.ibm.com (unknown [9.192.254.114]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id CA96AA01A1; Wed, 8 Jul 2015 13:29:22 +1000 (AEST) From: Samuel Mendoza-Jonas To: anton@samba.org Subject: [kexec-lite PATCH V2] trampoline: Reset primary cpu endian to big-endian Date: Wed, 8 Jul 2015 13:29:38 +1000 Message-Id: <1436326178-17021-1-git-send-email-sam.mj@au1.ibm.com> X-Mailer: git-send-email 2.4.5 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15070803-1618-0000-0000-000002593A0D X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@ozlabs.org, Samuel Mendoza-Jonas MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Older big-endian ppc64 kernels don't include the FIXUP_ENDIAN check, meaning if we kexec from a little-endian kernel the target kernel will fail to boot. Returning to big-endian before we enter the target kernel ensures that the target kernel can boot whether or not it includes FIXUP_ENDIAN. Signed-off-by: Samuel Mendoza-Jonas --- V2: As suggested by Anton take advantage of the rfid call and switch off MSR_LE and branch to the target kernel in the same step. kexec_trampoline.S | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kexec_trampoline.S b/kexec_trampoline.S index a3eb314..3751112 100644 --- a/kexec_trampoline.S +++ b/kexec_trampoline.S @@ -88,8 +88,15 @@ start: li r5,0 - mtctr r4 - bctr + mtsrr0 r4 + + mfmsr r5 + clrrdi r5,r5,1 /* Clear MSR_LE */ + mtsrr1 r5 + + li r5,0 + + rfid . = KERNEL_ADDR_OFFSET kernel_addr: