From patchwork Thu Oct 30 21:28:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 39945 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 26349202FE for ; Fri, 31 Oct 2014 17:38:51 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id p9sf599925lbv.9 for ; Fri, 31 Oct 2014 10:38:49 -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=NrXqwH/coCk42kYnokf40toA+QmyNmLB3iGI9ZIWKOE=; b=Xq17EXitAXoPKWGDiSVmSiXSS5DLlYY2E7XaYg/XZ4YZhR7lPXued/r3LPV+7GdkZo /icnDlZIYosYcP/e7FnZ6BZ2bH1jo0rEWz94OUrr+GymKR9tvJv/2MiVn9jP1SjP7hNV WUfhFmmgzEMKXzqSv25wXk8YWFdF+nAc0s8gqgw5gIpEjA6VHrnZC7Dyyi1kwEXTXocm IvNO0+Z1G3n6zp8loJj/94qDr1JUtiV4p0L0X/mpeIuAgxkkR3PVuLgYC/coGqDW9fbY wosLDIEbzteoZKkwXazs+AB9OIOPkmL13KCTR5l7vd9nL0wlGZuq97SF3zsu0vQ4LYID EUzQ== X-Gm-Message-State: ALoCoQm1PRU4oNay9BQIctYrSNNZ2XPHzbOTMTyv9YmynknqZZWGe1/HswRwnPyA4HHXM8w1Vx2/ X-Received: by 10.194.86.66 with SMTP id n2mr13564wjz.7.1414777129476; Fri, 31 Oct 2014 10:38:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.13 with SMTP id bc13ls506778lab.21.gmail; Fri, 31 Oct 2014 10:38:49 -0700 (PDT) X-Received: by 10.112.36.197 with SMTP id s5mr28423131lbj.30.1414777129318; Fri, 31 Oct 2014 10:38:49 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id qr5si17874549lbb.54.2014.10.31.10.38.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 10:38:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id z12so6385653lbi.39 for ; Fri, 31 Oct 2014 10:38:49 -0700 (PDT) X-Received: by 10.112.12.35 with SMTP id v3mr27952452lbb.80.1414777129137; Fri, 31 Oct 2014 10:38:49 -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.112.84.229 with SMTP id c5csp237553lbz; Fri, 31 Oct 2014 10:38:48 -0700 (PDT) X-Received: by 10.140.86.116 with SMTP id o107mr36407397qgd.67.1414777127396; Fri, 31 Oct 2014 10:38:47 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u3si14072075qat.92.2014.10.31.10.38.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Oct 2014 10:38:47 -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]:40047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkG9u-0002pM-BU for patch@linaro.org; Fri, 31 Oct 2014 13:38:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkE62-0005wR-8u for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:27:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjxHs-0005HC-LJ for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:50 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:33776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjxHs-0005GU-Fx for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:44 -0400 Received: by mail-pa0-f54.google.com with SMTP id rd3so6311505pab.13 for ; Thu, 30 Oct 2014 14:29:43 -0700 (PDT) X-Received: by 10.66.187.234 with SMTP id fv10mr20179867pac.60.1414704583859; Thu, 30 Oct 2014 14:29:43 -0700 (PDT) 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 o5sm8017713pdr.50.2014.10.30.14.29.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 14:29:43 -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: Thu, 30 Oct 2014 16:28:55 -0500 Message-Id: <1414704538-17103-25-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1414704538-17103-1-git-send-email-greg.bellows@linaro.org> References: <1414704538-17103-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.54 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v8 24/27] 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.217.180 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: Greg Bellows Reviewed-by: Peter Maydell --- 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 | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 3c6ff4a..e0954c7 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -306,7 +306,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 ec957fb..fb040d4 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -905,9 +905,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 }, @@ -4371,7 +4371,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) {