From patchwork Mon Jun 30 23:09:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 32835 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ABA89203F4 for ; Tue, 1 Jul 2014 00:53:17 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id a41sf21335699yho.9 for ; Mon, 30 Jun 2014 17:53:17 -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=ZMFxvRj7TvFEfNaDMp7YJWfI3NAQPkKrc1brwWzV3Ks=; b=G4nnt3VAWobYDiNBrYwH4sgEN9fkEXx8xaqwAV9yeLBBWLSuM4tZ+0xNnX11RDnuYR YQEAqTYn1foYBJlS/R5TDHnuTfw3SXH//n/3CPRveStbyqdZheJc9sI1++eFD9en9Wip NJVItLXhaKOyNA+5rx3LI2NobmIg9KUljCkQiyFbnoyjve5mSm6A/pnXssATbhe2l3ai HfjP9PO9xeXyYK4lEymwREBeqk7hJLXOsglB1SvK6+SthUu8nfjSLWDDmq1V6t0pXc+N ZSWWlGxQhKkyBem8a9Ti1knhaFC4Ug5Of+8nS/s0ugQACxSSe5/jARS7HgSbqh3X5CuV gNPA== X-Gm-Message-State: ALoCoQktoSfeX4XlRcKoqq+d2ZD05lAEb6vziRoO8AHbKlbw7CvZqOLmMEWQfjbX0A9s2LJ4qLnb X-Received: by 10.236.162.9 with SMTP id x9mr2067487yhk.17.1404175997183; Mon, 30 Jun 2014 17:53:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.198 with SMTP id 64ls1364886qgn.8.gmail; Mon, 30 Jun 2014 17:53:17 -0700 (PDT) X-Received: by 10.220.161.8 with SMTP id p8mr41266737vcx.4.1404175996993; Mon, 30 Jun 2014 17:53:16 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id ev7si10764042vdb.36.2014.06.30.17.53.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 17:53:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jz11so8916815veb.31 for ; Mon, 30 Jun 2014 17:53:16 -0700 (PDT) X-Received: by 10.220.163.3 with SMTP id y3mr41315560vcx.7.1404175996900; Mon, 30 Jun 2014 17:53:16 -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 tc5csp179354vcb; Mon, 30 Jun 2014 17:53:16 -0700 (PDT) X-Received: by 10.140.96.229 with SMTP id k92mr60802128qge.38.1404175996436; Mon, 30 Jun 2014 17:53:16 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h3si27236896qab.80.2014.06.30.17.53.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 30 Jun 2014 17:53:16 -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]:37009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kjo-0006lz-Ug for patch@linaro.org; Mon, 30 Jun 2014 19:11:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kid-0005Y9-Rm for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:10:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1kiY-00039l-DW for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:10:39 -0400 Received: from mail-ob0-f176.google.com ([209.85.214.176]:53907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kiY-00039Y-8K for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:10:34 -0400 Received: by mail-ob0-f176.google.com with SMTP id wm4so9522017obc.7 for ; Mon, 30 Jun 2014 16:10:33 -0700 (PDT) X-Received: by 10.182.134.164 with SMTP id pl4mr46124205obb.16.1404169833906; Mon, 30 Jun 2014 16:10:33 -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.10.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 16:10:32 -0700 (PDT) From: greg.bellows@linaro.org To: qemu-devel@nongnu.org Date: Mon, 30 Jun 2014 18:09:06 -0500 Message-Id: <1404169773-20264-7-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.214.176 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 06/33] target-arm: make arm_current_pl() return PL3 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.172 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 Make arm_current_pl() return PL3 for secure PL1 and monitor mode. Increase MMU modes since mmu_index is directly infered from arm_ current_pl(). Changes assertion in arm_el_is_aa64() to allow EL3. Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows --- target-arm/cpu.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index aba077b..1faf1e2 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -100,7 +100,7 @@ typedef uint32_t ARMReadCPFunc(void *opaque, int cp_info, struct arm_boot_info; -#define NB_MMU_MODES 2 +#define NB_MMU_MODES 4 /* We currently assume float and double are IEEE single and double precision respectively. @@ -726,7 +726,6 @@ static inline int arm_feature(CPUARMState *env, int feature) return (env->features & (1ULL << feature)) != 0; } - /* Return true if exception level below EL3 is in secure state */ static inline bool arm_is_secure_below_el3(CPUARMState *env) { @@ -767,11 +766,12 @@ static inline bool arm_is_secure(CPUARMState *env) /* Return true if the specified exception level is running in AArch64 state. */ static inline bool arm_el_is_aa64(CPUARMState *env, int el) { - /* We don't currently support EL2 or EL3, and this isn't valid for EL0 + /* We don't currently support EL2, and this isn't valid for EL0 * (if we're in EL0, is_a64() is what you want, and if we're not in EL0 * then the state of EL0 isn't well defined.) */ - assert(el == 1); + assert(el == 1 || el == 3); + /* AArch64-capable CPUs always run with EL1 in AArch64 mode. This * is a QEMU-imposed simplification which we may wish to change later. * If we in future support EL2 and/or EL3, then the state of lower @@ -963,9 +963,12 @@ static inline int arm_current_pl(CPUARMState *env) if ((env->uncached_cpsr & 0x1f) == ARM_CPU_MODE_USR) { return 0; + } else if (arm_is_secure(env)) { + /* Secure PL1 and monitor mode are mapped to PL3 */ + return 3; } - /* We don't currently implement the Virtualization or TrustZone - * extensions, so PL2 and PL3 don't exist for us. + /* We currently do not implement the Virtualization extensions, so PL2 does + * not exist for us. */ return 1; }