From patchwork Wed Jan 27 22:16:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 8144861 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 1A5BBBEEE5 for ; Wed, 27 Jan 2016 22:17:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 760DC20274 for ; Wed, 27 Jan 2016 22:17:22 +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 D20272024C for ; Wed, 27 Jan 2016 22:17:21 +0000 (UTC) Received: from localhost ([::1]:52830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOYOv-0001CX-1X for patchwork-qemu-devel@patchwork.kernel.org; Wed, 27 Jan 2016 17:17:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOYOf-00018q-Sz for qemu-devel@nongnu.org; Wed, 27 Jan 2016 17:17:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOYOf-0007PE-33 for qemu-devel@nongnu.org; Wed, 27 Jan 2016 17:17:05 -0500 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:34086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOYOe-0007Ov-RB; Wed, 27 Jan 2016 17:17:04 -0500 Received: by mail-pf0-x244.google.com with SMTP id 65so1014360pfd.1; Wed, 27 Jan 2016 14:17:04 -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=t+AWYplYlJ3DeNLLsoPmdHwb8KxYNJAiqXDR7EyeNUw=; b=mcgZmP7iEi0/0yRVTVVlGQ1ykcvX+FftUCgcY1dysz2Z0RChjvr2IHGX1FHmevAMyF U8xZHFbi349Tay6UeoDG3u1oKvTXuAwk/S9SwKjR0YeD3x9SEKb4Scaqop6rnspjCHn5 JsuaZQ0CRvruL5w+AmmfG3eufO15X4BAtAQQ6laSA0VNbbXhhGcp+Xn+ZmbgV9E77K4I WZ16JuudOJufIMlcznbZX4u+MVSzqpqeLws8KLzrahRmfEouG+J9JcTkKJMGPhqhQmrm UrX4/36a+rP73N/qZ1TUaioD97dZrkG5hzQlRJjBaQs/B4D0JcCd+6RkfnwQyUKpbH4K p6LQ== 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=t+AWYplYlJ3DeNLLsoPmdHwb8KxYNJAiqXDR7EyeNUw=; b=O0gqmQ1KjuJAAA8v6Do9lgvpsoa1i3crkaWBt1SeVo9UrW0oUJX0gKCMlUmpBBL6xC 7nTNQRuwsR5qS4jNYl/KvK+KSPEB5cfPocVW5sEbp1QxreOtDsyjeVJlCmb+OiyUHbcW bNjq3ckPN5TDDW1Hy9ACCbhh9Jk8q4HJsSx5Rgr8C7K9iyV1d/ylSbyrsT8eRQQL39j6 mCT9m9+8cLgbvNR9njqZUxICqvsHiWLagzG/m/qW0zAFDAWy/ZVwf8i9lJdgrChBzI14 q4woVwmPpjzKUywrm1tqWLwhDdBoCc9wDYdOYErnTPMGjFv4kjCLtRevECkAuJnxsdyU 593Q== X-Gm-Message-State: AG10YORUBulCXuymz5i4SgulYzJXXPS4Ex3noK9lmhBaXZBzVegI8SfFBozVqYEQ5Z7koA== X-Received: by 10.98.68.220 with SMTP id m89mr5850165pfi.65.1453933024292; Wed, 27 Jan 2016 14:17:04 -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 k74sm11288719pfb.30.2016.01.27.14.17.02 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 27 Jan 2016 14:17:03 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 27 Jan 2016 23:16:10 +0100 Message-Id: <1453932970-14576-4-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453932970-14576-1-git-send-email-edgar.iglesias@gmail.com> References: <1453932970-14576-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:400e:c00::244 Cc: edgar.iglesias@xilinx.com, qemu-arm@nongnu.org, alex.bennee@linaro.org Subject: [Qemu-devel] [PATCH v4 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. This is CONSTRAINED UNPREDICTABLE and we choose to fault. Signed-off-by: Edgar E. Iglesias Reviewed-by: Alex Bennée --- target-arm/helper.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target-arm/helper.c b/target-arm/helper.c index 13e9933..9f75840 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -6790,6 +6790,7 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, } if (is_aa64) { + CPUARMState *env = &cpu->env; unsigned int pamax = arm_pamax(cpu); switch (stride) { @@ -6811,6 +6812,13 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, default: g_assert_not_reached(); } + + /* Inputsize checks. */ + if (inputsize > pamax && + (arm_el_is_aa64(env, 1) || inputsize > 40)) { + /* This is CONSTRAINED UNPREDICTABLE and we choose to fault. */ + return false; + } } else { /* AArch32 only supports 4KB pages. Assert on that. */ assert(stride == 9);