Re: [PATCHv2 00/29] TDX Guest: TDX core support

From: Sean Christopherson
Date: Wed Feb 09 2022 - 11:50:17 EST


On Wed, Feb 09, 2022, Borislav Petkov wrote:
> On Thu, Feb 10, 2022 at 12:48:31AM +1300, Kai Huang wrote:
> > Are you suggesting even for now we can start to put TDX host support to
> > arch/x86/coco/tdx/ ?
>
> That's exactly what I'm suggesting. The TDX stuff is not upstream so
> nothing's cast in stone yet. This way there won't be any unpleasant code
> movements later.

I strongly prefer we put the guest and host code in separate directories. Both
TDX and SEV are big enough that they'll benefit from splitting up files, having
to fight over file names or tag all files with guest/host will get annoying.

I do like the idea of arch/x86/coco though. The most straightforward approach
would be:

arch/x86/coco/guest/
arch/x86/coco/host/

but that doesn't provide any extensibility on the host virtualization side, e.g.
to land non-coco, non-KVM-specific host virtualization code (we have a potential
use case for this). If that happens, we'd end up with x86 KVM having code and
dependencies split across:

arch/x86/coco/host
arch/x86/kvm/
arch/x86/???/

An alternative idea would be to mirror what generic KVM does (virt/kvm/), and do:

arch/x86/coco/<guest stuff>
arch/x86/virt/<"generic" x86 host virtualization stuff>
arch/x86/virt/coco/<host coco stuff>
arch/x86/virt/kvm/

Though I can already hear the stable trees and downstream kernels crying out in
horror at moving arch/x86/kvm :-)