On 8/22/2023 7:00 AM, Isaku Yamahata wrote:
On Fri, Aug 18, 2023 at 05:49:51AM -0400,
Xiaoyao Li <xiaoyao.li@xxxxxxxxx> wrote:
diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
index 56cb826f6125..3198bc9fd5fb 100644
--- a/target/i386/kvm/tdx.c
+++ b/target/i386/kvm/tdx.c
...
+static inline uint32_t host_cpuid_reg(uint32_t function,
+ uint32_t index, int reg)
+{
+ uint32_t eax, ebx, ecx, edx;
+ uint32_t ret = 0;
+
+ host_cpuid(function, index, &eax, &ebx, &ecx, &edx);
+
+ switch (reg) {
+ case R_EAX:
+ ret |= eax;
+ break;
+ case R_EBX:
+ ret |= ebx;
+ break;
+ case R_ECX:
+ ret |= ecx;
+ break;
+ case R_EDX:
+ ret |= edx;
Nitpick: "|" isn't needed as we initialize ret = 0 above. Just '='.
Will fix it in next version.
thanks!