[Deepin-Kernel-SIG] [linux 6.18-y] [Fromlist] KVM: x86: Advertise AVX512 Bit Matrix Multiply (BMM) to userspace#1620
Conversation
Advertise AVX512 Bit Matrix Multiply (BMM) and Bit Reversal instructions to userspace via CPUID leaf 0x80000021_EAX[23]. This feature enables bit matrix multiply operations and bit reversal. While at it, reorder PREFETCHI to match the bit position order in CPUID leaf 0x80000021_EAX for better organization. Signed-off-by: Nikunj A Dadhania <nikunj@amd.com> Link: kvm-x86/linux@de0bfdc7137d Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR exposes the new AVX512 Bit Matrix Multiply (BMM) feature to KVM userspace via CPUID and keeps the PREFETCHI bit aligned with the architectural CPUID bit ordering, by defining the new feature flag and wiring it into KVM’s synthetic CPUID capabilities list. Class diagram for updated CPUID feature flagsclassDiagram
class Cpufeatures_Leaf20 {
+int X86_FEATURE_GP_ON_USER_CPUID
+int X86_FEATURE_PREFETCHI
+int X86_FEATURE_AVX512_BMM
+int X86_FEATURE_SBPB
+int X86_FEATURE_IBPB_BRTYPE
+int X86_FEATURE_SRSO_NO
}
class KVM_CpuCaps {
+void kvm_set_cpu_caps()
}
KVM_CpuCaps --> Cpufeatures_Leaf20 : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull request overview
Advertises AMD CPUID 0x80000021.EAX[23] (AVX512 Bit Matrix Multiply / Bit Reversal per PR description) to KVM userspace and tidies the feature ordering to match CPUID bit positions.
Changes:
- Add
X86_FEATURE_AVX512_BMMfor CPUID 0x80000021.EAX[23]. - Expose AVX512_BMM in KVM’s supported CPUID for leaf 0x80000021.
- Reorder
PREFETCHIin KVM CPU cap initialization for better bit-order alignment.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| arch/x86/kvm/cpuid.c | Adds AVX512_BMM to KVM’s advertised caps for CPUID 0x80000021.EAX and reorders PREFETCHI for readability/alignment. |
| arch/x86/include/asm/cpufeatures.h | Introduces X86_FEATURE_AVX512_BMM at word 20, bit 23. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #define X86_FEATURE_GP_ON_USER_CPUID (20*32+17) /* User CPUID faulting */ | ||
|
|
||
| #define X86_FEATURE_PREFETCHI (20*32+20) /* Prefetch Data/Instruction to Cache Level */ | ||
| #define X86_FEATURE_AVX512_BMM (20*32+23) /* AVX512 Bit Matrix Multiply instructions */ |
There was a problem hiding this comment.
X86_FEATURE_AVX512_BMM is missing a quoted feature name (e.g. "avx512_bmm") at the start of the comment. mkcapflags.sh only emits entries for x86_cap_flags when the trailing /* ... */ begins with a quoted string; without it, the feature won't appear in /proc/cpuinfo flags and can’t be referenced by name via setcpuid=/clearcpuid=. Consider aligning with other ISA feature definitions (e.g. X86_FEATURE_AVX512_FP16 in this file) by adding the quoted name.
| #define X86_FEATURE_AVX512_BMM (20*32+23) /* AVX512 Bit Matrix Multiply instructions */ | |
| #define X86_FEATURE_AVX512_BMM (20*32+23) /* "avx512_bmm" AVX512 Bit Matrix Multiply instructions */ |
| #define X86_FEATURE_GP_ON_USER_CPUID (20*32+17) /* User CPUID faulting */ | ||
|
|
||
| #define X86_FEATURE_PREFETCHI (20*32+20) /* Prefetch Data/Instruction to Cache Level */ | ||
| #define X86_FEATURE_AVX512_BMM (20*32+23) /* AVX512 Bit Matrix Multiply instructions */ |
There was a problem hiding this comment.
PR description says CPUID 0x80000021.EAX[23] advertises both AVX512 BMM and Bit Reversal instructions, but the new X86_FEATURE_AVX512_BMM comment mentions only bit matrix multiply. Please update either the PR description or the in-code comment so they match (and mention Bit Reversal too if it’s covered by the same CPUID bit).
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: opsiff The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Advertise AVX512 Bit Matrix Multiply (BMM) and Bit Reversal instructions to userspace via CPUID leaf 0x80000021_EAX[23]. This feature enables bit matrix multiply operations and bit reversal.
While at it, reorder PREFETCHI to match the bit position order in CPUID leaf 0x80000021_EAX for better organization.
Link: kvm-x86/linux@de0bfdc7137d
Summary by Sourcery
Advertise the AVX512 Bit Matrix Multiply capability to KVM userspace via CPUID while keeping CPUID feature bit ordering aligned with the architectural specification.
New Features:
Enhancements: