public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux•org.uk>
To: Marc Zyngier <maz@kernel•org>
Cc: linux-arm-kernel@lists•infradead.org, kvm@vger•kernel.org,
	kvmarm@lists•cs.columbia.edu, James Morse <james.morse@arm•com>,
	Suzuki K Poulose <suzuki.poulose@arm•com>,
	Alexandru Elisei <alexandru.elisei@arm•com>,
	Alexandre Chartre <alexandre.chartre@oracle•com>,
	Robin Murphy <robin.murphy@arm•com>,
	kernel-team@android•com
Subject: Re: [PATCH 1/3] KVM: arm64: Narrow PMU sysreg reset values to architectural requirements
Date: Tue, 13 Jul 2021 17:15:44 +0100	[thread overview]
Message-ID: <20210713161544.GL22278@shell.armlinux.org.uk> (raw)
In-Reply-To: <87mtqq6w75.wl-maz@kernel.org>

On Tue, Jul 13, 2021 at 04:59:58PM +0100, Marc Zyngier wrote:
> On Tue, 13 Jul 2021 15:39:49 +0100,
> "Russell King (Oracle)" <linux@armlinux•org.uk> 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 Marc.

For the whole series:

Acked-by: Russell King (Oracle) <rmk+kernel@armlinux•org.uk>

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-07-13 16:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 13:58 [PATCH 0/3] kvm-arm64: Fix PMU reset values (and more) Marc Zyngier
2021-07-13 13:58 ` [PATCH 1/3] KVM: arm64: Narrow PMU sysreg reset values to architectural requirements Marc Zyngier
2021-07-13 14:39   ` Russell King (Oracle)
2021-07-13 15:59     ` Marc Zyngier
2021-07-13 16:15       ` Russell King (Oracle) [this message]
2021-07-14 15:48   ` Alexandru Elisei
2021-07-15 11:11     ` Marc Zyngier
2021-07-15 11:51       ` Robin Murphy
2021-07-15 12:25         ` Marc Zyngier
2021-07-13 13:58 ` [PATCH 2/3] KVM: arm64: Drop unnecessary masking of PMU registers Marc Zyngier
2021-07-14 16:12   ` Alexandru Elisei
2021-07-13 13:59 ` [PATCH 3/3] KVM: arm64: Disabling disabled PMU counters wastes a lot of time Marc Zyngier
2021-07-14 16:18   ` Alexandru Elisei
2021-07-15  8:34 ` [PATCH 0/3] kvm-arm64: Fix PMU reset values (and more) Alexandre Chartre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210713161544.GL22278@shell.armlinux.org.uk \
    --to=linux@armlinux$(echo .)org.uk \
    --cc=alexandre.chartre@oracle$(echo .)com \
    --cc=alexandru.elisei@arm$(echo .)com \
    --cc=james.morse@arm$(echo .)com \
    --cc=kernel-team@android$(echo .)com \
    --cc=kvm@vger$(echo .)kernel.org \
    --cc=kvmarm@lists$(echo .)cs.columbia.edu \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=maz@kernel$(echo .)org \
    --cc=robin.murphy@arm$(echo .)com \
    --cc=suzuki.poulose@arm$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox