On 6/13/2024 4:26 PM, Duan, Zhenzhong wrote:
+ *
+ * It also has side effect to enable unsupported bits, e.g., the
+ * bits of "fixed0" type while present natively. It's safe because
+ * the unsupported bits will be masked off by .fixed0 later.
+ */
+ *ret |= host_cpuid_reg(function, index, reg);
Looks KVM capabilities are merged with native bits, is this intentional?
yes, if we change the order, it would be more clear for you I guess.
host_cpuid_reg() | kvm_capabilities
The base is host's native value, while any bit that absent from native
but KVM can emulate is also added to base.
Imagine there is a 'type native' bit that's absent from native but KVM emulated,
With above code we pass 1 to tdx module but it wants native 0, is it an issue?
yes, it will have issue but it's not "we pass 1 to tdx_module".
"Native" bit is not configurable in the view of TDX module, and QEMU/KVM
cannot configure it. But it does causes mismatch in above case that QEMU
sees the bit is supported while in the TD the bit is not supported.
This is one of the reason why we are going to drop the solution that
QEMU maintains the CPUID configurability in this series.