Re: [PATCH] KVM: arm64: Fix hvhe and broken CNTVOFF_EL2
Fuad Tabba <[email protected]> Thu, 6 Aug 2026 17:55:50 +0100
| Newsgroups | dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CA+EHjTzk154LY4Tb8mKCL5iud23M_VovoRAujkr6qOqEc4_rWg@mail.gmail.com> |
Hi Mostafa, On Thu, 6 Aug 2026 at 16:01, Mostafa Saleh <[email protected]> wrote: ... > void __kvm_timer_set_cntvoff(u64 cntvoff) > { > @@ -63,7 +64,7 @@ void __timer_enable_traps(struct kvm_vcpu *vcpu) > * Trap the virtual counter/timer if we have a broken cntvoff > * implementation. > */ > - if (has_broken_cntvoff()) > + if (has_broken_cntvoff() && hyp_timer_get_offset(vcpu_vtimer(vcpu))) > set |= CNTHCTL_EL1TVT | CNTHCTL_EL1TVCT; nit: the comment above could note the trap is now gated on a non-zero virtual offset, to match timer_set_traps() on the VHE side (well... maybe you don't want to _completely_ match _that_ comment, but you get my drift ;)) . Tested on QEMU with a forced has_broken_cntvoff(), then booted a protected guest: without the patch it hits the UNDEF, with it the guest boots. Reviewed-by: Fuad Tabba <[email protected]> Tested-by: Fuad Tabba < [email protected]> Cheers, /fuad > > sysreg_clear_set(cnthctl_el2, clr, set); > -- > 2.55.0.654.g21b8a5bc05-goog >