All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: Buggy branch in __init_el2_gicv3?
Date: Mon, 14 Feb 2022 16:26:01 +0000	[thread overview]
Message-ID: <a5ee26b2e9fd44849fb598c0a2404cfb@kernel.org> (raw)
In-Reply-To: <YgptqviZbdXtaNH6@FVFF77S0Q05N>

On 2022-02-14 14:56, Mark Rutland wrote:
> On Mon, Feb 14, 2022 at 12:34:12PM +0000, Joakim Tjernlund wrote:
>> In init_el2_state calls __init_el2_gicv3 which looks:
>> 
>> /* GICv3 system register access */
>> .macro __init_el2_gicv3
>> 	mrs	x0, id_aa64pfr0_el1
>> 	ubfx	x0, x0, #ID_AA64PFR0_GIC_SHIFT, #4
>> 	cbz	x0, .Lskip_gicv3_\@
>> 
>> 	mrs_s	x0, SYS_ICC_SRE_EL2
>> 	orr	x0, x0, #ICC_SRE_EL2_SRE	// Set ICC_SRE_EL2.SRE==1
>> 	orr	x0, x0, #ICC_SRE_EL2_ENABLE	// Set ICC_SRE_EL2.Enable==1
>> 	msr_s	SYS_ICC_SRE_EL2, x0
>> 	isb					// Make sure SRE is now set
>> 	mrs_s	x0, SYS_ICC_SRE_EL2		// Read SRE back,
>> 	tbz     x0, #0, 1f
>> //	tbz	x0, #0, .Lskip_gicv3_\@		// and check that it sticks
>> 	msr_s	SYS_ICH_HCR_EL2, xzr		// Reset ICC_HCR_EL2 to defaults
>> .Lskip_gicv3_\@:
>> .endm
>> 
>> Note the tbz     x0, #0, 1f, this instruction causes my A53 CPU to 
>> jump far out of the macro and make the
>> CPU go into EL0, failing with an exception a bit later. I believe the 
>> 1f is a bug and if I replace it with
>>  tbz	x0, #0, .Lskip_gicv3_\@
>> the CPU continue too boot.
> 
> You're right, that should be targetting `.Lskip_gicv3_\@`. It looks 
> like that
> was left behind in commit:
> 
>   114945d84a30a5fe ("arm64: Fix labels in el2_setup macros")
> 
> Marc?

Yup, that's a glaring bug. My bad. Thanks for pointing that out.

Joakim, can you please write a patch and cc me?

Cheers,

         M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-02-14 16:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 12:34 Buggy branch in __init_el2_gicv3? Joakim Tjernlund
2022-02-14 14:56 ` Mark Rutland
2022-02-14 15:14   ` Joakim Tjernlund
2022-02-14 17:16     ` Marc Zyngier
2022-02-14 16:26   ` Marc Zyngier [this message]
2022-02-14 17:12     ` Joakim Tjernlund

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=a5ee26b2e9fd44849fb598c0a2404cfb@kernel.org \
    --to=maz@kernel.org \
    --cc=Joakim.Tjernlund@infinera.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.