From patchwork Thu Nov 6 15:51:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40350 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A1CFF20C4E for ; Thu, 6 Nov 2014 16:05:51 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gq15sf1966501lab.2 for ; Thu, 06 Nov 2014 08:05:50 -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=E7GBBYGr3vt1VS9bVpitOXx5TqCcUSUz48JzNHT4EbA=; b=c/kMWxJaQx+wW2F5sJMOk615sfbEV4zPQUJlhNCz6Ij3WOqcg0zDFMAdfGD0wjCDXZ IP5OtTITVboW4Nu4icI1BzTMF1lpjSoR/qcdwn5yIHQMxjZbrMN4Gik5qJA8XAlQfVZj 8HyGq/Dd0m+B6Q9IJj0c8usjBCWhVtUg7A+ul4awYE1td1e+P7nj1GCQBcEvlaaPHlPR nLOfM6aKknpVCNOPpFILefX7/fQwweRhiyFKC1RQ7T7ehPcNqcotKvjZoR5sKY8GOrBb R3FN6TDmvpvEv2JOAZns1DMknaP25R/m8TvLQQVUmCZ1SszA6RfHdY78AuPLSbbCURe2 ZsqQ== X-Gm-Message-State: ALoCoQkiX9l4EZB1SfAhHlGfeakltYMc2KuTH2LXLJvYqTkWqztNY+xwyzvV4OX+ycSgR5IjpuuT X-Received: by 10.194.91.180 with SMTP id cf20mr829441wjb.4.1415289950656; Thu, 06 Nov 2014 08:05:50 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.135 with SMTP id jo7ls103720lab.108.gmail; Thu, 06 Nov 2014 08:05:50 -0800 (PST) X-Received: by 10.152.170.194 with SMTP id ao2mr5952989lac.60.1415289950387; Thu, 06 Nov 2014 08:05:50 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id ke10si11980615lbc.41.2014.11.06.08.05.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 08:05:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id gm9so2807667lab.5 for ; Thu, 06 Nov 2014 08:05:50 -0800 (PST) X-Received: by 10.152.116.102 with SMTP id jv6mr199027lab.40.1415289950286; Thu, 06 Nov 2014 08:05:50 -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 ew9csp67378lbc; Thu, 6 Nov 2014 08:05:49 -0800 (PST) X-Received: by 10.170.53.216 with SMTP id 207mr5383679ykv.60.1415289948536; Thu, 06 Nov 2014 08:05:48 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h5si12493360qcm.23.2014.11.06.08.05.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Nov 2014 08:05:48 -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]:54681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPZD-0007nB-M6 for patch@linaro.org; Thu, 06 Nov 2014 11:05:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPM4-0002Ph-DG for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmPLz-0004Od-5E for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:12 -0500 Received: from mail-pd0-f182.google.com ([209.85.192.182]:38548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPLz-0004OY-0X for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:07 -0500 Received: by mail-pd0-f182.google.com with SMTP id fp1so1373147pdb.13 for ; Thu, 06 Nov 2014 07:52:06 -0800 (PST) X-Received: by 10.70.123.228 with SMTP id md4mr5121996pdb.159.1415289126468; Thu, 06 Nov 2014 07:52:06 -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 z9sm6245585pdp.73.2014.11.06.07.52.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 07:52:05 -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: Thu, 6 Nov 2014 09:51:07 -0600 Message-Id: <1415289073-14681-21-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415289073-14681-1-git-send-email-greg.bellows@linaro.org> References: <1415289073-14681-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.192.182 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v10 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.46 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 c271ab2..e627843 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 f47748b..6246c38 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, @@ -4340,11 +4341,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;