From patchwork Fri Jan 22 09:50:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 8088631 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 861A5BEEE5 for ; Fri, 22 Jan 2016 09:51:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1872203B4 for ; Fri, 22 Jan 2016 09:51:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4799D203A9 for ; Fri, 22 Jan 2016 09:51:32 +0000 (UTC) Received: from localhost ([::1]:52122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMYNP-0002pT-Nz for patchwork-qemu-devel@patchwork.kernel.org; Fri, 22 Jan 2016 04:51:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMYNC-0002hx-Ob for qemu-devel@nongnu.org; Fri, 22 Jan 2016 04:51:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMYNA-0005pr-PN for qemu-devel@nongnu.org; Fri, 22 Jan 2016 04:51:18 -0500 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:35927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMYNA-0005pm-Ks; Fri, 22 Jan 2016 04:51:16 -0500 Received: by mail-oi0-x243.google.com with SMTP id a202so3514323oib.3; Fri, 22 Jan 2016 01:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j6/6igmrW7PHLltsRSNSoa3VUBGoxXAMWDaA60rfnpo=; b=Nr9CH3lbc93V7yHT/Lqbp/q4WmAo/QVY/0HMlaogU6kkAyLHM2InY09D9Pvv2CPnwT 3D7Dsmc0cxNqOQa2pYGwSxGT1KvhtXwe5IWNicjL/ZtdnXVPTW/UQwXfKr/+WmLdEpyw jYUwZqPDIyBpZ4y/DXthCV0GET0MKdyiCaETuePohM2lYqISoD933O/W5umLB1Kc1Y8D 3vOv5ahUgzmcReTUIDiPJ7o3+6sUkQl+vQpoX2x7KxL3oKvJRTjMH3zNDBD5Nzdry6iy U5daso/qfvAa/klfPm0nZPZs+42IMQH5WUPITobPs07nBHtsyPTJjd0DbDb86WT1ZYyL Yujg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j6/6igmrW7PHLltsRSNSoa3VUBGoxXAMWDaA60rfnpo=; b=Cdb67JIyWbe5zilSbtkev8hUvu1SIGow5dKb7bl6vx+J11zZXcaZjO7390at8NiSez xiMt7UojhyvSTQMUBPGNonxm3gSZX6g+meiMWlo1Ta7yifbXbpL3AHYLAcmMFry3jkaI IpwXuIAsKJ6Ax12DsaUAZ2QnPELVhO6CFLrRlMa57mYfSd5KHQktSw9MjdUFZcaFlTEo HPXVWPDyHOe7I7LYDex9EzrU1ig1zGHIZ7ZXSga9eNH4hOKIO6GVD3X1aDoCSRGIy+z0 Pz65GBB5XG8nr7gyVqHMjs3wx1A8ofgs3tW4DGZLawGI/PlPkYbhtDguy/6Q5fF4E+LE sBkA== X-Gm-Message-State: AG10YOT6p6X/dTWuaMOqAoL3GBZL3OJCR1mHfAs5MFGQBNgjZicRaqOjuS0uoodBbaxKnA== X-Received: by 10.202.83.74 with SMTP id h71mr1494531oib.115.1453456276000; Fri, 22 Jan 2016 01:51:16 -0800 (PST) Received: from localhost (ec2-52-8-89-49.us-west-1.compute.amazonaws.com. [52.8.89.49]) by smtp.gmail.com with ESMTPSA id u8sm2702967obf.5.2016.01.22.01.51.14 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 22 Jan 2016 01:51:15 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 22 Jan 2016 10:50:43 +0100 Message-Id: <1453456243-19879-4-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453456243-19879-1-git-send-email-edgar.iglesias@gmail.com> References: <1453456243-19879-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::243 Cc: edgar.iglesias@xilinx.com, qemu-arm@nongnu.org, alex.bennee@linaro.org Subject: [Qemu-devel] [PATCH v3 3/3] target-arm: Implement the S2 MMU inputsize > pamax check 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Implement the inputsize > pamax check for Stage 2 translations. We have multiple choices for how to respond to errors and choose to fault. Signed-off-by: Edgar E. Iglesias --- target-arm/helper.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 2a6fa94..8901762 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -6809,7 +6809,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, */ int startlevel = extract32(tcr->raw_tcr, 6, 2); unsigned int pamax = arm_pamax(cpu); - bool ok; + bool ok = true; if (va_size == 32 || stride == 9) { /* AArch32 or 4KB pages */ @@ -6819,9 +6819,17 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, level = 3 - startlevel; } - /* Check that the starting level is valid. */ - ok = check_s2_startlevel(cpu, va_size == 64, level, - inputsize, stride, pamax); + if (va_size == 64 && + inputsize > pamax && + (arm_el_is_aa64(env, 1) || inputsize > 40)) { + /* We have multiple choices but choose to fault. */ + ok = false; + } + if (ok) { + /* Check that the starting level is valid. */ + ok = check_s2_startlevel(cpu, va_size == 64, level, + inputsize, stride, pamax); + } if (!ok) { /* AArch64 reports these as level 0 faults. * AArch32 reports these as level 1 faults.