From: Will Deacon <will@kernel.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Fuad Tabba <fuad.tabba@linux.dev>,
Mark Rutland <mark.rutland@arm.com>,
Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
Anshuman Khandual <anshuman.khandual@arm.com>,
"Rob Herring (Arm)" <robh@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64/boot: Don't set PMUv3p9 FGT2 bits without PMUv3
Date: Sun, 4 Oct 2026 09:39:49 +0100 [thread overview]
Message-ID: <asIQ1ZwUjkmNJbRP@willie-the-truck> (raw)
In-Reply-To: <ar_QOXqCYTGargBe@arm.com>
On Fri, Oct 02, 2026 at 04:39:37PM +0100, Catalin Marinas wrote:
> On Fri, Oct 02, 2026 at 04:24:06PM +0100, Fuad Tabba wrote:
> > On Fri, Oct 02, 2026 at 03:51:16PM +0100, Catalin Marinas wrote:
> > > I couldn't figure out the #8 either. I wonder whether it's more readable
> > > as (untested):
> > >
> > > sub x1, x1, #ID_AA64DFR0_EL1_PMUVer_V3P9
> > > cmp x1, #(ID_AA64DFR0_EL1_PMUVer_IMP_DEF - ID_AA64DFR0_EL1_PMUVer_V3P9)
> > > b.hs .Lskip_pmuv3p9_\@ // Skip unless V3P9 <= PMUVer < IMP_DEF
> >
> > This looks correct to me.
> >
> > That said, if readability is the goal, I think the plainest is two
> > compares and two branches. It's one more instruction, but this runs
> > once at boot:
> >
> > cmp x1, #ID_AA64DFR0_EL1_PMUVer_IMP_DEF
> > b.eq .Lskip_pmuv3p9_\@
> > cmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9
> > b.lt .Lskip_pmuv3p9_\@
> >
> > I used ccmp to match __init_el2_debug in the same file, which does the
> > same NI/IMP_DEF check with a raw #4, as does reset_pmuserenr_el0 in
> > assembler.h (and hyp-entry.S uses the same pattern for HVC64/HVC32).
>
> I'll leave it to Will. My preference is whatever is more readable, no
> need to optimise another cycle or two here.
Now that Fuad's put me right and given that we already use ccmp in
__init_el2_debug, I think consistency is probably the winner so I'll queue
this as-is.
I wonder if it would be worth having some #defines for some of the common
conditions, so we could avoid having the bare immediates each time in
future? (obviously, that would be a separate cleanup rather than part of
this fix).
Will
next prev parent reply other threads:[~2026-10-04 8:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 12:12 [PATCH] arm64/boot: Don't set PMUv3p9 FGT2 bits without PMUv3 Fuad Tabba
2026-09-30 13:26 ` Anshuman Khandual
2026-09-30 13:32 ` Fuad Tabba
2026-10-01 2:59 ` Anshuman Khandual
2026-10-02 13:29 ` Will Deacon
2026-10-02 13:54 ` Fuad Tabba
2026-10-02 14:00 ` Will Deacon
2026-10-02 14:51 ` Catalin Marinas
2026-10-02 15:24 ` Fuad Tabba
2026-10-02 15:39 ` Catalin Marinas
2026-10-04 8:39 ` Will Deacon [this message]
2026-10-04 13:39 ` Fuad Tabba
2026-10-02 15:33 ` Bradley Morgan
2026-10-04 13:45 ` Will Deacon
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=asIQ1ZwUjkmNJbRP@willie-the-truck \
--to=will@kernel.org \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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