[PATCH v2 3/3] KVM: arm64: Disable host PMU counters for protected guests

Fuad Tabba fuad.tabba at linux.dev
Wed Oct 28 06:27:50 PDT 2026


On Wed, 28 Oct 2026 at 12:52, Marc Zyngier <maz at kernel.org> wrote:
>
> On Wed, 28 Oct 2026 11:07:39 +0000,
> Fuad Tabba <fuad.tabba at linux.dev> 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



More information about the linux-arm-kernel mailing list