From patchwork Wed Nov 5 23:23:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40244 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 007D3240A6 for ; Wed, 5 Nov 2014 23:35:58 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf1096849lbg.1 for ; Wed, 05 Nov 2014 15:35:57 -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=Kmka4aZ4rh5xJvaltF3vPyIl2J1dQ0IVx/vM9Nu6E1w=; b=hnxgrZROIrNp+kArfI2OIgIuLbuLD3F4OwaSOKzUMWnsLmOKTfRqIGqwZIwvVHy4ia Z2VkrxI4vJGtvTppgEsc5+zhGDhQYa2sCc8pSzCNQ5qD8v6xfA9MtXWTC8kR77MvJv2C ZGzB64/wxwEF4AVCVN1kww28JQpYCBGCMVZa+3L3RE5HOPVWXyamVeZPvmA3Z97FYIw+ HT0Sps/8iX/Vz25JYnrig5eoT6JzR+0X2pcqldzMcWYMMukmHRlhdP7wz3YTL6vsjMF3 7xMPDn7GdPW4mRkrq3I5Wc4PLFu5gqxYVgcNJGG0dP+Oqf7YyKRvXLVWrSrp0UbFZtG3 IMFQ== X-Gm-Message-State: ALoCoQmTCVHIlC6eHIkpU5M3V3aSJ5x4qfvNEpI2GGoAzzRxrrMeFNRoDpXoQuqanUJYWfVnN6PD X-Received: by 10.194.176.106 with SMTP id ch10mr2442wjc.6.1415230557554; Wed, 05 Nov 2014 15:35:57 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.132 with SMTP id ue4ls8127lac.100.gmail; Wed, 05 Nov 2014 15:35:57 -0800 (PST) X-Received: by 10.112.137.234 with SMTP id ql10mr502648lbb.91.1415230557400; Wed, 05 Nov 2014 15:35:57 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id cq12si8880755lad.9.2014.11.05.15.35.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:35:57 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id s18so1641333lam.14 for ; Wed, 05 Nov 2014 15:35:57 -0800 (PST) X-Received: by 10.112.12.35 with SMTP id v3mr641520lbb.80.1415230557145; Wed, 05 Nov 2014 15:35:57 -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 ew9csp372390lbc; Wed, 5 Nov 2014 15:35:56 -0800 (PST) X-Received: by 10.140.44.8 with SMTP id f8mr740224qga.105.1415230555753; Wed, 05 Nov 2014 15:35:55 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l4si9065843qct.45.2014.11.05.15.35.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:35:55 -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]:49069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmA7H-0000KD-1U for patch@linaro.org; Wed, 05 Nov 2014 18:35:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm9vn-0004pa-Fe for qemu-devel@nongnu.org; Wed, 05 Nov 2014 18:24:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xm9vi-0004kL-75 for qemu-devel@nongnu.org; Wed, 05 Nov 2014 18:24:03 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:39100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm9vi-0004kA-1w for qemu-devel@nongnu.org; Wed, 05 Nov 2014 18:23:58 -0500 Received: by mail-pa0-f43.google.com with SMTP id eu11so1757625pac.16 for ; Wed, 05 Nov 2014 15:23:57 -0800 (PST) X-Received: by 10.66.155.2 with SMTP id vs2mr312241pab.135.1415229837507; Wed, 05 Nov 2014 15:23:57 -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 r4sm4086349pdm.93.2014.11.05.15.23.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:23:56 -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: Wed, 5 Nov 2014 17:23:10 -0600 Message-Id: <1415229793-3278-24-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415229793-3278-1-git-send-email-greg.bellows@linaro.org> References: <1415229793-3278-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.43 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v9 23/26] 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.215.41 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 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 Reviewed-by: Peter Maydell --- v8 -> v9 - Revert unnecessary CPreg definition changes v5 -> v6 - Changed _el field variants to be array based - Merged VBAR and VBAR_EL1 reginfo entries v3 -> v4 - Fix vbar union/structure definition - Revert back to array-based vbar definition combined with v7 naming --- target-arm/cpu.h | 10 +++++++++- target-arm/helper.c | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index a991f85..0dcee1b 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -297,7 +297,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]; + }; uint32_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 fa4ad05..f66e6c6 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -911,7 +911,8 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { { .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]), + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.vbar_s), + offsetof(CPUARMState, cp15.vbar_ns) }, .resetvalue = 0 }, { .name = "CCSIDR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 0, @@ -4402,7 +4403,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) {