]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Report deprecated x87 features in supported CPUID
authorJim Mattson <jmattson@google.com>
Fri, 4 Feb 2022 00:13:48 +0000 (16:13 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 4 Feb 2022 08:06:55 +0000 (03:06 -0500)
commita528e3326fe3111ff8f99e79ba54e7a76ac5f1cf
tree7d8373e9f4b937c1e89ebc49096f100e62ac803f
parentaa87f556a8355309081dc68bc07d3f5d2d566693
KVM: x86: Report deprecated x87 features in supported CPUID

CPUID.(EAX=7,ECX=0):EBX.FDP_EXCPTN_ONLY[bit 6] and
CPUID.(EAX=7,ECX=0):EBX.ZERO_FCS_FDS[bit 13] are "defeature"
bits. Unlike most of the other CPUID feature bits, these bits are
clear if the features are present and set if the features are not
present. These bits should be reported in KVM_GET_SUPPORTED_CPUID,
because if these bits are set on hardware, they cannot be cleared in
the guest CPUID. Doing so would claim guest support for a feature that
the hardware doesn't support and that can't be efficiently emulated.

Of course, any software (e.g WIN87EM.DLL) expecting these features to
be present likely predates these CPUID feature bits and therefore
doesn't know to check for them anyway.

Aaron Lewis added the corresponding X86_FEATURE macros in
commit a86c1528e501 ("x86/cpufeatures: Add FDP_EXCPTN_ONLY and
ZERO_FCS_FDS"), with the intention of reporting these bits in
KVM_GET_SUPPORTED_CPUID, but I was unable to find a proposed patch on
the kvm list.

Opportunistically reordered the CPUID_7_0_EBX capability bits from
least to most significant.

Cc: Aaron Lewis <aaronlewis@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Message-Id: <20220204001348.2844660-1-jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c