Messages in this thread | | | Date | Thu, 23 Mar 2023 12:54:29 +0000 | From | Mark Brown <> | Subject | Re: [PATCH V9 00/10] arm64/perf: Enable branch stack sampling |
| |
On Thu, Mar 23, 2023 at 09:55:47AM +0530, Anshuman Khandual wrote: > On 3/22/23 00:32, Mark Brown wrote:
> > document a requirement for those traps to be disabled now in case we > > need them later, and do so during EL2 setup for KVM guests? That could > > always be done incrementally.
> Unlike all other instruction trap enable fields in SYS_HFGITR_EL2, these BRBE > instructions ones are actually inverted in semantics i.e the particular fields > need to be set for these traps to be disabled in EL2.
Right, for backwards compatibility all newly added fields are trap by default.
> SYS_HFGITR_EL2.nBRBIALL > SYS_HFGITR_EL2.nBRBINJ
> By default entire SYS_HFGITR_EL2 is set as cleared during init and that would > prevent a guest from using BRBE.
It should prevent the host as well shouldn't it?
> I guess something like the following (untested) needs to be done, to enable > BRBE in guests.
> + mrs x1, id_aa64dfr0_el1 > + ubfx x1, x1, #ID_AA64DFR0_EL1_BRBE_SHIFT, #4 > + cbz x1, .Lskip_brbe_\@ > + mov x0, xzr > + orr x0, x0, #HFGITR_EL2_nBRBIALL > + orr x0, x0, #HFGITR_EL2_nBRBINJ > + msr_s SYS_HFGITR_EL2, x0 > + > +.Lskip_brbe_\@:
Yes, looks roughly what I'd expect.
> > I've got a patch adding the definition of that register to sysreg which > > I should be sending shortly, no need to duplicate that effort.
> Sure, I assume you are moving the existing definition for SYS_HFGITR_EL2 along > with all its fields from ../include/asm/sysreg.h to ../tools/sysreg. Right, it > makes sense.
No fields at the minute but yes, like the other conversions. [unhandled content-type:application/pgp-signature] | |