Re: [PATCH] arm64: Do not trap PMSNEVFR_EL1
From: Mark Brown <broonie@kernel.org>
Date: 2021-08-24 15:13:25
Also in:
kvmarm
On Tue, Aug 24, 2021 at 02:24:59PM +0100, Alexandru Elisei wrote:
Commit 31c00d2aeaa2 ("arm64: Disable fine grained traps on boot") zeroed
the fine grained trap registers to prevent unwanted register traps from
occuring. However, for the PMSNEVFR_EL1 register, the corresponding
HDFGRTR_EL2.nPMSNEVFR_EL1 field must be 1 to disable trapping. Set the
field to 1 if FEAT_SPEv1p2 is detected.Oh, that's a shame :/ I wonder why this feature is different to the others, I just had a quick check and didn't see any other issues but...
Based on v5.14-rc7. Also, we could write 1 << 62 to HDFGRTR_EL2 unconditionally since the field is RAZ/WI if !FEAT_SPEv1p2. I don't have a strong preference for either approaches, but I chose this implementation because it's clearer (even though it's more verbose and it's one extra trap on NV).
Yes, the explicit feature check is both clearer and more conservative - it's unlikely to have a practical impact but
At this point, I am inclined to think it's a model bug because reading works, but writing causes a hang and that looks very suspicious to me. I'm going to open a model bug internally and see what comes of it.
...are you sure this isn't that the same issue also exists with the equivalent field HDFGWTR_EL2 - glancing at the XML it appears to have the same issue? One of the fine grained aspects of fine grained traps is that there's separate read and write traps!