On 10/28/24 18:05, Mark Rutland wrote: > On Wed, Oct 23, 2024 at 11:42:37AM +0530, Anshuman Khandual wrote: >> >> >> On 10/22/24 21:40, Mark Rutland wrote: >>> On Tue, Oct 01, 2024 at 10:06:01AM +0530, Anshuman Khandual wrote: >>>> Fine grained trap control for MDSELR_EL1 register needs to be configured in >>>> HDFGRTR2_EL2, and HDFGWTR2_EL2 registers when kernel enters at EL1, but EL2 >>>> is also present. This adds a new helper __init_el2_fgt2() initializing this >>>> new FEAT_FGT2 based fine grained registers. >>>> >>>> MDCR_EL2.EBWE needs to be enabled for additional (beyond 16) breakpoint and >>>> watchpoint exceptions when kernel enters at EL1, but EL2 is also present. >>>> This updates __init_el2_debug() as required for FEAT_Debugv8p9. >>>> >>>> While here, also update booting.rst with MDCR_EL3 and SCR_EL3 requirements. >>> >>> [...] >>> >>>> + For CPUs with FEAT_Debugv8p9 extension present: >>>> + >>>> + - If the kernel is entered at EL1 and EL2 is present: >>>> + >>>> + - HDFGRTR2_EL2.nMDSELR_EL1 (bit 5) must be initialized to 0b1 >>>> + - HDFGWTR2_EL2.nMDSELR_EL1 (bit 5) must be initialized to 0b1 >>>> + - MDCR_EL2.EBWE (bit 43) must be initialized to 0b1 >>>> + >>>> + - If EL3 is present: >>>> + >>>> + - MDCR_EL3.TDA (bit 9) must be initialized to 0b0 >>> >>> AFAICT we need TDA==0 this regardless of FEAT_Debugv8p9 (and e.g. we need >> >> That's because MDCR_EL3.TDA=0, enables access to many other debug registers >> beside FEAT_Debugv8p9, which are currently used and hence this MDCR_EL3.TDA >> =0 requirement is a not a new one but rather a missing one instead ? > > Yes, that's why I said we need it regardless; it's an existing > requirement that wasn't documented. Alright, got it. > >> >>> MDCR_EL3.TPM==0 where FEAT_PMUv3 is implemented), so we should probably >>> check if there's anything else we haven't yet documented in MDCR_EL3. >> >> Will scan through MDCR_EL3 register and match it with existing documentation >> i.e Documentation/arch/arm64/booting.rst. If there are some missing MDCR_EL3 >> fields which should be mentioned, will add them via a separate pre-requisite >> patch ? > > Yes please. > > Mark. Sure, will separate those changes in a pre-requisite patch as suggested.