Re: [PATCH 00/11] KVM: arm64: Add NV timer support

Oliver Upton
2024-12-05T00:40:33Z

On Mon, Dec 02, 2024 at 05:21:23PM +0000, Marc Zyngier wrote:
> Here's another batch of NV-related patches, this time bringing in most
> of the timer support for EL2 as well as nested guests.
>
> The code is pretty convoluted for a bunch of reasons:
>
> - FEAT_NV2 breaks the timer semantics by redirecting HW controls to
> memory, meaning that a guest could setup a timer and never see it
> firing until the next exit
>
> - We go try hard to reflect the timer state in memory, but that's not
> great.
>
> - With FEAT_ECV, we can finally correctly emulate the virtual timer,
> but this emulation is pretty costly
>
> - As a way to make things suck less, we handle timer reads as early as
> possible, and only defer writes to the normal trap handling
>
> - Finally, some implementations are badly broken, and require some
> hand-holding, irrespective of NV support. So we try and reuse the NV
> infrastructure to make them usable. This could be further optimised,
> but I'm running out of patience for this sort of HW.
>
> What this is not implementing is support for CNTPOFF_EL2. It appears
> that the architecture doesn't let you correctly emulate it, so I guess
> this will be trap/emulate for the foreseeable future.
>
> This series is on top of v6.13-rc1, and has been tested on my usual M2
> setup, but also on a Snapdragon X1 Elite devkit. I would like to thank
> Qualcomm for the free hardware with no strings (nor support) attached!

This series is looking pretty good to me, but I think it'd be good to
remap "EL0 timer" -> "EL1 timer" throughout this series to match the
architectural term.

--
Thanks,
Oliver