Re: [PATCH v2] x86/tdx: Don't write CSTAR MSR on Intel

From: Thomas Gleixner
Date: Wed Nov 24 2021 - 18:40:56 EST


Kuppuswamy,

On Thu, Nov 18 2021 at 19:58, Kuppuswamy Sathyanarayanan wrote:

almost. The subject line is bogus:

x86/tdx: Don't write CSTAR MSR on Intel

This has nothing to do with TDX in the first place as the actual check
is for CPU vendor == Intel. It's absolutely no requirement to remove
this for TDX. TDX could just handle the #VE and ignore the write.

It's an obvious optimization without TDX because the write is pointless
independent of TDX. There is no value to slap TDX on everything just
because.

Also 'write on Intel' should be 'write on Intel CPUs' to make sense.

> +/* Don't write CSTAR MSR on Intel platforms */

How is this comment useful? The proper explanation is below.

> +static void wrmsrl_cstar(unsigned long val)
> +{
> + /*
> + * Intel CPUs do not support 32-bit SYSCALL. Writing to MSR_CSTAR
> + * is normally ignored by the CPU, but raises a #VE trap in a TDX
> + * guest.
> + */
> + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
> + wrmsrl(MSR_CSTAR, val);
> +}

I fixed it up for you because of Thanksgiving.

Thanks,

tglx