[boot-wrapper 5/7] aarch64: Introduce EL2 boot code for Armv8-R AArch64

Andre Przywara andre.przywara at arm.com
Tue Jul 16 06:52:09 PDT 2024


On Tue, 16 Jul 2024 14:33:08 +0100
Luca Fancellu <Luca.Fancellu at arm.com> wrote:

Hi Luca,

> > A patch to a patch is really hard to read, please send a new version with
> > your proposal.  
> 
> Sure I will.
> 
> >>>  
> >>
> >> I think you are right, also, reading again the manual we have the HCR_EL2.EnSCXT bit implemented only when
> >> FEAT_CSV2_2 is implemented or FEAT_CSV2_1p2 is implemented, otherwise it’s res0, so I think I should check:
> >>
> >> 1) FEAT_CSV2_2 which is implemented if ID_AA64PFR0_EL1.CSV2 is 0010 (2)  
> >
> > ... or larger than 2, since CSV2_3 includes all functionality of CSV2_2.
> >  
> >> 2) FEAT_CSV2_1p2 which is implemented if ID_AA64PFR1_EL1.CSV2_frac is 0010 (2)  
> >
> > ... and ID_AA64PFR0_EL1.CSV2 is 0b0001. Also I think CSV2_frac >= 0b0010.
> >  
> >> Does it sounds ok for you?  
> >
> > Before this gets too complicated, please check two things:
> > 1) HCR_EL2.EnSCXT is RES0 otherwise, which means we can always write this
> > unconditionally, without adverse effects?  
> 
> Yes, HCR_EL2.EnSCXT is RES0 otherwise, I guess that if we write 1 when it is not implemented, it is ignored? And
> for the cases where it is implemented, then 1 would be the right value.
> Would it be the right approach? I’ve always avoided to write on reserved fields.

Yeah, I agree it leaves some bitter taste, though the definition of RES0
in the glossary seems to suggest it's safe to do.
In this particular case, which is confined to v8-R64, which implements at
least some kind of CSV2, I personally tend to set HCR_EL2.EnSCXT
unconditionally, accompanied by a comment why it is safe to do so.

Cheers,
Andre

> > 2) The Armv8-R64 supplement defines minimum values for PFR0.CSV2, maybe
> > this simplifies some checks?  
> 
> I checked but it doesn’t simplifies, so I think I should do:
> 
> if ((mrs_field(ID_AA64PFR0_EL1, CSV2) >= 2) ||
>     ((mrs_field(ID_AA64PFR0_EL1, CSV2) >= 1) && (mrs_field(ID_AA64PFR1_EL1, CSV2_frac) >= 2)))
>     hcr |= HCR_EL2_ENSCXT_NOTRAP;
> 
> Please let me know your preference.
> 
> Cheers,
> Luca
> 
> >
> > Cheers,
> > Andre  
> 




More information about the linux-arm-kernel mailing list