From patchwork Wed Oct 17 14:47:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 985429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Zw4h3gMfz9sC2 for ; Thu, 18 Oct 2018 01:47:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NIGSwf9u"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42Zw4h21SVzF3YL for ; Thu, 18 Oct 2018 01:47:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NIGSwf9u"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::544; helo=mail-pg1-x544.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NIGSwf9u"; dkim-atps=neutral Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42Zw4b5MNVzF3SX for ; Thu, 18 Oct 2018 01:47:11 +1100 (AEDT) Received: by mail-pg1-x544.google.com with SMTP id y18-v6so12665906pge.0 for ; Wed, 17 Oct 2018 07:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=5prZNZAqKekUwrS2FUVcxp0C7USXFpYKuUtq7Fd686o=; b=NIGSwf9u40X8eD0WQj4EkdHOLdRZYAr6uumYJ+VLhO31QKrXXXxwgbB4fbKyObZ1hx Cp14tBVssjlOtCW04LpC26lUrpccpv57puMvyxjZqJESQT9DQjSOf6oaNx31v+8BPMIy ppZ733h4mjR8z2Y80YuimnDVMNBra15LmC9t72ipzhyMB+myQgP/YfxWS5LEUdTPXGvH gqAeLh0oHrjwGEKtbSuKmMrVcq76b+eHxhpAYQiaITwev8cnZfLDLVwQzIANwLG7XGQ8 Y9ifSqsMXu0slBCAJ+kt2UoL1DjA6cpw8HKWs/boBeDP574ggvG1eJLhlgytMB1jnGce yreQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5prZNZAqKekUwrS2FUVcxp0C7USXFpYKuUtq7Fd686o=; b=d93gwvOBOf/uFIWQhFc96p4GbqxjnAJromBHUST7p1BczB3Hmjsp+7Q7ceeE9mpg4x wDTDhmZobXIRPda/VJjYF+d3p7vpacCPeHSamCWBS5Qo+tQXZp8jJypsbcF51rf9upro ysC6ra28rCkmEH/aBOT+imSl5wLvjKsjO5Xh9ETVQsdct3KMLh56W4rzfYxRaC4BRDo4 FgCBC/ClOEelENriw7S/vREo0+OwaY2Jrc37lq42+c0AKutC1vOWe0UZXIjQrHS4YC37 c2JC7IZU/KYWj1mccb7e4qrtEspF5OdAQiMIwWMPPC/SPm36ppu4yQKPuu9LIMbl3OlB 2yOg== X-Gm-Message-State: ABuFfogYPz4fe0gt5wQ8htIK17M5U5Efib1t51THIgRONMwMHQtduMqu 8wT/6JaaUSMpTwOaOzIZjnc8PxI/ X-Google-Smtp-Source: ACcGV60fpLa7qoe5XHJwwydgGXm7LWnO46YxVcZpMnumalKF9sDlrjRx7D1SDEkMkO/12D9MSeoBLg== X-Received: by 2002:a63:5605:: with SMTP id k5-v6mr25021783pgb.189.1539787629696; Wed, 17 Oct 2018 07:47:09 -0700 (PDT) Received: from roar.local0.net (14-202-199-226.tpgi.com.au. [14.202.199.226]) by smtp.gmail.com with ESMTPSA id 72-v6sm35851252pfr.115.2018.10.17.07.47.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 07:47:09 -0700 (PDT) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Thu, 18 Oct 2018 00:47:01 +1000 Message-Id: <20181017144701.12783-1-npiggin@gmail.com> X-Mailer: git-send-email 2.18.0 Subject: [Skiboot] [PATCH] asm/head: use HSRR exception registers in FIXUP_ENDIAN X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Taken from the Linux FIXUP_ENDIAN_HV macro, use the HSRR registers in FIXUP_ENDIAN. This allows the 0x100 exception handler (the single user of the macro) to preserve SRR registers and potentially recover, debug, or do something useful with them. This also allows the maco to be used in code with MSR[RI]=1, if the need arises. Signed-off-by: Nicholas Piggin --- asm/head.S | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/asm/head.S b/asm/head.S index 8b9c0483..b7569d24 100644 --- a/asm/head.S +++ b/asm/head.S @@ -472,17 +472,18 @@ call_relocate: 1: /* Fatal relocate failure */ attn -#define FIXUP_ENDIAN \ - tdi 0,0,0x48; /* Reverse endian of b . + 8 */ \ - b $+36; /* Skip trampoline if endian is good */ \ - .long 0x05009f42; /* bcl 20,31,$+4 */ \ - .long 0xa602487d; /* mflr r10 */ \ - .long 0x1c004a39; /* addi r10,r10,28 */ \ - .long 0xa600607d; /* mfmsr r11 */ \ - .long 0x01006b69; /* xori r11,r11,1 */ \ - .long 0xa6035a7d; /* mtsrr0 r10 */ \ - .long 0xa6037b7d; /* mtsrr1 r11 */ \ - .long 0x2400004c /* rfid */ +#define FIXUP_ENDIAN \ + tdi 0,0,0x48; /* Reverse endian of b . + 8 */ \ + b 191f; /* Skip trampoline if endian is good */ \ + .long 0xa600607d; /* mfmsr r11 */ \ + .long 0x01006b69; /* xori r11,r11,1 */ \ + .long 0x05009f42; /* bcl 20,31,$+4 */ \ + .long 0xa602487d; /* mflr r10 */ \ + .long 0x14004a39; /* addi r10,r10,20 */ \ + .long 0xa64b5a7d; /* mthsrr0 r10 */ \ + .long 0xa64b7b7d; /* mthsrr1 r11 */ \ + .long 0x2402004c; /* hrfid */ \ +191: /* This is a little piece of code that is copied down to * 0x100 for handling power management wakeups