From patchwork Tue May 6 23:32:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Bassel X-Patchwork-Id: 29742 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C99D12055C for ; Tue, 6 May 2014 23:33:00 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wm4sf1043674obc.10 for ; Tue, 06 May 2014 16:33:00 -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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=lzRbhj2/LBdOJDTwhdYLUVuPLqEQAu5+V25zEAVgjpQ=; b=N2GVO4lt6UMcNM9dVZgO9+fRHb3y3wZcGTLAEtpiomev2qqOKG0sR1OuCVXYeTar9n otsskIIMhCgc7eMmqWOpf8H1MSv3goMoUo4GlugkI5gSMX4fz6C+vZZj/WW7tJEIozPd lPX19RcupN2OpykviOJ7G2nVv50J8kN3PG3sUB6cRXGSQOcEYpre96M0F+xtulFO1hVS 8RjKpTgOISNJsbgXXKC2iJ+GyqN680CnJI5XmI6r59MPdlglNvuboE4F79dYnc/Ak7/8 0xE4jT8u5lClkzXqDb/izIbZnClwM9/JRzpz4T6T6r8GOD+JehSb9Twb43NUsCFtzSWK EXxg== X-Gm-Message-State: ALoCoQle2l4AMhay3iAEaDHmmnIJt43J4FJf5tjA+r//9MRJIf6cZg2TY9dJzPmzaVVDH4LOs10e X-Received: by 10.43.88.73 with SMTP id az9mr2411419icc.5.1399419180282; Tue, 06 May 2014 16:33:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.210 with SMTP id o76ls2989605qga.66.gmail; Tue, 06 May 2014 16:33:00 -0700 (PDT) X-Received: by 10.52.255.65 with SMTP id ao1mr2739169vdd.43.1399419180155; Tue, 06 May 2014 16:33:00 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id sa1si1192880vdb.196.2014.05.06.16.33.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 May 2014 16:33:00 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ib6so259234vcb.5 for ; Tue, 06 May 2014 16:33:00 -0700 (PDT) X-Received: by 10.58.23.6 with SMTP id i6mr35023065vef.12.1399419180067; Tue, 06 May 2014 16:33:00 -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.220.221.72 with SMTP id ib8csp263222vcb; Tue, 6 May 2014 16:32:59 -0700 (PDT) X-Received: by 10.66.221.99 with SMTP id qd3mr11872119pac.46.1399419178930; Tue, 06 May 2014 16:32:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ap2si827117pbc.218.2014.05.06.16.32.58; Tue, 06 May 2014 16:32:58 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-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 S1753949AbaEFXcr (ORCPT + 27 others); Tue, 6 May 2014 19:32:47 -0400 Received: from mail-qa0-f45.google.com ([209.85.216.45]:52721 "EHLO mail-qa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753458AbaEFXcp (ORCPT ); Tue, 6 May 2014 19:32:45 -0400 Received: by mail-qa0-f45.google.com with SMTP id hw13so211534qab.18 for ; Tue, 06 May 2014 16:32:44 -0700 (PDT) X-Received: by 10.224.134.194 with SMTP id k2mr59477484qat.5.1399419164517; Tue, 06 May 2014 16:32:44 -0700 (PDT) Received: from localhost.localdomain (adsl-71-136-229-99.dsl.sndg02.pacbell.net. [71.136.229.99]) by mx.google.com with ESMTPSA id 104sm17635231qgq.1.2014.05.06.16.32.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 May 2014 16:32:44 -0700 (PDT) From: Larry Bassel To: catalin.marinas@arm.com, will.deacon@arm.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, khilman@linaro.org, Larry Bassel Subject: [PATCH v2 1/2] arm64: adjust el0_sync so that a function can be called Date: Tue, 6 May 2014 16:32:28 -0700 Message-Id: <1399419149-26685-2-git-send-email-larry.bassel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1399419149-26685-1-git-send-email-larry.bassel@linaro.org> References: <1399419149-26685-1-git-send-email-larry.bassel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: larry.bassel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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: , To implement the context tracker properly on arm64, a function call needs to be made after debugging and interrupts are turned on, but before the lr is changed to point to ret_from_exception(). If the function call is made after the lr is changed the function will not return to the correct place. For similar reasons, defer the setting of x0 so that it doesn't need to be saved around the function call (save far_el1 in x26 temporarily instead). Signed-off-by: Larry Bassel Reviewed-by: Kevin Hilman --- arch/arm64/kernel/entry.S | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 39ac630..d920d7f 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -349,11 +349,11 @@ el0_sync: lsr x24, x25, #ESR_EL1_EC_SHIFT // exception class cmp x24, #ESR_EL1_EC_SVC64 // SVC in 64-bit state b.eq el0_svc - adr lr, ret_from_exception cmp x24, #ESR_EL1_EC_DABT_EL0 // data abort in EL0 b.eq el0_da cmp x24, #ESR_EL1_EC_IABT_EL0 // instruction abort in EL0 b.eq el0_ia + adr lr, ret_from_exception cmp x24, #ESR_EL1_EC_FP_ASIMD // FP/ASIMD access b.eq el0_fpsimd_acc cmp x24, #ESR_EL1_EC_FP_EXC64 // FP/ASIMD exception @@ -378,11 +378,11 @@ el0_sync_compat: lsr x24, x25, #ESR_EL1_EC_SHIFT // exception class cmp x24, #ESR_EL1_EC_SVC32 // SVC in 32-bit state b.eq el0_svc_compat - adr lr, ret_from_exception cmp x24, #ESR_EL1_EC_DABT_EL0 // data abort in EL0 b.eq el0_da cmp x24, #ESR_EL1_EC_IABT_EL0 // instruction abort in EL0 b.eq el0_ia + adr lr, ret_from_exception cmp x24, #ESR_EL1_EC_FP_ASIMD // FP/ASIMD access b.eq el0_fpsimd_acc cmp x24, #ESR_EL1_EC_FP_EXC32 // FP/ASIMD exception @@ -421,28 +421,32 @@ el0_da: /* * Data abort handling */ - mrs x0, far_el1 - bic x0, x0, #(0xff << 56) + mrs x26, far_el1 disable_step x1 isb enable_dbg // enable interrupts before calling the main handler enable_irq + mov x0, x26 + bic x0, x0, #(0xff << 56) mov x1, x25 mov x2, sp + adr lr, ret_from_exception b do_mem_abort el0_ia: /* * Instruction abort handling */ - mrs x0, far_el1 + mrs x26, far_el1 disable_step x1 isb enable_dbg // enable interrupts before calling the main handler enable_irq + mov x0, x26 orr x1, x25, #1 << 24 // use reserved ISS bit for instruction aborts mov x2, sp + adr lr, ret_from_exception b do_mem_abort el0_fpsimd_acc: /*