qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Bonnans, Laurent" <laurent.bonnans@here.com>
To: Clement Deschamps <clement.deschamps@greensocs.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	Andrew Baumann <Andrew.Baumann@microsoft.com>
Subject: Re: [PATCH] hw/arm/boot: Set NSACR.{CP11, CP10} in dummy SMC setup routine
Date: Tue, 5 Nov 2019 13:01:42 +0000	[thread overview]
Message-ID: <e04fb8db-6711-df97-50b6-c91bdbdb1219@here.com> (raw)
In-Reply-To: <20191104151137.81931-1-clement.deschamps@greensocs.com>

On 11/4/19 4:11 PM, Clement Deschamps wrote:

> Set the NSACR CP11 and CP10 bits, to allow FPU access in Non-Secure state
> when using dummy SMC setup routine. Otherwise an AArch32 kernel will UNDEF as
> soon as it tries to use the FPU.
>
> This fixes kernel panic when booting raspbian on raspi2.
I can confirm that it solves the kernel panics we've had in our tests 
when running our yocto-built images.

Tested-by: Laurent Bonnans <laurent.bonnans@here.com>

Laurent
>
> Successfully tested with:
>    2017-01-11-raspbian-jessie-lite.img
>    2018-11-13-raspbian-stretch-lite.img
>    2019-07-10-raspbian-buster-lite.img
>
> See also commit ece628fcf6 that fixes the issue when *not* using the
> dummy SMC setup routine.
>
> Fixes: fc1120a7f5
> Signed-off-by: Clement Deschamps <clement.deschamps@greensocs.com>
> ---
>   hw/arm/boot.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index ef6724960c..8fb4a63606 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -240,6 +240,9 @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
>       };
>       uint32_t board_setup_blob[] = {
>           /* board setup addr */
> +        0xee110f51, /* mrc     p15, 0, r0, c1, c1, 2  ;read NSACR */
> +        0xe3800b03, /* orr     r0, #0xc00             ;set CP11, CP10 */
> +        0xee010f51, /* mcr     p15, 0, r0, c1, c1, 2  ;write NSACR */
>           0xe3a00e00 + (mvbar_addr >> 4), /* mov r0, #mvbar_addr */
>           0xee0c0f30, /* mcr     p15, 0, r0, c12, c0, 1 ;set MVBAR */
>           0xee110f11, /* mrc     p15, 0, r0, c1 , c1, 0 ;read SCR */

  reply	other threads:[~2019-11-05 13:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04 15:11 [PATCH] hw/arm/boot: Set NSACR.{CP11, CP10} in dummy SMC setup routine Clement Deschamps
2019-11-05 13:01 ` Bonnans, Laurent [this message]
2019-11-11 11:41 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e04fb8db-6711-df97-50b6-c91bdbdb1219@here.com \
    --to=laurent.bonnans@here.com \
    --cc=Andrew.Baumann@microsoft.com \
    --cc=clement.deschamps@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).