From patchwork Sun May 21 13:15:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 765092 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wW2Wl6jgyz9s1h for ; Sun, 21 May 2017 23:22:11 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jWjKgkxv"; 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 3wW2Wl5VjlzDqMV for ; Sun, 21 May 2017 23:22:11 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jWjKgkxv"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (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 3wW2P15PdNzDqLm for ; Sun, 21 May 2017 23:16:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jWjKgkxv"; dkim-atps=neutral Received: by mail-pf0-x241.google.com with SMTP id w69so14494197pfk.1 for ; Sun, 21 May 2017 06:16:21 -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:in-reply-to:references; bh=sRpf6/acuLzuuxVAHdZvoqfa4p3JlMn/roGdlRE15qk=; b=jWjKgkxvcrfUsmiwf0vemf7SM0N1pMwWaNkSf+QZjX7L2kyhBw25IQR3Mhkg7LWf3H FIv2oZgJ6pPzNf22yCigwGjSgVRZ21RyHxJoJXFQCVBq+gkaCNV+m0El6yhRDNr3bT/H V77Ob+FGc/2KehQrhVsSMIVc7fCa4B0le9isKL5cuH4I96PHVvs7OEkKIH/sz2lbkGSI fKWwm/BVFaQl2BqrQvbIaT2qQhSa4MjP/qAaskrkrUbb81gW9eBEvHrE9t5mZwprt69E nn/LQQEIC4C3iHXFLfaZBgc+Ps2CPkX8xs0pq1u3tKV8QP54qlI6PAWHvxpdP1McWzJe /tJw== 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:in-reply-to :references; bh=sRpf6/acuLzuuxVAHdZvoqfa4p3JlMn/roGdlRE15qk=; b=t2ibCCgUzU2VfElKffeegOcOcgIPArVS/ApuSm9xS1oOGJFqUMrWPpxBy+YCK61kEQ wrG0IUsmnMImrwSEZKCfelllFrGIbRoZjeJtaRACLr+K/VDNgKSrrjzTUt7nKkREe3Ml dSCdt1nM8m6HToaOud8TykzOEMFu1Nx72DsOywM7Kt9hMfpUw2pAfuQ3CjoHEzEylJT5 Wco8eESpPTZ3zNKlKFa5sF/jnEDhugr5ZM5xRLvUjYiYk4HPQSqhwa9deJzjr9TD0F1U PimucsfheUPfvkhumiW3wCWE+fUBKTwvDsOtLdbyyw9CJzZiDdBPa2Zj4It9s92WPfJr 6L4w== X-Gm-Message-State: AODbwcCtKTd0Z6Og5QXDX8L6B0J9KfuPUzzb/BwITKSNF2aRaf0s738E UNShp267Hp5XbKNU X-Received: by 10.98.138.150 with SMTP id o22mr20040120pfk.120.1495372579771; Sun, 21 May 2017 06:16:19 -0700 (PDT) Received: from roar.ozlabs.ibm.com (149.45.218.139.dynamic.dsl.dv.iprimus.net.au. [139.218.45.149]) by smtp.gmail.com with ESMTPSA id x80sm26285428pff.105.2017.05.21.06.16.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 May 2017 06:16:18 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 3/9] powerpc/64s: SLB miss already has CTR saved for relocatable kernel Date: Sun, 21 May 2017 23:15:44 +1000 Message-Id: <20170521131550.25813-4-npiggin@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170521131550.25813-1-npiggin@gmail.com> References: <20170521131550.25813-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The EXCEPTION_PROLOG_1 used by SLB miss already saves CTR when the kernel is built with CONFIG_RELOCATABLE. So it does not have to be saved and reloaded when branching to slb_miss_realmode. It can be restored from the PACA as usual. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index a4a71bce35d6..486e205cc762 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -519,7 +519,7 @@ EXC_REAL_BEGIN(data_access_slb, 0x380, 0x80) * because the distance from here to there depends on where * the kernel ends up being put. */ - mfctr r11 + /* CTR is saved if RELOCATABLE */ LOAD_HANDLER(r10, slb_miss_realmode) mtctr r10 bctr @@ -542,7 +542,7 @@ EXC_VIRT_BEGIN(data_access_slb, 0x4380, 0x80) * because the distance from here to there depends on where * the kernel ends up being put. */ - mfctr r11 + /* CTR is saved if RELOCATABLE */ LOAD_HANDLER(r10, slb_miss_realmode) mtctr r10 bctr @@ -582,7 +582,7 @@ EXC_REAL_BEGIN(instruction_access_slb, 0x480, 0x80) #ifndef CONFIG_RELOCATABLE b slb_miss_realmode #else - mfctr r11 + /* CTR is saved if RELOCATABLE */ LOAD_HANDLER(r10, slb_miss_realmode) mtctr r10 bctr @@ -600,7 +600,7 @@ EXC_VIRT_BEGIN(instruction_access_slb, 0x4480, 0x80) #ifndef CONFIG_RELOCATABLE b slb_miss_realmode #else - mfctr r11 + /* CTR is saved if RELOCATABLE */ LOAD_HANDLER(r10, slb_miss_realmode) mtctr r10 bctr @@ -622,10 +622,6 @@ EXC_COMMON_BEGIN(slb_miss_realmode) * procedure. */ mflr r10 -#ifdef CONFIG_RELOCATABLE - mtctr r11 -#endif - stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ std r10,PACA_EXSLB+EX_LR(r13) /* save LR */ @@ -654,6 +650,7 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_RADIX) mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */ .machine pop + RESTORE_CTR(r9, PACA_EXSLB) RESTORE_PPR_PACA(PACA_EXSLB, r9) ld r3,PACA_EXSLB+EX_R3(r13) ld r9,PACA_EXSLB+EX_R9(r13)