From patchwork Wed Nov 5 23:22:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40232 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 39178240A6 for ; Wed, 5 Nov 2014 23:29:13 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id h11sf1461020wiw.3 for ; Wed, 05 Nov 2014 15:29:12 -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=LCE6VdcpMg8gJ70hTfgP1WqSkmZX1BHVk7i0R6hdF7A=; b=TdWXYI+xkqaqTr8VNF0097qOa0JPLHd79q++MJhfgFujM8HDgvK2rcd3SwJhNkKhom FtFXMV1r4YENjV/ByLpKgnl5+B/ITt0bYlE6yIiXaeOao5flKKxDBelfsvZ03LoNiyzG d5ekcRfkx8c6wh5J9fwnHNkj2HZHH12LgRZ80X8FYUt8rApg2Cm/tXYktvHdnNMi/1tG TzJnno+VOxwOA9t4dtr2rxNMOBrXxEKaDH0uTHonYI8GDG8LEdvdI22wsn4zMIPUVyr4 H33U8l914/ywIwHOAWN1sij8efwhcEw9WYzzCvXHVCIkl5UC+l7Up6JnVNWxkq0Lfwct mU1A== X-Gm-Message-State: ALoCoQl7Nd9uxP6gljLAe4BvLb7ij3QtfN5TRT8zCsxTxPVVnvKxF/gQDPoeJE9cv+7Llv89MZnL X-Received: by 10.112.77.9 with SMTP id o9mr83741lbw.6.1415230152412; Wed, 05 Nov 2014 15:29:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.226 with SMTP id b2ls10561lak.36.gmail; Wed, 05 Nov 2014 15:29:12 -0800 (PST) X-Received: by 10.112.139.165 with SMTP id qz5mr599186lbb.96.1415230152271; Wed, 05 Nov 2014 15:29:12 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id jd2si8672432lbc.91.2014.11.05.15.29.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:29:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id s18so1633542lam.27 for ; Wed, 05 Nov 2014 15:29:12 -0800 (PST) X-Received: by 10.112.130.41 with SMTP id ob9mr609686lbb.74.1415230152164; Wed, 05 Nov 2014 15:29:12 -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 ew9csp371744lbc; Wed, 5 Nov 2014 15:29:11 -0800 (PST) X-Received: by 10.140.102.7 with SMTP id v7mr969497qge.68.1415230150766; Wed, 05 Nov 2014 15:29:10 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w17si9062623qgd.44.2014.11.05.15.29.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:29:10 -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]:48989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmA0j-0004dZ-V8 for patch@linaro.org; Wed, 05 Nov 2014 18:29:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm9vV-0004In-HW for qemu-devel@nongnu.org; Wed, 05 Nov 2014 18:23:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xm9vQ-0004eI-Ju for qemu-devel@nongnu.org; Wed, 05 Nov 2014 18:23:45 -0500 Received: from mail-pd0-f173.google.com ([209.85.192.173]:64223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm9vQ-0004e5-F2 for qemu-devel@nongnu.org; Wed, 05 Nov 2014 18:23:40 -0500 Received: by mail-pd0-f173.google.com with SMTP id v10so1688984pde.32 for ; Wed, 05 Nov 2014 15:23:39 -0800 (PST) X-Received: by 10.70.34.206 with SMTP id b14mr649687pdj.10.1415229819841; Wed, 05 Nov 2014 15:23:39 -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.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:23:39 -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:22:59 -0600 Message-Id: <1415229793-3278-13-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.192.173 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v9 12/26] target-arm: add MVBAR support 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.54 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 Use MVBAR register as exception vector base address for exceptions taken to CPU monitor mode. Signed-off-by: Sergey Fedorov Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows Reviewed-by: Peter Maydell --- v8 -> v9 - Fixed declaration order of the MVBAR register components v7 -> v8 - Changed the mvbar cp15 storage from uint64_t to uint32_t --- target-arm/cpu.h | 1 + target-arm/helper.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) -- 1.8.3.2 diff --git a/target-arm/cpu.h b/target-arm/cpu.h index e5c773d..03662af 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -211,6 +211,7 @@ typedef struct CPUARMState { uint32_t c9_pminten; /* perf monitor interrupt enables */ uint64_t mair_el1; uint64_t vbar_el[4]; /* vector base address register */ + uint32_t mvbar; /* (monitor) vector base address register */ uint32_t c13_fcse; /* FCSE PID. */ uint64_t contextidr_el1; /* Context ID. */ uint64_t tpidr_el0; /* User RW Thread register. */ diff --git a/target-arm/helper.c b/target-arm/helper.c index cb15ad4..a12ba1f 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -2356,6 +2356,9 @@ static const ARMCPRegInfo el3_cp_reginfo[] = { { .name = "NSACR", .cp = 15, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 2, .access = PL3_W | PL1_R, .resetvalue = 0, .fieldoffset = offsetof(CPUARMState, cp15.nsacr) }, + { .name = "MVBAR", .cp = 15, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1, + .access = PL3_RW, .writefn = vbar_write, .resetvalue = 0, + .fieldoffset = offsetof(CPUARMState, cp15.mvbar) }, REGINFO_SENTINEL }; @@ -4272,16 +4275,16 @@ void arm_cpu_do_interrupt(CPUState *cs) cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); return; /* Never happens. Keep compiler happy. */ } - /* High vectors. */ - if (env->cp15.c1_sys & SCTLR_V) { - /* when enabled, base address cannot be remapped. */ + + if (new_mode == ARM_CPU_MODE_MON) { + addr += env->cp15.mvbar; + } else if (env->cp15.c1_sys & SCTLR_V) { + /* High vectors. When enabled, base address cannot be remapped. */ addr += 0xffff0000; } else { /* ARM v7 architectures provide a vector base address register to remap * the interrupt vector table. - * This register is only followed in non-monitor mode, and has a secure - * and un-secure copy. Since the cpu is always in a un-secure operation - * and is never in monitor mode this feature is always active. + * 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];