It is essential for TD users to be aware of the vendor and version of
the current TDX. Additionally, they can reference the TDX version when
reporting bugs or issues.
Furthermore, the applications or device drivers running in TD can achieve
enhanced reliability and flexibility by following the TDX Module ABI
specification, because there are significant differences between different
versions of TDX, as mentioned in the "Intel® TDX Module Incompatibilities
between v1.0 and v1.5" reference.
Add function detect_tdx_version to fetch and dump the version of the
TDX, which is called during TD initialization. Obtain the info by calling
TDG.SYS.RD, including the major and minor version numbers and vendor ID.
The TDCALL TDG.SYS.RD originates from TDX version 1.5. If the error
TDCALL_INVALID_OPERAND occurs, it should be treated as TDX version 1.0.
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
Co-developed-by: Dongcheng Yan <dongcheng.yan@xxxxxxxxx>
Signed-off-by: Dongcheng Yan <dongcheng.yan@xxxxxxxxx>
Signed-off-by: Yi Sun <yi.sun@xxxxxxxxx>