Skip to contentSkip to conversation

x86/cpufeatures: Make AVX512_BMM depend on AVX512F

PATCH In review Jim Mattson 4 participants 4 messages Jul 15 – Jul 20

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpufeatures: Make AVX512_BMM depend on AVX512F

Add an explicit dependency between X86_FEATURE_AVX512_BMM and X86_FEATURE_AVX512F in the CPUID dependency table.

AVX512 Bit Matrix Multiply (BMM) instructions operate on vector registers and require AVX512 Foundation support. Declaring this dependency ensures that if AVX512F is disabled (e.g. via clearcpuid or host capabilities), AVX512_BMM will be automatically cleared as well.

Fixes de0bfdc7137d ("KVM: x86: Advertise AVX512 Bit Matrix Multiply (BMM) to userspace")
---
 arch/x86/kernel/cpu/cpuid-deps.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/cpuid-deps.c +1 -0
index 99801e844b30..e9fdf944633b 100644
@@ -75,6 +75,7 @@ static const struct cpuid_dep cpuid_deps[] = {
 	{ X86_FEATURE_SDCIAE,			X86_FEATURE_CAT_L3    },
 	{ X86_FEATURE_AVX512_BF16,		X86_FEATURE_AVX512VL  },
 	{ X86_FEATURE_AVX512_FP16,		X86_FEATURE_AVX512BW  },
+	{ X86_FEATURE_AVX512_BMM,		X86_FEATURE_AVX512F   },
 	{ X86_FEATURE_ENQCMD,			X86_FEATURE_XSAVES    },
 	{ X86_FEATURE_PER_THREAD_MBA,		X86_FEATURE_MBA       },
 	{ X86_FEATURE_SGX_LC,			X86_FEATURE_SGX	      },
Signature · 1 line
2.55.0.141.g00534a21ce-goog
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Build failure due to undeclared identifier X86_FEATURE_AVX512_BMM. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Build failure due to undeclared identifier X86_FEATURE_AVX512_BMM. --

--- Patch [1]: [PATCH] x86/cpufeatures: Make AVX512_BMM depend on AVX512F --- commit 5ec2859f67a824ceedb01518734f6afb9a711eef
Author: Jim Mattson <[email protected]>

x86/cpufeatures: Make AVX512_BMM depend on AVX512F

This commit explicitly declares a CPUID dependency for AVX512_BMM on AVX512F so that disabling AVX512F automatically clears AVX512_BMM.

arch/x86/kernel/cpu/cpuid-deps.c static const struct cpuid_dep cpuid_deps[] = { · line 78

Quoted 9 lines
arch/x86/kernel/cpu/cpuid-deps.c +1 -0
index 146f6f8b0650b..e2e3d0a3abcd5 100644
@@ -75,6 +75,7 @@ static const struct cpuid_dep cpuid_deps[] = {
 	{ X86_FEATURE_SDCIAE,			X86_FEATURE_CAT_L3    },
 	{ X86_FEATURE_AVX512_BF16,		X86_FEATURE_AVX512VL  },
 	{ X86_FEATURE_AVX512_FP16,		X86_FEATURE_AVX512BW  },
+	{ X86_FEATURE_AVX512_BMM,		X86_FEATURE_AVX512F   },

[Severity: Low]
Is X86_FEATURE_AVX512_BMM defined anywhere in the tree? It appears this macro is undeclared, which will cause a build failure when compiling arch/x86/kernel/cpu/cpuid-deps.c.

Quoted 3 lines
arch/x86/kernel/cpu/cpuid-deps.c +0 -0
 	{ X86_FEATURE_ENQCMD,			X86_FEATURE_XSAVES    },
 	{ X86_FEATURE_PER_THREAD_MBA,		X86_FEATURE_MBA       },
 	{ X86_FEATURE_SGX_LC,			X86_FEATURE_SGX	      },
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jim Mattson
Quoted 10 lines · Jim Mattson

Add an explicit dependency between X86_FEATURE_AVX512_BMM and X86_FEATURE_AVX512F in the CPUID dependency table.

AVX512 Bit Matrix Multiply (BMM) instructions operate on vector registers and require AVX512 Foundation support. Declaring this dependency ensures that if AVX512F is disabled (e.g. via clearcpuid or host capabilities), AVX512_BMM will be automatically cleared as well.

Fixes de0bfdc7137d ("KVM: x86: Advertise AVX512 Bit Matrix Multiply (BMM) to userspace")
reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Jim Mattson
Quoted 11 lines · Jim Mattson

Add an explicit dependency between X86_FEATURE_AVX512_BMM and X86_FEATURE_AVX512F in the CPUID dependency table.

AVX512 Bit Matrix Multiply (BMM) instructions operate on vector registers and require AVX512 Foundation support. Declaring this dependency ensures that if AVX512F is disabled (e.g. via clearcpuid or host capabilities), AVX512_BMM will be automatically cleared as well.

Fixes de0bfdc7137d ("KVM: x86: Advertise AVX512 Bit Matrix Multiply (BMM) to userspace")

---

I assume this will go through the tip tree.