[PATCH v8 52/55] i386/tdx: Don't treat SYSCALL as unavailable

Xiaoyao Li posted 55 patches 10 months, 2 weeks ago
[PATCH v8 52/55] i386/tdx: Don't treat SYSCALL as unavailable
Posted by Xiaoyao Li 10 months, 2 weeks ago
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
Changes in v7:
 - fix CPUID_EXT2_SYSCALL by adding it to actual;
---
 target/i386/kvm/tdx.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
index 58797470ba7e..cd8e96d476b8 100644
--- a/target/i386/kvm/tdx.c
+++ b/target/i386/kvm/tdx.c
@@ -841,6 +841,19 @@ static int tdx_check_features(X86ConfidentialGuest *cg, CPUState *cs)
             continue;
         }
 
+        /* Fixup for special cases */
+        switch (w) {
+        case FEAT_8000_0001_EDX:
+            /*
+             * Intel enumerates SYSCALL bit as 1 only when processor in 64-bit
+             * mode and before vcpu running it's not in 64-bit mode.
+             */
+            actual |= CPUID_EXT2_SYSCALL;
+            break;
+        default:
+            break;
+        }
+
         requested = env->features[w];
         unavailable = requested & ~actual;
         mark_unavailable_features(cpu, w, unavailable, unav_prefix);
-- 
2.34.1
Re: [PATCH v8 52/55] i386/tdx: Don't treat SYSCALL as unavailable
Posted by Zhao Liu 9 months, 1 week ago
On Tue, Apr 01, 2025 at 09:02:02AM -0400, Xiaoyao Li wrote:
> Date: Tue,  1 Apr 2025 09:02:02 -0400
> From: Xiaoyao Li <xiaoyao.li@intel.com>
> Subject: [PATCH v8 52/55] i386/tdx: Don't treat SYSCALL as unavailable
> X-Mailer: git-send-email 2.34.1

It's better to add the commit message (for example, your additional
comment at v6 [1]).

[1]: https://lore.kernel.org/qemu-devel/3345330e-c111-4d08-9852-9dede46957d2@intel.com/

> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
> Changes in v7:
>  - fix CPUID_EXT2_SYSCALL by adding it to actual;
> ---
>  target/i386/kvm/tdx.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>