qemu-e2k/target/i386/kvm
Paolo Bonzini 58f7db26f2 KVM: x86: workaround invalid CPUID[0xD,9] info on some AMD processors
Some AMD processors expose the PKRU extended save state even if they do not have
the related PKU feature in CPUID.  Worse, when they do they report a size of
64, whereas the expected size of the PKRU extended save state is 8, therefore
the esa->size == eax assertion does not hold.

The state is already ignored by KVM_GET_SUPPORTED_CPUID because it
was not enabled in the host XCR0.  However, QEMU kvm_cpu_xsave_init()
runs before QEMU invokes arch_prctl() to enable dynamically-enabled
save states such as XTILEDATA, and KVM_GET_SUPPORTED_CPUID hides save
states that have yet to be enabled.  Therefore, kvm_cpu_xsave_init()
needs to consult the host CPUID instead of KVM_GET_SUPPORTED_CPUID,
and dies with an assertion failure.

When setting up the ExtSaveArea array to match the host, ignore features that
KVM does not report as supported.  This will cause QEMU to skip the incorrect
CPUID leaf instead of tripping the assertion.

Closes: https://gitlab.com/qemu-project/qemu/-/issues/916
Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Analyzed-by: Yang Zhong <yang.zhong@intel.com>
Reported-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-23 14:13:58 +01:00
..
hyperv-proto.h i386: Implement pseudo 'hv-avic' ('hv-apicv') enlightenment 2021-10-01 19:04:45 +02:00
hyperv-stub.c
hyperv.c
hyperv.h
kvm_i386.h x86: Grant AMX permission for guest 2022-03-15 11:50:50 +01:00
kvm-cpu.c KVM: x86: workaround invalid CPUID[0xD,9] info on some AMD processors 2022-03-23 14:13:58 +01:00
kvm-cpu.h
kvm-stub.c
kvm.c i386: Set MCG_STATUS_RIPV bit for mce SRAR error 2022-03-23 12:22:25 +01:00
meson.build target/i386/kvm: Restrict SEV stubs to x86 architecture 2021-10-13 10:47:49 +02:00
sev-stub.c target/i386/sev: Declare system-specific functions in 'sev.h' 2021-10-13 10:47:49 +02:00
trace-events
trace.h