Re: [PATCH v9 07/18] x86/virt/tdx: Do TDX module per-cpu initialization

From: Huang, Kai
Date: Mon Feb 13 2023 - 19:09:15 EST


On Mon, 2023-02-13 at 15:52 -0800, Dave Hansen wrote:
> On 2/13/23 15:43, Huang, Kai wrote:
> > ( My main concern is "Run after the KVM handler" seems a little bit hacky to me.
> > Logically, it's more reasonable to have the TDX callback _before_ KVM's but not
> > _after_. If any user (KVM) has done tdx_enable() successfully, the TDX code
> > should give the user a "TDX-runnable" cpu before user (KVM)'s own callback is
> > involved. Anyway as mentioned above, I'll do above as you suggested.)
>
> I was assuming that the KVM callback is what does VMXON for a given
> logical CPU. If that were the case, you'd need to do the TDX stuff
> *AFTER* VMXON.
>
> Am I wrong?
>
>

You are right.

What I meant was: because we choose to not support VMXON in the (non-KVM)
kernel, we need/have to put TDX's callback after KVM's. Otherwise, perhaps a
better way is to put TDX's callback before KVM's. But maybe it's an arguable
"perhaps", so let's just do TDX's callback after KVM's as you suggested.