From patchwork Thu Nov 6 15:51:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40353 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A4B6F20C4E for ; Thu, 6 Nov 2014 16:08:37 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id ex7sf863074wid.8 for ; Thu, 06 Nov 2014 08:08:36 -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=yJAAM0uCeBfo1SoCkf0sDNlIc2077P2UFyElB+ITMis=; b=Ox8Q/r+mBWGc3ovGUCEdxGeMZf6lp8zPS92w7Dl+Dx1zn1sdj26s//MAkvQUGmfV1M 2h+l4ZZUs1tdA45mK+B6bkMa0NoPlagAmzpSk2nyM+9T03l1mFeuF0OencAgF10F0VXw pbwpjrT2MMY1Cngod1TmJY/AtAJF0YHN0IPjSP+mTzBab9zPE7HOybd8MK067K1wpAgI MhRCHnoAmbPSVaPUo6HCzr27NzIj37BmN+JwTNeXnOg4d9qXLbFgHZ0ZX4uWwXyl7Sps jL1JXj+tXPScQmacPrCpj3iskE+1eZPOH5PJixhlYVURPyquiZChH6HqdU8PrIwxcDDN N2lQ== X-Gm-Message-State: ALoCoQldaAr+ZoCoF7E/FYaBiH4ZZTL6Aui8fzMylDeqtXTFViSZcaDDkqKvDAkdwuoQUDuEBek8 X-Received: by 10.112.138.202 with SMTP id qs10mr904191lbb.5.1415290116947; Thu, 06 Nov 2014 08:08:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.40 with SMTP id p8ls84578lah.106.gmail; Thu, 06 Nov 2014 08:08:36 -0800 (PST) X-Received: by 10.152.20.72 with SMTP id l8mr5863918lae.43.1415290116651; Thu, 06 Nov 2014 08:08:36 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id oz1si5921255lbb.88.2014.11.06.08.08.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 08:08:36 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so1289087lbj.37 for ; Thu, 06 Nov 2014 08:08:36 -0800 (PST) X-Received: by 10.112.12.35 with SMTP id v3mr5884474lbb.80.1415290116194; Thu, 06 Nov 2014 08:08:36 -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 ew9csp67798lbc; Thu, 6 Nov 2014 08:08:35 -0800 (PST) X-Received: by 10.224.45.65 with SMTP id d1mr8108217qaf.43.1415290114207; Thu, 06 Nov 2014 08:08:34 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id c50si12347908qgc.116.2014.11.06.08.08.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Nov 2014 08:08:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Received: from localhost ([::1]:54712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPbp-0003RP-2S for patch@linaro.org; Thu, 06 Nov 2014 11:08:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPM6-0002V1-SU for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmPM1-0004PI-Bk for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:14 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:44417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPM1-0004P4-4H for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:09 -0500 Received: by mail-pa0-f50.google.com with SMTP id eu11so1470281pac.23 for ; Thu, 06 Nov 2014 07:52:08 -0800 (PST) X-Received: by 10.70.128.11 with SMTP id nk11mr5091089pdb.113.1415289128555; Thu, 06 Nov 2014 07:52:08 -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.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 07:52:07 -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:08 -0600 Message-Id: <1415289073-14681-22-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.220.50 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v10 21/26] target-arm: make IFAR/DFAR 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.217.178 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) IFAR and DFAR have a secure and a non-secure instance. Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows Reviewed-by: Peter Maydell --- v8 -> v9 - Reordered CP register component order - Removed extra semicolon v3 -> v4 - Revert to array-based notation of far_el in combination with v7 naming --- target-arm/cpu.c | 2 +- target-arm/cpu.h | 19 ++++++++++++++++++- target-arm/helper.c | 16 +++++++++------- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/target-arm/cpu.c b/target-arm/cpu.c index fdb7b35..d3db279 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -552,7 +552,7 @@ static void arm1026_initfn(Object *obj) ARMCPRegInfo ifar = { .name = "IFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1, .access = PL1_RW, - .fieldoffset = offsetofhigh32(CPUARMState, cp15.far_el[1]), + .fieldoffset = offsetof(CPUARMState, cp15.ifar_ns), .resetvalue = 0 }; define_one_arm_cp_reg(cpu, &ifar); diff --git a/target-arm/cpu.h b/target-arm/cpu.h index e627843..9518fc7 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -261,7 +261,24 @@ typedef struct CPUARMState { uint64_t esr_el[4]; }; uint32_t c6_region[8]; /* MPU base/size registers. */ - uint64_t far_el[4]; /* Fault address registers. */ + union { /* Fault address registers. */ + struct { + uint64_t _unused_far0; +#ifdef HOST_WORDS_BIGENDIAN + uint32_t ifar_ns; + uint32_t dfar_ns; + uint32_t ifar_s; + uint32_t dfar_s; +#else + uint32_t dfar_ns; + uint32_t ifar_ns; + uint32_t dfar_s; + uint32_t ifar_s; +#endif + uint64_t _unused_far3; + }; + uint64_t far_el[4]; + }; uint64_t par_el1; /* Translation result. */ uint32_t c9_insn; /* Cache lockdown registers. */ uint32_t c9_data; diff --git a/target-arm/helper.c b/target-arm/helper.c index 6246c38..6296731 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -559,7 +559,8 @@ static const ARMCPRegInfo v6_cp_reginfo[] = { .access = PL0_W, .type = ARM_CP_NOP }, { .name = "IFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 2, .access = PL1_RW, - .fieldoffset = offsetofhigh32(CPUARMState, cp15.far_el[1]), + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ifar_s), + offsetof(CPUARMState, cp15.ifar_ns) }, .resetvalue = 0, }, /* Watchpoint Fault Address Register : should actually only be present * for 1136, 1176, 11MPCore. @@ -1682,11 +1683,14 @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { .resetfn = arm_cp_reset_ignore, .raw_writefn = vmsa_ttbcr_raw_write, .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tcr_el[3]), offsetoflow32(CPUARMState, cp15.tcr_el[1])} }, - /* 64-bit FAR; this entry also gives us the AArch32 DFAR */ - { .name = "FAR_EL1", .state = ARM_CP_STATE_BOTH, + { .name = "FAR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 0, .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.far_el[1]), .resetvalue = 0, }, + { .name = "DFAR", .cp = 15, .opc1 = 0, .crn = 6, .crm = 0, .opc2 = 0, + .access = PL1_RW, .resetvalue = 0, + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.dfar_s), + offsetof(CPUARMState, cp15.dfar_ns) } }, REGINFO_SENTINEL }; @@ -4331,8 +4335,7 @@ void arm_cpu_do_interrupt(CPUState *cs) /* Fall through to prefetch abort. */ case EXCP_PREFETCH_ABORT: A32_BANKED_CURRENT_REG_SET(env, ifsr, env->exception.fsr); - env->cp15.far_el[1] = deposit64(env->cp15.far_el[1], 32, 32, - env->exception.vaddress); + A32_BANKED_CURRENT_REG_SET(env, ifar, env->exception.vaddress); qemu_log_mask(CPU_LOG_INT, "...with IFSR 0x%x IFAR 0x%x\n", env->exception.fsr, (uint32_t)env->exception.vaddress); new_mode = ARM_CPU_MODE_ABT; @@ -4342,8 +4345,7 @@ void arm_cpu_do_interrupt(CPUState *cs) break; case EXCP_DATA_ABORT: 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); + A32_BANKED_CURRENT_REG_SET(env, dfar, env->exception.vaddress); qemu_log_mask(CPU_LOG_INT, "...with DFSR 0x%x DFAR 0x%x\n", env->exception.fsr, (uint32_t)env->exception.vaddress);