From patchwork Wed Jan 20 13:49:40 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: 8072201 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 1F1639F818 for ; Wed, 20 Jan 2016 13:51:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A078204A7 for ; Wed, 20 Jan 2016 13:51:14 +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 CEAC0204A0 for ; Wed, 20 Jan 2016 13:51:13 +0000 (UTC) Received: from localhost ([::1]:43192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLtAH-0000dc-4r for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Jan 2016 08:51:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLt94-0007IL-NK for qemu-devel@nongnu.org; Wed, 20 Jan 2016 08:49:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLt93-0001tn-SJ for qemu-devel@nongnu.org; Wed, 20 Jan 2016 08:49:58 -0500 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]:32843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLt93-0001tf-NC; Wed, 20 Jan 2016 08:49:57 -0500 Received: by mail-oi0-x242.google.com with SMTP id j3so478320oig.0; Wed, 20 Jan 2016 05:49:57 -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=YRRLhrvotiVumx0tskr+is6WIBJ9G4ni1dG56gggJcE=; b=quNlqB3/yheuWhT/XV4S5NH+l+bqp30rYMJiVlx2ohRlrUxxdyqJn2qYPg3lOjHHiv GTxy5vKa7zt8P5uLaozRLJ3lM/FsMXMOqdmloXAvrC31MSi5wz3XCmLrImogjKtwaki8 lcuM47LcyhxuLopm1cLzGm1TaBpIp0piMZ/KTwIcBf/vfFYlQhyw11PeuDwsE3Bk0BlE wDRHd3wGt53z0Z9A3rS+y76U6eQs1RBvJFo2Ybfk2MDbxIrE+Zh5oHkC46alm0KsP2om YV40na538nEd7Wbd/hpg20ZhtSbJlLNKpnwrd4s0Y+zan5rJfc0Pzb6yTADfgqZQlBnc oeNg== 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=YRRLhrvotiVumx0tskr+is6WIBJ9G4ni1dG56gggJcE=; b=ZChNZq+q8nqX80xuZheVx93fLbeR7xdKXtzgVZTsmnIu31rfoNZT2fLuMjD9TZCAu8 Ut2DLkz5rfrNKF3hNRO1eEUZtiOUErxUElyUJurhRutnNJ7rzKJIgaS26L0f9BNDyj/d arNm75vwq1BnJEG2EVSlU01BwaAV/BKfZ3aHH5TJPNBmKi4qQH2pBjl4yju48TCKF5LV AAvk9Cue6rroHnmSVKDDv1J8fWoWbS3KFotYbE+bLIF/NiWftQSHfWQ/mOvyJYXyDbc/ 1kUb4VBaK5J4x77gPLv2PLh69xAjq7dXX0+UFJJKO0iHcjzJnAQNL7kvHcto8jQpXFdV Nysg== X-Gm-Message-State: ALoCoQk7+hkVN5bnGl+1ExUivM58+iAOTj3+yyIyJuwTD5QIja9vJUqOSA00jqw8Knpv1NFFKTF6u/maziIw3N3axRZqp8kFqA== X-Received: by 10.202.85.194 with SMTP id j185mr27083195oib.107.1453297797232; Wed, 20 Jan 2016 05:49:57 -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 f9sm18043590obw.13.2016.01.20.05.49.56 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 20 Jan 2016 05:49:56 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 20 Jan 2016 14:49:40 +0100 Message-Id: <1453297780-12514-4-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453297780-12514-1-git-send-email-edgar.iglesias@gmail.com> References: <1453297780-12514-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::242 Cc: edgar.iglesias@xilinx.com, qemu-arm@nongnu.org, alex.bennee@linaro.org Subject: [Qemu-devel] [PATCH v1 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 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 4abeb4d..e1fa209 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,16 @@ 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 (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.