[RFC PATCH v7 05/28] perf: arm_spe_pmu: Add PMBIDR_EL1 and PMSIDR_EL1 to struct arm_spe_pmu
Alexandru Elisei
alexandru.elisei at arm.com
Fri Nov 27 06:59:50 PST 2026
Hi Lorenzo,
On Mon, Nov 16, 2026 at 05:56:28PM +0000, Lorenzo Stoakes (ARM) wrote:
> On Wed, Nov 11, 2026 at 05:20:08PM +0000, Alexandru Elisei wrote:
[..]
> > On Thu, Oct 15, 2026 at 04:12:27PM +0100, Lorenzo Stoakes (ARM) wrote:
[..]
> > > On Thu, Sep 03, 2026 at 05:06:00PM +0100, Alexandru Elisei wrote:
[..]
> > > > diff --git a/include/linux/perf/arm_spe_pmu.h b/include/linux/perf/arm_spe_pmu.h
> > > > index af86fd184050..97b14e236fcd 100644
> > > > --- a/include/linux/perf/arm_spe_pmu.h
> > > > +++ b/include/linux/perf/arm_spe_pmu.h
> > > > @@ -21,6 +21,8 @@ struct arm_spe_pmu {
> > > > cpumask_t supported_cpus;
> > > > struct hlist_node hotplug_node;
> > > >
> > > > + u64 pmbidr_el1;
> > >
> > > Equally, this doesn't seem to be used anywhere in the series, maybe drop?
> >
> > Fixed.
> >
> > >
> > > > + u64 pmsidr_el1;
> > >
> > > This field is used in kvm_spe_has_feat_spe_fds() and
> > > kvm_spe_has_feat_spe_fne():
> > >
> > > bool kvm_spe_has_feat_spe_fds(struct kvm *kvm)
> > > {
> > > ...
> > > return kvm_has_feat(kvm, ID_AA64DFR0_EL1, PMSVer, V1P4) &&
> > > FIELD_GET(PMSIDR_EL1_FDS, spe_pmu->pmsidr_el1);
> > > }
> > >
> > > bool kvm_spe_has_feat_spe_fne(struct kvm *kvm)
> > > {
> > > ...
> > > return kvm_has_feat(kvm, ID_AA64DFR0_EL1, PMSVer, V1P2) &&
> > > FIELD_GET(PMSIDR_EL1_FnE, spe_pmu->pmsidr_el1);
> > > }
> > >
> > > So checking for FDS and FnE, but these are available as feature flags as
> > > __arm_spe_pmu_dev_probe() gets these:
> > >
> > > static void __arm_spe_pmu_dev_probe(void *info)
> > > {
> > > ...
> > > if (FIELD_GET(PMSIDR_EL1_FnE, reg))
> > > spe_pmu->features |= SPE_PMU_FEAT_INV_FILT_EVT;
> > > ...
> > > if (FIELD_GET(PMSIDR_EL1_FDS, reg))
> > > spe_pmu->features |= SPE_PMU_FEAT_FDS;
> > > ...
> > > }
> > >
> > > And then kvm_spe_has_feat_spe_fds() and kvm_spe_has_feat_spe_fne() can be:
> > >
> > > bool kvm_spe_has_feat_spe_fds(struct kvm *kvm)
> > > {
> > > ...
> > > return kvm_has_feat(kvm, ID_AA64DFR0_EL1, PMSVer, V1P4) &&
> > > (spe_pmu->features & SPE_PMU_FEAT_FDS);
> > > }
> > >
> > > bool kvm_spe_has_feat_spe_fne(struct kvm *kvm)
> > > {
> > > ...
> > > return kvm_has_feat(kvm, ID_AA64DFR0_EL1, PMSVer, V1P2) &&
> > > (spe_pmu->features & SPE_PMU_FEAT_INV_FILT_EVT);
> > > }
> > >
> > > Right?
> >
> > In this use case they are functionally the same, yes, but conceptually, they are
> > not the same thing. spe_pmu->features advertises the features that the SPE
> > *driver* supports, PMSIDR_EL1 advertises the features that the *hardware*
> > implements. The two are not always equal. For example, KVM added handling for
> > the PMSNEVFR_EL1 register (added by FEAT_SPE_FnE), a few years before the SPE
> > driver supported FEAT_SPE_FnE.
> >
> > I can see KVM, in the future, having to virtualize hardware features not
> > supported by the host driver yet, so unless you have a strong objection, I would
> > rather keep the use of the architectural register instead of relying on the
> > driver.
>
> Ack OK, sounds sensible, no strong objection but could you add a sentence to the
> commit msg about that? Thanks! :)
Done.
Thanks,
Alex
More information about the linux-arm-kernel
mailing list