Hi Peter,
Thanks for reviewing!
On Mon, Sep 28, 2026 at 03:01:32PM +0100, Peter Maydell wrote:
> FYI for next time around, QEMU patches that depend on not-yet-accepted
> kernel ABI changes should be tagged RFC, please.
Ack, sorry about that. I will tag future versions with RFC until the
kernel uAPI is accepted.
> > ---
> > target/arm/cpu.c | 20 ++++++++++++++++++++
> > target/arm/cpu.h | 4 ++++
> > target/arm/kvm.c | 32 ++++++++++++++++++++++++++++++++
>
> New CPU properties should be documented in docs/system/arm/cpu-features.rst .
Will document them there in the next revision.
> > +static bool arm_get_pmu_partition(Object *obj, Error **errp)
> > +{
> > + ARMCPU *cpu = ARM_CPU(obj);
> > +
> > + return cpu->kvm_pmu_partition;
> > +}
> > +
> > +static void arm_set_pmu_partition(Object *obj, bool value, Error **errp)
> > +{
> > + ARMCPU *cpu = ARM_CPU(obj);
> > +
> > + cpu->kvm_pmu_partition = value;
> > +}
>
> If your getter/setter are only updating the struct field,
> you can use a DEFINE_PROP_BOOL to avoid having to have them
> (compare arm_cpu_has_el2_property etc.)
Thanks, I will switch to DEFINE_PROP_BOOL.
> > if (arm_feature(&cpu->env, ARM_FEATURE_PMU)) {
> > cpu->has_pmu = true;
> > object_property_add_bool(obj, "pmu", arm_get_pmu, arm_set_pmu);
> > + object_property_add_bool(obj, "pmu-partition",
> > + arm_get_pmu_partition,
> > + arm_set_pmu_partition);
> > + object_property_add_uint32_ptr(obj, "pmu-num-counters",
> > + &cpu->kvm_pmu_nr_counters,
> > + OBJ_PROP_FLAG_READWRITE);
>
> What should we do with these properties if we're not using KVM
> (i.e. for TCG, hvf, etc) ?
PMU partitioning is specific to KVM, so moving it into
kvm_arm_add_vcpu_properties() (which is only called when kvm_enabled())
and naming it "kvm-pmu-partition" per the KVM VCPU Features convention
in docs/system/arm/cpu-features.rst seems to make the most sense.
For the counter limit property, would you prefer that it also live in
kvm_arm_add_vcpu_properties() as "kvm-pmu-num-counters" (KVM-only), or
keep "pmu-num-counters" general so TCG can also use it to override
PMCR_EL0.N in reset_pmcr_el0?
Thanks,
Colton