From patchwork Thu Oct 30 21:28: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: 39944 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 06438202FE for ; Fri, 31 Oct 2014 17:36:44 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id k14sf4400380wgh.7 for ; Fri, 31 Oct 2014 10:36:44 -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: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=iXwklLVCO2msMGOx8atA4W5JY7U8g3aUqj6aqgIvKWA=; b=Na0s7uYds79rmnzHE8c02VsIEvLZnJhroWtD8hBTW33SsR8OoSN6P02k/q71JaXQTZ ArUSwXYPL3LeMz3rY/wFr2FXexS+J0GTQhjrdCz3WTfthGNSzLnBvubQdccjywX0HtYs 2Pwi800l//q4guq/EPNsVWi2Q+1Fi2HudIi7Ew7oCofQAwyvEWpwMsDiH1/Bj7ktyZ4z 1Pfj9WhrShs3dGiN1ZNN3/TWFLR1VNQDmlXw/3s4fQe68++SH0RM2vh84UaXzDNH72hd LenFoBzOH0RJHwlO/MtuUxYmP8JmLrfn4UEsJNmLh0y3YAZBQdFDO2XYaG/OrbqmIvo5 oNoA== X-Gm-Message-State: ALoCoQnr5BHDzs04wAbeF/J0oZmOBHz2JRGYeQIghN9yGpyBD9YcNTsZyrMU5wgeVCwP4PBNdK1K X-Received: by 10.112.38.101 with SMTP id f5mr4277255lbk.7.1414777004231; Fri, 31 Oct 2014 10:36:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.40 with SMTP id p8ls416751lah.106.gmail; Fri, 31 Oct 2014 10:36:43 -0700 (PDT) X-Received: by 10.152.28.134 with SMTP id b6mr28757894lah.12.1414777003705; Fri, 31 Oct 2014 10:36:43 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id ew1si1629276lbc.134.2014.10.31.10.36.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 10:36:43 -0700 (PDT) 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 gf13so6658073lab.17 for ; Fri, 31 Oct 2014 10:36:43 -0700 (PDT) X-Received: by 10.152.5.38 with SMTP id p6mr27742000lap.44.1414777003574; Fri, 31 Oct 2014 10:36:43 -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.112.84.229 with SMTP id c5csp237293lbz; Fri, 31 Oct 2014 10:36:42 -0700 (PDT) X-Received: by 10.224.79.146 with SMTP id p18mr37406036qak.67.1414777002098; Fri, 31 Oct 2014 10:36:42 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u16si18148942qaj.39.2014.10.31.10.36.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Oct 2014 10:36:42 -0700 (PDT) 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]:40024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkG7s-0007Bn-VA for patch@linaro.org; Fri, 31 Oct 2014 13:36:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkE63-0006Cd-7x for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:27:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjxHo-0005CD-Ey for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:45 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:58361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjxHo-0005Ba-9R for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:40 -0400 Received: by mail-pa0-f45.google.com with SMTP id lf10so6256757pab.18 for ; Thu, 30 Oct 2014 14:29:39 -0700 (PDT) X-Received: by 10.66.187.209 with SMTP id fu17mr20672811pac.120.1414704579647; Thu, 30 Oct 2014 14:29:39 -0700 (PDT) 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 o5sm8017713pdr.50.2014.10.30.14.29.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 14:29:38 -0700 (PDT) From: Greg Bellows To: qemu-devel@nongnu.org, peter.maydell@linaro.org, serge.fdrv@gmail.com, edgar.iglesias@gmail.com, aggelerf@ethz.ch Date: Thu, 30 Oct 2014 16:28:52 -0500 Message-Id: <1414704538-17103-22-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1414704538-17103-1-git-send-email-greg.bellows@linaro.org> References: <1414704538-17103-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.45 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v8 21/27] 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 c44649e..29bf273 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -260,7 +260,15 @@ typedef struct CPUARMState { uint32_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 de355f5..c5948f7 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1650,7 +1650,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, @@ -4309,11 +4310,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;