From patchwork Tue Aug 25 15:00:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 52686 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 564A922E8F for ; Tue, 25 Aug 2015 15:07:54 +0000 (UTC) Received: by labd1 with SMTP id d1sf55013909lab.0 for ; Tue, 25 Aug 2015 08:07:53 -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: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=QMypX/mPEddnSzYztWxaDHPjuEpGhA3GE0cVdbIG7vI=; b=foOCHW8bwC8bQi1pulW25F8SZrFfOrC2YMqLLyH6PHa7WabmLRHrB2JwfFeGYbMtqQ lG4wXiAe+aW0EtILsr4atfLvJsq+H6Y4c0gOUQeTbDAPl75KXUS6dm/F0J/KF+8U5R1C 2mDNV5a2Iulpi/nQ9pZzM0fHZA26/7HVPcOx493xsQw9HSzSCfoiGM9+CnXnmXSM+I+B hGwdk+UHJdcQIB2QtAsDwrxMmARc+S7wIgGtfouhc1IpMqrBDPMR4gJaQfDYk4una/Z6 Y0xBOvyVK9MCU/r0jv5ng/heZingdyd3BwaghwySxWsZfeWQTDalsfvgwTGHibSu0/oX Rs2A== X-Gm-Message-State: ALoCoQl05v3wXB/XTSipaN4Tp9l9QnyH3qwfLLOROx0F9cc9+Fe4mDgfalsC2nTQcWdq5oO7M18V X-Received: by 10.152.25.199 with SMTP id e7mr3556523lag.1.1440515273303; Tue, 25 Aug 2015 08:07:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.198 with SMTP id 6ls777098law.79.gmail; Tue, 25 Aug 2015 08:07:53 -0700 (PDT) X-Received: by 10.112.85.3 with SMTP id d3mr25846070lbz.33.1440515272975; Tue, 25 Aug 2015 08:07:52 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id eg8si16239716lac.1.2015.08.25.08.07.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Aug 2015 08:07:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbtg9 with SMTP id tg9so102187415lbb.1 for ; Tue, 25 Aug 2015 08:07:52 -0700 (PDT) X-Received: by 10.152.37.104 with SMTP id x8mr13209731laj.29.1440515272851; Tue, 25 Aug 2015 08:07:52 -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.162.200 with SMTP id yc8csp3242844lbb; Tue, 25 Aug 2015 08:07:51 -0700 (PDT) X-Received: by 10.55.204.208 with SMTP id n77mr7738687qkl.46.1440515271046; Tue, 25 Aug 2015 08:07:51 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d19si33838613qhc.106.2015.08.25.08.07.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 25 Aug 2015 08:07:51 -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]:60698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUFpG-0004yz-5B for patch@linaro.org; Tue, 25 Aug 2015 11:07:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUFi9-0001ja-D1 for qemu-devel@nongnu.org; Tue, 25 Aug 2015 11:00:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUFi8-0001XK-Bu for qemu-devel@nongnu.org; Tue, 25 Aug 2015 11:00:29 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34989) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUFi8-0001NR-5G for qemu-devel@nongnu.org; Tue, 25 Aug 2015 11:00:28 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZUFhx-0004KT-CV for qemu-devel@nongnu.org; Tue, 25 Aug 2015 16:00:17 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 25 Aug 2015 16:00:07 +0100 Message-Id: <1440514816-16562-12-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1440514816-16562-1-git-send-email-peter.maydell@linaro.org> References: <1440514816-16562-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 11/20] target-arm: Enable the AArch32 ATS12NSO ops 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: peter.maydell@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.171 as permitted sender) smtp.mailfrom=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 Apply the correct conditions in the ats_access() function for the ATS12NSO* address translation operations: * succeed at EL2 or EL3 * normal UNDEF trap from NS EL1 * trap to EL3 from S EL1 (only possible if EL3 is AArch64) (This change means they're now available in our EL3-supporting CPUs when they would previously always UNDEF.) Signed-off-by: Peter Maydell Reviewed-by: Edgar E. Iglesias Message-id: 1437751263-21913-5-git-send-email-peter.maydell@linaro.org --- target-arm/helper.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 8603660..4b2fc090 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1719,12 +1719,17 @@ static void par_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri) { if (ri->opc2 & 4) { - /* Other states are only available with TrustZone; in - * a non-TZ implementation these registers don't exist - * at all, which is an Uncategorized trap. This underdecoding - * is safe because the reginfo is NO_RAW. + /* The ATS12NSO* operations must trap to EL3 if executed in + * Secure EL1 (which can only happen if EL3 is AArch64). + * They are simply UNDEF if executed from NS EL1. + * They function normally from EL2 or EL3. */ - return CP_ACCESS_TRAP_UNCATEGORIZED; + if (arm_current_el(env) == 1) { + if (arm_is_secure_below_el3(env)) { + return CP_ACCESS_TRAP_UNCATEGORIZED_EL3; + } + return CP_ACCESS_TRAP_UNCATEGORIZED; + } } return CP_ACCESS_OK; } @@ -1899,6 +1904,7 @@ static const ARMCPRegInfo vapa_cp_reginfo[] = { offsetoflow32(CPUARMState, cp15.par_ns) }, .writefn = par_write }, #ifndef CONFIG_USER_ONLY + /* This underdecoding is safe because the reginfo is NO_RAW. */ { .name = "ATS", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = CP_ANY, .access = PL1_W, .accessfn = ats_access, .writefn = ats_write, .type = ARM_CP_NO_RAW },