diff options
| author | Binbin Wu <binbin.wu@linux.intel.com> | 2026-06-09 15:57:48 +0800 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-07-08 13:41:02 -0700 |
| commit | 8835a24a56089e90953af7f2a79363fcccd7f97c (patch) | |
| tree | 04c6f9edb339b31d72812b8f4bcd70233ddf9dfb /tools/perf/scripts/python | |
| parent | eb606a24386389d6f707a872f2e899cf5875c2c5 (diff) | |
KVM: x86: Fix emulated CPUID features being applied to wrong sub-leaf
Pass the CPUID index into cpuid_func_emulated() and return no emulated
features for indexed CPUID leaves with a non-zero index.
KVM currently emulates CPUID features only for index 0, but
kvm_vcpu_after_set_cpuid() looks up emulated features by function alone.
As a result, reverse_cpuid[] entries that share a function but use a
non-zero index, e.g. CPUID.7.1:ECX, can inherit emulated features that
belong to index 0. For example, RDPID, which is CPUID.7.0:ECX[22], can
be incorrectly OR'd into CPUID.7.1:ECX.
This is benign today because the affected bits do not correspond to
features KVM cares about, but it can become a real bug as new CPUID
features are defined. Make the helper index-aware so emulated features
are applied only to the CPUID entry they actually describe.
Fixes: e592ec657d84 ("KVM: x86: Initialize guest cpu_caps based on KVM support")
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://patch.msgid.link/20260609075748.612704-1-binbin.wu@linux.intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
