From patchwork Thu Jan 21 11:18:28 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: 8080141 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5DE379F1CC for ; Thu, 21 Jan 2016 11:19:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8DBE2057F for ; Thu, 21 Jan 2016 11:19:26 +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 2217920575 for ; Thu, 21 Jan 2016 11:19:26 +0000 (UTC) Received: from localhost ([::1]:46998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMDGv-0001U4-Fl for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 Jan 2016 06:19:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMDGh-0001Ol-My for qemu-devel@nongnu.org; Thu, 21 Jan 2016 06:19:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMDGf-0007bu-Tx for qemu-devel@nongnu.org; Thu, 21 Jan 2016 06:19:11 -0500 Received: from mail-ob0-x242.google.com ([2607:f8b0:4003:c01::242]:33825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMDGf-0007bq-Pq; Thu, 21 Jan 2016 06:19:09 -0500 Received: by mail-ob0-x242.google.com with SMTP id x5so2464426obg.1; Thu, 21 Jan 2016 03:19:09 -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=/v4pLAfq3x/2KuXhNjIQE/gZHDqf8ZCTGiBn6wAWgks=; b=sA4SqSJw3a/OtkaIo9HWDfm4qzH+y+yHPPW29Ktg7Qk81jV741TgJD8TRSVjQ/Ygh7 II/rYPbBliVueVJF/0T5lpHoqeUY+qNXCRonYEe1Ee+OrfrGAEzj4/YdRyOXDYgiOSBL 3O95WoB8mB/3zLIryuiskp42AYbmv2igxaJGZ8IoZLRry8/aasCyBjE21c0xkcnQHUSU 1PGlcI2+gXjYQ6Lfyx0frSq1LiAS1a2+UIvI2NWgBUBjmi6GdU2yk3h5b6VMo6hFpJow HalBc+3SDxRG6YGy+iBKC4vRYjQ6U9poflfY9xi2oZedRbOkE99Eay3vCB9XDL2jctee oSGQ== 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=/v4pLAfq3x/2KuXhNjIQE/gZHDqf8ZCTGiBn6wAWgks=; b=PrMWa349QZMX3T1vsTduMPDSnu0iSGZN5j7Epo6C0HiLRKPkTeEW23VfBe4SamMHPN XRfiDwgSqVZYeo2k/5VY2SizHsB9YMG+qUH0eTyD3lXLCMOiCirxbb+EGCHBku7matlz nVO7sgMRxo98MCnaDEPJuTAfYdDXuA+UkGntgduMupitHDDaZgvSrRDoujQtTbV4cMmN cI1GvBJSgqXFNQbY87gPd34ShVlCFxxTdoMk1j7o6Rht5kenLF9N5LKi8XzVTKKE99FP 1PBRETfzXKp3foudhZpT70hGW18O4BhRJP87JfInZjn/0ffIK4x6lPYnr4mh81vxxQQa /43A== X-Gm-Message-State: ALoCoQmd/O0MQ5BZx8pblgo8pYPpxfZ4C/TSp7JcuiUsfDwLpy/hAn/Y1G0TexE9MKt9xDFI6m5yfiuw+43H7854BEWRJp/eAg== X-Received: by 10.182.142.105 with SMTP id rv9mr33848504obb.66.1453375149372; Thu, 21 Jan 2016 03:19:09 -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 a10sm311836obj.21.2016.01.21.03.19.08 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 21 Jan 2016 03:19:08 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Thu, 21 Jan 2016 12:18:28 +0100 Message-Id: <1453375108-25229-4-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453375108-25229-1-git-send-email-edgar.iglesias@gmail.com> References: <1453375108-25229-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:c01::242 Cc: edgar.iglesias@xilinx.com, qemu-arm@nongnu.org, alex.bennee@linaro.org Subject: [Qemu-devel] [PATCH v2 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 4abeb4d..9a7ff5e 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -6808,7 +6808,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 */ @@ -6818,9 +6818,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.