Re: [PATCH v2 3/3] KVM: arm64: Disable host PMU counters for protected guests
From: Fuad Tabba
Date: Wed Oct 28 2026 - 09:28:57 EST
On Wed, 28 Oct 2026 at 12:52, Marc Zyngier <maz@xxxxxxxxxx> wrote:
>
> On Wed, 28 Oct 2026 11:07:39 +0000,
> Fuad Tabba <fuad.tabba@xxxxxxxxx> wrote:
[...]
> > +static u64 __pmu_stop_host_counters(struct kvm_vcpu *vcpu)
> > +{
> > + u64 pmcnten;
> > +
> > + if (!vcpu_is_protected(vcpu) || !system_supports_pmuv3())
> > + return 0;
> > +
> > + pmcnten = read_sysreg(pmcntenset_el0);
> > + if (pmcnten)
> > + write_sysreg(pmcnten, pmcntenclr_el0);
>
> It feels a bit odd to change the individual counter enables, rather
> than just use PMCR_EL0.E, which is designed for this purpose.
>
> It probably doesn't change much, but it'd certainly make the intent a
> bit more obvious. Or am I missing something?
Nope, my miss. I'll move to PMCR_EL0.E in v3.
Thanks,
/fuad