From patchwork Mon Jun 30 23:09:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 32819 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DE3AC203C0 for ; Mon, 30 Jun 2014 23:59:56 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id m1sf56846926oag.1 for ; Mon, 30 Jun 2014 16:59:56 -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=pNegqktU44GS7DzvfhZ6NNsgorkMaZMBeiynjX3p63k=; b=IhaWiuZEDDAiZzW4pG8qI2gGM4KzOHOVEhpaV/CvFND4JMFwcFVUFawNaO44l3WMoB I4YBW4kMoWNrsqk45QTLzjZltd8kj5Zucp+jEdNhFm+WrhKv/TfzfvoZZm1jKcCiDpPL m9cCkyf1z1kkHQZnbxZmsjATjlVB8TZlZNA/lZf1jH6ExcJboyBJUddj84mJllZWxL8a ULr/cyYDLei4QkhbJVyjdSCUP5clxL0imVgM/IAA4Liv0uKrALEgFcqH0ddIOADryZyC /7sBNhMB6cqNF8pSGyAptG/hRqXtUUgAwm8psLAC0v3sUbGNsBLJ+91vdh2kl5F011hB 7YIw== X-Gm-Message-State: ALoCoQkRTk0YdcuBHqhX91EpZ5z4UnkB7krIepVjqi4hyk4NCo5/eDxBhGYcGXnz2a3SZ8iUq80W X-Received: by 10.50.79.129 with SMTP id j1mr17697085igx.7.1404172796442; Mon, 30 Jun 2014 16:59:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.247 with SMTP id i110ls1466952qge.20.gmail; Mon, 30 Jun 2014 16:59:56 -0700 (PDT) X-Received: by 10.58.182.105 with SMTP id ed9mr18169422vec.16.1404172796311; Mon, 30 Jun 2014 16:59:56 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id q6si10742443vcm.67.2014.06.30.16.59.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 16:59:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id oy12so8901842veb.13 for ; Mon, 30 Jun 2014 16:59:56 -0700 (PDT) X-Received: by 10.220.105.136 with SMTP id t8mr40944425vco.13.1404172796221; Mon, 30 Jun 2014 16:59:56 -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.221.37.5 with SMTP id tc5csp176816vcb; Mon, 30 Jun 2014 16:59:55 -0700 (PDT) X-Received: by 10.224.104.10 with SMTP id m10mr66753978qao.27.1404172795804; Mon, 30 Jun 2014 16:59:55 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b9si27091047qad.117.2014.06.30.16.59.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 30 Jun 2014 16:59:55 -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]:37572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1lUJ-0006xw-HQ for patch@linaro.org; Mon, 30 Jun 2014 19:59:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kjX-0006sE-0I for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:11:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1kjR-0003wj-KZ for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:11:34 -0400 Received: from mail-oa0-f50.google.com ([209.85.219.50]:38033) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kjR-0003wM-FD for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:11:29 -0400 Received: by mail-oa0-f50.google.com with SMTP id n16so9785802oag.9 for ; Mon, 30 Jun 2014 16:11:29 -0700 (PDT) X-Received: by 10.60.132.44 with SMTP id or12mr6728484oeb.60.1404169889156; Mon, 30 Jun 2014 16:11:29 -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 cu7sm76370192oec.12.2014.06.30.16.11.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 16:11:28 -0700 (PDT) From: greg.bellows@linaro.org To: qemu-devel@nongnu.org Date: Mon, 30 Jun 2014 18:09:31 -0500 Message-Id: <1404169773-20264-32-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1404169773-20264-1-git-send-email-greg.bellows@linaro.org> References: <1404169773-20264-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.219.50 Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, Fabian Aggeler , Greg Bellows , serge.fdrv@gmail.com, edgar.iglesias@gmail.com, christoffer.dall@linaro.org Subject: [Qemu-devel] [PATCH v4 31/33] target-arm: make VBAR 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.128.182 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) VBAR has a secure and a non-secure instance, which are mapped to VBAR_EL1 and VBAR_EL3. Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows ---------------- v3 -> v4 - Fix vbar union/structure definition - Revert back to array-based vbar definition combined with v7 naming Signed-off-by: Greg Bellows --- target-arm/cpu.h | 10 +++++++++- target-arm/helper.c | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index d5cad97..aade869 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -312,7 +312,15 @@ typedef struct CPUARMState { uint32_t c9_pmuserenr; /* perf monitor user enable */ uint32_t c9_pminten; /* perf monitor interrupt enables */ uint64_t mair_el1; - uint64_t vbar_el[4]; /* vector base address register */ + union { /* vector base address register */ + struct { + uint64_t _unused_vbar; + uint64_t vbar_ns; + uint64_t hvbar; + uint64_t vbar_s; + }; + uint64_t vbar_el[4]; + }; uint64_t mvbar; /* (monitor) vector base address register */ uint32_t c13_fcse; /* FCSE PID. */ uint64_t contextidr_el1; /* Context ID. */ diff --git a/target-arm/helper.c b/target-arm/helper.c index 1178a79..1a07124 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -805,9 +805,9 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .resetvalue = 0, .writefn = pmintenclr_write, }, { .name = "VBAR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 0, - .access = PL1_RW, .writefn = vbar_write, - .fieldoffset = offsetof(CPUARMState, cp15.vbar_el[1]), - .resetvalue = 0 }, + .access = PL1_RW, .writefn = vbar_write, .resetvalue = 0, + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.vbar_s), + offsetof(CPUARMState, cp15.vbar_ns) } }, { .name = "CCSIDR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 0, .access = PL1_R, .readfn = ccsidr_read, .type = ARM_CP_NO_MIGRATE }, @@ -3945,7 +3945,7 @@ void arm_cpu_do_interrupt(CPUState *cs) * This register is only followed in non-monitor mode, and is banked. * Note: only bits 31:5 are valid. */ - addr += env->cp15.vbar_el[1]; + addr += A32_BANKED_CURRENT_REG_GET(env, vbar); } if ((env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_MON) {