From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id w8sm11337389wjx.21.2016.01.28.06.31.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jan 2016 06:31:50 -0800 (PST) Received: from zen (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTPS id A469E3E0192; Thu, 28 Jan 2016 14:31:49 +0000 (GMT) References: <1453932970-14576-1-git-send-email-edgar.iglesias@gmail.com> <1453932970-14576-4-git-send-email-edgar.iglesias@gmail.com> User-agent: mu4e 0.9.17; emacs 25.0.50.8 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: "Edgar E. Iglesias" Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org, qemu-arm@nongnu.org, edgar.iglesias@xilinx.com Subject: Re: [PATCH v4 3/3] target-arm: Implement the S2 MMU inputsize > pamax check In-reply-to: <1453932970-14576-4-git-send-email-edgar.iglesias@gmail.com> Date: Thu, 28 Jan 2016 14:31:49 +0000 Message-ID: <87zivphj1m.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-TUID: 8frZUTP/ehio Edgar E. Iglesias writes: > 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 Much cleaner now, thanks. 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); -- Alex Bennée From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOnc9-00021k-3q for qemu-devel@nongnu.org; Thu, 28 Jan 2016 09:32:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOnc0-0003BF-Bf for qemu-devel@nongnu.org; Thu, 28 Jan 2016 09:32:01 -0500 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:34712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOnc0-0003B3-4U for qemu-devel@nongnu.org; Thu, 28 Jan 2016 09:31:52 -0500 Received: by mail-wm0-x235.google.com with SMTP id 128so13111808wmz.1 for ; Thu, 28 Jan 2016 06:31:52 -0800 (PST) References: <1453932970-14576-1-git-send-email-edgar.iglesias@gmail.com> <1453932970-14576-4-git-send-email-edgar.iglesias@gmail.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1453932970-14576-4-git-send-email-edgar.iglesias@gmail.com> Date: Thu, 28 Jan 2016 14:31:49 +0000 Message-ID: <87zivphj1m.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 3/3] target-arm: Implement the S2 MMU inputsize > pamax check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Edgar E. Iglesias" Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Edgar E. Iglesias writes: > 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 Much cleaner now, thanks. 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); -- Alex Bennée