On Tue, 13 Jul 2021 15:39:49 +0100, "Russell King (Oracle)" <linux@xxxxxxxxxxxxxxx> wrote: > > On Tue, Jul 13, 2021 at 02:58:58PM +0100, Marc Zyngier wrote: > > +static void reset_pmu_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) > > +{ > > + u64 n, mask; > > + > > + /* No PMU available, any PMU reg may UNDEF... */ > > + if (!kvm_arm_support_pmu_v3()) > > + return; > > + > > + n = read_sysreg(pmcr_el0) >> ARMV8_PMU_PMCR_N_SHIFT; > > + n &= ARMV8_PMU_PMCR_N_MASK; > > + > > + reset_unknown(vcpu, r); > > + > > + mask = BIT(ARMV8_PMU_CYCLE_IDX); > > + if (n) > > + mask |= GENMASK(n - 1, 0); > > + > > + __vcpu_sys_reg(vcpu, r->reg) &= mask; > > Would this read more logically to structure it as: > > mask = BIT(ARMV8_PMU_CYCLE_IDX); > > n = read_sysreg(pmcr_el0) >> ARMV8_PMU_PMCR_N_SHIFT; > n &= ARMV8_PMU_PMCR_N_MASK; > if (n) > mask |= GENMASK(n - 1, 0); > > reset_unknown(vcpu, r); > __vcpu_sys_reg(vcpu, r->reg) &= mask; > > ? Yup, that's nicer. Amended locally. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm