]> 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)
commitdcb48d36d07e6006bbaa5e9fb0c9299dfb211726
tree7d8373e9f4b937c1e89ebc49096f100e62ac803f
parentc05a31690e29b681a9787ad994b960707500c1f3
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 1edce07ce2ab ("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