Message ID | 20241105062408.3533704-57-xiaoyao.li@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | QEMU TDX support | expand |
On 11/5/24 07:24, Xiaoyao Li wrote: > Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> > --- > target/i386/kvm/tdx.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c > index 9cb099e160e4..05475edf72bd 100644 > --- a/target/i386/kvm/tdx.c > +++ b/target/i386/kvm/tdx.c > @@ -734,6 +734,13 @@ static int tdx_check_features(X86ConfidentialGuest *cg, CPUState *cs) > > requested = env->features[w]; > unavailable = requested & ~actual; > + /* > + * Intel enumerates SYSCALL bit as 1 only when processor in 64-bit > + * mode and before vcpu running it's not in 64-bit mode. > + */ > + if (w == FEAT_8000_0001_EDX && unavailable & CPUID_EXT2_SYSCALL) { > + unavailable &= ~CPUID_EXT2_SYSCALL; > + } > mark_unavailable_features(cpu, w, unavailable, unav_prefix); > if (unavailable) { > mismatch = true; This seems like a TDX module bug? It's the kind of thing that I guess could be worked around in KVM. If we do it in QEMU, I'd rather see it as actual = cpuid_entry_get_reg(entry, wi->cpuid.reg); switch (w) { case FEAT_8000_0001_EDX: actual |= CPUID_EXT2_SYSCALL; break; } break; Paolo
diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index 9cb099e160e4..05475edf72bd 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -734,6 +734,13 @@ static int tdx_check_features(X86ConfidentialGuest *cg, CPUState *cs) requested = env->features[w]; unavailable = requested & ~actual; + /* + * Intel enumerates SYSCALL bit as 1 only when processor in 64-bit + * mode and before vcpu running it's not in 64-bit mode. + */ + if (w == FEAT_8000_0001_EDX && unavailable & CPUID_EXT2_SYSCALL) { + unavailable &= ~CPUID_EXT2_SYSCALL; + } mark_unavailable_features(cpu, w, unavailable, unav_prefix); if (unavailable) { mismatch = true;
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> --- target/i386/kvm/tdx.c | 7 +++++++ 1 file changed, 7 insertions(+)