From patchwork Fri Oct 10 16:03:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 398709 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DE8EA140092 for ; Sat, 11 Oct 2014 03:12:14 +1100 (EST) Received: from localhost ([::1]:49446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xccnc-0003BA-Ne for incoming@patchwork.ozlabs.org; Fri, 10 Oct 2014 12:12:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xccg7-0007Om-22 for qemu-devel@nongnu.org; Fri, 10 Oct 2014 12:04:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xccg1-00088p-Pl for qemu-devel@nongnu.org; Fri, 10 Oct 2014 12:04:26 -0400 Received: from mail-oi0-f51.google.com ([209.85.218.51]:35993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xccg1-00088b-FC for qemu-devel@nongnu.org; Fri, 10 Oct 2014 12:04:21 -0400 Received: by mail-oi0-f51.google.com with SMTP id h136so7098388oig.10 for ; Fri, 10 Oct 2014 09:04:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=LuOEYcA3l3sgrwqfTgI96U2VFbCQpq8yTMmkp/ee0I0=; b=hIWAz3gPxUE0BIS+d2XPLBJU8j5d6sOMLHCCOef0j759EpV53X8isqW7QDRgxuT+ZF DUsSFI5NZppXcsSLhMRaPpg8jLmla7kWq5iXoXWNEvDJn3HIsX/1CYr2qYTZde5LCqRR CBjN3fGBrGQ47LNV0Xdoj/K8qgDR0w/uMg7Ii9TUUT31SsetxtKBGYxmA1BCWWdXNhtD 7hnQrBmHgKvARbafVenw7iuFo9fg+/RqU0KzaSMdAeZQmpkVjbVF9zCAIOWXB/THOFHb CeI9xv4IgmaRv18axAAI5bP0Xpp6rYAKIvRHR2DUwXyLo9AiddKRTwvhYNec1S4+UXJI fm3Q== X-Gm-Message-State: ALoCoQn3Ohgk+tSR90MJS9h0KurbtoBtamXnMqC+kDYQgRONRd4Bs7+FBQqH1EMsf6+aSC6N0Zc+ X-Received: by 10.182.191.102 with SMTP id gx6mr2943493obc.60.1412957061143; Fri, 10 Oct 2014 09:04:21 -0700 (PDT) Received: from gbellows-linaro.bellowshome.net (99-179-1-128.lightspeed.austtx.sbcglobal.net. [99.179.1.128]) by mx.google.com with ESMTPSA id d6sm5382455obt.12.2014.10.10.09.04.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Oct 2014 09:04:20 -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: Fri, 10 Oct 2014 11:03:38 -0500 Message-Id: <1412957023-11105-28-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1412957023-11105-1-git-send-email-greg.bellows@linaro.org> References: <1412957023-11105-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.218.51 Subject: [Qemu-devel] [PATCH v6 27/32] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --------------- 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 adb51d3..66206f9 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 af6b371..9fdbbbf 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1663,7 +1663,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, @@ -4366,11 +4367,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;