From patchwork Thu Oct 30 21:28:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 39956 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 47345202FE for ; Fri, 31 Oct 2014 18:23:39 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf3119288lbj.8 for ; Fri, 31 Oct 2014 11:23:38 -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=IMdsWVVcjyhTHclMjPNGHynE3Hc92FF16LieQToY2ww=; b=EV7QSofxZhTmHeXxpybCKb12KJFgf1/sntoy8RBvxu7+5BTn3afS6y2mKp7deoNr3U B7zJr+3KnEmTR/uhqXa0ocyrZcFm01bAP6SFaRtM4ttQgz1zXOdv3odoaMx4SsipAjBq +7rZrzHMhne2eB5Rrz9sRpETDSpQ5IEsoyqqGui7IjOgcBf2BQzYDKPcXVtoyImqXf/z vmIAiVghF/mlXpAaQg/lBZKQpS4+NeD/p9sKhV0yW0zFAXWJMrhc1GzoQa3/DLFFcROD +AkgoiNa7LhivSYFqqE6jVMh+iA63uZv6wpx7WCdLiV/wLShffatlEz5RjUNYHdve6hh jSbA== X-Gm-Message-State: ALoCoQn3yQvsRrKiMPAMIKcHPORSHA8T36+YEIUQeq58oFmibBJmR2IwR4ulOLn++U8tywWThZIc X-Received: by 10.180.105.74 with SMTP id gk10mr928200wib.0.1414779818096; Fri, 31 Oct 2014 11:23:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.38 with SMTP id n6ls467096laj.86.gmail; Fri, 31 Oct 2014 11:23:37 -0700 (PDT) X-Received: by 10.152.43.77 with SMTP id u13mr4982161lal.98.1414779817923; Fri, 31 Oct 2014 11:23:37 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id 2si18116434lal.27.2014.10.31.11.23.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 11:23:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id f15so7076809lbj.41 for ; Fri, 31 Oct 2014 11:23:37 -0700 (PDT) X-Received: by 10.112.130.41 with SMTP id ob9mr27796177lbb.74.1414779817678; Fri, 31 Oct 2014 11:23:37 -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 c5csp242931lbz; Fri, 31 Oct 2014 11:23:36 -0700 (PDT) X-Received: by 10.140.107.11 with SMTP id g11mr12390515qgf.38.1414779816363; Fri, 31 Oct 2014 11:23:36 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i7si18371020qan.31.2014.10.31.11.23.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Oct 2014 11:23:36 -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]:40716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkGrH-0004dS-FB for patch@linaro.org; Fri, 31 Oct 2014 14:23:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkE65-0007OX-TA for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:27:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjxHb-0004uV-3v for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:31 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:47573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjxHa-0004to-UW for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:27 -0400 Received: by mail-pa0-f43.google.com with SMTP id eu11so6294908pac.2 for ; Thu, 30 Oct 2014 14:29:26 -0700 (PDT) X-Received: by 10.69.0.230 with SMTP id bb6mr5030684pbd.165.1414704566266; Thu, 30 Oct 2014 14:29:26 -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.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 14:29:25 -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:43 -0500 Message-Id: <1414704538-17103-13-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.43 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v8 12/27] 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.217.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 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 --- 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(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 62cf48a..596bfae 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 0be19f3..3c56d8f 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -2355,6 +2355,9 @@ static const ARMCPRegInfo el3_cp_reginfo[] = { { .name = "NSACR", .cp = 15, .crn = 1, .crm = 1, .opc1 = 0, .opc2 = 2, .access = PL3_RW | PL1_R, .resetvalue = 0, .fieldoffset = offsetof(CPUARMState, cp15.nsacr) }, + { .name = "MVBAR", .cp = 15, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 1, + .access = PL3_RW, .writefn = vbar_write, .resetvalue = 0, + .fieldoffset = offsetof(CPUARMState, cp15.mvbar) }, REGINFO_SENTINEL }; @@ -4265,16 +4268,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];