]> git.ipfire.org Git - thirdparty/qemu.git/commit
i386/tdx: Implement adjust_cpuid_features() for TDX
authorXiaoyao Li <xiaoyao.li@intel.com>
Thu, 8 May 2025 14:59:50 +0000 (10:59 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 28 May 2025 17:35:54 +0000 (19:35 +0200)
commit75ec6189f5c65cab210dd9f16cf4eef368038d45
tree8e933aad8690a256043b7be41b42e287c706b866
parent695bfaee7153153708228946aa26c6d879599c04
i386/tdx: Implement adjust_cpuid_features() for TDX

Maintain a TDX specific supported CPUID set, and use it to mask the
common supported CPUID value of KVM. It can avoid newly added supported
features (reported via KVM_GET_SUPPORTED_CPUID) for common VMs being
falsely reported as supported for TDX.

As the first step, initialize the TDX supported CPUID set with all the
configurable CPUID bits. It's not complete because there are other CPUID
bits are supported for TDX but not reported as directly configurable.
E.g. the XFAM related bits, attribute related bits and fixed-1 bits.
They will be handled in the future.

Also, what matters are the CPUID bits related to QEMU's feature word.
Only mask the CPUID leafs which are feature word leaf.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250508150002.689633-45-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/cpu.c
target/i386/cpu.h
target/i386/kvm/kvm.c
target/i386/kvm/kvm_i386.h
target/i386/kvm/tdx.c