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 r6sm27285239wmd.4.2017.01.24.08.59.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 08:59:53 -0800 (PST) Received: from zen (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTPS id AF2693E0133; Tue, 24 Jan 2017 16:59:52 +0000 (GMT) References: <1484937883-1068-1-git-send-email-peter.maydell@linaro.org> <1484937883-1068-7-git-send-email-peter.maydell@linaro.org> User-agent: mu4e 0.9.19; emacs 25.1.91.4 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: Peter Maydell Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, Liviu Ionescu , Michael Davidsaver , patches@linaro.org Subject: Re: [Qemu-arm] [PATCH 6/6] armv7m: Clear FAULTMASK on return from non-NMI exceptions In-reply-to: <1484937883-1068-7-git-send-email-peter.maydell@linaro.org> Date: Tue, 24 Jan 2017 16:59:52 +0000 Message-ID: <87pojc9ywn.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-TUID: 2ZuDg5wxU7Du Peter Maydell writes: > From: Michael Davidsaver > > FAULTMASK must be cleared on return from all > exceptions other than NMI. > > Signed-off-by: Michael Davidsaver > Reviewed-by: Peter Maydell > Signed-off-by: Peter Maydell > --- > target/arm/helper.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/target/arm/helper.c b/target/arm/helper.c > index dc383d1..cfbc622 100644 > --- a/target/arm/helper.c > +++ b/target/arm/helper.c > @@ -5969,8 +5969,13 @@ static void do_v7m_exception_exit(CPUARMState *env) > uint32_t xpsr; > > type = env->regs[15]; > - if (env->v7m.exception != 0) > + if (env->v7m.exception != ARMV7M_EXCP_NMI) { > + /* Auto-clear FAULTMASK on return from other than NMI */ > + env->daif &= ~PSTATE_F; > + } > + if (env->v7m.exception != 0) { > armv7m_nvic_complete_irq(env->nvic, env->v7m.exception); > + } > > /* Switch to the target stack. */ > switch_v7m_sp(env, (type & 4) != 0); Reviewed-by: Alex Bennée -- Alex Bennée From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cW4Rq-0008W6-Iw for qemu-devel@nongnu.org; Tue, 24 Jan 2017 11:59:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cW4Rn-0000Xa-IX for qemu-devel@nongnu.org; Tue, 24 Jan 2017 11:59:58 -0500 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:37869) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cW4Rn-0000XM-CP for qemu-devel@nongnu.org; Tue, 24 Jan 2017 11:59:55 -0500 Received: by mail-wm0-x22f.google.com with SMTP id c206so219652635wme.0 for ; Tue, 24 Jan 2017 08:59:55 -0800 (PST) References: <1484937883-1068-1-git-send-email-peter.maydell@linaro.org> <1484937883-1068-7-git-send-email-peter.maydell@linaro.org> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1484937883-1068-7-git-send-email-peter.maydell@linaro.org> Date: Tue, 24 Jan 2017 16:59:52 +0000 Message-ID: <87pojc9ywn.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH 6/6] armv7m: Clear FAULTMASK on return from non-NMI exceptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, Liviu Ionescu , Michael Davidsaver , patches@linaro.org Peter Maydell writes: > From: Michael Davidsaver > > FAULTMASK must be cleared on return from all > exceptions other than NMI. > > Signed-off-by: Michael Davidsaver > Reviewed-by: Peter Maydell > Signed-off-by: Peter Maydell > --- > target/arm/helper.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/target/arm/helper.c b/target/arm/helper.c > index dc383d1..cfbc622 100644 > --- a/target/arm/helper.c > +++ b/target/arm/helper.c > @@ -5969,8 +5969,13 @@ static void do_v7m_exception_exit(CPUARMState *env) > uint32_t xpsr; > > type = env->regs[15]; > - if (env->v7m.exception != 0) > + if (env->v7m.exception != ARMV7M_EXCP_NMI) { > + /* Auto-clear FAULTMASK on return from other than NMI */ > + env->daif &= ~PSTATE_F; > + } > + if (env->v7m.exception != 0) { > armv7m_nvic_complete_irq(env->nvic, env->v7m.exception); > + } > > /* Switch to the target stack. */ > switch_v7m_sp(env, (type & 4) != 0); Reviewed-by: Alex Bennée -- Alex Bennée