diff mbox series

arm64: Add missing registrations of SF8MMx hwcaps

Message ID 20250210-arm64-fix-2024-dpisa-v1-1-d77f43c7b253@kernel.org (mailing list archive)
State New
Headers show
Series arm64: Add missing registrations of SF8MMx hwcaps | expand

Commit Message

Mark Brown Feb. 10, 2025, 5:49 p.m. UTC
Commit 819935464cb2 ("arm64/hwcap: Describe 2024 dpISA extensions to
userspace") added definitions for HWCAP_F8MM8 and HWCAP_F8MM4 but did
not include the crucial registration in arm64_elf_hwcaps.  Add it.

Fixes: 819935464cb2 ("arm64/hwcap: Describe 2024 dpISA extensions to userspace")
Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/kernel/cpufeature.c | 2 ++
 1 file changed, 2 insertions(+)


---
base-commit: 21fed7c223e20e694b91dbf25936d922a50c8b19
change-id: 20250207-arm64-fix-2024-dpisa-635a5961609c

Best regards,

Comments

Mark Rutland Feb. 10, 2025, 6:41 p.m. UTC | #1
On Mon, Feb 10, 2025 at 05:49:33PM +0000, Mark Brown wrote:
> Commit 819935464cb2 ("arm64/hwcap: Describe 2024 dpISA extensions to
> userspace") added definitions for HWCAP_F8MM8 and HWCAP_F8MM4 but did
> not include the crucial registration in arm64_elf_hwcaps.  Add it.

Looking again, it looks like KERNEL_HWCAP_FPRCVT also isn't wired up?

I did a quick check for suspects in that commit with:

| [mark@lakrids:~/src/linux]% git show 819935464cb2 | grep '^+\s' | grep -o 'KERNEL_HWCAP_[A-Z0-9_]\+' | sort | uniq -c | sort -n
|       1 KERNEL_HWCAP_F8MM4
|       1 KERNEL_HWCAP_F8MM8
|       1 KERNEL_HWCAP_FPRCVT
|       1 KERNEL_HWCAP_SME_SF8MM4
|       1 KERNEL_HWCAP_SME_SF8MM8
|       2 KERNEL_HWCAP_CMPBR
|       2 KERNEL_HWCAP_SME2P2
|       2 KERNEL_HWCAP_SME_AES
|       2 KERNEL_HWCAP_SME_SBITPERM
|       2 KERNEL_HWCAP_SME_SFEXPA
|       2 KERNEL_HWCAP_SME_SMOP4
|       2 KERNEL_HWCAP_SME_STMOP
|       2 KERNEL_HWCAP_SVE2P2
|       2 KERNEL_HWCAP_SVE_AES2
|       2 KERNEL_HWCAP_SVE_BFSCALE
|       2 KERNEL_HWCAP_SVE_ELTPERM
|       2 KERNEL_HWCAP_SVE_F16MM

... and while KERNEL_HWCAP_SME_SF8MM4 and KERNEL_HWCAP_SME_SF8MM8 are
gone now, KERNEL_HWCAP_FPRCVT is still around AFAICT.

Checking against a tree based on v6.14-rc1, it superficially looks like
we're not missing any other KERNEL_HWCAP_* bits per a coarse search,
which shows three missing entries in cpufeature.c:

| [mark@lakrids:~/src/linux]% git grep -oh 'KERNEL_HWCAP_[A-Z0-9_]\+' -- arch/arm64/include/asm/hwcap.h | wc -l              
| 112
| [mark@lakrids:~/src/linux]% git grep -oh 'KERNEL_HWCAP_[A-Z0-9_]\+' -- arch/arm64/include/asm/hwcap.h | sort | uniq | wc -l
| 112
| [mark@lakrids:~/src/linux]% git grep -oh 'KERNEL_HWCAP_[A-Z0-9_]\+' -- arch/arm64/kernel/cpuinfo.c | sort | uniq | wc -l
| 112
| [mark@lakrids:~/src/linux]% git grep -oh 'KERNEL_HWCAP_[A-Z0-9_]\+' -- arch/arm64/kernel/cpufeature.c | sort | uniq | wc -l
| 109

... but maybe that misses something, and I haven't checked
COMPAT_HWCAP(*) or COMPAT_HWCAP2(*).

Could you please go check if there's anything else missing more generally?

Mark.

> Fixes: 819935464cb2 ("arm64/hwcap: Describe 2024 dpISA extensions to userspace")
> Reported-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  arch/arm64/kernel/cpufeature.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index f0910f20fbf8c18fbeb63bcee18abf13371b1d5e..2cde1e6e309a1b840e0e8dc3a5a55f07f0aadd82 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -3190,6 +3190,8 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
>  	HWCAP_CAP(ID_AA64FPFR0_EL1, F8FMA, IMP, CAP_HWCAP, KERNEL_HWCAP_F8FMA),
>  	HWCAP_CAP(ID_AA64FPFR0_EL1, F8DP4, IMP, CAP_HWCAP, KERNEL_HWCAP_F8DP4),
>  	HWCAP_CAP(ID_AA64FPFR0_EL1, F8DP2, IMP, CAP_HWCAP, KERNEL_HWCAP_F8DP2),
> +	HWCAP_CAP(ID_AA64FPFR0_EL1, F8MM8, IMP, CAP_HWCAP, KERNEL_HWCAP_F8MM8),
> +	HWCAP_CAP(ID_AA64FPFR0_EL1, F8MM4, IMP, CAP_HWCAP, KERNEL_HWCAP_F8MM4),
>  	HWCAP_CAP(ID_AA64FPFR0_EL1, F8E4M3, IMP, CAP_HWCAP, KERNEL_HWCAP_F8E4M3),
>  	HWCAP_CAP(ID_AA64FPFR0_EL1, F8E5M2, IMP, CAP_HWCAP, KERNEL_HWCAP_F8E5M2),
>  #ifdef CONFIG_ARM64_POE
> 
> ---
> base-commit: 21fed7c223e20e694b91dbf25936d922a50c8b19
> change-id: 20250207-arm64-fix-2024-dpisa-635a5961609c
> 
> Best regards,
> -- 
> Mark Brown <broonie@kernel.org>
>
Mark Brown Feb. 10, 2025, 7:14 p.m. UTC | #2
On Mon, Feb 10, 2025 at 06:41:09PM +0000, Mark Rutland wrote:
> On Mon, Feb 10, 2025 at 05:49:33PM +0000, Mark Brown wrote:
> > Commit 819935464cb2 ("arm64/hwcap: Describe 2024 dpISA extensions to
> > userspace") added definitions for HWCAP_F8MM8 and HWCAP_F8MM4 but did
> > not include the crucial registration in arm64_elf_hwcaps.  Add it.

> Looking again, it looks like KERNEL_HWCAP_FPRCVT also isn't wired up?

Indeed.  I'll add that separately.

> I did a quick check for suspects in that commit with:

> | [mark@lakrids:~/src/linux]% git show 819935464cb2 | grep '^+\s' | grep -o 'KERNEL_HWCAP_[A-Z0-9_]\+' | sort | uniq -c | sort -n

> Checking against a tree based on v6.14-rc1, it superficially looks like
> we're not missing any other KERNEL_HWCAP_* bits per a coarse search,
> which shows three missing entries in cpufeature.c:

> | [mark@lakrids:~/src/linux]% git grep -oh 'KERNEL_HWCAP_[A-Z0-9_]\+' -- arch/arm64/kernel/cpuinfo.c | sort | uniq | wc -l
> | 112
> | [mark@lakrids:~/src/linux]% git grep -oh 'KERNEL_HWCAP_[A-Z0-9_]\+' -- arch/arm64/kernel/cpufeature.c | sort | uniq | wc -l
> | 109

> ... but maybe that misses something, and I haven't checked
> COMPAT_HWCAP(*) or COMPAT_HWCAP2(*).

> Could you please go check if there's anything else missing more generally?

The other two (on top of FPRCVT) are CPUID and EVTSTRM.  Both of these
are set using cpu_set_named_feature() which doesn't use match your grep
for KERNEL_HWCAP_ in cpufeature.c but instead generates the constant
name via token pasting.
Mark Rutland Feb. 11, 2025, 11:37 a.m. UTC | #3
On Mon, Feb 10, 2025 at 07:14:58PM +0000, Mark Brown wrote:
> On Mon, Feb 10, 2025 at 06:41:09PM +0000, Mark Rutland wrote:
> > On Mon, Feb 10, 2025 at 05:49:33PM +0000, Mark Brown wrote:
> > > Commit 819935464cb2 ("arm64/hwcap: Describe 2024 dpISA extensions to
> > > userspace") added definitions for HWCAP_F8MM8 and HWCAP_F8MM4 but did
> > > not include the crucial registration in arm64_elf_hwcaps.  Add it.
> 
> > Looking again, it looks like KERNEL_HWCAP_FPRCVT also isn't wired up?
> 
> Indeed.  I'll add that separately.

Given that KERNEL_HWCAP_FPRCVT was also added by commit 819935464cb2,
I assume you mean you'll send a v2 of this patch doing that.

Mark.
Mark Brown Feb. 11, 2025, 12:58 p.m. UTC | #4
On Tue, Feb 11, 2025 at 11:37:44AM +0000, Mark Rutland wrote:
> On Mon, Feb 10, 2025 at 07:14:58PM +0000, Mark Brown wrote:
> > On Mon, Feb 10, 2025 at 06:41:09PM +0000, Mark Rutland wrote:

> > > Looking again, it looks like KERNEL_HWCAP_FPRCVT also isn't wired up?

> > Indeed.  I'll add that separately.

> Given that KERNEL_HWCAP_FPRCVT was also added by commit 819935464cb2,
> I assume you mean you'll send a v2 of this patch doing that.

Well, I was actually intending to send a separate patch given that
otherwise it ends up looking like two different changelogs in the same
patch and the diffs shouldn't overlap.
Mark Rutland Feb. 11, 2025, 1:15 p.m. UTC | #5
On Tue, Feb 11, 2025 at 12:58:10PM +0000, Mark Brown wrote:
> On Tue, Feb 11, 2025 at 11:37:44AM +0000, Mark Rutland wrote:
> > On Mon, Feb 10, 2025 at 07:14:58PM +0000, Mark Brown wrote:
> > > On Mon, Feb 10, 2025 at 06:41:09PM +0000, Mark Rutland wrote:
> 
> > > > Looking again, it looks like KERNEL_HWCAP_FPRCVT also isn't wired up?
> 
> > > Indeed.  I'll add that separately.
> 
> > Given that KERNEL_HWCAP_FPRCVT was also added by commit 819935464cb2,
> > I assume you mean you'll send a v2 of this patch doing that.
> 
> Well, I was actually intending to send a separate patch given that
> otherwise it ends up looking like two different changelogs in the same
> patch and the diffs shouldn't overlap.

It would be simpler for others if you sent a single patch that handled
the three hwcaps that we failed to wire up in commit 819935464cb2. That
way they only have one thing to track.

I don't understand what you mean by "two different changelogs"; surely the
commit message is a trivial variation of the one for this v1 patch:

| arm64: Add missing hwcap registrations
|
| Commit 819935464cb2 ("arm64/hwcap: Describe 2024 dpISA extensions to
| userspace") added definitions for HWCAP_F8MM8, HWCAP_F8MM4, and
| HWCAP_FPRCVT, but did not include the crucial registration in
| arm64_elf_hwcaps. Add them.

... and the diff from v1 is "Handle HWCAP_FPRCVT".

Mark.
Mark Brown Feb. 11, 2025, 1:30 p.m. UTC | #6
On Tue, Feb 11, 2025 at 01:15:52PM +0000, Mark Rutland wrote:
> On Tue, Feb 11, 2025 at 12:58:10PM +0000, Mark Brown wrote:

> > Well, I was actually intending to send a separate patch given that
> > otherwise it ends up looking like two different changelogs in the same
> > patch and the diffs shouldn't overlap.

> It would be simpler for others if you sent a single patch that handled
> the three hwcaps that we failed to wire up in commit 819935464cb2. That
> way they only have one thing to track.

> I don't understand what you mean by "two different changelogs"; surely the
> commit message is a trivial variation of the one for this v1 patch:

My first scan through had made it look like there was more stuff missing
for FPRCVT but now that I go to write the change that's not actually the
case, it's different handling of the different ID registers.
diff mbox series

Patch

diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index f0910f20fbf8c18fbeb63bcee18abf13371b1d5e..2cde1e6e309a1b840e0e8dc3a5a55f07f0aadd82 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -3190,6 +3190,8 @@  static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
 	HWCAP_CAP(ID_AA64FPFR0_EL1, F8FMA, IMP, CAP_HWCAP, KERNEL_HWCAP_F8FMA),
 	HWCAP_CAP(ID_AA64FPFR0_EL1, F8DP4, IMP, CAP_HWCAP, KERNEL_HWCAP_F8DP4),
 	HWCAP_CAP(ID_AA64FPFR0_EL1, F8DP2, IMP, CAP_HWCAP, KERNEL_HWCAP_F8DP2),
+	HWCAP_CAP(ID_AA64FPFR0_EL1, F8MM8, IMP, CAP_HWCAP, KERNEL_HWCAP_F8MM8),
+	HWCAP_CAP(ID_AA64FPFR0_EL1, F8MM4, IMP, CAP_HWCAP, KERNEL_HWCAP_F8MM4),
 	HWCAP_CAP(ID_AA64FPFR0_EL1, F8E4M3, IMP, CAP_HWCAP, KERNEL_HWCAP_F8E4M3),
 	HWCAP_CAP(ID_AA64FPFR0_EL1, F8E5M2, IMP, CAP_HWCAP, KERNEL_HWCAP_F8E5M2),
 #ifdef CONFIG_ARM64_POE