From patchwork Mon Nov 17 16:47:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40969 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F327F24035 for ; Mon, 17 Nov 2014 17:08:04 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf1246791eek.1 for ; Mon, 17 Nov 2014 09:08:04 -0800 (PST) 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:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=IP1NUOCtH26bGiW7OnVBlOKYwEmo1ULYjqkFjjRGMTs=; b=djZ0NBoD5dAqVpCo0V+IDCTHAbmlex7I0nXjrH5wXV9CViDPSvLa89LibkMHfgNGa/ 9ytDHGo/kFa/DKwSNFdWeE0XMVjTEf354KYkyeGVnr77LapTHKGheOwSXAAPfKRLJzW2 jREJ3DLz3S9t5/fPommg00Z1XWFOhVMaevVUlg6GAfSKZhN+elz4jttutvNl8Fe4sCs3 2zulg+nE9O/MSFcLfSaiXgXxGxrWs3YeSWPi+sYZSzuGI2TTi0Edg55bMRoj3mEe6+x0 cDcZxRbWTadU5ZNxgyLOylpQDUK78ei5V0ddZ4Q4fnB/8E6aqpvUh8B2GN6X45rvlC8K cUyg== X-Gm-Message-State: ALoCoQkTGYmHkqgBVKHPpMjDtvfLGXFT5lnLL/d6iWs8G3KfuzSRzZNhr+TYS3NWHiwWBrvK8kXO X-Received: by 10.152.10.233 with SMTP id l9mr6199992lab.0.1416244083882; Mon, 17 Nov 2014 09:08:03 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.170 with SMTP id p10ls92949lal.35.gmail; Mon, 17 Nov 2014 09:08:03 -0800 (PST) X-Received: by 10.112.200.34 with SMTP id jp2mr29345200lbc.1.1416244083576; Mon, 17 Nov 2014 09:08:03 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id r8si19341182laj.68.2014.11.17.09.08.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Nov 2014 09:08:03 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id hz20so8549716lab.31 for ; Mon, 17 Nov 2014 09:08:03 -0800 (PST) X-Received: by 10.152.6.228 with SMTP id e4mr12124831laa.71.1416244083415; Mon, 17 Nov 2014 09:08:03 -0800 (PST) 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.112.184.201 with SMTP id ew9csp1190451lbc; Mon, 17 Nov 2014 09:08:02 -0800 (PST) X-Received: by 10.170.117.73 with SMTP id j70mr4250506ykb.76.1416244081666; Mon, 17 Nov 2014 09:08:01 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i7si64625865qan.31.2014.11.17.09.08.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 17 Nov 2014 09:08:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqPmS-0001ta-5Y for patch@linaro.org; Mon, 17 Nov 2014 12:08:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqPU0-0002JY-Sg for qemu-devel@nongnu.org; Mon, 17 Nov 2014 11:49:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqPTv-0007HH-BR for qemu-devel@nongnu.org; Mon, 17 Nov 2014 11:48:56 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:37557) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqPTk-0007Fu-60 for qemu-devel@nongnu.org; Mon, 17 Nov 2014 11:48:51 -0500 Received: by mail-pa0-f52.google.com with SMTP id eu11so1743674pac.11 for ; Mon, 17 Nov 2014 08:48:39 -0800 (PST) X-Received: by 10.68.203.41 with SMTP id kn9mr30541451pbc.47.1416242919513; Mon, 17 Nov 2014 08:48:39 -0800 (PST) Received: from gbellows-linaro.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com. [67.52.129.61]) by mx.google.com with ESMTPSA id r2sm18499056pdi.60.2014.11.17.08.48.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Nov 2014 08:48:38 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, serge.fdrv@gmail.com, edgar.iglesias@gmail.com, aggelerf@ethz.ch, peter.maydell@linaro.org Date: Mon, 17 Nov 2014 10:47:52 -0600 Message-Id: <1416242878-876-21-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1416242878-876-1-git-send-email-greg.bellows@linaro.org> References: <1416242878-876-1-git-send-email-greg.bellows@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.52 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v11 20/26] target-arm: make DFSR banked X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: greg.bellows@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) 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 From: Fabian Aggeler When EL3 is running in AArch32 (or ARMv7 with Security Extensions) DFSR has a secure and a non-secure instance. Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows Reviewed-by: Peter Maydell --- v3 -> v4 - Reverted esr/dfsr back to array-based notation as a union with v7 naming. --- target-arm/cpu.h | 10 +++++++++- target-arm/helper.c | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index e8bb057..29870bd 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -251,7 +251,15 @@ typedef struct CPUARMState { uint64_t ifsr32_el2; }; }; - uint64_t esr_el[4]; + union { + struct { + uint64_t _unused_dfsr; + uint64_t dfsr_ns; + uint64_t hsr; + uint64_t dfsr_s; + }; + uint64_t esr_el[4]; + }; uint32_t c6_region[8]; /* MPU base/size registers. */ uint64_t far_el[4]; /* Fault address registers. */ uint64_t par_el1; /* Translation result. */ diff --git a/target-arm/helper.c b/target-arm/helper.c index 1ed7bd2..eb0f8b4 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1651,7 +1651,8 @@ static void vmsa_ttbr_write(CPUARMState *env, const ARMCPRegInfo *ri, static const ARMCPRegInfo vmsa_cp_reginfo[] = { { .name = "DFSR", .cp = 15, .crn = 5, .crm = 0, .opc1 = 0, .opc2 = 0, .access = PL1_RW, .type = ARM_CP_NO_MIGRATE, - .fieldoffset = offsetoflow32(CPUARMState, cp15.esr_el[1]), + .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.dfsr_s), + offsetoflow32(CPUARMState, cp15.dfsr_ns) }, .resetfn = arm_cp_reset_ignore, }, { .name = "IFSR", .cp = 15, .crn = 5, .crm = 0, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .resetvalue = 0, @@ -4339,11 +4340,11 @@ void arm_cpu_do_interrupt(CPUState *cs) offset = 4; break; case EXCP_DATA_ABORT: - env->cp15.esr_el[1] = env->exception.fsr; + A32_BANKED_CURRENT_REG_SET(env, dfsr, env->exception.fsr); env->cp15.far_el[1] = deposit64(env->cp15.far_el[1], 0, 32, env->exception.vaddress); qemu_log_mask(CPU_LOG_INT, "...with DFSR 0x%x DFAR 0x%x\n", - (uint32_t)env->cp15.esr_el[1], + env->exception.fsr, (uint32_t)env->exception.vaddress); new_mode = ARM_CPU_MODE_ABT; addr = 0x10;