Re: [PATCH 4/9] KVM: arm64: PMU: Add counter_index_to_*reg() helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 10, 2022 at 02:17:52AM -0500, Oliver Upton wrote:
> On Fri, Aug 05, 2022 at 02:58:08PM +0100, Marc Zyngier wrote:
> > In order to reduce the boilerplate code, add two helpers returning
> > the counter register index (resp. the event register) in the vcpu
> > register file from the counter index.
> > 
> > Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
> 
> Reviewed-by: Oliver Upton <oliver.upton@xxxxxxxxx>
> 
> > ---
> >  arch/arm64/kvm/pmu-emul.c | 27 +++++++++++++++------------
> >  1 file changed, 15 insertions(+), 12 deletions(-)
> > 
> > diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c
> > index 0ab6f59f433c..9be485d23416 100644
> > --- a/arch/arm64/kvm/pmu-emul.c
> > +++ b/arch/arm64/kvm/pmu-emul.c
> > @@ -75,6 +75,16 @@ static struct kvm_vcpu *kvm_pmc_to_vcpu(struct kvm_pmc *pmc)
> >  	return container_of(vcpu_arch, struct kvm_vcpu, arch);
> >  }
> >  
> > +static u32 counter_index_to_reg(u64 idx)
> > +{
> > +	return (idx == ARMV8_PMU_CYCLE_IDX) ? PMCCNTR_EL0 : PMEVCNTR0_EL0 + idx;
> > +}
> > +
> > +static u32 counter_index_to_evtreg(u64 idx)
> > +{
> > +	return (idx == ARMV8_PMU_CYCLE_IDX) ? PMCCFILTR_EL0 : PMEVTYPER0_EL0 + idx;
> > +}
> > +

After reading the series, do you think these helpers could be applied to
kvm_pmu_counter_increment() as well?

--
Thanks,
Oliver
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux