From patchwork Sun Apr 27 19:44:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Bassel X-Patchwork-Id: 29163 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7727F20534 for ; Sun, 27 Apr 2014 19:44:53 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id oz11sf24667897veb.1 for ; Sun, 27 Apr 2014 12:44:53 -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=qw2B4u/sWyKrnjysQEZUUVsvVUAjpgY9aTjVNCihgIE=; b=KRMbCIgLxqieVJ1VsAui4lNts7z4/7RNu96p0WWG8JgZCKz3klOdTeVhU7hs871NUI 6Vlm25LDy3WQ6iPmx2sNWDtLZbdd4iNIMpGBDX0qAS8TLDliYHo8MtpGZDdpWQRMDSlS EgU9spJzuYWNSP0ubI6NYVB0900tJPmWbLGyeWKylKClMT9GdqDeRK0RawoQrQwm9mU/ FtPNb1qV4hvw9P7g1/y7TZUaOF+Me9Hk7i742dDJO2wd93kUBaAEDCm/Fk03nrO9uJ7M AOK5RxBikwsJ7MVMRSZuvDNdFwMekPJCScf0RqWGG6Er20tyAyziIa4XAellMB/6N4BA MMjw== X-Gm-Message-State: ALoCoQl4Cwr8Wu4sTSvDPB/PZQ5ZME7Es8Aw+q6M6RGB9fgssZppYn78nr7c0fTu/ifpCnrtSYhP X-Received: by 10.236.181.74 with SMTP id k50mr9273362yhm.46.1398627893166; Sun, 27 Apr 2014 12:44:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.70 with SMTP id u64ls2236575qgd.80.gmail; Sun, 27 Apr 2014 12:44:53 -0700 (PDT) X-Received: by 10.220.4.132 with SMTP id 4mr19730272vcr.9.1398627892999; Sun, 27 Apr 2014 12:44:52 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id qr10si3137254vcb.189.2014.04.27.12.44.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 27 Apr 2014 12:44:52 -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.178; Received: by mail-vc0-f178.google.com with SMTP id hu19so7030368vcb.37 for ; Sun, 27 Apr 2014 12:44:52 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr19673826vcb.0.1398627892911; Sun, 27 Apr 2014 12:44:52 -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 ib8csp70459vcb; Sun, 27 Apr 2014 12:44:52 -0700 (PDT) X-Received: by 10.66.232.68 with SMTP id tm4mr21160803pac.114.1398627892174; Sun, 27 Apr 2014 12:44:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vw5si8937181pab.374.2014.04.27.12.44.50 for ; Sun, 27 Apr 2014 12:44:50 -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 S1753929AbaD0Tok (ORCPT + 28 others); Sun, 27 Apr 2014 15:44:40 -0400 Received: from mail-qg0-f43.google.com ([209.85.192.43]:40225 "EHLO mail-qg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753415AbaD0Toc (ORCPT ); Sun, 27 Apr 2014 15:44:32 -0400 Received: by mail-qg0-f43.google.com with SMTP id a108so6148357qge.30 for ; Sun, 27 Apr 2014 12:44:31 -0700 (PDT) X-Received: by 10.140.49.207 with SMTP id q73mr3133367qga.103.1398627871311; Sun, 27 Apr 2014 12:44:31 -0700 (PDT) Received: from localhost.localdomain (adsl-71-136-233-53.dsl.sndg02.pacbell.net. [71.136.233.53]) by mx.google.com with ESMTPSA id g7sm28465898qaf.14.2014.04.27.12.44.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 27 Apr 2014 12:44:30 -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 1/3] arm64: adjust el0_sync so that a function can be called Date: Sun, 27 Apr 2014 12:44:12 -0700 Message-Id: <1398627854-9617-2-git-send-email-larry.bassel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398627854-9617-1-git-send-email-larry.bassel@linaro.org> References: <1398627854-9617-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. Signed-off-by: Larry Bassel Reviewed-by: Kevin Hilman --- arch/arm64/kernel/entry.S | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 39ac630..eda7755 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,30 @@ el0_da: /* * Data abort handling */ - mrs x0, far_el1 - bic x0, x0, #(0xff << 56) disable_step x1 isb enable_dbg // enable interrupts before calling the main handler enable_irq + mrs x0, far_el1 + 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 disable_step x1 isb enable_dbg // enable interrupts before calling the main handler enable_irq + mrs x0, far_el1 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: /*