Re: [PATCH V17 4/9] arm64/boot: Enable EL2 requirements for BRBE

From: Mark Rutland
Date: Mon Jun 03 2024 - 05:44:28 EST


On Mon, Jun 03, 2024 at 02:41:32PM +0530, Anshuman Khandual wrote:
> On 5/29/24 16:21, Mark Rutland wrote:
> > On Fri, Apr 05, 2024 at 08:16:34AM +0530, Anshuman Khandual wrote:

> >> + For CPUs with feature Branch Record Buffer Extension (FEAT_BRBE):
> >> +
> >> + - If the kernel is entered at EL2 and EL1 is present:
> >> +
> >> + - BRBCR_EL1.CC (bit 3) must be initialised to 0b1.
> >> + - BRBCR_EL1.MPRED (bit 4) must be initialised to 0b1.
> >
> > IIUC this isn't necessary; if the kernel is entered at EL2, it's capable
> > of initializing the EL1 regs, and it doesn't look like this silently
> > affects something we'd need in the absence of a BRBE driver.
>
> No, this does not affect anything other than the BRBE driver.

Ok.

> > AFAICT the __init_el2_brbe() code you add below handles this, so I think
> > this is redundant and can be deleted.
>
> Did not understand the above. __init_el2_brbe() handles setting both BRBCR_EL2
> and BRBCR_EL1 for CC and MPRED config irrespective of whether the kernel enters
> EL2 directly or enters EL1 via EL2. But should not that be documented here for
> both those scenarios ? OR because once the kernel is in EL2, it can configure
> EL1 as required, so it is not a booting requirement anymore ?

The latter -- since the kernel can set this up, and only needs to do
that for the BRBE driver to work, this doesn't need to be a requiremnt
on FW/bootloader. So we can drop this when the kernel is booted at EL2.

Mark.